Errors and limits

Error shape

Every error response has the same body:

{
  "error": {
    "type": "invalid_request",
    "message": "Invalid url.",
    "param": "url"
  }
}

type is one of invalid_request, authentication, permission, not_found, conflict, rate_limited or internal. param names the request field at fault, when there is one. rate_limited errors also carry a code saying which limit was reached (see below).

A task that runs and does not succeed is not an error: the request succeeds and the task object reports partial or failed with a cause.

HTTP status codes

Code Type When
400 invalid_request Malformed JSON, or a bad query parameter or Idempotency-Key.
401 authentication The API key is missing or invalid.
403 permission Creating the task would pass the key's monthly spending limit (see usage), or the key already has its maximum number of schedules.
404 not_found No such task for this key, or it finished more than 30 days ago (see data retention).
409 conflict An Idempotency-Key was reused with a different body, or a schedule that lost its params is resumed without its task.
413 invalid_request The request body is larger than 128 KB.
422 invalid_request The body failed validation, including unknown fields and start URLs that are not allowed. param names the field, for example limits.max_steps.
429 rate_limited Rate limit, or the key's concurrent-task cap, reached; code says which. Honour Retry-After.
5xx internal A server error. Safe to retry with the same Idempotency-Key.

Rate and concurrency limits

Each API key has a request rate limit (per minute) and a cap on unfinished tasks. Requests over either return 429 with type: "rate_limited" and a Retry-After header in seconds. The error's code tells them apart:

code Meaning Retry-After
rate_limit_exceeded Too many requests this minute. Seconds until the minute window resets.
concurrency_limit_exceeded Too many unfinished tasks for the key; a slot frees when one finishes or is cancelled. 10
quota_exceeded The account's tasks for the month are used up (keys from the dashboard share one monthly allowance). It resets on the 1st (UTC). Seconds until the 1st
{
  "error": {
    "type": "rate_limited",
    "code": "concurrency_limit_exceeded",
    "message": "This API key already has 2 unfinished tasks, its concurrency limit."
  }
}

Repeated requests with a missing or invalid API key are also limited: after 20 in a minute from one address, further requests from it get 429 with code: "rate_limit_exceeded" until the minute is over.

The SDK waits and retries for you, except after quota_exceeded, and exposes the code as RateLimitError.code.

Per-task limits are capped: timeout_seconds at 720 (default 600) and max_steps at 100. Higher values are lowered to the cap. The time limit counts from when the task starts running.

A task that has not started 15 minutes after it was created fails with cause internal_error and is not charged. The files a task saves, downloads included, may take up to 1 GB; past that it stops with cause limit_reached.

Data retention

  • params are deleted when the task finishes.
  • Finished tasks (output, results, steps) are deleted 30 days after they finish; getting one after that returns 404. Your usage totals are kept.
  • A schedule keeps its task's params while it is active. Once it has been paused for 30 days, or its API key is revoked, they are deleted; to resume it, send its task again with them.

Idempotency

Send an Idempotency-Key header on POST /v1/tasks. Keys are scoped to your API key and kept for 24 hours. A retry with the same key and an equal body returns the original task, with Idempotent-Replayed: true, instead of starting another one, so network errors and 5xx responses are safe to retry. The same key with a different body is a 409 conflict. A create rejected by the concurrent-task cap does not use up its key.

URL rules

The start URL must be a public http or https URL without credentials. Addresses on private networks, loopback, link-local (including cloud metadata endpoints) and other reserved ranges are rejected, as are localhost and hostnames ending in .localhost, .internal or .local.

The same rules apply while the task runs. Images, frames and other files from such addresses are not loaded. If a page redirects or links the task to one, the task stops with cause site_blocked, keeping anything it found before.