> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nt3.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Translation Memory

> Access and manage translation memory entries.

**Translation Memory (TM)** is an organization-wide database of previously translated strings. When a translator or the AI engine works on a new string, Entri searches the TM for similar strings and suggests the approved translations as a starting point. This accelerates translation, reduces cost, and enforces consistency across projects.

TM entries are created automatically when AI translations are saved. All projects in the organization share the same TM.

The TM search uses fuzzy matching — strings do not need to be identical to be considered a match.

## Endpoints

```
GET    /api/organizations/:orgId/tm                      Browse TM entries (paginated)
GET    /api/organizations/:orgId/tm/search               Search TM by source text
DELETE /api/organizations/:orgId/tm/:entryId             Delete a TM entry
```

<Note>
  Translation memory endpoints are organization-scoped. All projects in the organization share the same TM.
</Note>

## Search Translation Memory

The most common use of the TM API is to look up matches for a given source string:

```bash theme={null}
curl "https://app.nt3.io/api/organizations/org_789xyz/tm/search?sourceText=Welcome+to+Entri&sourceLang=en&targetLang=fr" \
  -H "Cookie: session=..."
```

**Query parameters:**

| Parameter    | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| `sourceText` | string | The text to search for.           |
| `sourceLang` | string | Source language code (e.g. `en`). |
| `targetLang` | string | Target language code (e.g. `fr`). |

**Response:**

```json theme={null}
[
  {
    "_id": "tm_abc123",
    "sourceText": "Welcome to Entri",
    "targetText": "Bienvenue sur Entri",
    "sourceLanguage": "en",
    "targetLanguage": "fr",
    "similarity": 100,
    "usageCount": 14
  },
  {
    "_id": "tm_def456",
    "sourceText": "Welcome to the platform",
    "targetText": "Bienvenue sur la plateforme",
    "sourceLanguage": "en",
    "targetLanguage": "fr",
    "similarity": 76,
    "usageCount": 3
  }
]
```

The `similarity` score (0–100) indicates how closely the stored source text matches the query. A score of 100 is an exact match.

<Note>
  `usageCount` tracks how many times the same source text has been added to the TM (e.g. duplicate strings across keys). It does **not** count how many times the entry has been applied as a suggestion.
</Note>

## Browse TM Entries

Browse all TM entries with pagination:

```bash theme={null}
curl "https://app.nt3.io/api/organizations/org_789xyz/tm?page=1&limit=50" \
  -H "Cookie: session=..."
```

**Response:**

```json theme={null}
{
  "data": [
    {
      "_id": "tm_abc123",
      "sourceText": "Welcome to Entri",
      "targetText": "Bienvenue sur Entri",
      "sourceLanguage": "en",
      "targetLanguage": "fr",
      "usageCount": 14
    }
  ],
  "meta": {
    "page": 1,
    "limit": 50,
    "total": 312,
    "totalPages": 7
  }
}
```

## Delete a TM Entry

Remove an incorrect or outdated TM entry:

```bash theme={null}
curl -X DELETE https://app.nt3.io/api/organizations/org_789xyz/tm/tm_abc123 \
  -H "Cookie: session=..."
```
