Skip to content

POST missing keys

POST {apiBaseUrl}/public/projects/{projectSlug}/missing/{locale}/{namespace}
e.g. (substitute your own slug)
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.
Authorization: Bearer lw_pub_…
Content-Type: application/json

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

LimitValueSource
Request body1 MiBpublic.ts bodyLimit
Entries per request1,000public.ts missingBodySchema
Key length512 charspublic.ts missingBodySchema
Value length10,000 charspublic.ts missingBodySchema

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.

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.

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

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.

LimitValueSource
Window60 s (fixed)PUBLIC_WRITE_WINDOW_MS
Requests per API key60 / windowPUBLIC_WRITES_PER_KEY_PER_WINDOW
Requests per IP30 / windowPUBLIC_WRITES_PER_IP_PER_WINDOW
Entries per API key2,000 / windowPUBLIC_ENTRIES_PER_KEY_PER_WINDOW
Entries per IP1,000 / windowPUBLIC_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.

Terminal window
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": [] }
  • SDK saveMissing — batching, splitting and retry behaviour on the client.
  • CDN contract — the read side, which needs no key at all.