DocsREST API
Strings
List, edit, approve, retranslate and delete project strings. These are the endpoints behind the editor.
A string is a source message submitted to a project through batch entries or generated by runtime translation, identified by its hash. Segments of uploaded files are not listed here. Each string has at most one current translation per locale, with a status.
| Status | Meaning |
|---|---|
machine |
Produced by the model, untouched. |
edited |
Changed by a person, not yet approved. |
approved |
Marked as reviewed. |
List strings
GET /v1/projects/:projectId/strings (project:read)
| Query | Default | Meaning |
|---|---|---|
locale |
none | Include each string’s translation in this locale. Needed for the status filters. |
q |
none | Substring search over source text, string id, context and translation text; also matches an exact hash. |
status |
all |
all, missing (no translation in locale), unreviewed (status machine or edited) or approved. Anything other than all needs locale, otherwise 400 invalid_request. |
cursor |
none | From a previous response’s nextCursor. |
limit |
50 | Page size, 1 to 200. |
Results are newest first. The cursor is an opaque offset.
curl "https://generic-translation-api.jacobfv123.workers.dev/v1/projects/current/strings?locale=es&status=unreviewed&limit=2" \
-H "authorization: Bearer $GENERIC_TRANSLATION_API_KEY"
{
"items": [
{
"hash": "5d1e7c2a90b34f6e8d1a0c3b5e7f9a24",
"source": "Hello <0>{name}</0>",
"context": "Dashboard greeting",
"dataFormat": "ICU",
"id": null,
"createdAt": "2026-11-30T09:59:40.000Z",
"translation": {
"text": "Hola <0>{name}</0>",
"status": "machine",
"updatedAt": "2026-11-30T10:00:21.000Z",
"updatedBy": "system"
}
},
{
"hash": "0b8f3a6d2c1e4f7a9b5d8e0c2a4f6b81",
"source": "Sign out",
"context": "",
"dataFormat": "ICU",
"id": "nav.signout",
"createdAt": "2026-11-30T09:59:40.000Z",
"translation": {
"text": "Cerrar la sesión",
"status": "edited",
"updatedAt": "2026-11-30T11:02:00.000Z",
"updatedBy": "usr_2mm9a…"
}
}
],
"nextCursor": "…",
"total": 182
}
translation is absent when the string has none in that locale (or when no locale was given). updatedBy is the id of the user or API key that last changed it, or "system" for a machine translation. total counts everything matching the filters, not just this page. context is an empty string when there is none.
Edit or approve a translation
PUT /v1/projects/:projectId/strings/:hash/:locale (translations:write)
| Field | Type | Meaning |
|---|---|---|
text |
string | New translation text, up to 20,000 characters. Sets the status to edited unless approved is also true. |
approved |
boolean | true marks the translation approved; false moves an approved translation back to edited. |
Send either or both. With only approved: true, the existing translation is approved as it is; if there is none, the call fails with 400 invalid_request. Unknown hashes return 404 not_found.
# fix the text and approve it in one call
curl -X PUT https://generic-translation-api.jacobfv123.workers.dev/v1/projects/current/strings/5d1e7c2a90b34f6e8d1a0c3b5e7f9a24/es \
-H "authorization: Bearer $GENERIC_TRANSLATION_API_KEY" \
-H "content-type: application/json" \
-d '{ "text": "¡Hola, <0>{name}</0>!", "approved": true }'
Returns the updated string record (same shape as in the list, with translation filled in). Needs translations:write, or the member role.
Validation
text must not be empty, and for ICU strings it must be compatible with the source: the same variables, tags, argument kinds and select branches. Otherwise nothing is saved and you get status 400:
{
"error": "Translation is not compatible with the source message: missing variable {name}",
"code": "incompatible_message",
"details": { "problems": ["missing variable {name}"] }
}
Strings whose dataFormat is STRING skip the compatibility check.
An edit triggers the translation.updated webhook; an approval triggers translation.approved.
Retranslate
POST /v1/projects/:projectId/strings/:hash/:locale/retranslate (translations:write)
Asks the model again for this string and locale, using the current project instructions and glossary, and replaces the stored translation even if a person edited or approved it. No body. Returns the updated string record with status machine. Errors: 400 invalid_request if the target locale is the same language as the project’s source, 404 not_found, and 502 translation_failed if the model could not produce a valid translation (the previous translation is kept).
Use it after improving a string’s context, the instructions or the glossary. The previous text remains in the history.
History
GET /v1/projects/:projectId/strings/:hash/:locale/history (project:read)
Every saved version of the translation, newest first, up to 100.
{
"items": [
{ "id": "412", "text": "¡Hola, <0>{name}</0>!", "status": "approved", "updatedBy": "usr_2mm9a…", "updatedByName": "Grace", "createdAt": "2026-11-30T11:05:00.000Z" },
{ "id": "377", "text": "Hola <0>{name}</0>", "status": "machine", "updatedBy": "system", "updatedByName": "Generic Translation", "createdAt": "2026-11-30T10:00:21.000Z" }
]
}
updatedByName is the user’s name, API key: <name> for a key, or Generic Translation for machine output; it can be null if the user no longer exists. Unknown hash returns 404 not_found.
Delete a string
DELETE /v1/projects/:projectId/strings/:hash (translations:write)
Removes the string, its translations and their history in every locale from the project. Returns { "ok": true }. Use it to clear out strings your code no longer contains. If the same source is submitted again later it is simply a new string; previously cached translations may be reused.
Deleting does not change what is already on the CDN. Publish again to remove the entry from the published maps.
Something wrong or unclear on this page? Open an issue.