# Replace memory

URL: https://docs.hanzo.ai/docs/openapi/translate/put-translate-memory

> Records a human decision on one translation-memory entry, and returns the entry as stored.

`PUT /v1/translate/memory`

> [Translate →](https://docs.hanzo.ai/docs/openapi/translate) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                            |
| ------------- | ------------------------------------------ |
| **Address**   | `https://api.hanzo.ai/v1/translate/memory` |
| **Method**    | `PUT`                                      |
| **Operation** | `put_translate_memory`                     |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`     |

Records a human decision on one translation-memory entry, and returns the
entry as stored. A human write always wins over the stored value, and once it lands
at approved or published no machine write can move it again — which is what makes a
locale rebuild safe to run against reviewed work.

The org is ALWAYS the validated principal's org, never a request field, so a review
can only ever land in the caller's own memory.

## Request

7 fields, body `application/json` (required).

| Field        | In   | Type   | Required | Description                                                                               |
| ------------ | ---- | ------ | -------- | ----------------------------------------------------------------------------------------- |
| `glossary`   | body | object | —        | Glossary is the terminology the entry was translated under.                               |
| `glossary.*` | body | string | —        |                                                                                           |
| `source`     | body | string | —        | Source is the ORIGINAL string this entry translates.                                      |
| `state`      | body | string | —        | State is the entry's new position on the review ladder: suggested, approved or published. |
| `target`     | body | string | —        | Target is the target language tag (BCP-47, e.g. "es" or "pt-BR").                         |
| `text`       | body | string | —        | Text is the reviewed translation to store.                                                |
| `tier`       | body | string | —        | Tier is the engine tier the entry belongs to, quality (the default) or bulk.              |

## Response

| Status    | Body                  | Meaning |
| --------- | --------------------- | ------- |
| `200`     | translate.MemoryEntry | ok      |
| `default` | problem-details       | refused |

`200` body — 8 fields.

| Field              | In   | Type            | Always | Description                                                                                                                                                                                    |
| ------------------ | ---- | --------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `actor`            | body | string          | —      | Actor is the validated user id that last wrote this entry by hand.                                                                                                                             |
| `glossary_version` | body | string          | —      | Glossary is the glossary VERSION the entry was translated under — the digest version() derives from the terms, so changing a term changes the key and the stale rendering can never be served. |
| `source`           | body | string          | —      | Source is the ORIGINAL string this entry translates.                                                                                                                                           |
| `state`            | body | string          | —      | State is the entry's position on the review ladder: machine, suggested, approved or published.                                                                                                 |
| `target`           | body | string          | —      | Target is the target language tag (BCP-47, e.g. "es" or "pt-BR").                                                                                                                              |
| `text`             | body | string          | —      | Text is the stored translation.                                                                                                                                                                |
| `tier`             | body | string          | —      | Tier is the engine tier the entry belongs to, quality or bulk.                                                                                                                                 |
| `updated_at`       | body | integer (int64) | —      | UpdatedAt is the unix second the entry last changed.                                                                                                                                           |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo translate memory replace
```

**SDK**

**.ts**

```ts
import { Configuration, TranslateApi } from 'hanzoai';

const api = new TranslateApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.putTranslateMemory({ glossary: {}, source: "<source>" });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import TranslateApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = TranslateApi(client).put_translate_memory(glossary={}, source="<source>")
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.TranslateAPI.PutTranslateMemory(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, translate_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = translate_api::put_translate_memory(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.TranslateApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new TranslateApi(client).putTranslateMemory();
```

**HTTP**

```bash
curl -X PUT https://api.hanzo.ai/v1/translate/memory \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "glossary": {},
       "source": "<source>"
     }'
```

**MCP**

MCP reaches **translate** through the `translate` tool, which names its 2 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "get_translate_memory"
         }
       }
     }'
```

---

[Translate API](https://docs.hanzo.ai/docs/openapi/translate) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
