> ## 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.

# Glossary

> Manage glossaries and glossary terms for consistent translation.

The **Glossary** is an organization-wide database of approved terminology. It ensures that key brand names, technical terms, and product concepts are translated consistently across all projects and by all translators — human and AI alike.

When the AI translation engine processes a key, it automatically checks the glossary and applies the approved translations for any matched terms. Human translators see glossary matches highlighted in the editor.

## Endpoints

**Glossaries**

```
POST   /api/organizations/:orgId/glossaries                      Create a glossary
GET    /api/organizations/:orgId/glossaries                      List glossaries
PATCH  /api/organizations/:orgId/glossaries/:id                  Update a glossary
DELETE /api/organizations/:orgId/glossaries/:id                  Delete a glossary
```

**Terms**

```
POST   /api/organizations/:orgId/glossaries/:id/terms            Add a term
GET    /api/organizations/:orgId/glossaries/:id/terms            List terms
PATCH  /api/organizations/:orgId/glossaries/terms/:termId        Update a term
DELETE /api/organizations/:orgId/glossaries/terms/:termId        Delete a term
```

**Import / Export**

```
POST   /api/organizations/:orgId/glossaries/:id/import           Import terms (CSV or TBX)
GET    /api/organizations/:orgId/glossaries/:id/export           Export terms (CSV or TBX)
```

**Text check**

```
POST   /api/organizations/:orgId/glossaries/check                Check text for glossary matches
```

<Note>
  Glossary endpoints are scoped to your organization. All glossaries and their terms are shared across all projects in the organization.
</Note>

## Create a Glossary

```bash theme={null}
curl -X POST https://app.nt3.io/api/organizations/org_789xyz/glossaries \
  -H "Cookie: session=..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product Glossary",
    "description": "Official terminology for all Entri products",
    "sourceLanguage": "en",
    "targetLanguages": ["fr", "de", "es"]
  }'
```

**Response:**

```json theme={null}
{
  "_id": "gloss_abc123",
  "name": "Product Glossary",
  "description": "Official terminology for all Entri products",
  "sourceLanguage": "en",
  "targetLanguages": ["fr", "de", "es"],
  "organizationId": "org_789xyz",
  "created": "2025-03-01T10:00:00.000Z"
}
```

## Add a Glossary Term

```bash theme={null}
curl -X POST https://app.nt3.io/api/organizations/org_789xyz/glossaries/gloss_abc123/terms \
  -H "Cookie: session=..." \
  -H "Content-Type: application/json" \
  -d '{
    "term": "onboarding",
    "definition": "The process of setting up a new user account and configuring initial settings"
  }'
```

**Response:**

```json theme={null}
{
  "_id": "gterm_abc123",
  "term": "onboarding",
  "definition": "The process of setting up a new user account",
  "translations": [
    { "language": "fr", "value": "intégration", "approved": true },
    { "language": "de", "value": "Einarbeitung", "approved": true }
  ],
  "glossaryId": "gloss_abc123",
  "created": "2025-03-01T10:00:00.000Z"
}
```

Note that `translations` is an **array** of objects, each with `language`, `value`, and `approved` fields.

## List Glossary Terms

```bash theme={null}
curl "https://app.nt3.io/api/organizations/org_789xyz/glossaries/gloss_abc123/terms?search=onboard" \
  -H "Cookie: session=..."
```

Use the `search` query parameter to filter terms by substring match.

## Update a Term

```bash theme={null}
curl -X PATCH https://app.nt3.io/api/organizations/org_789xyz/glossaries/terms/gterm_abc123 \
  -H "Cookie: session=..." \
  -H "Content-Type: application/json" \
  -d '{
    "definition": "Updated definition here"
  }'
```

## Delete a Term

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

## Import Terms

Import terms from a CSV or TBX file by sending the file contents as a string in the request body:

```bash theme={null}
curl -X POST https://app.nt3.io/api/organizations/org_789xyz/glossaries/gloss_abc123/import \
  -H "Cookie: session=..." \
  -H "Content-Type: application/json" \
  -d '{
    "format": "csv",
    "content": "term,definition,fr,de\nonboarding,Setup process,intégration,Einarbeitung"
  }'
```

Supported formats: `csv`, `tbx`.

**CSV format:** First row is a header. Required column: `term`. Optional columns: `definition`, `doNotTranslate` (`true`/`false`), `caseSensitive` (`true`/`false`), and any language code (e.g. `fr`, `de`).

**TBX format:** A term entry's do-not-translate and case-sensitivity flags are read from (and exported as) `<termNote type="doNotTranslate">true</termNote>` and `<termNote type="caseSensitive">true</termNote>` elements.

## Export Terms

```bash theme={null}
curl "https://app.nt3.io/api/organizations/org_789xyz/glossaries/gloss_abc123/export?format=csv" \
  -H "Cookie: session=..."
```

Returns `{ "content": "...", "format": "csv" }`.

## Check Text for Glossary Matches

Scan a text string against all glossary terms for your organization. Useful for validating human translations before saving:

```bash theme={null}
curl -X POST https://app.nt3.io/api/organizations/org_789xyz/glossaries/check \
  -H "Cookie: session=..." \
  -H "Content-Type: application/json" \
  -d '{
    "text": "The onboarding flow should be simple"
  }'
```

<Note>
  The text check endpoint is a **POST** request with a JSON body `{ "text": "..." }`, not a GET with query parameters.
</Note>

**Response:**

```json theme={null}
{
  "matches": [
    {
      "term": "onboarding",
      "definition": "The process of setting up a new user account",
      "position": { "start": 4, "end": 14 },
      "translations": [
        { "language": "fr", "value": "intégration", "approved": true }
      ]
    }
  ]
}
```
