POST missing keys
Request
Section titled “Request”POST {apiBaseUrl}/public/projects/{projectSlug}/missing/{locale}/{namespace}https://api.localize.work/public/projects/your-project/missing/en/common| Part | Rules |
|---|---|
projectSlug |
Must match the project the API key belongs to. |
locale |
Canonicalised to BCP 47 (en-fi → en-FI). Must be the project’s source locale or one of its target locales. |
namespace |
1–200 characters, one path segment: /, \, . and .. are rejected. Created on first use. |
Headers
Section titled “Headers”Authorization: Bearer lw_pub_…Content-Type: application/jsonThe token must be a public project API key. Keys are stored as SHA-256 hashes; the plaintext token is shown once, at creation.
A flat JSON object of string → string. Nothing nested, no arrays, no nulls.
{ "nav.settings": "Settings", "items_one": "{{count}} item", "items_other": "{{count}} items"}Keys carrying CLDR cardinal suffixes (_one, _other, …) are collapsed into a
single plural key server-side, exactly as the import pipeline does.
Limits
Section titled “Limits”| Limit | Value | Source |
|---|---|---|
| Request body | 1 MiB | public.ts bodyLimit |
| Entries per request | 1,000 | public.ts missingBodySchema |
| Key length | 512 chars | public.ts missingBodySchema |
| Value length | 10,000 chars | public.ts missingBodySchema |
Semantics
Section titled “Semantics”Create-only, and idempotent because of it. A translation row that already
exists for (key, locale, plural form) is never overwritten — its value, status
and history are untouched. Posting the same batch twice produces the same state;
the second call just reports everything as existing.
Status of created rows depends on the locale: source-locale rows are born
reviewed (source text is authored, not translated), target-locale rows are
born draft. Since only reviewed rows publish, a key reported for a target
locale does not reach the CDN until a human reviews it.
Skips, all of which leave the rest of the batch intact:
| Case | Behaviour |
|---|---|
| Empty value, variant locale | Skipped silently — an empty override means “inherit the base locale”. |
| Plural form unused by the locale | Skipped, with a warning. |
| Plural shape contradicts the existing key | Skipped, with a warning. |
Plan limit is a soft fail. New keys beyond the organization’s key limit are
skipped; rows for keys that already exist still commit; the response carries
limitReached and limit. Nothing is rolled back, and the status code stays
200.
Auditing. A batch that created at least one row writes a
project.save_missing entry to the activity log with the locale, namespace, and
the created/existing counts. An all-existing batch — the steady state of a dev
session — writes nothing.
Response
Section titled “Response”200 OK
{ "created": 12, "existing": 340, "warnings": [], "limitReached": true, "limit": 500}| Field | Type | Meaning |
|---|---|---|
created |
number | Translation rows written. A new key counts here through its first row. |
existing |
number | Rows that already existed and were left alone. |
warnings |
string[] | Per-entry parse and skip messages (see below). |
limitReached |
boolean? | Present only when new keys were skipped at the plan wall. |
limit |
number | null? | The key limit that was hit; null when the org has an unlimited override. |
Warning strings
Section titled “Warning strings”Emitted verbatim, so you can match on them:
| Warning | Cause |
|---|---|
"<key>_<form>": <locale> does not use the "<form>" plural form — skipped |
Posted a CLDR category the locale has no rule for. |
"<key>": existing key is plural — entry skipped |
Posted a non-plural value for an existing plural key. |
"<key>": existing key is not plural — entry skipped |
The reverse. |
"<path>": null value skipped |
Body contained a null. |
"<path>": arrays are not supported — skipped |
Body contained an array. |
"<path>": key appears more than once — the later value wins |
Duplicate after flattening. |
"<key>": ordinal plurals are not supported yet — imported as a plain key |
An _ordinal_* suffix. |
"<key>": the key "<plain key>" already has the name of this plural key's <form> form — the whole key skipped |
A new plural key, when a plain key of the namespace is named like one of its forms (a plain items_one when items_one/items_other are posted). Only one of the two would show. |
"<key>": the plural key "<plural key>" already publishes its <form> form under this name — skipped |
A new plain key named like a form of an existing plural key. |
"<path>": unsafe key path segment — skipped |
A segment named __proto__, prototype or constructor. |
Status codes
Section titled “Status codes”| Code | Body | When |
|---|---|---|
| 200 | the report above | Anything that reached the write path, including partial plan-limit skips. |
| 400 | {"error":"invalid_locale","message":"…"} |
Locale is not canonicalisable, or is not a locale of this project. |
| 400 | {"error":"invalid_namespace"} |
Namespace fails the path-segment rules. |
| 400 | {"error":"bad_body","issues":[…]} |
Body is not a flat string→string object within the size caps. issues is the Zod issue list. |
| 401 | {"error":"unauthorized"} |
Missing/malformed Authorization header, unknown token, secret-kind key, or a key belonging to a different project. |
| 404 | {"error":"not_found"} |
The owning organization is soft-deleted. |
| 429 | {"error":"rate_limited"} + Retry-After |
Either rate-limit dimension exceeded. |
Rate limits
Section titled “Rate limits”Fixed window, enforced per API key and per client IP. The key dimension bounds aggregate writes from every browser sharing that public key; the IP dimension stops one visitor consuming the whole allowance. The entry budget exists so that many maximum-sized batches cannot slip past a request-only limit.
| Limit | Value | Source |
|---|---|---|
| Window | 60 s (fixed) | PUBLIC_WRITE_WINDOW_MS |
| Requests per API key | 60 / window | PUBLIC_WRITES_PER_KEY_PER_WINDOW |
| Requests per IP | 30 / window | PUBLIC_WRITES_PER_IP_PER_WINDOW |
| Entries per API key | 2,000 / window | PUBLIC_ENTRIES_PER_KEY_PER_WINDOW |
| Entries per IP | 1,000 / window | PUBLIC_ENTRIES_PER_IP_PER_WINDOW |
Rate limiting is applied before the token is looked up, so a flood of requests with an invalid token is cheap to reject. Counters are per API process and reset on deploy.
/public/* responds with a wildcard origin and no credentials — it is designed
to be called from a browser on any origin with a bearer token. Every other
prefix is locked to the editor’s origin with credentials.
Worked example
Section titled “Worked example”curl -X POST https://api.localize.work/public/projects/your-project/missing/en/common \-H "Authorization: Bearer $LOCALIZE_PUBLIC_KEY" \-H "Content-Type: application/json" \-d '{"nav.settings":"Settings","items_one":"{{count}} item","items_other":"{{count}} items"}'{ "created": 3, "existing": 0, "warnings": [] }Run it a second time:
{ "created": 0, "existing": 3, "warnings": [] }Related
Section titled “Related”- SDK saveMissing — batching, splitting and retry behaviour on the client.
- CDN contract — the read side, which needs no key at all.