Errors
Status codes, the partial-success contract, and how to read a failure.
There are two kinds of failure, and they look different on purpose.
- The request was wrong — bad JSON, no key, too many items. Nothing was
written, and you get a single
errorobject. - Some items were wrong — one item in a batch is missing a summary. The
rest were written, and you get a
resultsarray saying which was which.
error and results never both appear. Whichever you get tells you which kind
of failure you are dealing with.
Status codes
| Code | Meaning |
|---|---|
200 | Single item replaced, or deleted, or already gone |
201 | Single item created |
207 | Batch processed — read results for the per-item outcome |
400 | The request itself is invalid, or the one item of a PUT was refused; nothing was written |
401 | Missing, malformed, unknown, or revoked key |
403 | The team's Content API is switched off; nothing was written |
405 | The path does not serve this method; the Allow header lists the ones it does |
413 | Body larger than 1 MiB |
415 | Content-Type is not application/json |
429 | Rate limit exceeded — see Rate limits |
500 | Something failed on our side; the request was not applied |
Partial success
A batch always returns 207, even when every item succeeded.
That is deliberate. If we returned 200 on full success, a client that checks
only the status code would read "97 of 100 written" as total success and never
look at the array. A code that never means "everything is fine" forces you to
read the results once, while you are integrating, which is when handling it is
cheap.
{
"request_id": "0f3b8e2a-…",
"results": [
{ "external_id": "cms-1041", "status": "created", "id": "9c2f…" },
{ "external_id": "cms-1042", "status": "updated", "id": "1ab7…" },
{
"external_id": "cms-1043",
"status": "failed",
"error": {
"code": "invalid_content",
"message": "One or more fields are invalid.",
"details": [{ "path": "summary", "message": "Invalid input: expected string, received undefined" }]
}
}
],
"summary": { "total": 3, "succeeded": 2, "failed": 1 }
}status is one of created, updated, deleted, not_found, or failed.
A single PUT is not a batch, so it does not answer 2xx for an item it did
not write. When its one item fails, you get 400 with the same single-item
body, "status": "failed" and the item's error:
{
"request_id": "0f3b8e2a-…",
"external_id": "cms-1043",
"status": "failed",
"error": { "code": "invalid_published_at", "message": "published_at is not a valid ISO 8601 date." }
}details lists at most 50 problems for a request, and 10 for each item in a
batch; past that, a last entry says how many more there were. Fix the ones
listed and the rest will show on the next push.
A failed item almost always carries invalid_content: a field failed
validation, and details names each path and what is wrong with it. That is
where a bad type, source, category, published_at, parameters or
tags is caught.
The other codes below come from a second, defensive check inside the database,
which repeats the same rules. You should not normally see them: they appear only
if an item passes validation and the database still refuses it. Handle them the
same way as invalid_content, but do not expect them for everyday mistakes, and
do not build your error handling around them.
error.code | Cause |
|---|---|
invalid_content | A field failed validation; details names the path |
invalid_type | type is not an object, its type_id uses forbidden characters, its title is absent, or it carries a key we do not accept (such as url) |
invalid_source | source is missing, its source_id uses forbidden characters, its title is absent, or its url is not http(s) |
invalid_category | The same, for category |
invalid_published_at | Not an ISO 8601 date — see Dates |
invalid_parameters | A parameter name is not permitted, a declared type does not match its value, or a limit was exceeded — see Custom parameters |
invalid_tags | A tag breaks the format, the item has more than 50, or one tag appears twice (in any casing) — see Tags |
An item rejected for any of these reasons leaves nothing behind: we do not create the type, the section or the tags it named. The other items in the batch are unaffected.
Fix the failed item and re-send the whole batch. Because pushes are idempotent, the items that already landed are simply replaced with identical values — no duplicates, no drift.
Request-level errors
{
"request_id": "0f3b8e2a-…",
"error": {
"code": "invalid_request",
"message": "A batch may contain at most 100 content items.",
"details": [{ "path": "content", "message": "…" }]
}
}error.code | Status | Cause |
|---|---|---|
invalid_request | 400 | Bad JSON, unknown top-level key, 0 or >100 items, duplicate ID, or a NUL character or unpaired UTF-16 surrogate in the body |
unauthorized | 401 | Key missing, malformed, unknown, or revoked |
content_api_disabled | 403 | The key is valid, but the team's Content API is switched off. A team owner turns it on in the team's Settings → Content API |
method_not_allowed | 405 | The path does not serve this method; Allow lists the ones it does |
payload_too_large | 413 | Body over 1 MiB |
unsupported_media_type | 415 | Wrong Content-Type |
rate_limited | 429 | A limit was hit; see Retry-After |
internal_error | 500 | Our fault |
Every 401 returns the same message whether the key is unknown, malformed, or revoked. That is intentional — the
difference would tell an attacker whether a key they found is real.
When you cannot see what went wrong
Open API keys → Logs in Embrin (team owners only). Every authenticated call
is listed with its status, how many items it carried, and how long it took.
Calls rejected before we know whose key it is — 405, 415, 401, and the
failed-authentication 429 — have no team to be filed under, so they are not
listed. Failed calls keep what we received, up to the first 64 KiB, together
with the validation errors, for 30 days. Rate-limited (429) calls keep no
payload: nothing in them was written, so re-send the same request once
Retry-After has passed. And while a key keeps hitting its limits, at most
one 429 per key per minute is listed; the others were answered the same
way. A 413 keeps no payload either: a body over the 1 MiB limit is not kept at
all. Nor does a 403 content_api_disabled: nothing is written while the Content
API is switched off, so there is nothing in the body to fix.
Successful calls do not keep the payload — it is the content itself, and you can see that on the Content tab.
Match the request_id from your response to the log entry to find one specific
call.
Retrying safely
Every operation is idempotent, so retrying is always safe:
- Re-pushing an unchanged item replaces it with identical values.
- Deleting something already deleted returns
not_found, not an error.
Back off on 429 and 5xx, using Retry-After when it is present. Do not
retry a 400 — the request will fail identically until you change it. Nor a
403 content_api_disabled: it fails identically until a team owner switches the
Content API back on. Your keys and content are kept while it is off.