@hunt-labs/bytekit-mcp 0.3.13 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,21 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.3.14] - 2026-09-29
14
+
15
+ ### Changed
16
+
17
+ - Pinned `@modelcontextprotocol/sdk` to the exact version `1.31.0` instead of the range
18
+ `^1.12.1`, so an `npx @hunt-labs/bytekit-mcp` install and the hosted `/mcp` endpoint run one SDK
19
+ version instead of the `npx` install floating to whatever upstream last published (#4949). The
20
+ pin moves only when we release a deliberate bump. Earlier releases keep the caret range in their
21
+ published manifest. No tool, schema or transport change.
22
+ - Refreshed the bundled documentation snapshot after the top-ups page (`billing/top-ups`) gained a
23
+ section on bandwidth owed: an overage that no allowance, USD balance or starter grant can cover
24
+ is recorded as bandwidth you owe, a top-up, renewal or plan upgrade pays it off first, and new
25
+ billable requests are refused with `402 quota_exceeded` while any is owed (#4960). No behavior
26
+ change: bundled content only, no tool, schema or transport change.
27
+
13
28
  ## [0.3.13] - 2026-09-24
14
29
 
15
30
  ### Changed
@@ -22,7 +22,7 @@
22
22
  "api/bulk/createbulk": {
23
23
  "title": "Create mixed bulk job",
24
24
  "section": "API Reference",
25
- "body": "# Create mixed bulk job\n\nEnqueues screenshots or scrapes in a single batch.\nProvide `urls` (simple list) or `items` (per-item config), not both.\nWebhook deliveries include `X-ByteKit-Event: bulk.completed` so\nreceivers can dispatch on the header without parsing the body shape.\nThe body follows `BulkCompletedWebhook`: at most 500 complete items and\n1 MiB, followed by cursor recovery through the existing mixed-item route\nwhenever `recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 4 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 32 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's richer per-item override\nbudget), which reaches 28.7 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 4 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**POST** `/v1/bulk`\n\n## Request Body\n\n- `urls`\n- `items`\n- `defaults`\n- `webhook_url` (required)\n- `webhook_secret`\n- `metadata`\n\n## Responses\n\n### 202 — Bulk job accepted.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `estimated_credits`\n- `webhook_url`\n\n### 400 — Bad request. When a `url` (or item URL) fails strict validation the\nerror code is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter is\n exhausted. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth; `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error. `bulk_too_large` is returned when the item count\nexceeds the account plan's `max_bulk_size` cap (also surfaced as\n`max_bulk_size` on `GET /v1/account`). `validation_error` is\nreturned when the request body contains an unrecognized key\nanywhere in the top-level object, an `items[]` entry, or\n`defaults` — all three reject unknown keys with a 422\n`validation_error` whose `details` message names the offending\nkey, instead of silently discarding it. The two nested objects\ndo not accept the same field set: `device_scale_factor` is\n`defaults`-only (rejected per item), and `duration`/`scenario`\nare `items[]`-only (rejected under `defaults`). `metadata` is\nvalid both at the top level of the body and per item, but is\nrejected with this same 422 if placed under `defaults`.\n- `status`\n- `error`"
25
+ "body": "# Create mixed bulk job\n\nEnqueues screenshots or scrapes in a single batch.\nProvide `urls` (simple list) or `items` (per-item config), not both.\nWebhook deliveries include `X-ByteKit-Event: bulk.completed` so\nreceivers can dispatch on the header without parsing the body shape.\nThe body follows `BulkCompletedWebhook`: at most 500 complete items and\n1 MiB, followed by cursor recovery through the existing mixed-item route\nwhenever `recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 4 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 32 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's richer per-item override\nbudget), which reaches 28.7 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 4 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**POST** `/v1/bulk`\n\n## Request Body\n\n- `urls`\n- `items`\n- `defaults`\n- `webhook_url` (required)\n- `webhook_secret`\n- `metadata`\n\n## Responses\n\n### 202 — Bulk job accepted.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `estimated_credits`\n- `webhook_url`\n\n### 400 — Bad request. When a `url` (or item URL) fails strict validation the\nerror code is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error. `bulk_too_large` is returned when the item count\nexceeds the account plan's `max_bulk_size` cap (also surfaced as\n`max_bulk_size` on `GET /v1/account`). `validation_error` is\nreturned when the request body contains an unrecognized key\nanywhere in the top-level object, an `items[]` entry, or\n`defaults` — all three reject unknown keys with a 422\n`validation_error` whose `details` message names the offending\nkey, instead of silently discarding it. The two nested objects\ndo not accept the same field set: `device_scale_factor` is\n`defaults`-only (rejected per item), and `duration`/`scenario`\nare `items[]`-only (rejected under `defaults`). `metadata` is\nvalid both at the top level of the body and per item, but is\nrejected with this same 422 if placed under `defaults`.\n- `status`\n- `error`"
26
26
  },
27
27
  "api/bulk/deletebulk": {
28
28
  "title": "Cancel a bulk job",
@@ -57,7 +57,7 @@
57
57
  "api/fetch-bulk/createfetchbulk": {
58
58
  "title": "Bulk fetch URLs",
59
59
  "section": "API Reference",
60
- "body": "# Bulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (wait_for_selector, etc.).\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/fetch/bulk/{id}` whenever\n`recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 2 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 20 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's per-item override budget),\nwhich reaches 16.8 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 2 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**POST** `/v1/fetch/bulk`\n\n## Request Body\n\n- `urls` (required)\n- `defaults`\n- `webhook_url` (required)\n- `webhook_secret`\n- `metadata`\n\n## Responses\n\n### 202 — Fetch bulk job accepted.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `estimated_credits`\n- `webhook_url`\n\n### 400 — Bad request. When a `url` (or item URL) fails strict validation the\nerror code is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter is\n exhausted. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth; `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error. `bulk_too_large` is returned when the item count\nexceeds the account plan's `max_bulk_size` cap (also surfaced as\n`max_bulk_size` on `GET /v1/account`).\n- `status`\n- `error`"
60
+ "body": "# Bulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (wait_for_selector, etc.).\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/fetch/bulk/{id}` whenever\n`recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 2 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 20 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's per-item override budget),\nwhich reaches 16.8 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 2 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**POST** `/v1/fetch/bulk`\n\n## Request Body\n\n- `urls` (required)\n- `defaults`\n- `webhook_url` (required)\n- `webhook_secret`\n- `metadata`\n\n## Responses\n\n### 202 — Fetch bulk job accepted.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `estimated_credits`\n- `webhook_url`\n\n### 400 — Bad request. When a `url` (or item URL) fails strict validation the\nerror code is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error. `bulk_too_large` is returned when the item count\nexceeds the account plan's `max_bulk_size` cap (also surfaced as\n`max_bulk_size` on `GET /v1/account`).\n- `status`\n- `error`"
61
61
  },
62
62
  "api/fetch-bulk/getfetchbulk": {
63
63
  "title": "Get fetch bulk job status",
@@ -67,12 +67,12 @@
67
67
  "api/fetch/getfetch": {
68
68
  "title": "Fetch a URL (GET)",
69
69
  "section": "API Reference",
70
- "body": "# Fetch a URL (GET)\n\nDirect HTTP fetch. Successful responses return the upstream response bytes verbatim;\nmetadata is returned in X-Fetch-* headers. Non-2xx upstream responses use the\n`upstream_error` JSON envelope with the upstream HTTP status.\n\n**GET** `/v1/fetch`\n\n## Parameters\n\n- `url` (query, string, required)\n- `country` (query, string)\n- `timeout_ms` (query, integer)\n- `cache_ttl` (query) — How long a freshly fetched URL may be served from cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts `Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values receive a 422 validation_error with an actionable message.\n\n## Responses\n\n### 200 — Content from upstream.\n\n### 400 — Invalid URL (`invalid_url`) or oversized request.\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter is\n exhausted. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth; `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error (e.g. slow-path-only field), or a fetch that failed for a\ntarget-side reason.\n\nTwo distinct conditions answer `422`. Read `error.code` to tell them apart.\n\n- **`validation_error`** — the request itself was rejected.\n- **`blocked`** or **`upstream_error`** — the fetch ran and the target could not\n be read. `blocked` means the target's bot protection refused every attempt;\n `upstream_error` (message `Failed to fetch URL.`) is any other exhausted-retries\n failure, such as a host that does not resolve. This is a result about the URL,\n not an outage of this API, so it is a `4xx` rather than `502` or `503`. No\n upstream HTTP status was received, so `error.http_status` reports `422`,\n mirroring what was served — unlike the relayed `upstream_error` under `502`\n below, whose status is the target's own. The request transfers no billable\n bytes and is charged nothing (#4669).\n- `status`\n- `error`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n\n### 503 — Two distinct conditions answer `503`, and they disagree about what the body's\n`error.http_status` reports. Read `error.code` to tell them apart.\n\n- **`upstream_error`** — the target returned HTTP `502` or `504`, relayed here as\n `503`. Cloudflare fronts this API and replaces a clean origin 502 or 504 with its\n own generic `text/plain` error page, discarding the envelope before it reaches\n you, while a 503 is passed through unchanged. The body's `error.http_status`\n still reports the **true upstream status**, `502` or `504` — not `503` — and is\n the only surviving record of what the target answered, so the body rather than\n the HTTP status is authoritative here (#3355, #4891). Every other non-2xx\n upstream response is relayed at its own HTTP status with the same\n `upstream_error` envelope, so any other 4xx/5xx the target returns surfaces as an\n Error envelope rather than a raw body (#1462).\n- **`internal_error`** (message `Fetch service unavailable.`) — no fetch service\n endpoint could be resolved on this deployment, a fault of this API and not of the\n target. There is no upstream status to preserve: the `503` is this API's own\n choice of wire status, so the body's `error.http_status` reports `503`, mirroring\n what was served (#3373). A fetch that ran and failed for a target-side reason\n answers `422` instead (#4669).\n- `status`\n- `error`"
70
+ "body": "# Fetch a URL (GET)\n\nDirect HTTP fetch. Successful responses return the upstream response bytes verbatim;\nmetadata is returned in X-Fetch-* headers. Non-2xx upstream responses use the\n`upstream_error` JSON envelope with the upstream HTTP status.\n\n**GET** `/v1/fetch`\n\n## Parameters\n\n- `url` (query, string, required)\n- `country` (query, string)\n- `timeout_ms` (query, integer)\n- `cache_ttl` (query) — How long a freshly fetched URL may be served from cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts `Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values receive a 422 validation_error with an actionable message.\n\n## Responses\n\n### 200 — Content from upstream.\n\n### 400 — Invalid URL (`invalid_url`) or oversized request.\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error (e.g. slow-path-only field), or a fetch that failed for a\ntarget-side reason.\n\nTwo distinct conditions answer `422`. Read `error.code` to tell them apart.\n\n- **`validation_error`** — the request itself was rejected.\n- **`blocked`** or **`upstream_error`** — the fetch ran and the target could not\n be read. `blocked` means the target's bot protection refused every attempt;\n `upstream_error` (message `Failed to fetch URL.`) is any other exhausted-retries\n failure, such as a host that does not resolve. This is a result about the URL,\n not an outage of this API, so it is a `4xx` rather than `502` or `503`. No\n upstream HTTP status was received, so `error.http_status` reports `422`,\n mirroring what was served — unlike the relayed `upstream_error` under `502`\n below, whose status is the target's own. The request transfers no billable\n bytes and is charged nothing (#4669).\n- `status`\n- `error`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n\n### 503 — Two distinct conditions answer `503`, and they disagree about what the body's\n`error.http_status` reports. Read `error.code` to tell them apart.\n\n- **`upstream_error`** — the target returned HTTP `502` or `504`, relayed here as\n `503`. Cloudflare fronts this API and replaces a clean origin 502 or 504 with its\n own generic `text/plain` error page, discarding the envelope before it reaches\n you, while a 503 is passed through unchanged. The body's `error.http_status`\n still reports the **true upstream status**, `502` or `504` — not `503` — and is\n the only surviving record of what the target answered, so the body rather than\n the HTTP status is authoritative here (#3355, #4891). Every other non-2xx\n upstream response is relayed at its own HTTP status with the same\n `upstream_error` envelope, so any other 4xx/5xx the target returns surfaces as an\n Error envelope rather than a raw body (#1462).\n- **`internal_error`** (message `Fetch service unavailable.`) — no fetch service\n endpoint could be resolved on this deployment, a fault of this API and not of the\n target. There is no upstream status to preserve: the `503` is this API's own\n choice of wire status, so the body's `error.http_status` reports `503`, mirroring\n what was served (#3373). A fetch that ran and failed for a target-side reason\n answers `422` instead (#4669).\n- `status`\n- `error`"
71
71
  },
72
72
  "api/fetch/postfetch": {
73
73
  "title": "Fetch a URL (POST)",
74
74
  "section": "API Reference",
75
- "body": "# Fetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/fetch`\n\n## Request Body\n\n- `url` (required)\n- `country`\n- `timeout_ms`\n- `cache_ttl`\n- `custom`\n\n## Responses\n\n### 200 — Content from upstream.\n\n### 400 — Invalid URL (`invalid_url`) or oversized request body.\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter is\n exhausted. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth; `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error (e.g. malformed JSON, unsupported fetch format, or slow-path-only\nfield), or a fetch that failed for a target-side reason.\n\nTwo distinct conditions answer `422`. Read `error.code` to tell them apart.\n\n- **`validation_error`** — the request itself was rejected.\n- **`blocked`** or **`upstream_error`** — the fetch ran and the target could not\n be read. `blocked` means the target's bot protection refused every attempt;\n `upstream_error` (message `Failed to fetch URL.`) is any other exhausted-retries\n failure, such as a host that does not resolve. This is a result about the URL,\n not an outage of this API, so it is a `4xx` rather than `502` or `503`. No\n upstream HTTP status was received, so `error.http_status` reports `422`,\n mirroring what was served — unlike the relayed `upstream_error` under `502`\n below, whose status is the target's own. The request transfers no billable\n bytes and is charged nothing (#4669).\n- `status`\n- `error`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n\n### 503 — Two distinct conditions answer `503`, and they disagree about what the body's\n`error.http_status` reports. Read `error.code` to tell them apart.\n\n- **`upstream_error`** — the target returned HTTP `502` or `504`, relayed here as\n `503`. Cloudflare fronts this API and replaces a clean origin 502 or 504 with its\n own generic `text/plain` error page, discarding the envelope before it reaches\n you, while a 503 is passed through unchanged. The body's `error.http_status`\n still reports the **true upstream status**, `502` or `504` — not `503` — and is\n the only surviving record of what the target answered, so the body rather than\n the HTTP status is authoritative here (#3355, #4891). Every other non-2xx\n upstream response is relayed at its own HTTP status with the same\n `upstream_error` envelope, so any other 4xx/5xx the target returns surfaces as an\n Error envelope rather than a raw body (#1462).\n- **`internal_error`** (message `Fetch service unavailable.`) — no fetch service\n endpoint could be resolved on this deployment, a fault of this API and not of the\n target. There is no upstream status to preserve: the `503` is this API's own\n choice of wire status, so the body's `error.http_status` reports `503`, mirroring\n what was served (#3373). A fetch that ran and failed for a target-side reason\n answers `422` instead (#4669).\n- `status`\n- `error`"
75
+ "body": "# Fetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/fetch`\n\n## Request Body\n\n- `url` (required)\n- `country`\n- `timeout_ms`\n- `cache_ttl`\n- `custom`\n\n## Responses\n\n### 200 — Content from upstream.\n\n### 400 — Invalid URL (`invalid_url`) or oversized request body.\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error (e.g. malformed JSON, unsupported fetch format, or slow-path-only\nfield), or a fetch that failed for a target-side reason.\n\nTwo distinct conditions answer `422`. Read `error.code` to tell them apart.\n\n- **`validation_error`** — the request itself was rejected.\n- **`blocked`** or **`upstream_error`** — the fetch ran and the target could not\n be read. `blocked` means the target's bot protection refused every attempt;\n `upstream_error` (message `Failed to fetch URL.`) is any other exhausted-retries\n failure, such as a host that does not resolve. This is a result about the URL,\n not an outage of this API, so it is a `4xx` rather than `502` or `503`. No\n upstream HTTP status was received, so `error.http_status` reports `422`,\n mirroring what was served — unlike the relayed `upstream_error` under `502`\n below, whose status is the target's own. The request transfers no billable\n bytes and is charged nothing (#4669).\n- `status`\n- `error`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n\n### 503 — Two distinct conditions answer `503`, and they disagree about what the body's\n`error.http_status` reports. Read `error.code` to tell them apart.\n\n- **`upstream_error`** — the target returned HTTP `502` or `504`, relayed here as\n `503`. Cloudflare fronts this API and replaces a clean origin 502 or 504 with its\n own generic `text/plain` error page, discarding the envelope before it reaches\n you, while a 503 is passed through unchanged. The body's `error.http_status`\n still reports the **true upstream status**, `502` or `504` — not `503` — and is\n the only surviving record of what the target answered, so the body rather than\n the HTTP status is authoritative here (#3355, #4891). Every other non-2xx\n upstream response is relayed at its own HTTP status with the same\n `upstream_error` envelope, so any other 4xx/5xx the target returns surfaces as an\n Error envelope rather than a raw body (#1462).\n- **`internal_error`** (message `Fetch service unavailable.`) — no fetch service\n endpoint could be resolved on this deployment, a fault of this API and not of the\n target. There is no upstream status to preserve: the `503` is this API's own\n choice of wire status, so the body's `error.http_status` reports `503`, mirroring\n what was served (#3373). A fetch that ran and failed for a target-side reason\n answers `422` instead (#4669).\n- `status`\n- `error`"
76
76
  },
77
77
  "api/health": {
78
78
  "title": "Health",
@@ -137,7 +137,7 @@
137
137
  "api/schema/createschemaextraction": {
138
138
  "title": "Schema-driven structured extraction",
139
139
  "section": "API Reference",
140
- "body": "# Schema-driven structured extraction\n\nFetches `url` and extracts structured JSON conforming to the supplied\nJSON Schema (draft 2020-12) using an LLM. Fast-path only — slow-path\nrendering options (`wait_until=networkidle`, `delay_ms`,\n`wait_for_selector`) cause a `400 unsupported_option`.\n\nDual-axis billing: a fixed per-request credit charge **plus** the\nunderlying page's bandwidth, billed at its upstream wire bytes with no\nendpoint factor (a 100 KiB estimate is pre-charged, then reconciled). The\nbandwidth is still billed when the scrape succeeds but extraction later\nfails; both axes are refunded only when the scrape itself never runs.\n\nAvailability is gated by a server-side feature flag; when disabled the\nendpoint returns `404`.\n\n**POST** `/v1/schema`\n\n## Request Body\n\n- `url` (required)\n- `schema` (required)\n- `prompt`\n- `model`\n- `wait_for_selector`\n- `wait_until`\n- `delay_ms`\n- `country`\n- `language`\n\n## Responses\n\n### 200 — Extraction completed (success or graceful extract failure).\n- `data`\n- `model`\n- `validated`\n- `metrics`\n- `scrape`\n- `warnings`\n\n### 400 — Invalid URL (`invalid_url`), unsupported model (`unsupported_model`), or unsupported slow-path option (`unsupported_option`).\n- `status`\n- `error`\n\n### 401 — Missing or invalid bearer key.\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter is\n exhausted. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth; `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 404 — Endpoint not available (feature flag disabled).\n- `status`\n- `error`\n\n### 422 — Validation error (`validation_error`) or non-normalizable schema (`schema_incompatible`).\n- `status`\n- `error`\n\n### 429 — Per-account rate limit (`rate_limited`) or upstream provider rate limit (`provider_rate_limited`); a `Retry-After` header may be present.\n- `status`\n- `error`\n\n### 503 — Read `error.code` to tell the conditions apart: underlying scrape failed or the\nextraction service was unreachable (`scrape_failed`), upstream provider error\n(`provider_error`), extraction provider unconfigured (`provider_unavailable`), or\nupstream provider timed out (`provider_timeout`). None of these answers `502` or\n`504`: Cloudflare fronts this API and replaces an origin 502 or 504 with its own\n`text/plain` page, discarding the error envelope, while a 503 passes through\nunchanged (#4891).\n- `status`\n- `error`"
140
+ "body": "# Schema-driven structured extraction\n\nFetches `url` and extracts structured JSON conforming to the supplied\nJSON Schema (draft 2020-12) using an LLM. Fast-path only — slow-path\nrendering options (`wait_until=networkidle`, `delay_ms`,\n`wait_for_selector`) cause a `400 unsupported_option`.\n\nDual-axis billing: a fixed per-request credit charge **plus** the\nunderlying page's bandwidth, billed at its upstream wire bytes with no\nendpoint factor (a 100 KiB estimate is pre-charged, then reconciled). The\nbandwidth is still billed when the scrape succeeds but extraction later\nfails; both axes are refunded only when the scrape itself never runs.\n\nAvailability is gated by a server-side feature flag; when disabled the\nendpoint returns `404`.\n\n**POST** `/v1/schema`\n\n## Request Body\n\n- `url` (required)\n- `schema` (required)\n- `prompt`\n- `model`\n- `wait_for_selector`\n- `wait_until`\n- `delay_ms`\n- `country`\n- `language`\n\n## Responses\n\n### 200 — Extraction completed (success or graceful extract failure).\n- `data`\n- `model`\n- `validated`\n- `metrics`\n- `scrape`\n- `warnings`\n\n### 400 — Invalid URL (`invalid_url`), unsupported model (`unsupported_model`), or unsupported slow-path option (`unsupported_option`).\n- `status`\n- `error`\n\n### 401 — Missing or invalid bearer key.\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 404 — Endpoint not available (feature flag disabled).\n- `status`\n- `error`\n\n### 422 — Validation error (`validation_error`) or non-normalizable schema (`schema_incompatible`).\n- `status`\n- `error`\n\n### 429 — Per-account rate limit (`rate_limited`) or upstream provider rate limit (`provider_rate_limited`); a `Retry-After` header may be present.\n- `status`\n- `error`\n\n### 503 — Read `error.code` to tell the conditions apart: underlying scrape failed or the\nextraction service was unreachable (`scrape_failed`), upstream provider error\n(`provider_error`), extraction provider unconfigured (`provider_unavailable`), or\nupstream provider timed out (`provider_timeout`). None of these answers `502` or\n`504`: Cloudflare fronts this API and replaces an origin 502 or 504 with its own\n`text/plain` page, discarding the error envelope, while a 503 passes through\nunchanged (#4891).\n- `status`\n- `error`"
141
141
  },
142
142
  "api/scrape": {
143
143
  "title": "Scrape",
@@ -152,7 +152,7 @@
152
152
  "api/scrape-bulk/createscrapebulk": {
153
153
  "title": "Bulk scrape URLs",
154
154
  "section": "API Reference",
155
- "body": "# Bulk scrape URLs\n\nEnqueues multiple URLs for scraping. Results delivered via webhook.\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/scrape/bulk/{id}` whenever\n`recovery_required` is true.\n\n**POST** `/v1/scrape/bulk`\n\n## Request Body\n\n- `urls`\n- `items`\n- `defaults`\n- `webhook_url` (required)\n- `webhook_secret`\n- `metadata`\n- `custom`\n\n## Responses\n\n### 202 — Bulk scrape job accepted.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `estimated_credits`\n- `webhook_url`\n\n### 400 — Bad request. When a `url` (or item URL) fails strict validation the\nerror code is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter is\n exhausted. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth; `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error. `bulk_too_large` is returned when the item count\nexceeds the account plan's `max_bulk_size` cap (also surfaced as\n`max_bulk_size` on `GET /v1/account`).\n- `status`\n- `error`"
155
+ "body": "# Bulk scrape URLs\n\nEnqueues multiple URLs for scraping. Results delivered via webhook.\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/scrape/bulk/{id}` whenever\n`recovery_required` is true.\n\n**POST** `/v1/scrape/bulk`\n\n## Request Body\n\n- `urls`\n- `items`\n- `defaults`\n- `webhook_url` (required)\n- `webhook_secret`\n- `metadata`\n- `custom`\n\n## Responses\n\n### 202 — Bulk scrape job accepted.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `estimated_credits`\n- `webhook_url`\n\n### 400 — Bad request. When a `url` (or item URL) fails strict validation the\nerror code is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error. `bulk_too_large` is returned when the item count\nexceeds the account plan's `max_bulk_size` cap (also surfaced as\n`max_bulk_size` on `GET /v1/account`).\n- `status`\n- `error`"
156
156
  },
157
157
  "api/scrape-bulk/getscrapebulk": {
158
158
  "title": "Get scrape bulk job status",
@@ -162,7 +162,7 @@
162
162
  "api/scrape/createscrape": {
163
163
  "title": "Scrape a URL",
164
164
  "section": "API Reference",
165
- "body": "# Scrape a URL\n\nFetches and processes a URL, returning content in one or more formats wrapped in a ScrapeEnvelope.\n\n**The response shape is decided by your request, not by how we route it.** In precedence order:\n\n1. `async: true` → **202** with a `ScrapeQueuedEnvelope` receipt, returned immediately. Poll `GET /v1/scrape/{id}` for the result.\n2. Otherwise, a request that needs a full page render — today that is `delay_ms > 0` — is **held open** until the render reaches a terminal state, then returns **200** with the content envelope (`success` or `failed`). If the render is still running when the hold window expires (28 seconds by default), the request returns the **202** receipt instead and the job continues in the background.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content envelope, typically in under a second.\n\n**A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all come back on the same **200** as a `failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A failure the fast path decides inline is recorded as a failed job, so its envelope normally carries that job's `id` and `GET /v1/scrape/{id}` returns the same envelope; if recording the failed job itself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is nothing to poll. A failure a held render reaches carries that render's real `id`. Either way the request transfers no billable bytes and is charged nothing.\n\nSo a 202 means one of exactly two things: you asked for one with `async: true`, or the hold window expired. `wait_for_selector` and `wait_until` are `ScreenshotRequest` options, not `ScrapeRequest` options — sending either to this endpoint returns `422 validation_error`, so neither can produce a 202 here.\n\n**POST** `/v1/scrape`\n\n## Request Body\n\n- `url` (required)\n- `formats`\n- `country`\n- `delay_ms`\n- `timeout_ms`\n- `async`\n- `webhook_url`\n- `events`\n- `markdown_mode`\n- `markdown_query`\n- `markdown_links`\n- `markdown_images`\n- `with_links_summary`\n- `with_images_summary`\n- `markdown_compact`\n- `markdown_filter_images`\n- `markdown_include_media`\n- `markdown_include_warnings`\n- `markdown_include_stats`\n- `token_budget`\n- `token_encoding`\n- `mobile`\n- `solve_challenge`\n- `remove_base64_images`\n- `include_tags`\n- `exclude_tags`\n- `cache_ttl`\n- `custom`\n- `clean_markdown`\n- `x_internal_scrape_path`\n\n## Responses\n\n### 200 — Scrape reached a terminal state and the body is that terminal envelope: `success` carrying content, or `failed` carrying the error envelope. Returned by the fast HTTP path in one round trip, and by a browser-path request without `async: true` once its render reaches a terminal state inside the hold window. A held render that ends in failure answers 200 with the same `failed` envelope `GET /v1/scrape/{id}` returns — narrow on `status` before reading the body. A definitive upstream outcome is a result, not a transport error: an unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all answer 200 with the `failed` envelope, never a 5xx. An inline failure is recorded as a failed job, so its envelope normally carries that job's `id` and polling it returns the same envelope; `id` is `null` only when recording the failed job itself failed. `error.http_status` is present only when a real upstream HTTP status is known.\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `final_url`\n- `content_type`\n- `content_length`\n- `status_code`\n- `retrieved_at`\n- `formats`\n- `metadata`\n- `tables`\n- `warnings`\n- `stats`\n- `markdown_tokens`\n- `billing`\n- `custom`\n- `cache`\n- `cache_age_s`\n- `error`\n\n### 202 — Scrape accepted for background processing; the body is a receipt, not content. Returned when `async: true` was requested, or when a browser-path request's hold window expired before the render finished. Poll `GET /v1/scrape/{id}` for the result.\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `status_url`\n- `queued_at`\n- `events`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter is\n exhausted. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth; `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error.\n- `status`\n- `error`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n\n### 500 — Internal server error.\n- `status`\n- `error`"
165
+ "body": "# Scrape a URL\n\nFetches and processes a URL, returning content in one or more formats wrapped in a ScrapeEnvelope.\n\n**The response shape is decided by your request, not by how we route it.** In precedence order:\n\n1. `async: true` → **202** with a `ScrapeQueuedEnvelope` receipt, returned immediately. Poll `GET /v1/scrape/{id}` for the result.\n2. Otherwise, a request that needs a full page render — today that is `delay_ms > 0` — is **held open** until the render reaches a terminal state, then returns **200** with the content envelope (`success` or `failed`). If the render is still running when the hold window expires (28 seconds by default), the request returns the **202** receipt instead and the job continues in the background.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content envelope, typically in under a second.\n\n**A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all come back on the same **200** as a `failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A failure the fast path decides inline is recorded as a failed job, so its envelope normally carries that job's `id` and `GET /v1/scrape/{id}` returns the same envelope; if recording the failed job itself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is nothing to poll. A failure a held render reaches carries that render's real `id`. Either way the request transfers no billable bytes and is charged nothing.\n\nSo a 202 means one of exactly two things: you asked for one with `async: true`, or the hold window expired. `wait_for_selector` and `wait_until` are `ScreenshotRequest` options, not `ScrapeRequest` options — sending either to this endpoint returns `422 validation_error`, so neither can produce a 202 here.\n\n**POST** `/v1/scrape`\n\n## Request Body\n\n- `url` (required)\n- `formats`\n- `country`\n- `delay_ms`\n- `timeout_ms`\n- `async`\n- `webhook_url`\n- `events`\n- `markdown_mode`\n- `markdown_query`\n- `markdown_links`\n- `markdown_images`\n- `with_links_summary`\n- `with_images_summary`\n- `markdown_compact`\n- `markdown_filter_images`\n- `markdown_include_media`\n- `markdown_include_warnings`\n- `markdown_include_stats`\n- `token_budget`\n- `token_encoding`\n- `mobile`\n- `solve_challenge`\n- `remove_base64_images`\n- `include_tags`\n- `exclude_tags`\n- `cache_ttl`\n- `custom`\n- `clean_markdown`\n- `x_internal_scrape_path`\n\n## Responses\n\n### 200 — Scrape reached a terminal state and the body is that terminal envelope: `success` carrying content, or `failed` carrying the error envelope. Returned by the fast HTTP path in one round trip, and by a browser-path request without `async: true` once its render reaches a terminal state inside the hold window. A held render that ends in failure answers 200 with the same `failed` envelope `GET /v1/scrape/{id}` returns — narrow on `status` before reading the body. A definitive upstream outcome is a result, not a transport error: an unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all answer 200 with the `failed` envelope, never a 5xx. An inline failure is recorded as a failed job, so its envelope normally carries that job's `id` and polling it returns the same envelope; `id` is `null` only when recording the failed job itself failed. `error.http_status` is present only when a real upstream HTTP status is known.\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `final_url`\n- `content_type`\n- `content_length`\n- `status_code`\n- `retrieved_at`\n- `formats`\n- `metadata`\n- `tables`\n- `warnings`\n- `stats`\n- `markdown_tokens`\n- `billing`\n- `custom`\n- `cache`\n- `cache_age_s`\n- `error`\n\n### 202 — Scrape accepted for background processing; the body is a receipt, not content. Returned when `async: true` was requested, or when a browser-path request's hold window expired before the render finished. Poll `GET /v1/scrape/{id}` for the result.\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `status_url`\n- `queued_at`\n- `events`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error.\n- `status`\n- `error`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n\n### 500 — Internal server error.\n- `status`\n- `error`"
166
166
  },
167
167
  "api/scrape/getscrape": {
168
168
  "title": "Get scrape result",
@@ -177,7 +177,7 @@
177
177
  "api/screenshots/createscreenshot": {
178
178
  "title": "Capture a screenshot",
179
179
  "section": "API Reference",
180
- "body": "# Capture a screenshot\n\nSync by default (holds up to 28s). Pass `?async=true` to return 202 immediately.\nPoll via GET /v1/screenshots/{id}.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/screenshots`\n\n## Parameters\n\n- `async` (query, boolean)\n\n## Request Body\n\n- `url` (required)\n- `device`\n- `viewport`\n- `full_page`\n- `format`\n- `quality`\n- `block_ads`\n- `block_cookie_banners`\n- `wait_until`\n- `wait_for_selector`\n- `delay_ms`\n- `scroll`\n- `clip`\n- `dark_mode`\n- `device_scale_factor`\n- `include_html`\n- `country`\n- `language`\n- `metadata`\n\n## Responses\n\n### 200 — Screenshot completed (sync mode).\n- `id`\n- `status`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 202 — Screenshot accepted (async mode or sync timeout).\n- `id`\n- `status`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter is\n exhausted. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth; `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error, or a screenshot that failed inside the sync hold.\nThe two carry DIFFERENT bodies (issue #2679):\n\n- A request-validation failure returns the unified `Error` envelope\n with code `validation_error`.\n- A capture that reached a terminal `failed` state inside the sync\n hold returns the full `ScreenshotResponse` resource, whose\n `error_code`/`error_message` carry the real failure (`blocked`,\n `timeout`, …). This is the canonical shape for that case: the\n resource body is what carries the `ss_` handle, `poll_url` and\n `expires_at` a client needs to redeem the failed capture, none of\n which fit the `Error` envelope.\n\nDiscriminate on the shape of the top-level `error` key. The envelope\nform carries `error` as an OBJECT (`{ code, message, http_status,\nfailed_at }`); the resource form has no `error` key at all, and\ncarries the flat `error_code`/`error_message` pair plus `id` instead.\n\nDo NOT discriminate on `status`. Both forms carry\n`\"status\": \"failed\"` on this response — `Error.status` is a required\nproperty with `enum: [failed]` — so it separates nothing here.\n\n`X-Screenshot-ID` accompanies the resource form only: a\nrequest-validation failure is raised before a screenshot row exists,\nso no screenshot headers travel with it.\n- `status`\n- `error`\n- `id`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`"
180
+ "body": "# Capture a screenshot\n\nSync by default (holds up to 28s). Pass `?async=true` to return 202 immediately.\nPoll via GET /v1/screenshots/{id}.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/screenshots`\n\n## Parameters\n\n- `async` (query, boolean)\n\n## Request Body\n\n- `url` (required)\n- `device`\n- `viewport`\n- `full_page`\n- `format`\n- `quality`\n- `block_ads`\n- `block_cookie_banners`\n- `wait_until`\n- `wait_for_selector`\n- `delay_ms`\n- `scroll`\n- `clip`\n- `dark_mode`\n- `device_scale_factor`\n- `include_html`\n- `country`\n- `language`\n- `metadata`\n\n## Responses\n\n### 200 — Screenshot completed (sync mode).\n- `id`\n- `status`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 202 — Screenshot accepted (async mode or sync timeout).\n- `id`\n- `status`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error, or a screenshot that failed inside the sync hold.\nThe two carry DIFFERENT bodies (issue #2679):\n\n- A request-validation failure returns the unified `Error` envelope\n with code `validation_error`.\n- A capture that reached a terminal `failed` state inside the sync\n hold returns the full `ScreenshotResponse` resource, whose\n `error_code`/`error_message` carry the real failure (`blocked`,\n `timeout`, …). This is the canonical shape for that case: the\n resource body is what carries the `ss_` handle, `poll_url` and\n `expires_at` a client needs to redeem the failed capture, none of\n which fit the `Error` envelope.\n\nDiscriminate on the shape of the top-level `error` key. The envelope\nform carries `error` as an OBJECT (`{ code, message, http_status,\nfailed_at }`); the resource form has no `error` key at all, and\ncarries the flat `error_code`/`error_message` pair plus `id` instead.\n\nDo NOT discriminate on `status`. Both forms carry\n`\"status\": \"failed\"` on this response — `Error.status` is a required\nproperty with `enum: [failed]` — so it separates nothing here.\n\n`X-Screenshot-ID` accompanies the resource form only: a\nrequest-validation failure is raised before a screenshot row exists,\nso no screenshot headers travel with it.\n- `status`\n- `error`\n- `id`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`"
181
181
  },
182
182
  "api/screenshots/getscreenshot": {
183
183
  "title": "Get screenshot status",
@@ -192,7 +192,7 @@
192
192
  "api/search/createsearch": {
193
193
  "title": "Search the web",
194
194
  "section": "API Reference",
195
- "body": "# Search the web\n\nRuns a web search for `query` and returns ranked organic results with\ncontiguous `position` values from 1.\n\nUse `limit` (1–100, default 10) to request more results in a single\ncall. Results are fetched in pages of 10, so a call consumes\n`ceil(limit / 10)` credits (capped at 10) from the account's monthly\ncredits bucket — for example `limit=10` costs 1 credit and `limit=35`\ncosts 4. Credits are charged for every page fetched regardless of how\nmany results a page returns. The credit count is reported as\n`credits_used` in the response.\n\n**POST** `/v1/search`\n\n## Request Body\n\n- `query` (required)\n- `type`\n- `limit`\n- `country`\n- `language`\n- `date_range`\n\n## Responses\n\n### 200 — Search completed.\n- `id`\n- `query`\n- `results`\n- `related_searches`\n- `credits_used`\n\n### 400 — Bad request (e.g. missing or empty `query`).\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter is\n exhausted. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth; `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 429 — Rate limit exceeded (`rate_limited`). Carries the `X-RateLimit-Limit`/`X-RateLimit-Remaining`/`X-RateLimit-Reset` triplet and a `Retry-After` header. The window is per-second for a bearer API key, or the 60-request/60-second Clerk session window when authenticated via `resolveDualAuth` — `Retry-After` reflects whichever window applies to the request.\n- `status`\n- `error`\n\n### 500 — Internal error (code `internal_error`) — the search request could not\nbe recorded before the provider call. The pre-incremented credits are\nrefunded and no provider call is made.\n- `status`\n- `error`\n\n### 503 — Upstream search provider error, answered at `503` rather than `502` because\nCloudflare replaces an origin 502 body with its own page (#4891). The body is a fixed,\nvendor-masked shape — deliberately NOT the unified `Error`\nenvelope. The upstream provider's identity and message are\nnever surfaced, so the response carries only the constant\n`error` code `search_provider_error`.\n- `error`"
195
+ "body": "# Search the web\n\nRuns a web search for `query` and returns ranked organic results with\ncontiguous `position` values from 1.\n\nUse `limit` (1–100, default 10) to request more results in a single\ncall. Results are fetched in pages of 10, so a call consumes\n`ceil(limit / 10)` credits (capped at 10) from the account's monthly\ncredits bucket — for example `limit=10` costs 1 credit and `limit=35`\ncosts 4. Credits are charged for every page fetched regardless of how\nmany results a page returns. The credit count is reported as\n`credits_used` in the response.\n\n**POST** `/v1/search`\n\n## Request Body\n\n- `query` (required)\n- `type`\n- `limit`\n- `country`\n- `language`\n- `date_range`\n\n## Responses\n\n### 200 — Search completed.\n- `id`\n- `query`\n- `results`\n- `related_searches`\n- `credits_used`\n\n### 400 — Bad request (e.g. missing or empty `query`).\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 429 — Rate limit exceeded (`rate_limited`). Carries the `X-RateLimit-Limit`/`X-RateLimit-Remaining`/`X-RateLimit-Reset` triplet and a `Retry-After` header. The window is per-second for a bearer API key, or the 60-request/60-second Clerk session window when authenticated via `resolveDualAuth` — `Retry-After` reflects whichever window applies to the request.\n- `status`\n- `error`\n\n### 500 — Internal error (code `internal_error`) — the search request could not\nbe recorded before the provider call. The pre-incremented credits are\nrefunded and no provider call is made.\n- `status`\n- `error`\n\n### 503 — Upstream search provider error, answered at `503` rather than `502` because\nCloudflare replaces an origin 502 body with its own page (#4891). The body is a fixed,\nvendor-masked shape — deliberately NOT the unified `Error`\nenvelope. The upstream provider's identity and message are\nnever surfaced, so the response carries only the constant\n`error` code `search_provider_error`.\n- `error`"
196
196
  },
197
197
  "api/sitemap": {
198
198
  "title": "Sitemap",
@@ -202,7 +202,7 @@
202
202
  "api/sitemap/createsitemap": {
203
203
  "title": "Discover URLs on a domain",
204
204
  "section": "API Reference",
205
- "body": "# Discover URLs on a domain\n\nCrawls a domain to build a sitemap. Returns cached results if available\nwithin cache_ttl. Results delivered via webhook and downloadable from results_url.\nWebhook deliveries include `X-ByteKit-Event: sitemap.completed` or\n`X-ByteKit-Event: sitemap.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/sitemap`\n\n## Request Body\n\n- `url` (required)\n- `strategy`\n- `max_depth`\n- `max_urls`\n- `process`\n- `webhook_url`\n- `webhook_secret`\n- `cache_ttl`\n- `compact`\n- `metadata`\n\n## Responses\n\n### 202 — Sitemap job accepted (or cached result returned).\n- `id`\n- `url`\n- `strategy`\n- `max_depth`\n- `max_urls`\n- `status`\n- `total_urls`\n- `sources`\n- `total_bytes`\n- `results_url`\n- `cache`\n- `cache_age_s`\n- `billing`\n- `warnings`\n- `error_code`\n- `error_message`\n- `compact`\n- `process`\n- `metadata`\n- `created_at`\n- `completed_at`\n- `expires_at`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter is\n exhausted. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth; `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error.\n- `status`\n- `error`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`"
205
+ "body": "# Discover URLs on a domain\n\nCrawls a domain to build a sitemap. Returns cached results if available\nwithin cache_ttl. Results delivered via webhook and downloadable from results_url.\nWebhook deliveries include `X-ByteKit-Event: sitemap.completed` or\n`X-ByteKit-Event: sitemap.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/sitemap`\n\n## Request Body\n\n- `url` (required)\n- `strategy`\n- `max_depth`\n- `max_urls`\n- `process`\n- `webhook_url`\n- `webhook_secret`\n- `cache_ttl`\n- `compact`\n- `metadata`\n\n## Responses\n\n### 202 — Sitemap job accepted (or cached result returned).\n- `id`\n- `url`\n- `strategy`\n- `max_depth`\n- `max_urls`\n- `status`\n- `total_urls`\n- `sources`\n- `total_bytes`\n- `results_url`\n- `cache`\n- `cache_age_s`\n- `billing`\n- `warnings`\n- `error_code`\n- `error_message`\n- `compact`\n- `process`\n- `metadata`\n- `created_at`\n- `completed_at`\n- `expires_at`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error.\n- `status`\n- `error`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`"
206
206
  },
207
207
  "api/sitemap/getsitemap": {
208
208
  "title": "Get sitemap job status",
@@ -272,7 +272,7 @@
272
272
  "billing/top-ups": {
273
273
  "title": "Top-ups and rollover",
274
274
  "section": "General",
275
- "body": "# Top-ups and rollover\n\nHow your USD balance is spent, why it never expires, and how plan allowance rolls over.\n\nTop-ups add dollars to your account's USD balance without changing your plan's included allowance. Value is spent in one order: your plan's included allowance, including any rollover from earlier periods, then the USD balance, then the one-time starter grant.\n\n## The USD balance\n\nYour USD balance never expires. It is not tied to the plan you were on when you added it: a cancellation or plan change does not freeze it, hold it, or reset its value. Usage beyond your included allowance draws from the balance at your current plan's top-up rate for the resource it uses — bandwidth or search credits — so the same dollars buy more on a plan with a lower rate. The bandwidth and credit amounts shown beside your balance are estimates at those current rates; the dollar figure is what you hold.\n\n## Billing-period rollover\n\nUnused bandwidth from your monthly plan allowance rolls over to the next billing period with no cap, for as long as the subscription stays on its plan or moves to a higher one. A downgrade or cancellation freezes it: the frozen balance stops being spendable, and resubscribing at the same tier or higher within 90 days restores it in full — after that it is permanently lost. The USD balance is separate from the billing period, so it is not reset when that period rolls over.\n\nCredits do not roll over — they reset every billing period. This does not affect your USD balance, which never expires.\n\nYour USD balance and rollover balances appear under **Dashboard → Settings → Billing**."
275
+ "body": "# Top-ups and rollover\n\nHow your USD balance is spent, why it never expires, and how plan allowance rolls over.\n\nTop-ups add dollars to your account's USD balance without changing your plan's included allowance. Value is spent in one order: your plan's included allowance, including any rollover from earlier periods, then the USD balance, then the one-time starter grant.\n\n## The USD balance\n\nYour USD balance never expires. It is not tied to the plan you were on when you added it: a cancellation or plan change does not freeze it, hold it, or reset its value. Usage beyond your included allowance draws from the balance at your current plan's top-up rate for the resource it uses — bandwidth or search credits — so the same dollars buy more on a plan with a lower rate. The bandwidth and credit amounts shown beside your balance are estimates at those current rates; the dollar figure is what you hold.\n\n## Bandwidth you owe\n\nA request is billed on the bandwidth it actually used, which can turn out larger than the amount set aside when it started. When that overage is more than your allowance, USD balance and starter grant can cover, the uncovered bandwidth is recorded as bandwidth you owe. It is not waived, and it does not make your USD balance negative. The amount you owe appears under **Dashboard → Settings → Billing**.\n\nYour next top-up, billing-period renewal or plan upgrade pays it off before anything else, oldest first, and only what is left over becomes spendable. A top-up first brings a USD balance that a refund or dispute took below zero back up to zero, then converts only as many of the remaining dollars as it needs to bandwidth at your current plan's top-up rate, and the rest stays in your USD balance. On a plan whose top-up rate is zero, only a renewal or plan upgrade can pay it off.\n\nWhile you owe anything, whether bandwidth or a USD balance below zero, new billable requests are refused with `402 quota_exceeded`, even if you still have allowance left. Requests already in progress finish and are billed as usual.\n\n## Billing-period rollover\n\nUnused bandwidth from your monthly plan allowance rolls over to the next billing period with no cap, for as long as the subscription stays on its plan or moves to a higher one. A downgrade or cancellation freezes it: the frozen balance stops being spendable, and resubscribing at the same tier or higher within 90 days restores it in full — after that it is permanently lost. The USD balance is separate from the billing period, so it is not reset when that period rolls over.\n\nCredits do not roll over — they reset every billing period. This does not affect your USD balance, which never expires.\n\nYour USD balance and rollover balances appear under **Dashboard → Settings → Billing**."
276
276
  },
277
277
  "cli": {
278
278
  "title": "Install & Authenticate",
@@ -342,7 +342,7 @@
342
342
  "guides/errors": {
343
343
  "title": "Errors",
344
344
  "section": "Guides",
345
- "body": "# Errors\n\nByteKit error response shape, common error codes, and retry guidance.\n\nAll errors from the ByteKit API follow a consistent envelope shape so you can handle them\nprogrammatically.\n\n## Error response shape\n\nEvery `4xx`/`5xx` response across the API uses one unified envelope. `status` is\nalways the literal string `\"failed\"`, so you can branch on the response body alone.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"rate_limited\",\n \"message\": \"Rate limit exceeded. Allowed 5 requests per second.\",\n \"http_status\": 429,\n \"failed_at\": \"2026-08-27T12:17:46.234Z\"\n }\n}\n```\n\nThe number in a `rate_limited` message is your own plan's per-second limit — the same value the `X-RateLimit-Limit` response header carries.\n\n| Field | Description |\n|-------|-------------|\n| `status` | Always `\"failed\"` on an error response — the top-level discriminator |\n| `error.code` | Machine-readable string identifier |\n| `error.message` | Human-readable explanation |\n| `error.http_status` | Mirrors the HTTP response status (useful for logged or replayed bodies) |\n| `error.failed_at` | ISO-8601 UTC timestamp of when the error was produced |\n| `error.details` | Optional object with additional context (e.g. which field failed validation). Absent — not `{}` — when the error carries no context |\n\n## Common error codes\n\n| HTTP status | Code | Meaning |\n|-------------|------|---------|\n| `400` | `invalid_url` | A supplied URL (including `webhook_url`) is malformed or uses an unsupported scheme |\n| `400` | `validation_error` | Field errors on `/v1/search`, `POST /v1/billing/checkout` and `PUT`/`DELETE /v1/billing/payment-methods/{id}`, plus rejections that run before schema validation on any endpoint: a removed field such as `cookies` or `headers` on a capture endpoint, or a `/v1/fetch` or `/v1/fetch/bulk` request asking for an option only `/v1/scrape` or `/v1/bulk` serves |\n| `401` | `unauthorized` | Missing or malformed `Authorization` header |\n| `401` | `invalid_api_key` | API key is present but not valid |\n| `402` | `quota_exceeded` | Account has exceeded its plan quota |\n| `402` | `spending_cap_reached` | A credit-metered request would push overage spend past the account's cap. Only reachable on a custom plan with an overage agreement — standard plans have no automatic overage and stop at `quota_exceeded` |\n| `402` | `billing_entitlement_impaired` | The paid subscription is in a payment impairment (e.g. `past_due`); `error.message` names the reason |\n| `402` | `billing_entitlement_expired` | The paid subscription's entitlement period has ended, or its dunning grace period has run out |\n| `403` | `forbidden` | Key is valid but lacks permission for this action |\n| `422` | `validation_error` | Malformed JSON, or a request field failed validation, everywhere the `400` row above does not name |\n| `422` | `blocked`, `upstream_error` | `/v1/fetch` only: the fetch ran and the target could not be read (bot protection refused every attempt, or another exhausted-retries failure such as an unresolvable host). This is a result about the URL, not an outage of this API, and it is charged nothing. `upstream_error` can also come from a relay fault on our side, so the code alone does not prove the target is at fault. The `X-Fetch-ID` response header, when present, names the failed request's row in Logs |\n| `429` | `rate_limited` | Too many requests per second; back off and retry |\n| `429` | `concurrency_limit` | Too many simultaneous in-flight requests; back off and retry |\n| `500` | `internal_error` | The upstream fetch or browser render failed |\n\n## Webhook URLs Must Use HTTPS\n\nAll webhook URLs submitted to the ByteKit API must use HTTPS. Plain HTTP URLs (e.g. `http://example.com/webhook`) are rejected with a `400` `invalid_url` error.\n\n**Why HTTPS only?** Webhook payloads may contain sensitive data (API keys, session tokens, scrape results). HTTPS encryption protects this data in transit.\n\n**Request with an invalid webhook URL:**\n\n```json\n{\n \"webhook_url\": \"http://example.com/webhook\"\n}\n```\n\n**Response (HTTP 400)** — the same unified envelope as every other error; `error.details` names the offending field and reason:\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"invalid_url\",\n \"message\": \"url is not a valid HTTP(S) URL: scheme_unsupported\",\n \"http_status\": 400,\n \"failed_at\": \"2026-08-27T12:16:29.033Z\",\n \"details\": {\n \"url\": \"http://example.com/webhook\",\n \"field\": \"webhook_url\",\n \"reason\": \"scheme_unsupported\"\n }\n }\n}\n```\n\n**Working example:**\n\n```json\n{\n \"webhook_url\": \"https://example.com/webhook\"\n}\n```\n\nThis applies to all endpoints that accept a `webhook_url` parameter: `/v1/scrape` (async), `/v1/scrape/bulk`, `/v1/fetch/bulk`, `/v1/bulk`, `/v1/monitors`, and `/v1/sitemap`.\n\n## Retry guidance\n\nNot all errors are retryable. Use this table to decide:\n\n| Code | Retry? | Guidance |\n|------|--------|---------|\n| `invalid_url` | No | Fix the URL before retrying |\n| `validation_error` | No | Fix the request body before retrying |\n| `unauthorized` / `invalid_api_key` | No | Check your API key |\n| `quota_exceeded` | No | Upgrade your plan or wait for quota reset |\n| `spending_cap_reached` | No | The overage cap is account-level and has no self-service control — [contact support](https://bytekit.com/docs/billing/spending) to raise it, or upgrade the plan |\n| `billing_entitlement_impaired` | No | Settle the outstanding invoice — retrying cannot succeed while the subscription is impaired |\n| `billing_entitlement_expired` | No | Restore or renew the subscription; the entitlement period has ended |\n| `forbidden` | No | You do not have access to this resource |\n| `rate_limited` | Yes | Exponential backoff; honour the `Retry-After` header |\n| `concurrency_limit` | Yes | Honour the `Retry-After` header (a short fixed back-off — a slot frees on job completion, not a fixed window) |\n| `internal_error` | Yes | Exponential backoff; most resolve on retry |\n\nFor retriable errors, start with a 1-second delay and double on each subsequent failure, up to\na maximum of 60 seconds. Respect the `Retry-After` header value when it is present on `429`\nresponses.\n\n## Example: handling errors in curl\n\n```bash\nresponse=$(curl -s -w \"\\n%{http_code}\" -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}')\n\nhttp_code=$(echo \"$response\" | tail -1)\n# Body is everything except the trailing status-code line — drop only the last\n# line so multi-line JSON responses survive intact.\nbody=$(echo \"$response\" | sed '$d')\n\nif [ \"$http_code\" -ge 400 ]; then\n echo \"Error $http_code: $body\"\nfi\n```\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, rate limit headers\n- [Scraping](https://bytekit.com/docs/guides/scraping) — when `500 internal_error` occurs and how fallback works\n- [API Reference](https://bytekit.com/docs/api) — per-endpoint error codes"
345
+ "body": "# Errors\n\nByteKit error response shape, common error codes, and retry guidance.\n\nAll errors from the ByteKit API follow a consistent envelope shape so you can handle them\nprogrammatically.\n\n## Error response shape\n\nEvery `4xx`/`5xx` response across the API uses one unified envelope. `status` is\nalways the literal string `\"failed\"`, so you can branch on the response body alone.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"rate_limited\",\n \"message\": \"Rate limit exceeded. Allowed 5 requests per second.\",\n \"http_status\": 429,\n \"failed_at\": \"2026-08-27T12:17:46.234Z\"\n }\n}\n```\n\nThe number in a `rate_limited` message is your own plan's per-second limit — the same value the `X-RateLimit-Limit` response header carries.\n\n| Field | Description |\n|-------|-------------|\n| `status` | Always `\"failed\"` on an error response — the top-level discriminator |\n| `error.code` | Machine-readable string identifier |\n| `error.message` | Human-readable explanation |\n| `error.http_status` | Mirrors the HTTP response status (useful for logged or replayed bodies) |\n| `error.failed_at` | ISO-8601 UTC timestamp of when the error was produced |\n| `error.details` | Optional object with additional context (e.g. which field failed validation). Absent — not `{}` — when the error carries no context |\n\n## Common error codes\n\n| HTTP status | Code | Meaning |\n|-------------|------|---------|\n| `400` | `invalid_url` | A supplied URL (including `webhook_url`) is malformed or uses an unsupported scheme |\n| `400` | `validation_error` | Field errors on `/v1/search`, `POST /v1/billing/checkout` and `PUT`/`DELETE /v1/billing/payment-methods/{id}`, plus rejections that run before schema validation on any endpoint: a removed field such as `cookies` or `headers` on a capture endpoint, or a `/v1/fetch` or `/v1/fetch/bulk` request asking for an option only `/v1/scrape` or `/v1/bulk` serves |\n| `401` | `unauthorized` | Missing or malformed `Authorization` header |\n| `401` | `invalid_api_key` | API key is present but not valid |\n| `402` | `quota_exceeded` | The balance cannot fund this request. Capture endpoints reject when it cannot fund the request's byte reservation, and `error.details.required_bytes` and `error.details.available_bytes` give the bytes the request reserves and the bytes available; `/v1/search` meters credits and rejects when its monthly credits are used up |\n| `402` | `spending_cap_reached` | A credit-metered request would push overage spend past the account's cap. Only reachable on a custom plan with an overage agreement — standard plans have no automatic overage and stop at `quota_exceeded` |\n| `402` | `billing_entitlement_impaired` | The paid subscription is in a payment impairment (e.g. `past_due`); `error.message` names the reason |\n| `402` | `billing_entitlement_expired` | The paid subscription's entitlement period has ended, or its dunning grace period has run out |\n| `403` | `forbidden` | Key is valid but lacks permission for this action |\n| `422` | `validation_error` | Malformed JSON, or a request field failed validation, everywhere the `400` row above does not name |\n| `422` | `blocked`, `upstream_error` | `/v1/fetch` only: the fetch ran and the target could not be read (bot protection refused every attempt, or another exhausted-retries failure such as an unresolvable host). This is a result about the URL, not an outage of this API, and it is charged nothing. `upstream_error` can also come from a relay fault on our side, so the code alone does not prove the target is at fault. The `X-Fetch-ID` response header, when present, names the failed request's row in Logs |\n| `429` | `rate_limited` | Too many requests per second; back off and retry |\n| `429` | `concurrency_limit` | Too many simultaneous in-flight requests; back off and retry |\n| `500` | `internal_error` | The upstream fetch or browser render failed |\n\n## Webhook URLs Must Use HTTPS\n\nAll webhook URLs submitted to the ByteKit API must use HTTPS. Plain HTTP URLs (e.g. `http://example.com/webhook`) are rejected with a `400` `invalid_url` error.\n\n**Why HTTPS only?** Webhook payloads may contain sensitive data (API keys, session tokens, scrape results). HTTPS encryption protects this data in transit.\n\n**Request with an invalid webhook URL:**\n\n```json\n{\n \"webhook_url\": \"http://example.com/webhook\"\n}\n```\n\n**Response (HTTP 400)** — the same unified envelope as every other error; `error.details` names the offending field and reason:\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"invalid_url\",\n \"message\": \"url is not a valid HTTP(S) URL: scheme_unsupported\",\n \"http_status\": 400,\n \"failed_at\": \"2026-08-27T12:16:29.033Z\",\n \"details\": {\n \"url\": \"http://example.com/webhook\",\n \"field\": \"webhook_url\",\n \"reason\": \"scheme_unsupported\"\n }\n }\n}\n```\n\n**Working example:**\n\n```json\n{\n \"webhook_url\": \"https://example.com/webhook\"\n}\n```\n\nThis applies to all endpoints that accept a `webhook_url` parameter: `/v1/scrape` (async), `/v1/scrape/bulk`, `/v1/fetch/bulk`, `/v1/bulk`, `/v1/monitors`, and `/v1/sitemap`.\n\n## Retry guidance\n\nNot all errors are retryable. Use this table to decide:\n\n| Code | Retry? | Guidance |\n|------|--------|---------|\n| `invalid_url` | No | Fix the URL before retrying |\n| `validation_error` | No | Fix the request body before retrying |\n| `unauthorized` / `invalid_api_key` | No | Check your API key |\n| `quota_exceeded` | No | Retrying the same request cannot succeed while the balance is short. Compare `error.details.required_bytes` with `error.details.available_bytes`: add balance (upgrade your plan or top up), or send a smaller request. On `/v1/search`, upgrade your plan or wait for the credit reset |\n| `spending_cap_reached` | No | The overage cap is account-level and has no self-service control — [contact support](https://bytekit.com/docs/billing/spending) to raise it, or upgrade the plan |\n| `billing_entitlement_impaired` | No | Settle the outstanding invoice — retrying cannot succeed while the subscription is impaired |\n| `billing_entitlement_expired` | No | Restore or renew the subscription; the entitlement period has ended |\n| `forbidden` | No | You do not have access to this resource |\n| `rate_limited` | Yes | Exponential backoff; honour the `Retry-After` header |\n| `concurrency_limit` | Yes | Honour the `Retry-After` header (a short fixed back-off — a slot frees on job completion, not a fixed window) |\n| `internal_error` | Yes | Exponential backoff; most resolve on retry |\n\nFor retriable errors, start with a 1-second delay and double on each subsequent failure, up to\na maximum of 60 seconds. Respect the `Retry-After` header value when it is present on `429`\nresponses.\n\n## Example: handling errors in curl\n\n```bash\nresponse=$(curl -s -w \"\\n%{http_code}\" -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}')\n\nhttp_code=$(echo \"$response\" | tail -1)\n# Body is everything except the trailing status-code line — drop only the last\n# line so multi-line JSON responses survive intact.\nbody=$(echo \"$response\" | sed '$d')\n\nif [ \"$http_code\" -ge 400 ]; then\n echo \"Error $http_code: $body\"\nfi\n```\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, rate limit headers\n- [Scraping](https://bytekit.com/docs/guides/scraping) — when `500 internal_error` occurs and how fallback works\n- [API Reference](https://bytekit.com/docs/api) — per-endpoint error codes"
346
346
  },
347
347
  "guides/monitors": {
348
348
  "title": "Monitors",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunt-labs/bytekit-mcp",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "description": "ByteKit MCP server — exposes ByteKit web-data tools (scrape, screenshot, search, docs) to AI agents over the Model Context Protocol, hosted or as a local stdio server.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -54,7 +54,7 @@
54
54
  "url": "https://bytekit.com/contact"
55
55
  },
56
56
  "dependencies": {
57
- "@modelcontextprotocol/sdk": "^1.12.1",
57
+ "@modelcontextprotocol/sdk": "1.31.0",
58
58
  "zod": "^3.23.6"
59
59
  },
60
60
  "scripts": {