Errors
Every non-2xx response is a JSON object with a single error field:
{ "error": "invalid token" }There is no error code, no nested detail object, and no variation between endpoints. The HTTP status carries the category; the error string is a human-readable explanation, intended for your logs rather than for pattern matching.
The sign-in endpoints an AI app uses (/oauth/…, see Connect your AI) are the exception: they follow OAuth’s own error format, an error code plus an error_description, because OAuth clients parse that.
The one place with machine-readable codes in the API is the import, and those are not errors in this sense. An import that is read and applied answers 200, and lists each key or value it could not write, with a stable code, in the body.
HTTP/1.1 404 Not FoundContent-Type: application/jsonX-Localeo-RateLimit-Remaining: 986{ "error": "release not found" }Status codes
| Status | Meaning | What to do |
|---|---|---|
400 | The request was malformed: an unparseable release ID, list parameters that could not be read, a missing or unknown language, or a body that is not valid JSON or breaks a rule such as the 1000-key limit on an import or on a key delete. POST /releases also answers 400 without a name, and for a project with no translations yet. The key endpoints answer 400 for an invalid key name or placeholder type. | Fix the request. Retrying will not help. |
401 | Missing, malformed, unknown, revoked or expired token. | Check the token. See Authentication. Note that retrying still consumes quota. |
403 | A read token on a write endpoint, or a write token whose creator may no longer write. | Use a write token from someone who is a manager or developer on the project. See Authentication. |
404 | The release does not exist or belongs to another project, or, on a GET, is not published yet. Or the translation key does not exist. | Treat all of these as “not available to you”: they are deliberately indistinguishable. |
409 | Publishing a release that is not a draft. | Nothing to do: it is already published or publishing. |
409 | Creating or renaming a key to a name that is taken (translation key already exists). | Update the existing key instead, or pick another name. See Managing keys. |
409 | Replacing an approved source text (approved source text cannot be changed). | Change only the name or description, or edit the value in the dashboard. |
409 | Creating a key past the plan’s translation-key limit. | Delete keys or upgrade the plan. |
429 | Rate limit exceeded. | Wait Retry-After seconds. See Rate limits. |
500 | Something failed inside Localeo. | Retry after a short delay. If it persists, get in touch. |
Do not match on the message
The error strings are not a stable API. They may be reworded to be clearer without that being a breaking change. Branch on the status code; log the message.
// Goodif (res.status === 429) await sleep(Number(res.headers.get('retry-after')) * 1000)
// Fragileif (body.error === 'rate limit exceeded') /* ... */404 is deliberately ambiguous
An unpublished release and a nonexistent one produce identical responses, as does a release belonging to a different project. This is intentional: distinguishing them would let a caller probe for the existence of releases they cannot read.
The practical implication is that a 404 on a release you believe exists usually means it is still a draft.
Errors carry the usual headers
Rate-limit headers are present on 400, 401 and 404 responses too, so you can read your remaining quota even from a failure. That is worth logging, because failed requests consume quota.
The exception is 429, which carries Retry-After instead. See rate limits.