Reference REST API 03 / 06
Errors and limits
Error shapes, status codes, rate limits, idempotency and the plan limits behind them.
On this page
When a call fails, the status code says what kind of problem it is and the body says which one. This page lists the codes Writ Cloud returns, the shape of each error body, and the limits that cause the most common ones.
Status codes
| Code | What it means at Writ | What to do |
|---|---|---|
| 200, 201 | Done. A failed run read by a status call is still 200: check status. | Read the body. |
| 202 | Accepted: a run, build or harvest started and goes on in the background. | Poll the status_url or the id it returns. |
| 204 | Done, no body (most deletes). | Nothing. |
| 400 | A value is not allowed, such as an unknown event type or preset. | Fix the request; detail names the value. |
| 401 | No key or token, a wrong one, an expired key, or an unsigned or stale webhook call. | Check the Authorization header. Replace an expired key. |
| 402 | A plan limit, or no credits left to pay for the call. | Read code; see Out of credits below. |
| 403 | The key lacks the scope, the route is not open to keys, or the action needs an Owner or Admin. | Add the scope named in detail, or use another credential. |
| 404 | It does not exist, or it belongs to another account. | Check the id and the account the key belongs to. |
| 409 | A request with the same Idempotency-Key is still running, a paused monitor was asked to check, or a write may already have happened. | Wait and retry, or read detail. |
| 413 | Run inputs above 10 MB, or a file above your plan's file size. | Upload large data as a file and pass its id. |
| 422 | The body failed validation, a page could not be read, or an Idempotency-Key was reused with a different body. | Read detail. |
| 429 | Too many calls: your plan's calls per minute, a per-key or per-webhook limit, or too many live sessions. | Wait Retry-After seconds, then retry. |
| 500 | An error on Writ's side. | Retry. If it keeps happening, quote error_id to support. |
| 502 | A published endpoint's run failed with a known cause. | Read error. |
| 503 | Writ could not check billing, the checker for a monitor is offline, or Writ Cloud is too busy for a Free plan browser run. | Retry after Retry-After, or run it on Writ Desktop. |
| 504 | A run took longer than the call could wait. It is still running. | Collect it at status_url. |
Error bodies
Errors are JSON, but their shape depends on where they come from. Read detail first; when a
body has a code, branch on the code, not on the sentence.
Most errors
A single detail sentence.
HTTP/1.1 401 Unauthorized
{ "detail": "Invalid API key" } Validation errors
A body that does not match the operation answers 422 with a list: one item per field, with where it is (loc) and what is wrong (msg).
HTTP/1.1 422 Unprocessable Entity
{
"detail": [
{ "type": "missing", "loc": ["body", "url"], "msg": "Field required" }
]
} Plan limits
A plan limit answers 402 (sometimes 413 or 429) with the limit's code, how much you use (current), the limit, and upgrade_hint: the plan that lifts it, or billing when adding funds is enough.
HTTP/1.1 402 Payment Required
{
"detail": "Concurrent browser limit reached (2/2). Wait for tasks to complete.",
"code": "concurrent_browsers",
"current": 2,
"limit": 2,
"upgrade_hint": "growth"
} Not found and server errors
A 404 adds error and message to the route's own detail. A 500 never shows internals; it carries an error_id that support can look up.
HTTP/1.1 404 Not Found
{
"error": "Not Found",
"message": "The requested resource was not found: /api/v1/workflows/412/runs/1",
"detail": "Task not found"
} HTTP/1.1 500 Internal Server Error
{
"error": "Internal Server Error",
"detail": "An unexpected error occurred. Please try again later. (ref: 3f9a1c07be42)",
"message": "An unexpected error occurred. Please try again later. (ref: 3f9a1c07be42)",
"error_id": "3f9a1c07be42"
} A page that could not be read
Reading a page answers 422 with an object in detail: a message that says
what happened and the next step, and a code. When another read could work, retry_with gives the settings to use, such as {"render_mode": "browser"}.
HTTP/1.1 422 Unprocessable Entity
{
"detail": {
"message": "The site answered HTTP 404: this URL does not exist on the site. Do not retry it; take real URLs from the site's own pages (its listing, search or sitemap).",
"code": "scrape_not_found",
"url": "https://example.com/old-page",
"status": 404,
"render_mode": "auto"
}
} | Code | Meaning |
|---|---|
scrape_not_found | The page does not exist (404 or 410). Do not retry. |
scrape_dns | The host does not exist. Check the address. |
scrape_url_refused | The address is not a public internet address. |
scrape_bot_wall | A bot check or a refusal stayed in front of the page after everything Writ tried. May carry site_block. |
scrape_http_4xx | The site refused the request (401, 403, 429 and others). A persona may help. |
scrape_site_error | The site had an error of its own (5xx). Retry later. |
scrape_timeout, scrape_connection_reset, scrape_tls | The connection timed out, was cut, or its HTTPS setup is broken. |
scrape_empty, scrape_not_read, scrape_unreachable | The page was empty, not read in time, or could not be reached for another reason. |
scrape_persona_sign_in_failed, scrape_persona_unavailable | The persona could not sign in, or cannot be used. |
A site that blocks Writ's servers
Some sites refuse connections from data centers. When your account cannot pay for a residential address,
the error carries a site_block object: the options that get past the block on your account,
in order (upgrade, Writ Desktop, buy credits), and a tell_user sentence to show a person. It
appears in failed page reads, harvests and builds, and in MCP answers. More: Blocks, CAPTCHAs and hand-offs.
{
"detail": {
"message": "shop.example refuses connections from Writ's servers (a data-center address), so the page doesn't load. ...",
"code": "scrape_bot_wall",
"url": "https://shop.example/item/42",
"site_block": {
"code": "site_blocks_datacenter",
"site": "shop.example",
"wall": "refusal",
"egress": "datacenter",
"tell_user": "shop.example refuses connections from Writ's servers ...",
"options": [
{ "id": "upgrade", "kind": "upgrade", "label": "Upgrade to Starter", "plan": "starter" },
{ "id": "use_desktop", "kind": "desktop", "download_url": "https://usewrit.app/desktop" },
{ "id": "buy_credits", "kind": "credits", "label": "Buy credits (residential is 7 credits per MB)" }
],
"recommended": "upgrade",
"upgrade_plan": { "id": "starter", "name": "Starter" },
"desktop": { "download_url": "https://usewrit.app/desktop", "free": true }
}
}
} Published endpoints
Published endpoints (/v1/{ref}/{path}) answer errors as {"success": false, "error": ..., "detail": ...}, so the same field tells success from failure on every answer.
A 409 with "code": "CLEARANCE_OUTCOME_UNKNOWN" means a write on the site may have
gone through: check the site before you send the call again.
HTTP/1.1 401 Unauthorized
{
"success": false,
"error": "Authentication required",
"detail": "Provide Authorization: Bearer <consumer_api_key>"
} Out of credits
When there are no credits left to pay for a cloud call, Writ refuses it before it runs, with 402 and one of these codes:
| Code | Refused call |
|---|---|
execution_time | A cloud run: published endpoints, runs by id, webhooks, schedules. |
insufficient_credits | Reading a page, or AI on Writ's models. In page reads it is inside detail. |
crawl_pages_exhausted | Starting a harvest. |
insufficient_balance | Starting a live session. |
HTTP/1.1 402 Payment Required
{
"detail": "Your included credits are spent ... Top up to keep crawling.",
"code": "crawl_pages_exhausted",
"current": 0,
"limit": 0,
"upgrade_hint": "billing"
} To keep going: wait for next month's allowance, add funds in Billing & Usage (Add funds; funds never expire), move to a bigger plan with Change plan, or run the same workflow on Writ Desktop, where local runs are free. A call that fails because of the site or Writ costs nothing. Prices: Credits and plans.
Rate limits and caps
Your plan sets how many calls per minute the account can make. The limit is shared by every API key, OAuth token and MCP tool call of the organization. Polling a run's status does not count.
| Plan | Calls per minute |
|---|---|
| Free | 10 |
| Starter | 60 |
| Pro | 200 |
| Growth | 600 |
| Scale | 2,000 |
| Enterprise | 5,000 |
Past the limit you get 429 with "code": "plan_rate_limit", a Retry-After header in seconds, and X-RateLimit-Limit and X-RateLimit-Remaining.
HTTP/1.1 429 Too Many Requests
Retry-After: 60
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
{
"detail": "Plan API rate limit exceeded (60 requests/min). Upgrade your plan for a higher limit.",
"code": "plan_rate_limit",
"limit": 60,
"retry_after_seconds": 60
} Other limits that answer 429:
- Each key may call a published endpoint 60 times a minute (
"error": "Rate limit exceeded", withX-RateLimit-Reset). - Each incoming webhook URL accepts 30 calls a minute.
- The Free plan runs one live session at a time.
- Keyless calls have a daily allowance per device and per IP address (
keyless_rate_limited), and a burst limit of 10 a minute (keyless_burst_limited).
Some caps are the same on every plan, as safety limits:
- A cloud run stops after 15 minutes.
- A live session or a recording ends after 1 hour.
- Run inputs are at most 10 MB (
413). Upload bigger data as a file. - A call waits at most 300 seconds for a run; longer runs go on in the background.
Retries and long runs
Retry safely with an idempotency key
A POST that timed out on the way back may already have run. To retry without running it twice,
send an Idempotency-Key header (any unique string, up to 255 characters) on POST, PUT and PATCH, and reuse it on every retry of the same call.
- A repeat within 24 hours gets the first answer back, with
Idempotency-Replayed: true. Nothing runs again. - A repeat while the first is still running answers
409withRetry-After: 1. - The same key with a different body answers
422. 5xxanswers are not kept, so a retry after one runs for real.
import os, time, uuid, requests
RETRY = {429, 500, 503}
def call(url, payload, attempts=4):
headers = {
"Authorization": f"Bearer {os.environ['WRIT_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()), # the same key for every retry
}
for attempt in range(attempts):
res = requests.post(url, json=payload, headers=headers, timeout=130)
busy = res.status_code == 409 and res.json().get("code") == "idempotency_conflict"
if res.status_code not in RETRY and not busy:
return res # done, or an answer that a retry would not change
time.sleep(int(res.headers.get("Retry-After", 2 ** attempt)))
return res const RETRY = new Set([429, 500, 503]);
async function call(url: string, payload: unknown, attempts = 4) {
const key = crypto.randomUUID(); // the same key for every retry
let res!: Response;
for (let attempt = 0; attempt < attempts; attempt++) {
res = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.WRIT_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": key,
},
body: JSON.stringify(payload),
});
const busy = res.status === 409 && (await res.clone().json()).code === "idempotency_conflict";
if (!RETRY.has(res.status) && !busy) return res;
const wait = Number(res.headers.get("Retry-After") ?? 2 ** attempt);
await new Promise((r) => setTimeout(r, wait * 1000));
}
return res;
}
Retry 429, 500 and 503 after Retry-After, and a 409 whose code is idempotency_conflict. A 504 means the run is still going: collect it instead of sending it again. Other 4xx answers fail the same way if you resend them unchanged.
Long runs
A published endpoint waits for the run up to its timeout. Past it, the answer is 504 with a run_id and a status_url, and the run keeps going: collect it there. To skip the wait, send Prefer: respond-async and poll from the start.
HTTP/1.1 504 Gateway Timeout
Location: https://api.usewrit.app/v1/your-org/_runs/run_Xb2c9T0qLm4sV8eYp1Aw
Retry-After: 5
{
"success": false,
"error": "Execution timeout",
"detail": "The run did not finish within 120s and is still in progress. Collect the result at status_url, or call with 'Prefer: respond-async' to avoid waiting.",
"status": "running",
"run_id": "run_Xb2c9T0qLm4sV8eYp1Aw",
"status_url": "https://api.usewrit.app/v1/your-org/_runs/run_Xb2c9T0qLm4sV8eYp1Aw"
}
A run by workflow id answers 200 with error and task_id when it outlives timeout; read the result later with its task_id. A saved harvest called with wait answers 504 with crawl_id and status_url. Full details: Call your API.
MCP and Writ Desktop errors
MCP
Writ's MCP server answers in JSON-RPC. A refused call (a rate limit, a suspended account, a busy server)
is an error with code -32000, sent with the real HTTP status. A rate limit also carries data with the code and the seconds to wait.
{
"jsonrpc": "2.0",
"id": 7,
"error": {
"code": -32000,
"message": "Plan API rate limit exceeded (10 requests/min). Upgrade your plan for a higher limit.",
"data": { "code": "plan_rate_limit", "limit": 10, "retry_after_seconds": 42 }
}
}
A missing or expired sign-in stays a plain HTTP 401, so your client signs in again on its own.
A tool that runs but fails answers a normal result with "isError": true and the error as JSON
text, so your assistant can read it and act. Other JSON-RPC codes: -32700 invalid JSON, -32600 invalid request, -32601 unknown method, -32602 invalid parameters.
{
"jsonrpc": "2.0",
"id": 8,
"result": {
"content": [ { "type": "text", "text": "{\"code\":\"scrape_not_found\",\"message\":\"The site answered HTTP 404 ...\"}" } ],
"isError": true
}
} Writ Desktop
Writ Desktop's local API uses one shape for every error: an error sentence and a stable code. See Desktop local API.
{ "error": "Workflow not found", "code": "not_found" }