Fully manage your Glossaries through the Transifex API

You can now create, edit, and delete glossaries, terms, and term translations through the Transifex REST API (v3). Until now, the API could only download a glossary file. The new endpoints let you keep a glossary in sync with your own tools, for example, a terminology database, a CMS, a CI job, or giving your AI tools the ability to generate and manage glossaries if you don’t have any yet.

What’s new

All endpoints are in the Glossaries section of the API reference.

Glossaries

  • POST /glossaries: create a glossary with a name and a source language.
  • PATCH /glossaries/{glossary_id}: rename it.
  • DELETE /glossaries/{glossary_id}: delete it.
  • GET, POST and DELETE /glossaries/{glossary_id}/relationships/projects: list, link and unlink the projects that use the glossary.

Terms

  • GET /glossary_terms: list a glossary’s terms. Filter by text, part of speech or tags.
  • POST /glossary_terms: create a term, with part of speech, note, tags and case sensitivity.
  • GET, PATCH and DELETE /glossary_terms/{glossary_term_id}: read, edit or delete one term.
  • DELETE /glossary_terms: delete up to 150 terms in one call (bulk).

Term translations

  • GET /glossary_term_translations: list translations.
  • PATCH /glossary_term_translations/{id}: add or change a translation, its note, or its reviewed state.
  • DELETE /glossary_term_translations/{id} and DELETE /glossary_term_translations: remove one translation, or many at once.

Uploads and stats

  • POST /glossaries_async_uploads and GET /glossaries_async_uploads/{id}: upload a glossary CSV and check the job’s status. By default the upload merges into the glossary and removes nothing. Set replace to true to also remove terms and translations the file leaves out. The whole file is saved or nothing is.
  • GET /glossary_language_stats: total, translated, untranslated and reviewed term counts per language.

Example: add a term and its Greek translation

curl -X POST https://rest.api.transifex.com/glossary_terms \
  -H "Authorization: Bearer $TRANSIFEX_API_TOKEN" \
  -H "Content-Type: application/vnd.api+json" \
  -d '{
    "data": {
      "type": "glossary_terms",
      "attributes": { "term": "sign up||signs up", "part_of_speech": "verb" },
      "relationships": {
        "glossary": { "data": { "type": "glossaries", "id": "o:my_org:g:my_glossary" } }
      }
    }
  }'

The glossary must already have Greek as a language before you can translate into it. Term translations can’t add a language. Upload a CSV with a translation_el column (see POST /glossaries_async_uploads) to add one.

Then use the id from the response (it looks like o:my_org:g:my_glossary:t:Zp8KqvA2wbRnL9xD) to add a translation:

curl -X PATCH "https://rest.api.transifex.com/glossary_term_translations/o:my_org:g:my_glossary:t:Zp8KqvA2wbRnL9xD:l:el" \
  -H "Authorization: Bearer $TRANSIFEX_API_TOKEN" \
  -H "Content-Type: application/vnd.api+json" \
  -d '{
    "data": {
      "type": "glossary_term_translations",
      "id": "o:my_org:g:my_glossary:t:Zp8KqvA2wbRnL9xD:l:el",
      "attributes": { "translation": "εγγραφή||εγγραφές" }
    }
  }'

Good to know

  • A new glossary has no target languages. Add one by uploading a CSV with a translation_<lang> column. Until then, language stats are empty and translation PATCH calls return 400.
  • Variants such as plural forms are separated with ||, in both terms and translations.
  • Creating, renaming and deleting glossaries, and uploading files, needs an organization administrator. Editing terms also works for project roles, as the glossary’s permissions allow.
  • Creating and editing terms needs a plan that supports glossary editing. Uploads need a plan that supports glossary upload.
  • A glossary takes one upload at a time. A second upload while the first is pending or processing returns 409.
  • Language stats update in the background, so a change can take a moment to show.

Feedback

Tell us what you build with these, or what’s still missing, in the replies below.

2 Likes