Concepts
Errors
Every error has the same shape and a code whose meaning never changes. Decide what to do from the code; show the message to people.
The error object
{
"error": {
"code": "validation_failed",
"message": "Title is required",
"field": "title"
}
}code: stable, for your program to branch on.message: a sentence for a person, naming the field or the fix. Its wording can improve over time, so never match on it.field: the input that was wrong, for validation errors.upgradeUrl: onplan_limit, where a person can see the plan's options.
Every answer, error or not, carries X-Request-Id. Quote it to support.
Codes
| Code | When | What to do |
|---|---|---|
| unauthorizedHTTP 401 | The key is missing, malformed, unknown, expired or revoked, or the account is suspended or being deleted. | Check the key is sent as a bearer token and has not been revoked or expired. Make a new one if needed. |
| forbiddenHTTP 403 | The key is read-only for a write, the key is limited to a workspace or pages and cannot use an account-wide tool, or your role on the page does not allow it. | Use a full-access key, or ask the page owner for a role that allows the change. |
| not_foundHTTP 404 | Not in your account, outside the key's limits, or a paused page that you do not own. | Check the id or username, and that the key's workspace or page limits include it. |
| validation_failedHTTP 400 | The input is wrong. `field` names the property. | Fix the field named in `field` and send again. |
| conflictHTTP 409 | The state does not allow it: a username is taken, a retry with the same Idempotency-Key is still running, nothing to publish. | Read the current state, then decide whether the request still makes sense. Retrying unchanged will not help. |
| revision_conflictHTTP 409 | The draft changed since `expectedRevision`. Call `get_publish_status` for the new revision and try again. | Fetch the publish status again, show the new changes, and send the new revision. |
| profile_pausedHTTP 423 | The page is paused because it is over what its plan includes. It is read-only for its owner. | The page is paused by its plan. It can be read; renew or change the plan to edit it again. |
| plan_limitHTTP 402 | The plan does not include it (a scheduled publish, an extra page, a teammate, a longer analytics window). The body adds `limit` and `upgradeUrl`. | Open `upgradeUrl` to see the plan's options, or stay within the current plan. |
| rate_limitedHTTP 429, retry | Over a limit. Wait for `Retry-After` seconds. | Wait for `Retry-After` seconds and send the same request again. |
| unsafe_urlHTTP 422 | The address is not a public http or https URL, or it failed our safety check. | Use an https address to a normal website. Some addresses are refused to protect visitors. |
| unavailableHTTP 503, retry | A dependency is down (storage, email). Try again later. | Wait a little and retry with the same Idempotency-Key. |
| internal_errorHTTP 500, retry | Our bug. Quote the `X-Request-Id` header when you contact support. | Retry later. If it keeps happening, contact support with the X-Request-Id. |
Errors over MCP
A tool that fails returns a normal result with isError: true and the same error object, so an assistant can read the code and explain it. Protocol problems (unknown method, bad JSON) use JSON-RPC errors instead.
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"isError": true,
"structuredContent": { "error": { "code": "not_found", "message": "Profile not found" } },
"content": [{ "type": "text", "text": "{\"error\":{\"code\":\"not_found\",...}}" }]
}
}Retrying
Only rate_limited, unavailable and internal_error can succeed unchanged. For creates, send the same Idempotency-Key so a retry never makes a second copy. A retry helper is in the recipes.
AI agents? Read this page as Markdown, or the API as OpenAPI.