Rookery
Developer docsErrors
Basics

Errors

Every error has one shape: a stable code, a sentence, the field it's about and a request id. What each code means, and what to do.

Updated View as Markdown

When something goes wrong, the API answers with a status code and a JSON body in one shape, whatever the endpoint:

{
  "error": {
    "code": "missing_scope",
    "message": "This key doesn't have the \"write\" scope.",
    "param": null,
    "request_id": "rqi_7k3m9q2wx8hd4rtn"
  }
}
  • code is stable. Match on it in your code.
  • message is one sentence for people, so you can show it or log it. Don't match on its words; they may get clearer.
  • param names the input field a 400 is about, like status or to.id. Null when it isn't about one field.
  • request_id is the same as the answer's Request-Id header.

Request ids

Every answer has a Request-Id header, like rqi_7k3m9q2wx8hd4rtn, whether it worked or not. Log it. For an answer that went wrong (any status from 400 up), we keep one line with the request's id, your key's id, the operation, the status and the error code, and nothing else: never the body or what it was about. Write to us with that id and we can find what happened.

Codes

CodeStatusWhat happenedWhat to do
invalid_request400Something in the request is missing or not allowedFix the request. param names the field
invalid_json400The request body isn't valid JSONSend a JSON body with Content-Type: application/json
unauthorized401No key, or the key is wrong (a typo fails its checksum), revoked, or the person who made it is no longer on the teamCheck the Authorization: Bearer rookery_… header. See Keys and scopes
missing_scope403The key doesn't have the scope this needsMake a key with that scope. See Keys and scopes
test_key_only403A live key called something only the sandbox doesUse a test key. See Sandbox
plan_required403The workspace's plan doesn't include thisThe API is on Pro and Team
not_allowed403The key may not do this here, like approving a draft the key or its person wrote, or one on a confidential conversationA person approves it in Rookery
not_found404No such thing, or one the key can't see (for a test key, anything outside the sandbox)Check the id. Someone else's private inbox always answers 404
conflict409It conflicts with how things stand now, like approving a draft with a version from before Rook wrote it againRead it again, then decide
idempotency_key_reused422Reserved for when Idempotency-Key arrives: the same key came with a different bodyNot sent today
rate_limited429More than about 120 requests in a minute with this key; for POST /sandbox/inbound, 120 simulated emails in a minute across the sandbox; or more than 10 wrong keys in a minute from one addressWait Retry-After seconds. See Rate limits
internal_error500Something went wrong on our sideTry again shortly. If it keeps happening, write to hello@userookery.com with the request id
unavailable503Rookery is busy or down for a momentWait Retry-After seconds, then try again

New codes may appear. Treat one you don't know by its status.

Bad input

A 400 for bad input lists every problem at once in message, separated by semicolons, each starting with its field. param names the first:

{
  "error": {
    "code": "invalid_request",
    "message": "status: Invalid option: expected one of \"open\"|\"waiting\"|\"closed\"; id: A conversation id looks like cnv_…",
    "param": "status",
    "request_id": "rqi_2h8q4w7m9kx3drtb"
  }
}

Each endpoint's fields, with their limits, are in the API reference.

On the MCP server

A tool that fails answers with isError: true and the same error body, as JSON text and as structuredContent, so an agent can read the code and fix its call. Problems with the request itself (not JSON-RPC, an unknown method) keep JSON-RPC's own error shape. See MCP.

Retrying

Retry a 429, a 500 or a 503, and a timeout or dropped connection, after a wait: Retry-After says how long for a 429 or a 503. Before retrying a request that creates something, like a note or a reply, read Retries: a retry can make a second one.