@hunt-labs/bytekit-mcp 0.3.27 → 0.3.29

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,29 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.3.29] - 2026-12-03
14
+
15
+ ### Changed
16
+
17
+ - Refreshed the bundled documentation snapshot after the TypeScript SDK reference dropped
18
+ `client.account.apiKeys` (#6217) and the errors guide stopped naming dashboard billing endpoints.
19
+ This refresh itself changes no tool, schema or transport.
20
+ - Refreshed the bundled documentation snapshot after bulk requests began refusing, per item, hosts
21
+ our proxy provider does not allow (`proxy_refused`, #6227). This refresh itself changes no tool,
22
+ schema or transport.
23
+
24
+ ## [0.3.28] - 2026-12-01
25
+
26
+ ### Changed
27
+
28
+ - Refreshed the bundled documentation snapshot after scrape, fetch, schema, screenshots and sitemap
29
+ gained the `403 proxy_refused` answer (#6180), given when our proxy provider does not allow
30
+ requests to the host. This refresh itself changes no tool, schema or transport.
31
+ - Refreshed the bundled documentation snapshot and the generated scrape contract after
32
+ `/v1/scrape` gained the `422 content_too_large` answer (#6197), given when `markdown` is
33
+ requested and the page is too large to convert. The generated `ScrapeEnvelopeErrorCode` union
34
+ gains `content_too_large`; no tool, schema or transport changes.
35
+
13
36
  ## [0.3.27] - 2026-12-01
14
37
 
15
38
  ### 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- `items.url`\n- `items.type`\n- `items.device`\n- `items.format`\n- `items.quality`\n- `items.full_page`\n- `items.block_ads`\n- `items.block_cookie_banners`\n- `items.scroll`\n- `items.include_html`\n- `items.country`\n- `items.language`\n- `items.dark_mode`\n- `items.formats`\n- `items.formats.type`\n- `items.formats.schema`\n- `items.formats.model`\n- `items.formats.prompt`\n- `items.wait_until`\n- `items.wait_for_selector`\n- `items.delay_ms`\n- `items.viewport`\n- `items.viewport.width`\n- `items.viewport.height`\n- `items.duration`\n- `items.scenario`\n- `items.metadata`\n- `defaults`\n- `defaults.type`\n- `defaults.device`\n- `defaults.format`\n- `defaults.quality`\n- `defaults.full_page`\n- `defaults.block_ads`\n- `defaults.block_cookie_banners`\n- `defaults.scroll`\n- `defaults.include_html`\n- `defaults.country`\n- `defaults.language`\n- `defaults.dark_mode`\n- `defaults.formats`\n- `defaults.formats.type`\n- `defaults.formats.schema`\n- `defaults.formats.model`\n- `defaults.formats.prompt`\n- `defaults.wait_until`\n- `defaults.wait_for_selector`\n- `defaults.delay_ms`\n- `defaults.viewport`\n- `defaults.viewport.width`\n- `defaults.viewport.height`\n- `defaults.device_scale_factor`\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- `total_billed_bytes`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — One or more URLs in the request are on ByteKit's blocklist. The whole request is\nrejected before anything is queued or billed. This body is NOT the unified `Error`\nenvelope: it carries no `status`, `http_status` or `failed_at`. `blocked` lists every\noffending URL with the rule that matched (`domain`, `tld`, `port` or `path`) and the\ncode that rule maps to (`host_forbidden` for the first three, `path_forbidden` for\n`path`).\n- `error`\n- `error.code`\n- `error.message`\n- `blocked`\n- `blocked.url`\n- `blocked.rule_type`\n- `blocked.error_code`\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`. A\n`viewport` outside width 360 to 2544 or height 1 to 1297, under\n`defaults` or on an item, is a 422 `validation_error` too.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
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- `items.url`\n- `items.type`\n- `items.device`\n- `items.format`\n- `items.quality`\n- `items.full_page`\n- `items.block_ads`\n- `items.block_cookie_banners`\n- `items.scroll`\n- `items.include_html`\n- `items.country`\n- `items.language`\n- `items.dark_mode`\n- `items.formats`\n- `items.formats.type`\n- `items.formats.schema`\n- `items.formats.model`\n- `items.formats.prompt`\n- `items.wait_until`\n- `items.wait_for_selector`\n- `items.delay_ms`\n- `items.viewport`\n- `items.viewport.width`\n- `items.viewport.height`\n- `items.duration`\n- `items.scenario`\n- `items.metadata`\n- `defaults`\n- `defaults.type`\n- `defaults.device`\n- `defaults.format`\n- `defaults.quality`\n- `defaults.full_page`\n- `defaults.block_ads`\n- `defaults.block_cookie_banners`\n- `defaults.scroll`\n- `defaults.include_html`\n- `defaults.country`\n- `defaults.language`\n- `defaults.dark_mode`\n- `defaults.formats`\n- `defaults.formats.type`\n- `defaults.formats.schema`\n- `defaults.formats.model`\n- `defaults.formats.prompt`\n- `defaults.wait_until`\n- `defaults.wait_for_selector`\n- `defaults.delay_ms`\n- `defaults.viewport`\n- `defaults.viewport.width`\n- `defaults.viewport.height`\n- `defaults.device_scale_factor`\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- `total_billed_bytes`\n- `estimated_credits`\n- `webhook_url`\n- `rejected`\n- `rejected.index`\n- `rejected.url`\n- `rejected.code`\n- `rejected.message`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — Either of two bodies.\n\nOne or more URLs in the request are on ByteKit's blocklist. The whole request is\nrejected before anything is queued or billed. This body is NOT the unified `Error`\nenvelope: it carries no `status`, `http_status` or `failed_at`. `blocked` lists every\noffending URL with the rule that matched (`domain`, `tld`, `port` or `path`) and the\ncode that rule maps to (`host_forbidden` for the first three, `path_forbidden` for\n`path`).\n\n`proxy_refused`: every item in the batch was refused because our proxy provider does not allow\nrequests to its host. This is the unified `Error` envelope, and `details.rejected` lists\neach item as `{ index, url, code, message }`. Nothing is queued or billed. When only some\nitems are refused the batch is accepted with `202` and those items are listed in\n`rejected`.\n- `error`\n- `error.code`\n- `error.message`\n- `blocked`\n- `blocked.url`\n- `blocked.rule_type`\n- `blocked.error_code`\n- `status`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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`. A\n`viewport` outside width 360 to 2544 or height 1 to 1297, under\n`defaults` or on an item, is a 422 `validation_error` too.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
26
26
  },
27
27
  "api/bulk/deletebulk": {
28
28
  "title": "Cancel a bulk job",
@@ -62,7 +62,7 @@
62
62
  "api/fetch-bulk/createfetchbulk": {
63
63
  "title": "Bulk fetch URLs",
64
64
  "section": "API Reference",
65
- "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- `urls.url`\n- `urls.country`\n- `urls.cache_ttl`\n- `defaults`\n- `defaults.country`\n- `defaults.cache_ttl`\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- `total_billed_bytes`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — One or more URLs in the request are on ByteKit's blocklist. The whole request is\nrejected before anything is queued or billed. This body is NOT the unified `Error`\nenvelope: it carries no `status`, `http_status` or `failed_at`. `blocked` lists every\noffending URL with the rule that matched (`domain`, `tld`, `port` or `path`) and the\ncode that rule maps to (`host_forbidden` for the first three, `path_forbidden` for\n`path`).\n- `error`\n- `error.code`\n- `error.message`\n- `blocked`\n- `blocked.url`\n- `blocked.rule_type`\n- `blocked.error_code`\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`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
65
+ "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- `urls.url`\n- `urls.country`\n- `urls.cache_ttl`\n- `defaults`\n- `defaults.country`\n- `defaults.cache_ttl`\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- `total_billed_bytes`\n- `estimated_credits`\n- `webhook_url`\n- `rejected`\n- `rejected.index`\n- `rejected.url`\n- `rejected.code`\n- `rejected.message`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — Either of two bodies.\n\nOne or more URLs in the request are on ByteKit's blocklist. The whole request is\nrejected before anything is queued or billed. This body is NOT the unified `Error`\nenvelope: it carries no `status`, `http_status` or `failed_at`. `blocked` lists every\noffending URL with the rule that matched (`domain`, `tld`, `port` or `path`) and the\ncode that rule maps to (`host_forbidden` for the first three, `path_forbidden` for\n`path`).\n\n`proxy_refused`: every item in the batch was refused because our proxy provider does not allow\nrequests to its host. This is the unified `Error` envelope, and `details.rejected` lists\neach item as `{ index, url, code, message }`. Nothing is queued or billed. When only some\nitems are refused the batch is accepted with `202` and those items are listed in\n`rejected`.\n- `error`\n- `error.code`\n- `error.message`\n- `blocked`\n- `blocked.url`\n- `blocked.rule_type`\n- `blocked.error_code`\n- `status`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
66
66
  },
67
67
  "api/fetch-bulk/getfetchbulk": {
68
68
  "title": "Get fetch bulk job status",
@@ -72,12 +72,12 @@
72
72
  "api/fetch/getfetch": {
73
73
  "title": "Fetch a URL (GET)",
74
74
  "section": "API Reference",
75
- "body": "# Fetch a URL (GET)\n\nDirect HTTP fetch. Metadata is returned in X-Fetch-* headers. What the body holds\ndepends on `X-Fetch-Fast-Path`. When it is `true`, a successful response returns the\nupstream response bytes verbatim. When it is `false` the request fell back to a browser\nrender, and the body is the rendered page rather than the bytes the target sent;\n`X-Fetch-Content-Length` is then the compressed size of that page. Non-2xx upstream\nresponses use the `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) — Two-letter country code. Either case is accepted; the value is upper-cased.\n- `timeout_ms` (query, integer) — Time budget for the fetch, in milliseconds, from 1000 to 90000 (default 60000). The fetch is bounded by the lower of this value and the server's fast-path limit, a deployment setting that is not part of this contract, so a value above that limit has no effect while a lower value tightens the budget. The response does not report which limit applied.\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- `custom` (query, string) — A JSON-encoded object, URL-encoded in the query string. It is echoed back base64-encoded in\nthe `X-Fetch-Custom` response header so callers can correlate the response to caller-side\nstate. Capped at 4096 UTF-8 bytes after JSON serialization, and not part of the cache key.\nA value that is not valid JSON answers `422 validation_error` (\"custom must be a\nJSON-encoded object\"); valid JSON that is not an object is also rejected with `422`.\n\n## Responses\n\n### 200 — Content from upstream.\n\n### 400 — Invalid URL (`invalid_url`) or oversized request.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error (e.g. slow-path-only field), or a fetch that failed for a\ntarget-side reason.\n\nThree 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 `503`\n below, whose `error.http_status` is the target's own. A target `502` or `504`\n ends here too whenever it does not meet the condition for `503` below. The\n request transfers no billable bytes and is charged nothing (#4669).\n- **`timeout`** — the fetch ran out of its time limit before the page could be\n fetched (message `The request hit its time limit before the page could be\n fetched.`). It takes precedence over `blocked` and `upstream_error`, and like\n them it is charged nothing and reports `error.http_status` `422`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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`. This happens only when the escalation ladder ended on that answer, or when a\n cached copy of it is served. A `502` or `504` is not terminal, so ByteKit first\n retries it through its proxy tiers and the browser fallback; if the ladder ends any\n other way, or a bot-protection vendor was seen on the way, the request answers\n `422` (`upstream_error` or `blocked`) instead.\n 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`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
75
+ "body": "# Fetch a URL (GET)\n\nDirect HTTP fetch. Metadata is returned in X-Fetch-* headers. What the body holds\ndepends on `X-Fetch-Fast-Path`. When it is `true`, a successful response returns the\nupstream response bytes verbatim. When it is `false` the request fell back to a browser\nrender, and the body is the rendered page rather than the bytes the target sent;\n`X-Fetch-Content-Length` is then the compressed size of that page. Non-2xx upstream\nresponses use the `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) — Two-letter country code. Either case is accepted; the value is upper-cased.\n- `timeout_ms` (query, integer) — Time budget for the fetch, in milliseconds, from 1000 to 90000 (default 60000). The fetch is bounded by the lower of this value and the server's fast-path limit, a deployment setting that is not part of this contract, so a value above that limit has no effect while a lower value tightens the budget. The response does not report which limit applied.\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- `custom` (query, string) — A JSON-encoded object, URL-encoded in the query string. It is echoed back base64-encoded in\nthe `X-Fetch-Custom` response header so callers can correlate the response to caller-side\nstate. Capped at 4096 UTF-8 bytes after JSON serialization, and not part of the cache key.\nA value that is not valid JSON answers `422 validation_error` (\"custom must be a\nJSON-encoded object\"); valid JSON that is not an object is also rejected with `422`.\n\n## Responses\n\n### 200 — Content from upstream.\n\n### 400 — Invalid URL (`invalid_url`) or oversized request.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — The target cannot be requested. Nothing is fetched and nothing is billed.\nThe unified `Error` envelope carries one of three codes:\n\n- `host_forbidden` — a blocked domain, any government host (`.gov`, or a `.gov.` country domain such as `.gov.uk`), or a blocked port.\n `details` is `{ host }`.\n- `path_forbidden` — an authentication-style path such as a login page.\n `details` is `{ path }`.\n- `proxy_refused` — our proxy provider does not allow requests to this host, so the request is refused without being attempted.\n `details` is `{ host }`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error (e.g. slow-path-only field), or a fetch that failed for a\ntarget-side reason.\n\nThree 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 `503`\n below, whose `error.http_status` is the target's own. A target `502` or `504`\n ends here too whenever it does not meet the condition for `503` below. The\n request transfers no billable bytes and is charged nothing (#4669).\n- **`timeout`** — the fetch ran out of its time limit before the page could be\n fetched (message `The request hit its time limit before the page could be\n fetched.`). It takes precedence over `blocked` and `upstream_error`, and like\n them it is charged nothing and reports `error.http_status` `422`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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`. This happens only when the escalation ladder ended on that answer, or when a\n cached copy of it is served. A `502` or `504` is not terminal, so ByteKit first\n retries it through its proxy tiers and the browser fallback; if the ladder ends any\n other way, or a bot-protection vendor was seen on the way, the request answers\n `422` (`upstream_error` or `blocked`) instead.\n 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`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
76
76
  },
77
77
  "api/fetch/postfetch": {
78
78
  "title": "Fetch a URL (POST)",
79
79
  "section": "API Reference",
80
- "body": "# Fetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body. The response is the same, including\nthe `X-Fetch-Fast-Path` rule for what the body holds: the upstream bytes verbatim when\nit is `true`, the rendered page when it is `false`.\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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\nThree 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 `503`\n below, whose `error.http_status` is the target's own. A target `502` or `504`\n ends here too whenever it does not meet the condition for `503` below. The\n request transfers no billable bytes and is charged nothing (#4669).\n- **`timeout`** — the fetch ran out of its time limit before the page could be\n fetched (message `The request hit its time limit before the page could be\n fetched.`). It takes precedence over `blocked` and `upstream_error`, and like\n them it is charged nothing and reports `error.http_status` `422`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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`. This happens only when the escalation ladder ended on that answer, or when a\n cached copy of it is served. A `502` or `504` is not terminal, so ByteKit first\n retries it through its proxy tiers and the browser fallback; if the ladder ends any\n other way, or a bot-protection vendor was seen on the way, the request answers\n `422` (`upstream_error` or `blocked`) instead.\n 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`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
80
+ "body": "# Fetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body. The response is the same, including\nthe `X-Fetch-Fast-Path` rule for what the body holds: the upstream bytes verbatim when\nit is `true`, the rendered page when it is `false`.\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — The target cannot be requested. Nothing is fetched and nothing is billed.\nThe unified `Error` envelope carries one of three codes:\n\n- `host_forbidden` — a blocked domain, any government host (`.gov`, or a `.gov.` country domain such as `.gov.uk`), or a blocked port.\n `details` is `{ host }`.\n- `path_forbidden` — an authentication-style path such as a login page.\n `details` is `{ path }`.\n- `proxy_refused` — our proxy provider does not allow requests to this host, so the request is refused without being attempted.\n `details` is `{ host }`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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\nThree 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 `503`\n below, whose `error.http_status` is the target's own. A target `502` or `504`\n ends here too whenever it does not meet the condition for `503` below. The\n request transfers no billable bytes and is charged nothing (#4669).\n- **`timeout`** — the fetch ran out of its time limit before the page could be\n fetched (message `The request hit its time limit before the page could be\n fetched.`). It takes precedence over `blocked` and `upstream_error`, and like\n them it is charged nothing and reports `error.http_status` `422`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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`. This happens only when the escalation ladder ended on that answer, or when a\n cached copy of it is served. A `502` or `504` is not terminal, so ByteKit first\n retries it through its proxy tiers and the browser fallback; if the ladder ends any\n other way, or a bot-protection vendor was seen on the way, the request answers\n `422` (`upstream_error` or `blocked`) instead.\n 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`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
81
81
  },
82
82
  "api/health": {
83
83
  "title": "Health",
@@ -142,7 +142,7 @@
142
142
  "api/schema/createschemaextraction": {
143
143
  "title": "Schema-driven structured extraction",
144
144
  "section": "API Reference",
145
- "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\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- `id`\n- `data`\n- `model`\n- `validated`\n- `metrics`\n- `metrics.scrape_ms`\n- `metrics.llm_total_ms`\n- `metrics.input_tokens`\n- `metrics.output_tokens`\n- `metrics.retries`\n- `metrics.total_ms`\n- `scrape`\n- `scrape.url`\n- `scrape.status_code`\n- `scrape.content_length`\n- `scrape.truncated`\n- `warnings`\n- `credits_used`\n\n### 400 — Invalid URL (`invalid_url`), unsupported model (`unsupported_model`), or unsupported slow-path option (`unsupported_option`).\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error (`validation_error`), non-normalizable schema (`schema_incompatible`),\nor the fetched page's HTML could not be converted for extraction — over the size cap or\npast the conversion deadline (`content_too_large`). On `content_too_large` the page's\nbandwidth is billed and the credits are refunded.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 500 — Internal error (`internal_error`): the request could not be recorded, or its\nbandwidth charge could not be reserved. The credits held for it are refunded.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
145
+ "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\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- `id`\n- `data`\n- `model`\n- `validated`\n- `metrics`\n- `metrics.scrape_ms`\n- `metrics.llm_total_ms`\n- `metrics.input_tokens`\n- `metrics.output_tokens`\n- `metrics.retries`\n- `metrics.total_ms`\n- `scrape`\n- `scrape.url`\n- `scrape.status_code`\n- `scrape.content_length`\n- `scrape.truncated`\n- `warnings`\n- `credits_used`\n\n### 400 — Invalid URL (`invalid_url`), unsupported model (`unsupported_model`), or unsupported slow-path option (`unsupported_option`).\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — The target cannot be requested. Nothing is fetched and nothing is billed.\nThe unified `Error` envelope carries one of three codes:\n\n- `host_forbidden` — a blocked domain, any government host (`.gov`, or a `.gov.` country domain such as `.gov.uk`), or a blocked port.\n `details` is `{ host }`.\n- `path_forbidden` — an authentication-style path such as a login page.\n `details` is `{ path }`.\n- `proxy_refused` — our proxy provider does not allow requests to this host, so the request is refused without being attempted.\n `details` is `{ host }`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error (`validation_error`), non-normalizable schema (`schema_incompatible`),\nor the fetched page's HTML could not be converted for extraction — over the size cap or\npast the conversion deadline (`content_too_large`). On `content_too_large` the page's\nbandwidth is billed and the credits are refunded.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 500 — Internal error (`internal_error`): the request could not be recorded, or its\nbandwidth charge could not be reserved. The credits held for it are refunded.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
146
146
  },
147
147
  "api/scrape": {
148
148
  "title": "Scrape",
@@ -157,7 +157,7 @@
157
157
  "api/scrape-bulk/createscrapebulk": {
158
158
  "title": "Bulk scrape URLs",
159
159
  "section": "API Reference",
160
- "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**Unknown keys.** An unknown key on an `items[]` entry, or at the top level of\nthe body, is rejected with `422 validation_error`. An unknown key inside\n`defaults` is not: it is dropped without a warning and the request is accepted\nwith `202`. The exception is `cookies` and `headers`, on an item or in `defaults`: they\nanswer `400 validation_error`.\n\n**POST** `/v1/scrape/bulk`\n\n## Request Body\n\n- `urls`\n- `items`\n- `items.url`\n- `items.formats`\n- `items.formats.type`\n- `items.formats.schema`\n- `items.formats.model`\n- `items.formats.prompt`\n- `items.country`\n- `items.delay_ms`\n- `items.timeout_ms`\n- `items.metadata`\n- `items.clean_markdown`\n- `items.custom`\n- `defaults`\n- `defaults.formats`\n- `defaults.formats.type`\n- `defaults.formats.schema`\n- `defaults.formats.model`\n- `defaults.formats.prompt`\n- `defaults.country`\n- `defaults.delay_ms`\n- `defaults.timeout_ms`\n- `defaults.clean_markdown`\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- `total_billed_bytes`\n- `estimated_credits`\n- `webhook_url`\n- `rejected`\n- `rejected.index`\n- `rejected.url`\n- `rejected.code`\n- `rejected.message`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — One or more URLs in the request are on ByteKit's blocklist. The whole request is\nrejected before anything is queued or billed. This body is NOT the unified `Error`\nenvelope: it carries no `status`, `http_status` or `failed_at`. `blocked` lists every\noffending URL with the rule that matched (`domain`, `tld`, `port` or `path`) and the\ncode that rule maps to (`host_forbidden` for the first three, `path_forbidden` for\n`path`).\n- `error`\n- `error.code`\n- `error.message`\n- `blocked`\n- `blocked.url`\n- `blocked.rule_type`\n- `blocked.error_code`\n\n### 415 — `unsupported_content_type`: every item in the batch was refused because its URL path ends in\n`.pdf` (the path, lowercased; the query string and fragment are not looked at). Nothing is\nqueued or billed. `details.rejected` lists each item as `{ index, url, code, message }`.\nWhen only some items are refused the batch is accepted with `202` and those items are\nlisted in `rejected` instead.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error. `bulk_too_large` is returned when the count of\naccepted items exceeds the account plan's `max_bulk_size` cap (also\nsurfaced as `max_bulk_size` on `GET /v1/account`). Items refused\nfor a `.pdf` path are listed in `rejected` and do not count.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
160
+ "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**Unknown keys.** An unknown key on an `items[]` entry, or at the top level of\nthe body, is rejected with `422 validation_error`. An unknown key inside\n`defaults` is not: it is dropped without a warning and the request is accepted\nwith `202`. The exception is `cookies` and `headers`, on an item or in `defaults`: they\nanswer `400 validation_error`.\n\n**POST** `/v1/scrape/bulk`\n\n## Request Body\n\n- `urls`\n- `items`\n- `items.url`\n- `items.formats`\n- `items.formats.type`\n- `items.formats.schema`\n- `items.formats.model`\n- `items.formats.prompt`\n- `items.country`\n- `items.delay_ms`\n- `items.timeout_ms`\n- `items.metadata`\n- `items.clean_markdown`\n- `items.custom`\n- `defaults`\n- `defaults.formats`\n- `defaults.formats.type`\n- `defaults.formats.schema`\n- `defaults.formats.model`\n- `defaults.formats.prompt`\n- `defaults.country`\n- `defaults.delay_ms`\n- `defaults.timeout_ms`\n- `defaults.clean_markdown`\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- `total_billed_bytes`\n- `estimated_credits`\n- `webhook_url`\n- `rejected`\n- `rejected.index`\n- `rejected.url`\n- `rejected.code`\n- `rejected.message`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — Either of two bodies.\n\nOne or more URLs in the request are on ByteKit's blocklist. The whole request is\nrejected before anything is queued or billed. This body is NOT the unified `Error`\nenvelope: it carries no `status`, `http_status` or `failed_at`. `blocked` lists every\noffending URL with the rule that matched (`domain`, `tld`, `port` or `path`) and the\ncode that rule maps to (`host_forbidden` for the first three, `path_forbidden` for\n`path`).\n\n`proxy_refused`: every item in the batch was refused because our proxy provider does not allow\nrequests to its host (if any of them was refused for a `.pdf` path, the answer is `415`\ninstead). This is the unified `Error` envelope, and `details.rejected` lists each item as\n`{ index, url, code, message }`. Nothing is queued or billed. When only some items are\nrefused the batch is accepted with `202` and those items are listed in `rejected`.\n- `error`\n- `error.code`\n- `error.message`\n- `blocked`\n- `blocked.url`\n- `blocked.rule_type`\n- `blocked.error_code`\n- `status`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 415 — `unsupported_content_type`: every item in the batch was refused, at least one of them because\nits URL path ends in `.pdf` (the path, lowercased; the query string and fragment are not\nlooked at). Nothing is queued or billed. `details.rejected` lists each item as\n`{ index, url, code, message }`. When only some items are refused the batch is accepted\nwith `202` and those items are listed in `rejected` instead.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error. `bulk_too_large` is returned when the count of\naccepted items exceeds the account plan's `max_bulk_size` cap (also\nsurfaced as `max_bulk_size` on `GET /v1/account`). Items listed\nin `rejected` do not count.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
161
161
  },
162
162
  "api/scrape-bulk/getscrapebulk": {
163
163
  "title": "Get scrape bulk job status",
@@ -167,7 +167,7 @@
167
167
  "api/scrape/createscrape": {
168
168
  "title": "Scrape a URL",
169
169
  "section": "API Reference",
170
- "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` in the body, or `?async=true` in the query string (either one is enough; `false` in one never cancels `true` in the other) → **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 any of `delay_ms > 0`, `solve_challenge: true`, or `outline` in `formats` — 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. A `solve_challenge` render can outlast the hold window, so expect the 202 receipt from such a request.\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\n**A target that rate-limits us is not ByteKit rate-limiting you.** The `failed` envelope's `error.code` is `target_rate_limited` when the target rate-limits the request. On the fast path that means our proxy attempts end on an HTTP 429 and no bot protection is identified on any attempt, even if the browser fallback then fails or reaches only an unidentified block page; the inline failure carries `error.retry_after_seconds` when the target sent a usable `Retry-After`. On a held render the browser's own answer decides: it observes a 429 on the page itself, or it fails outright after the proxy attempts ended on an HTTP 429. A bot-protection verdict on an earlier fetch attempt does not keep a held render `blocked` when the browser then observes the 429. A held render never carries `error.retry_after_seconds`. Retrying a `target_rate_limited` failure later is likely to work. A held render whose browser reaches an unidentified 403 or 503 page after a proxy 429 is `blocked`. A 429 that bot protection sends as a block stays `blocked` when it is the answer that decides the code: the fast path's proxy attempts, or the browser render on a held render. Your own per-key limit is a separate case: it answers HTTP 429 `rate_limited` with a `Retry-After` header (see the `429` response).\n\nSo a 202 means one of exactly two things: you asked for one with `async: true` or `?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## Parameters\n\n- `async` (query, boolean) — Query-string spelling of the body `async` field. `true` returns the 202 receipt immediately; any other value is ignored. Either spelling turns async on, and `false` in one never cancels `true` in the other.\n\n## Request Body\n\n- `url` (required)\n- `formats`\n- `formats.type`\n- `formats.schema`\n- `formats.model`\n- `formats.prompt`\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\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` or `?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- `formats.raw`\n- `formats.markdown`\n- `formats.links`\n- `formats.links.url`\n- `formats.links.text`\n- `formats.links.isInternal`\n- `formats.links.rel`\n- `formats.images`\n- `formats.images.url`\n- `formats.images.alt`\n- `formats.images.width`\n- `formats.images.height`\n- `formats.images.format`\n- `formats.images.score`\n- `formats.json`\n- `formats.json.data`\n- `formats.json.validated`\n- `formats.json.model`\n- `formats.outline`\n- `metadata`\n- `metadata.title`\n- `metadata.description`\n- `metadata.language`\n- `metadata.canonicalUrl`\n- `metadata.ogTitle`\n- `metadata.ogDescription`\n- `metadata.ogImage`\n- `metadata.ogUrl`\n- `metadata.ogSiteName`\n- `metadata.robots`\n- `metadata.byline`\n- `metadata.publishedAt`\n- `tables`\n- `tables.kind`\n- `tables.gfm`\n- `tables.rows`\n- `tables.cols`\n- `warnings`\n- `warnings.code`\n- `warnings.message`\n- `warnings.element`\n- `stats`\n- `stats.chars`\n- `stats.tokens`\n- `stats.blocks`\n- `markdown_tokens`\n- `markdown_tokens.kept`\n- `markdown_tokens.total`\n- `markdown_tokens.truncated`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `custom`\n- `cache`\n- `cache_age_s`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.retry_after_seconds`\n- `error.failed_at`\n\n### 202 — Scrape accepted for background processing; the body is a receipt, not content. Returned when `async: true` or `?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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 415 — `unsupported_content_type`, in two cases:\n- The `url` path ends in `.pdf`: the path, lowercased, ends in `.pdf`; the query string and\n fragment are not looked at. It is refused before anything is drawn. A PDF served from\n another path, or reached through a redirect, is not caught by this check.\n- The page was fetched (or served from cache) and its content type cannot produce the\n requested formats. The charge is refunded.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error. A `json` format entry whose `schema` the extractor cannot take is\nrefused with `schema_incompatible`, before anything is drawn.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 500 — Internal server error.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 503 — The request carried a `json` format entry and JSON extraction is unavailable on this\ndeployment (`provider_unavailable`). It is refused before anything is drawn. A\nterminal upstream failure is never a `503`: it is a `200` result, described above.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
170
+ "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` in the body, or `?async=true` in the query string (either one is enough; `false` in one never cancels `true` in the other) → **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 any of `delay_ms > 0`, `solve_challenge: true`, or `outline` in `formats` — 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. A `solve_challenge` render can outlast the hold window, so expect the 202 receipt from such a request.\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\n**A target that rate-limits us is not ByteKit rate-limiting you.** The `failed` envelope's `error.code` is `target_rate_limited` when the target rate-limits the request. On the fast path that means our proxy attempts end on an HTTP 429 and no bot protection is identified on any attempt, even if the browser fallback then fails or reaches only an unidentified block page; the inline failure carries `error.retry_after_seconds` when the target sent a usable `Retry-After`. On a held render the browser's own answer decides: it observes a 429 on the page itself, or it fails outright after the proxy attempts ended on an HTTP 429. A bot-protection verdict on an earlier fetch attempt does not keep a held render `blocked` when the browser then observes the 429. A held render never carries `error.retry_after_seconds`. Retrying a `target_rate_limited` failure later is likely to work. A held render whose browser reaches an unidentified 403 or 503 page after a proxy 429 is `blocked`. A 429 that bot protection sends as a block stays `blocked` when it is the answer that decides the code: the fast path's proxy attempts, or the browser render on a held render. Your own per-key limit is a separate case: it answers HTTP 429 `rate_limited` with a `Retry-After` header (see the `429` response).\n\nSo a 202 means one of exactly two things: you asked for one with `async: true` or `?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## Parameters\n\n- `async` (query, boolean) — Query-string spelling of the body `async` field. `true` returns the 202 receipt immediately; any other value is ignored. Either spelling turns async on, and `false` in one never cancels `true` in the other.\n\n## Request Body\n\n- `url` (required)\n- `formats`\n- `formats.type`\n- `formats.schema`\n- `formats.model`\n- `formats.prompt`\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\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` or `?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- `formats.raw`\n- `formats.markdown`\n- `formats.links`\n- `formats.links.url`\n- `formats.links.text`\n- `formats.links.isInternal`\n- `formats.links.rel`\n- `formats.images`\n- `formats.images.url`\n- `formats.images.alt`\n- `formats.images.width`\n- `formats.images.height`\n- `formats.images.format`\n- `formats.images.score`\n- `formats.json`\n- `formats.json.data`\n- `formats.json.validated`\n- `formats.json.model`\n- `formats.outline`\n- `metadata`\n- `metadata.title`\n- `metadata.description`\n- `metadata.language`\n- `metadata.canonicalUrl`\n- `metadata.ogTitle`\n- `metadata.ogDescription`\n- `metadata.ogImage`\n- `metadata.ogUrl`\n- `metadata.ogSiteName`\n- `metadata.robots`\n- `metadata.byline`\n- `metadata.publishedAt`\n- `tables`\n- `tables.kind`\n- `tables.gfm`\n- `tables.rows`\n- `tables.cols`\n- `warnings`\n- `warnings.code`\n- `warnings.message`\n- `warnings.element`\n- `stats`\n- `stats.chars`\n- `stats.tokens`\n- `stats.blocks`\n- `markdown_tokens`\n- `markdown_tokens.kept`\n- `markdown_tokens.total`\n- `markdown_tokens.truncated`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `custom`\n- `cache`\n- `cache_age_s`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.retry_after_seconds`\n- `error.failed_at`\n\n### 202 — Scrape accepted for background processing; the body is a receipt, not content. Returned when `async: true` or `?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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — `proxy_refused`: our proxy provider does not allow requests to this host, so the request\nis refused without being attempted. Nothing is fetched and nothing is billed.\n`details` is `{ host }`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 415 — `unsupported_content_type`, in two cases:\n- The `url` path ends in `.pdf`: the path, lowercased, ends in `.pdf`; the query string and\n fragment are not looked at. It is refused before anything is drawn. A PDF served from\n another path, or reached through a redirect, is not caught by this check.\n- The page was fetched (or served from cache) and its content type cannot produce the\n requested formats. The charge is refunded.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — One of two codes:\n- `schema_incompatible`: a `json` format entry whose `schema` the extractor cannot take\n is refused before anything is drawn.\n- `content_too_large`: the request asks for `markdown` and the page is too large to\n convert (over the size cap or past the conversion deadline). The request is not\n charged, and the other requested formats are not returned. An `async` request fails\n with the same code on its error envelope.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 500 — Internal server error.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 503 — The request carried a `json` format entry and JSON extraction is unavailable on this\ndeployment (`provider_unavailable`). It is refused before anything is drawn. A\nterminal upstream failure is never a `503`: it is a `200` result, described above.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
171
171
  },
172
172
  "api/scrape/getscrape": {
173
173
  "title": "Get scrape result",
@@ -182,7 +182,7 @@
182
182
  "api/screenshots/createscreenshot": {
183
183
  "title": "Capture a screenshot",
184
184
  "section": "API Reference",
185
- "body": "# Capture a screenshot\n\nSync by default (holds up to 28s). Pass `async: true` in the body or `?async=true` in the\nquery string to return 202 immediately; either one is enough, and `false` in one never\ncancels `true` in the other.\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) — Query-string spelling of the body `async` field. `true` returns the 202 immediately; any other value is ignored.\n\n## Request Body\n\n- `url` (required)\n- `device`\n- `viewport`\n- `viewport.width`\n- `viewport.height`\n- `async`\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- `clip.x`\n- `clip.y`\n- `clip.width`\n- `clip.height`\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- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\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- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — The target is on ByteKit's blocklist. Nothing is captured and nothing is billed.\nThe unified `Error` envelope carries one of two codes:\n\n- `host_forbidden` — a blocked domain, any government host (`.gov`, or a `.gov.` country domain such as `.gov.uk`), or a blocked port.\n `details` is `{ host }`.\n- `path_forbidden` — an authentication-style path such as a login page.\n `details` is `{ path }`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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`. A `viewport` outside the `Viewport`\n bounds (width 360 to 2544, height 1 to 1297) is one.\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\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`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
185
+ "body": "# Capture a screenshot\n\nSync by default (holds up to 28s). Pass `async: true` in the body or `?async=true` in the\nquery string to return 202 immediately; either one is enough, and `false` in one never\ncancels `true` in the other.\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) — Query-string spelling of the body `async` field. `true` returns the 202 immediately; any other value is ignored.\n\n## Request Body\n\n- `url` (required)\n- `device`\n- `viewport`\n- `viewport.width`\n- `viewport.height`\n- `async`\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- `clip.x`\n- `clip.y`\n- `clip.width`\n- `clip.height`\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- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\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- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — The target cannot be requested. Nothing is captured and nothing is billed.\nThe unified `Error` envelope carries one of three codes:\n\n- `host_forbidden` — a blocked domain, any government host (`.gov`, or a `.gov.` country domain such as `.gov.uk`), or a blocked port.\n `details` is `{ host }`.\n- `path_forbidden` — an authentication-style path such as a login page.\n `details` is `{ path }`.\n- `proxy_refused` — our proxy provider does not allow requests to this host, so the request is refused without being attempted.\n `details` is `{ host }`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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`. A `viewport` outside the `Viewport`\n bounds (width 360 to 2544, height 1 to 1297) is one.\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\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`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
186
186
  },
187
187
  "api/screenshots/getscreenshot": {
188
188
  "title": "Get screenshot status",
@@ -207,7 +207,7 @@
207
207
  "api/sitemap/createsitemap": {
208
208
  "title": "Discover URLs on a domain",
209
209
  "section": "API Reference",
210
- "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\nThe webhook body is `{ event, data }`. For a job the worker ran, `data` is not a\n`SitemapResponse`:\n\n- `sitemap.completed` `data` carries `id`, `url`, `strategy`, `status`,\n `total_urls`, `sources`, `total_bytes`, `results_url`, `warnings`,\n `metadata`, `compact` and `billing`.\n- `sitemap.failed` `data` carries `id`, `url`, `strategy`, `status`,\n `error_code`, `error_message`, `warnings` and `metadata`.\n\nIn both, `url` is the host as `scheme://host`, and `warnings` is the\nworker's own warnings or `null`. When the request is answered from a cached job\n(`cache: hit`), the `sitemap.completed` `data` is instead the full job object, the\nsame fields as a `SitemapResponse`.\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- `process.action`\n- `process.options`\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- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — The target is on ByteKit's blocklist. Nothing is queued and nothing is billed.\nThe unified `Error` envelope carries one of two codes:\n\n- `host_forbidden` — a blocked domain, any government host (`.gov`, or a `.gov.` country domain such as `.gov.uk`), or a blocked port.\n `details` is `{ host }`.\n- `path_forbidden` — an authentication-style path such as a login page.\n `details` is `{ path }`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
210
+ "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\nThe webhook body is `{ event, data }`. For a job the worker ran, `data` is not a\n`SitemapResponse`:\n\n- `sitemap.completed` `data` carries `id`, `url`, `strategy`, `status`,\n `total_urls`, `sources`, `total_bytes`, `results_url`, `warnings`,\n `metadata`, `compact` and `billing`.\n- `sitemap.failed` `data` carries `id`, `url`, `strategy`, `status`,\n `error_code`, `error_message`, `warnings` and `metadata`.\n\nIn both, `url` is the host as `scheme://host`, and `warnings` is the\nworker's own warnings or `null`. When the request is answered from a cached job\n(`cache: hit`), the `sitemap.completed` `data` is instead the full job object, the\nsame fields as a `SitemapResponse`.\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- `process.action`\n- `process.options`\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- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — The target cannot be requested. Nothing is queued and nothing is billed.\nThe unified `Error` envelope carries one of three codes:\n\n- `host_forbidden` — a blocked domain, any government host (`.gov`, or a `.gov.` country domain such as `.gov.uk`), or a blocked port.\n `details` is `{ host }`.\n- `path_forbidden` — an authentication-style path such as a login page.\n `details` is `{ path }`.\n- `proxy_refused` — our proxy provider does not allow requests to this host, so the request is refused without being attempted.\n `details` is `{ host }`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\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- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
211
211
  },
212
212
  "api/sitemap/getsitemap": {
213
213
  "title": "Get sitemap job status",
@@ -347,7 +347,7 @@
347
347
  "guides/bulk": {
348
348
  "title": "Bulk",
349
349
  "section": "Guides",
350
- "body": "# Bulk\n\nSubmit many URLs in one request — which of the three bulk APIs to use, how results arrive, how to cancel a job, what it costs, and the limits.\n\nByteKit has three bulk APIs. Each takes a list of URLs in one request, answers `202` with a job id, and does the work in the background.\nYou get the results by webhook when the job completes, and you can also read them by polling. A job that is cancelled or failed sends no webhook, so poll it.\n\n## Which bulk API to use\n\n| You want | Use | Entries are |\n| ------------------------------------------------------- | ---------------------- | ------------------------------------------------------------ |\n| Screenshots, or screenshots and scrapes in one job | `POST /v1/bulk` | `urls`, or `items` that each choose `screenshot` or `scrape` |\n| Scrapes only, as `raw`, `markdown`, `links` or `images` | `POST /v1/scrape/bulk` | `urls`, or `items` with per-URL options |\n| The raw response from each URL | `POST /v1/fetch/bulk` | `urls`, as strings or small objects |\n\nThe three do not share one field set. For example, `clean_markdown` is accepted on `/v1/scrape/bulk` and\nrejected on `/v1/bulk` with a `422`, and `wait_until` is accepted on `/v1/bulk` and rejected on a\n`/v1/scrape/bulk` item with a `422`. The API Reference lists the fields of each:\n[Bulk](https://bytekit.com/docs/api/bulk/createbulk), [Scrape bulk](https://bytekit.com/docs/api/scrape-bulk/createscrapebulk) and\n[Fetch bulk](https://bytekit.com/docs/api/fetch-bulk/createfetchbulk).\n\n`/v1/fetch/bulk` does not render pages. A `cookies` or `headers` field in its body, in `defaults`, or in a `urls` object returns\n`400 validation_error` with the message `cookies is no longer accepted: caller-supplied cookies and headers were removed from the capture API. Every capture presents ByteKit's own identity to the target site.` (the message for `headers` is the same with `headers` in place of the leading `cookies`; for a `urls` object it starts with `Item 0: `, using the object's position). No bulk route accepts `cookies` or `headers`, so there is no other route to send them to. A `wait_for_selector`, `delay_ms` or `wait_until` field in the same three places returns `400 validation_error` with the message `Use /v1/bulk for browser-backed options.`, with the same `Item 0: ` prefix, because `/v1/bulk` accepts all three. Naming a scrape format such as `markdown` as `format` is also a `400`. For\nMarkdown, links or images from a batch, use `/v1/scrape/bulk`.\n\n## Submit a job\n\nAll three create routes require `webhook_url`, an `https://` URL. An `http://` URL is rejected with\n`400 invalid_url` and the reason `scheme_unsupported`. Set `webhook_secret` to have the deliveries signed;\nsee the [Webhooks guide](https://bytekit.com/docs/guides/webhooks) for verification.\n\n### Mixed screenshots and scrapes\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/bulk \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"items\": [\n {\"url\": \"https://example.com/?page=bulk-guide-1\", \"type\": \"screenshot\"},\n {\"url\": \"https://example.com/?page=bulk-guide-1\", \"type\": \"scrape\", \"formats\": [\"markdown\"]}\n ],\n \"webhook_url\": \"https://hooks.example.com/bytekit\"\n }'\n```\n\n```json\n{\n \"id\": \"bulk_01a125a61d9777909cff22879e7d0165\",\n \"status\": \"processing\",\n \"total\": 2,\n \"completed\": 0,\n \"failed\": 0,\n \"total_credits_charged\": 0,\n \"total_billed_bytes\": null,\n \"estimated_credits\": 2.5,\n \"webhook_url\": \"https://hooks.example.com/bytekit\",\n \"created_at\": \"2026-10-10T11:50:05.984Z\",\n \"completed_at\": null\n}\n```\n\n> This request was run for real and returned `202`.\n\nKeep the `id`: it is how you read and cancel the job. `total_billed_bytes` is `null` here because nothing has completed yet.\n\n### Scrapes only\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/scrape/bulk \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"urls\": [\"https://example.com/?page=bulk-guide-2\"],\n \"defaults\": {\"formats\": [\"markdown\"]},\n \"webhook_url\": \"https://hooks.example.com/bytekit\"\n }'\n```\n\n> This request was run for real and returned `202`, with the same job envelope as above.\n\n### Raw fetches\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/fetch/bulk \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"urls\": [\"https://example.com/?page=bulk-guide-3\"],\n \"webhook_url\": \"https://hooks.example.com/bytekit\"\n }'\n```\n\n> This request was run for real and returned `202`, with the same job envelope as above.\n\n### `urls` or `items`\n\nOn `/v1/bulk` and `/v1/scrape/bulk`, send `urls` or `items`, not both. A request with both returns\n`422 validation_error` (`Provide either urls or items, not both.`), and a request with neither returns\n`422 validation_error` (`Either urls or items must be provided.`).\n\n- `urls` is a plain list of URLs. Each one takes the values in `defaults`.\n- `items` is a list of objects, each with a `url` and its own options. An option on an item wins over the\n same option in `defaults`.\n- On `/v1/bulk`, an entry that names no `type` is a screenshot unless `defaults.type` says `scrape`. A bare\n `urls` list on `/v1/bulk` therefore produces screenshots, and with `\"defaults\": {\"type\": \"scrape\"}` it\n produces scrapes. Both were run for real.\n- `/v1/fetch/bulk` has no `items`. It takes `urls`, as strings or as objects with `url`, `country` and\n `cache_ttl`, and a body with `items` and no `urls` returns `422 validation_error`.\n\n## Get the results\n\n### By webhook\n\nWhen the job reaches `completed`, ByteKit sends a `POST` to your `webhook_url` with the header `X-ByteKit-Event: bulk.completed`, so you can dispatch on the header without reading the body. A job that ends `cancelled` or `failed` gets no webhook, so poll it. The\n[Scraping guide](https://bytekit.com/docs/guides/scraping#webhook-event-header) lists the other event types.\n\nThe body is bounded: it carries at most 500 complete items and 1 MiB of JSON. These are its fields, from\nthe API Reference (this page shows no captured delivery):\n\n| Field | Meaning |\n| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `bulk_id` | The job id |\n| `status` | `completed` |\n| `total`, `completed`, `failed` | Counts for the whole job |\n| `total_billed_bytes` | Bandwidth billed for the job, in bytes, or `null` when it cannot be reported in full |\n| `total_credits_charged` | Deprecated: read `total_billed_bytes` instead |\n| `webhook_url` | The `webhook_url` the job was created with |\n| `items` | Complete item records, up to 500. Each has an `id`, a `type` and a `status` (`success`, `completed`, `failed` or `cancelled`), and may carry `error_code` and `error_message` |\n| `recovery_api` | `fetch`, `scrape` or `mixed`: which API created the job |\n| `recovery_url` | The path to read the rest of the results from |\n| `manifest_item_count` | How many items this body carries |\n| `manifest_items_complete` | `true` when every item that reached a final status is in `items` |\n| `manifest_artifacts_complete` | `true` when every included completed item has a usable result reference |\n| `manifest_complete` | `true` when both of the above are `true` |\n| `recovery_required` | The inverse of `manifest_complete` |\n\nWhen `recovery_required` is `true`, the body does not hold the whole job. Read the rest from\n`recovery_url` with cursors: request it, then repeat the request with `?cursor=` set to the `next_cursor`\nyou were given, until `has_more` is `false`. `recovery_url` depends on the API that created the job:\n\n| Created with | `recovery_url` |\n| ---------------------- | --------------------------- |\n| `POST /v1/bulk` | `/v1/bulk/{id}/screenshots` |\n| `POST /v1/scrape/bulk` | `/v1/scrape/bulk/{id}` |\n| `POST /v1/fetch/bulk` | `/v1/fetch/bulk/{id}` |\n\nA delivery can arrive more than once or late. Use `bulk_id` together with each item `id` to process an item\nonce.\n\n### By polling\n\nEach API has `GET` routes for its own jobs. The job routes (`GET /v1/bulk/{id}`,\n`GET /v1/scrape/bulk/{id}` and `GET /v1/fetch/bulk/{id}`) answer `202` while the job is `processing` and `200` once it is `completed`, `failed` or `cancelled`. `GET /v1/bulk/{id}/screenshots` answers `200` whatever the job's status; an item that\nhas not completed shows `null` in `billing`.\n\n| Created with | Job status | Items |\n| ---------------------- | -------------------------- | --------------------------------------------------------- |\n| `POST /v1/bulk` | `GET /v1/bulk/{id}` | `GET /v1/bulk/{id}/screenshots`, whatever the item `type` |\n| `POST /v1/scrape/bulk` | `GET /v1/scrape/bulk/{id}` | the same response, in `items` |\n| `POST /v1/fetch/bulk` | `GET /v1/fetch/bulk/{id}` | the same response, in `items` |\n\n`GET /v1/bulk/{id}/screenshots` lists the items of a mixed job and is not limited to screenshots; each item\nhas a `type` of `screenshot` or `scrape`. Unless the job is cancelled, its `status` is `processing` until every item has completed or failed, and `completed` after. A `completed` job can have a non-zero `failed`; read `failed` to tell. The other values are `failed` and `cancelled`.\n\n```bash\ncurl -i https://api.bytekit.com/v1/bulk/bulk_01a125a61d9777909cff22879e7d0165 \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n```json\n{\n \"id\": \"bulk_01a125a61d9777909cff22879e7d0165\",\n \"status\": \"completed\",\n \"total\": 2,\n \"completed\": 2,\n \"failed\": 0,\n \"total_credits_charged\": 0,\n \"total_billed_bytes\": 1002,\n \"estimated_credits\": null,\n \"webhook_url\": \"https://hooks.example.com/bytekit\",\n \"created_at\": \"2026-10-10T11:50:05.951Z\",\n \"completed_at\": \"2026-10-10T11:50:16.313Z\"\n}\n```\n\n> This request was run for real and returned `200`. Called while the job was still running, it returned `202`.\n\nThe items of that job:\n\n```bash\ncurl -i https://api.bytekit.com/v1/bulk/bulk_01a125a61d9777909cff22879e7d0165/screenshots \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n```json\n{\n \"bulk_id\": \"bulk_01a125a61d9777909cff22879e7d0165\",\n \"items\": [\n {\n \"type\": \"screenshot\",\n \"id\": \"ss_01a125a61d9d744299721fb4b915b626\",\n \"status\": \"completed\",\n \"url\": \"https://example.com/?page=bulk-guide-1\",\n \"image_url\": \"https://…\",\n \"billing\": { \"raw_bytes\": 334, \"multiplier\": 1.5, \"billed_bytes\": 501 },\n \"error_code\": null\n },\n {\n \"type\": \"scrape\",\n \"id\": \"sc_01a125a61d9973569644148e9697b8ba\",\n \"status\": \"completed\",\n \"url\": \"https://example.com/?page=bulk-guide-1\",\n \"content_url\": \"https://…\",\n \"markdown_url\": \"https://…\",\n \"billing\": { \"raw_bytes\": 334, \"multiplier\": 1.5, \"billed_bytes\": 501 },\n \"error_code\": null\n }\n ],\n \"total\": 2,\n \"next_cursor\": null,\n \"has_more\": false,\n \"job_counters\": { \"total\": 2, \"completed\": 2, \"failed\": 0 }\n}\n```\n\n> This request was run for real and returned `200`. Links are shortened, and other fields, such as\n> `page_title`, `artifacts` and `created_at`, are left out.\n\nThe item routes take `limit`, `cursor` and `status` (`pending`, `processing`, `completed`, `failed` or\n`cancelled`). `limit` runs from 1 to 500; its default is 100 on `/v1/bulk/{id}/screenshots` and 500 on the\nother two. Pass the `next_cursor` of one page as `cursor` of the next while `has_more` is `true`, and reuse\nthe same `status` filter for the whole walk.\n\nDownload links in the item lists are signed and expire. `content_url`, `markdown_url` and `image_url` on\n`/v1/bulk/{id}/screenshots` and `content_url` on `/v1/fetch/bulk/{id}` are valid for 600 seconds; read the\njob again for a fresh link. On `/v1/scrape/bulk/{id}`, a `raw` or `markdown` result up to 10 MiB is returned\ninline, and a larger one is replaced by a signed link valid for 24 hours.\n\nRead a job through the routes of the API that created it. Another API's routes can answer `200` with\nsomething else: in a run for real, `GET /v1/fetch/bulk/{id}` on a `POST /v1/bulk` job returned `200` with an\nempty `items` list.\n\n### Listing jobs\n\n`GET /v1/bulk` lists your bulk jobs, most recent first, whichever API created them. It takes `status`\n(`processing`, `completed`, `failed` or `cancelled`), `limit` (1 to 100, default 25) and `cursor`. Follow\n`next_cursor` while `has_more` is `true`. Each entry is the job envelope without `items`.\n\n```bash\ncurl -i \"https://api.bytekit.com/v1/bulk?limit=2\" \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n> This request was run for real and returned `200` with `data`, `next_cursor` and `has_more`.\n\n### Checking bulk concurrency\n\n`GET /v1/bulk/concurrency` returns `{ active, limit }`: how many of your account's bulk concurrency slots\nare in use, and your plan's maximum concurrency. Compare the two to see whether your jobs are held at the\ncap. `active` is `null` when the count cannot be read right now; it is not zero. A slot whose release never\narrived drops out of the count after 5 minutes.\n\n## Cancel a job\n\n`DELETE /v1/bulk/{id}` cancels a job that is still running. It takes the id from any of the three create\nroutes. `/v1/scrape/bulk/{id}` and `/v1/fetch/bulk/{id}` have no `DELETE`; they answer `404`.\n\nCancelling drains the items that are still waiting to start and refunds the quota held for exactly those.\nItems that already completed or are in progress are not refunded by the cancel. A failed item adds nothing to `total_billed_bytes`, and on `GET /v1/bulk/{id}/screenshots` it shows `null` in `billing`. Repeating a `DELETE` is safe: on a job that is already `completed`, `failed` or `cancelled` it retu\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 22715 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/bulk]"
350
+ "body": "# Bulk\n\nSubmit many URLs in one request — which of the three bulk APIs to use, how results arrive, how to cancel a job, what it costs, and the limits.\n\nByteKit has three bulk APIs. Each takes a list of URLs in one request, answers `202` with a job id, and does the work in the background.\nYou get the results by webhook when the job completes, and you can also read them by polling. A job that is cancelled or failed sends no webhook, so poll it.\n\n## Which bulk API to use\n\n| You want | Use | Entries are |\n| ------------------------------------------------------- | ---------------------- | ------------------------------------------------------------ |\n| Screenshots, or screenshots and scrapes in one job | `POST /v1/bulk` | `urls`, or `items` that each choose `screenshot` or `scrape` |\n| Scrapes only, as `raw`, `markdown`, `links` or `images` | `POST /v1/scrape/bulk` | `urls`, or `items` with per-URL options |\n| The raw response from each URL | `POST /v1/fetch/bulk` | `urls`, as strings or small objects |\n\nThe three do not share one field set. For example, `clean_markdown` is accepted on `/v1/scrape/bulk` and\nrejected on `/v1/bulk` with a `422`, and `wait_until` is accepted on `/v1/bulk` and rejected on a\n`/v1/scrape/bulk` item with a `422`. The API Reference lists the fields of each:\n[Bulk](https://bytekit.com/docs/api/bulk/createbulk), [Scrape bulk](https://bytekit.com/docs/api/scrape-bulk/createscrapebulk) and\n[Fetch bulk](https://bytekit.com/docs/api/fetch-bulk/createfetchbulk).\n\n`/v1/fetch/bulk` does not render pages. A `cookies` or `headers` field in its body, in `defaults`, or in a `urls` object returns\n`400 validation_error` with the message `cookies is no longer accepted: caller-supplied cookies and headers were removed from the capture API. Every capture presents ByteKit's own identity to the target site.` (the message for `headers` is the same with `headers` in place of the leading `cookies`; for a `urls` object it starts with `Item 0: `, using the object's position). No bulk route accepts `cookies` or `headers`, so there is no other route to send them to. A `wait_for_selector`, `delay_ms` or `wait_until` field in the same three places returns `400 validation_error` with the message `Use /v1/bulk for browser-backed options.`, with the same `Item 0: ` prefix, because `/v1/bulk` accepts all three. Naming a scrape format such as `markdown` as `format` is also a `400`. For\nMarkdown, links or images from a batch, use `/v1/scrape/bulk`.\n\n## Submit a job\n\nAll three create routes require `webhook_url`, an `https://` URL. An `http://` URL is rejected with\n`400 invalid_url` and the reason `scheme_unsupported`. Set `webhook_secret` to have the deliveries signed;\nsee the [Webhooks guide](https://bytekit.com/docs/guides/webhooks) for verification.\n\n### Mixed screenshots and scrapes\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/bulk \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"items\": [\n {\"url\": \"https://example.com/?page=bulk-guide-1\", \"type\": \"screenshot\"},\n {\"url\": \"https://example.com/?page=bulk-guide-1\", \"type\": \"scrape\", \"formats\": [\"markdown\"]}\n ],\n \"webhook_url\": \"https://hooks.example.com/bytekit\"\n }'\n```\n\n```json\n{\n \"id\": \"bulk_01a125a61d9777909cff22879e7d0165\",\n \"status\": \"processing\",\n \"total\": 2,\n \"completed\": 0,\n \"failed\": 0,\n \"total_credits_charged\": 0,\n \"total_billed_bytes\": null,\n \"estimated_credits\": 2.5,\n \"webhook_url\": \"https://hooks.example.com/bytekit\",\n \"created_at\": \"2026-10-10T11:50:05.984Z\",\n \"completed_at\": null\n}\n```\n\n> This request was run for real and returned `202`.\n\nKeep the `id`: it is how you read and cancel the job. `total_billed_bytes` is `null` here because nothing has completed yet.\n\n### Scrapes only\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/scrape/bulk \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"urls\": [\"https://example.com/?page=bulk-guide-2\"],\n \"defaults\": {\"formats\": [\"markdown\"]},\n \"webhook_url\": \"https://hooks.example.com/bytekit\"\n }'\n```\n\n> This request was run for real and returned `202`, with the same job envelope as above.\n\n### Raw fetches\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/fetch/bulk \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"urls\": [\"https://example.com/?page=bulk-guide-3\"],\n \"webhook_url\": \"https://hooks.example.com/bytekit\"\n }'\n```\n\n> This request was run for real and returned `202`, with the same job envelope as above.\n\n### `urls` or `items`\n\nOn `/v1/bulk` and `/v1/scrape/bulk`, send `urls` or `items`, not both. A request with both returns\n`422 validation_error` (`Provide either urls or items, not both.`), and a request with neither returns\n`422 validation_error` (`Either urls or items must be provided.`).\n\n- `urls` is a plain list of URLs. Each one takes the values in `defaults`.\n- `items` is a list of objects, each with a `url` and its own options. An option on an item wins over the\n same option in `defaults`.\n- On `/v1/bulk`, an entry that names no `type` is a screenshot unless `defaults.type` says `scrape`. A bare\n `urls` list on `/v1/bulk` therefore produces screenshots, and with `\"defaults\": {\"type\": \"scrape\"}` it\n produces scrapes. Both were run for real.\n- `/v1/fetch/bulk` has no `items`. It takes `urls`, as strings or as objects with `url`, `country` and\n `cache_ttl`, and a body with `items` and no `urls` returns `422 validation_error`.\n\n### Hosts our proxy provider refuses\n\nOur proxy provider does not allow requests to some hosts. An entry for such a host is not queued: the\n`202` body lists it under `rejected` as `{ index, url, code, message }` with the code\n`proxy_refused`, it is not counted in `total`, and nothing is billed for it. The other entries run as\nusual. When every entry is refused for this reason, no job is created and the request returns\n`403 proxy_refused`, with the same list in `error.details.rejected`.\n\n## Get the results\n\n### By webhook\n\nWhen the job reaches `completed`, ByteKit sends a `POST` to your `webhook_url` with the header `X-ByteKit-Event: bulk.completed`, so you can dispatch on the header without reading the body. A job that ends `cancelled` or `failed` gets no webhook, so poll it. The\n[Scraping guide](https://bytekit.com/docs/guides/scraping#webhook-event-header) lists the other event types.\n\nThe body is bounded: it carries at most 500 complete items and 1 MiB of JSON. These are its fields, from\nthe API Reference (this page shows no captured delivery):\n\n| Field | Meaning |\n| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `bulk_id` | The job id |\n| `status` | `completed` |\n| `total`, `completed`, `failed` | Counts for the whole job |\n| `total_billed_bytes` | Bandwidth billed for the job, in bytes, or `null` when it cannot be reported in full |\n| `total_credits_charged` | Deprecated: read `total_billed_bytes` instead |\n| `webhook_url` | The `webhook_url` the job was created with |\n| `items` | Complete item records, up to 500. Each has an `id`, a `type` and a `status` (`success`, `completed`, `failed` or `cancelled`), and may carry `error_code` and `error_message` |\n| `recovery_api` | `fetch`, `scrape` or `mixed`: which API created the job |\n| `recovery_url` | The path to read the rest of the results from |\n| `manifest_item_count` | How many items this body carries |\n| `manifest_items_complete` | `true` when every item that reached a final status is in `items` |\n| `manifest_artifacts_complete` | `true` when every included completed item has a usable result reference |\n| `manifest_complete` | `true` when both of the above are `true` |\n| `recovery_required` | The inverse of `manifest_complete` |\n\nWhen `recovery_required` is `true`, the body does not hold the whole job. Read the rest from\n`recovery_url` with cursors: request it, then repeat the request with `?cursor=` set to the `next_cursor`\nyou were given, until `has_more` is `false`. `recovery_url` depends on the API that created the job:\n\n| Created with | `recovery_url` |\n| ---------------------- | --------------------------- |\n| `POST /v1/bulk` | `/v1/bulk/{id}/screenshots` |\n| `POST /v1/scrape/bulk` | `/v1/scrape/bulk/{id}` |\n| `POST /v1/fetch/bulk` | `/v1/fetch/bulk/{id}` |\n\nA delivery can arrive more than once or late. Use `bulk_id` together with each item `id` to process an item\nonce.\n\n### By polling\n\nEach API has `GET` routes for its own jobs. The job routes (`GET /v1/bulk/{id}`,\n`GET /v1/scrape/bulk/{id}` and `GET /v1/fetch/bulk/{id}`) answer `202` while the job is `processing` and `200` once it is `completed`, `failed` or `cancelled`. `GET /v1/bulk/{id}/screenshots` answers `200` whatever the job's status; an item that\nhas not completed shows `null` in `billing`.\n\n| Created with | Job status | Items |\n| ---------------------- | -------------------------- | --------------------------------------------------------- |\n| `POST /v1/bulk` | `GET /v1/bulk/{id}` | `GET /v1/bulk/{id}/screenshots`, whatever the item `type` |\n| `POST /v1/scrape/bulk` | `GET /v1/scrape/bulk/{id}` | the same response, in `items` |\n| `POST /v1/fetch/bulk` | `GET /v1/fetch/bulk/{id}` | the same response, in `items` |\n\n`GET /v1/bulk/{id}/screenshots` lists the items of a mixed job and is not limited to screenshots; each item\nhas a `type` of `screenshot` or `scrape`. Unless the job is cancelled, its `status` is `processing` until every item has completed or failed, and `completed` after. A `completed` job can have a non-zero `failed`; read `failed` to tell. The other values are `failed` and `cancelled`.\n\n```bash\ncurl -i https://api.bytekit.com/v1/bulk/bulk_01a125a61d9777909cff22879e7d0165 \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n```json\n{\n \"id\": \"bulk_01a125a61d9777909cff22879e7d0165\",\n \"status\": \"completed\",\n \"total\": 2,\n \"completed\": 2,\n \"failed\": 0,\n \"total_credits_charged\": 0,\n \"total_billed_bytes\": 1002,\n \"estimated_credits\": null,\n \"webhook_url\": \"https://hooks.example.com/bytekit\",\n \"created_at\": \"2026-10-10T11:50:05.951Z\",\n \"completed_at\": \"2026-10-10T11:50:16.313Z\"\n}\n```\n\n> This request was run for real and returned `200`. Called while the job was still running, it returned `202`.\n\nThe items of that job:\n\n```bash\ncurl -i https://api.bytekit.com/v1/bulk/bulk_01a125a61d9777909cff22879e7d0165/screenshots \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n```json\n{\n \"bulk_id\": \"bulk_01a125a61d9777909cff22879e7d0165\",\n \"items\": [\n {\n \"type\": \"screenshot\",\n \"id\": \"ss_01a125a61d9d744299721fb4b915b626\",\n \"status\": \"completed\",\n \"url\": \"https://example.com/?page=bulk-guide-1\",\n \"image_url\": \"https://…\",\n \"billing\": { \"raw_bytes\": 334, \"multiplier\": 1.5, \"billed_bytes\": 501 },\n \"error_code\": null\n },\n {\n \"type\": \"scrape\",\n \"id\": \"sc_01a125a61d9973569644148e9697b8ba\",\n \"status\": \"completed\",\n \"url\": \"https://example.com/?page=bulk-guide-1\",\n \"content_url\": \"https://…\",\n \"markdown_url\": \"https://…\",\n \"billing\": { \"raw_bytes\": 334, \"multiplier\": 1.5, \"billed_bytes\": 501 },\n \"error_code\": null\n }\n ],\n \"total\": 2,\n \"next_cursor\": null,\n \"has_more\": false,\n \"job_counters\": { \"total\": 2, \"completed\": 2, \"failed\": 0 }\n}\n```\n\n> This request was run for real and returned `200`. Links are shortened, and other fields, such as\n> `page_title`, `artifacts` and `created_at`, are left out.\n\nThe item routes take `limit`, `cursor` and `status` (`pending`, `processing`, `completed`, `failed` or\n`cancelled`). `limit` runs from 1 to 500; its default is 100 on `/v1/bulk/{id}/screenshots` and 500 on the\nother two. Pass the `next_cursor` of one page as `cursor` of the next while `has_more` is `true`, and reuse\nthe same `status` filter for the whole walk.\n\nDownload links in the item lists are signed and expire. `content_url`, `markdown_url` and `image_url` on\n`/v1/bulk/{id}/screenshots` and `content_url` on `/v1/fetch/bulk/{id}` are valid for 600 seconds; read the\njob again for a fresh link. On `/v1/scrape/bulk/{id}`, a `raw` or `markdown` result up to 10 MiB is returned\ninline, and a larger one is replaced by a signed link valid for 24 hours.\n\nRead a job through the routes of the API that created it. Another API's routes can answer `200` with\nsomething else: in a run for real, `GET /v1/fetch/bulk/{id}` on a `POST /v1/bulk` job returned `200` with an\nempty `items` list.\n\n### Listing jobs\n\n`GET /v1/bulk` lists your bulk jobs, most recent first, whichever API created them. It takes `status`\n(`processing`, `completed`, `failed` or `cancelled`), `limit` (1 to 100, default 25) and `cursor`. Follow\n`next_cursor` while `has_more` is `true`. Each entry is the job envelope without `items`.\n\n```bash\ncurl -i \"https://api.bytekit.com/v1/bulk?limit=2\" \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n> This request was run for real and returned `200` with `data`, `next_cursor` and `has_more`.\n\n### Checking bulk concurrency\n\n`GET /v1/bulk/concurrency` returns `{ active, limit }`: how many of your account's bulk concurrency slots\nare in use, and your plan's maximum concurrency. Compare the two to see whether your jobs are held at the\ncap. `active` is `null` when the count cannot be read right now; it is not zero. A slot whose release never\narrived drops out of the count after 5 minutes.\n\n## Cancel a job\n\n`DELETE /v1/bulk/{id}` cancels a job that is still running. It takes the id from any of the three create\nroutes. `\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 23560 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/bulk]"
351
351
  },
352
352
  "guides/choosing-an-endpoint": {
353
353
  "title": "Choosing an endpoint",
@@ -357,12 +357,12 @@
357
357
  "guides/errors": {
358
358
  "title": "Errors",
359
359
  "section": "Guides",
360
- "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](https://bytekit.com/docs/billing#terms) 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 credit balance is 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`, `timeout` | `/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), or it ran out of its time limit before the page could be fetched (`timeout`). 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` | A ByteKit-side failure (for example, failing to enqueue a job or to persist a result, or an unexpected server error), not a problem with the target site. A target-site failure is a result instead: a `200` response with a `failed` scrape envelope on `/v1/scrape` (its `error.code` can itself be `internal_error`), or the `422` `blocked` / `upstream_error` row above on `/v1/fetch` |\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\n---\n[Truncated to the 16384-byte per-page limit — this page is 18359 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/errors]"
360
+ "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`, 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](https://bytekit.com/docs/billing#terms) 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 credit balance is 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` | `content_too_large` | The page is too large to convert to markdown: over the size cap, or past the conversion deadline. On `/v1/scrape` this answers a request that asks for `markdown` (an `async` request fails with the same code on its error envelope); `/v1/schema` answers it too. The request is charged nothing, and on `/v1/scrape` the other requested formats are not returned either |\n| `422` | `blocked`, `upstream_error`, `timeout` | `/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), or it ran out of its time limit before the page could be fetched (`timeout`). 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` | A ByteKit-side failure (for example, failing to enqueue a job or to persist a result, or an unexpected server error), not a problem with the target site. A target-site failure is a result instead: a `200` response with a `failed` scrape envelope on `/v1/scrape` (its `error.code` can itself be `internal_error`), or the `422` `blocked` / `upstream_error` row above on `/v1/fetch` |\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\n---\n[Truncated to the 16384-byte per-page limit — this page is 19291 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/errors]"
361
361
  },
362
362
  "guides/fetch": {
363
363
  "title": "Fetch",
364
364
  "section": "Guides",
365
- "body": "# Fetch\n\nFetch the raw response from a URL — a working request, the X-Fetch-* headers, the options that matter, what it costs, and the errors to handle.\n\n`GET /v1/fetch` and `POST /v1/fetch` request a URL and return the target's response as the body of a\nsuccessful reply. The metadata about the fetch travels in `X-Fetch-*` response headers rather than in\na JSON envelope. The endpoint takes no `format`: for Markdown, links, images, browser rendering or\nasynchronous delivery, use `/v1/scrape` (see\n[When to use /v1/scrape instead](#when-to-use-v1scrape-instead)).\n\n## Fetch a URL\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/fetch \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com/?page=guide-demo\"}'\n```\n\nThe response is the upstream page, with ByteKit's metadata in the headers:\n\n```http\nHTTP/2 200\ncontent-type: text/html\nx-billable-bytes: 334\nx-billing-multiplier: 1\nx-fetch-billing-multiplier: 1\nx-fetch-cache: miss\nx-fetch-completed-at: 2026-10-10T02:36:27.212Z\nx-fetch-content-length: 334\nx-fetch-content-type: text/html\nx-fetch-created-at: 2026-10-10T02:36:27.181Z\nx-fetch-credits-charged: 0\nx-fetch-duration-ms: 452\nx-fetch-expires-at: 2027-10-10T02:36:27.212Z\nx-fetch-fast-path: true\nx-fetch-id: ft_8cabc1f901d879c89f62e4bd5ef80083\nx-fetch-status: completed\nx-fetch-url: https://example.com/?page=guide-demo\nx-raw-bytes: 334\n\n<!doctype html><html lang=en><head><meta charset=utf-8>…<title>Example Domain</title>…\n```\n\n> This request was run for real and returned `200`. The `X-Quota-*` headers are left out and the\n> body is cut short.\n\nThe same request as `GET` puts the fields in the query string:\n\n```bash\ncurl -i \"https://api.bytekit.com/v1/fetch?url=https%3A%2F%2Fexample.com%2F%3Fpage%3Dguide-demo\" \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n> This request was run for real and returned `200`.\n\nA target that answers `201` comes back as `201`. Read the body as the page, and read the headers for\neverything else.\n\n## Response headers\n\nA `200` response carries these headers:\n\n| Header | Description |\n| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `X-Fetch-ID` | Fetch identifier, prefixed `ft_` |\n| `X-Fetch-Status` | `completed` on a successful response |\n| `X-Fetch-URL` | The URL that was fetched |\n| `X-Fetch-Content-Type` | The upstream `Content-Type` |\n| `X-Fetch-Content-Length` | Size of the upstream response in bytes, as the target sent it; see `X-Fetch-Fast-Path` below for the exception. When the target compresses its responses this is the compressed size |\n| `X-Fetch-Cache` | `hit`, `miss` or `bypass` — see [Caching](#caching) |\n| `X-Fetch-Cache-Age` | On a cache hit, the age of the cached copy in seconds |\n| `X-Fetch-Duration-Ms` | How long the fetch took, in milliseconds |\n| `X-Fetch-Created-At` | ISO 8601 timestamp of when the fetch started |\n| `X-Fetch-Completed-At` | ISO 8601 timestamp of when the fetch finished |\n| `X-Fetch-Expires-At` | ISO 8601 timestamp of when the stored fetch record expires |\n| `X-Fetch-Custom` | Your `custom` payload, base64-encoded JSON. Omitted when you sent no `custom` or an empty object |\n| `X-Fetch-Waf-Vendor` | The bot-protection vendor detected on the target site, or `suspected` when a low-confidence block marker was served. Omitted when none was detected |\n| `X-Fetch-Fast-Path` | `true` or `false`; see below |\n| `X-Fetch-Credits-Charged` | `0` on the responses shown here: `/v1/fetch` is billed on bandwidth, not credits (see [Cost](#cost)) |\n| `X-Raw-Bytes` | The byte count the charge starts from (see [Cost](#cost)) |\n| `X-Billing-Multiplier` | The factor applied to `X-Raw-Bytes`: `1`, or `0.5` on a cache hit |\n| `X-Fetch-Billing-Multiplier` | The same value as `X-Billing-Multiplier`, kept for clients that read the `X-Fetch-*` family. Prefer `X-Billing-Multiplier` |\n| `X-Billable-Bytes` | What the fetch is billed: `X-Raw-Bytes` times `X-Billing-Multiplier`, rounded |\n\nThe response also carries `X-Quota-Limit`, `X-Quota-Used`, `X-Quota-Remaining` and `X-Quota-Reset`,\nwhich report your quota.\n\nWhen the target compresses its responses, your HTTP client decodes the body, so the body you read can\nbe larger than `X-Fetch-Content-Length`.\n\n`X-Fetch-Fast-Path` is `false` when the page came from the fallback path that renders it, and `true`\notherwise. In the `false` case the body is the rendered page rather than the bytes the target sent, and\n`X-Fetch-Content-Length`, `X-Raw-Bytes` and the billing headers are based on the compressed size of\nthat rendered page, not on a response from the target. A cache hit reports `true` whatever produced\nthe cached copy.\n\n## Options\n\n`GET` takes `url`, `country`, `timeout_ms` and `cache_ttl` as query parameters, and `custom` as a\nJSON-encoded string. `POST` takes the same fields as a JSON body. Only `url` is required.\n\n| Option | Default | Description |\n| ------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `url` | — | The page to fetch. Must be an HTTP or HTTPS URL |\n| `country` | `US` | Two-letter country code the request is made from |\n| `timeout_ms` | `60000` | How long to allow for the fetch, in milliseconds, from `1000` to `90000` |\n| `cache_ttl` | `48h` | How old a cached copy may be and still be served: `Nh` (hours) or `Nd` (days) up to `168h` / `7d`, or `0` to skip the cache read. See [Caching](#caching) |\n| `custom` | `{}` | A JSON object of your own, echoed back in `X-Fetch-Custom`. At most 4096 bytes once serialized as JSON |\n\nOn `GET`, `custom` goes in the query as JSON:\n\n```bash\ncurl -G \"https://api.bytekit.com/v1/fetch\" \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n --data-urlencode \"url=https://example.com\" \\\n --data-urlencode 'custom={\"job\":\"abc\"}'\n```\n\n> This request was run for real and returned `200` with `x-fetch-custom: eyJqb2IiOiJhYmMifQ==`,\n> which decodes to `{\"job\":\"abc\"}`.\n\n`custom` does not take part in caching: requests that differ only in `custom` share one cache entry.\n\n## Caching\n\nA fetch can be served from cache when a copy exists that is no older than `cache_ttl`, and\n`X-Fetch-Cache` says what happened:\n\n| `X-Fetch-Cache` | Meaning |\n| --------------- | ---------------------------------------------------------------------------------------- |\n| `miss` | No usable cached copy; the URL was fetched fresh |\n| `hit` | Served from a cached copy; `X-Fetch-Cache-Age` gives its age in seconds |\n| `bypass` | You sent `cache_ttl` of `0`, so the cache read was skipped and the URL was fetched fresh |\n\nRepeating the request above returned a cache hit, with the billing headers showing the cache-hit\nfactor (see [Cost](#cost)):\n\n```http\nHTTP/2 200\nx-billable-bytes: 167\nx-billing-multiplier: 0.5\nx-fetch-billing-multiplier: 0.5\nx-fetch-cache: hit\nx-fetch-cache-age: 0\nx-fetch-content-length: 334\nx-raw-bytes: 334\n```\n\n> This response was returned by a real request; only the cache and billing headers are shown.\n\nA `cache_ttl` above seven days is rejected with `422 validation_error`. A fresh fetch is normally\nwritten to the cache even when you send `cache_ttl` of `0`, so a later request with a non-zero\n`cache_ttl` can be served from it. A response flagged as a suspected bot-protection block is not\nwritten, and a non-2xx answer other than `404` or `410` is kept for 60 seconds only.\n\n## When to use /v1/scrape instead\n\n`/v1/fetch` takes no `format` and does not return Markdown: naming a `/v1/scrape` format returns\n`400 validation_error` and points you at `/v1/scrape`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/fetch \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"format\": \"markdown\"}'\n```\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"validation_error\",\n \"message\": \"Use /v1/scrape for this format.\",\n \"http_status\": 400,\n \"failed_at\": \"2026-10-10T02:31:11.017Z\"\n }\n}\n```\n\n> This request was run for real and returned `400`.\n\nReach for `/v1/scrape` when you need:\n\n| You need | Where it lives |\n| ------------------------------------------------ | ------------------------------------------ |\n| Markdown, links or images from the page | the `formats` option on `/v1/scrape` |\n| The page rendered in a browser before it is read | options such as `delay_ms` on `/v1/scrape` |\n| A queued scrape you collect later | the `async` option on `/v1/scrape` |\n\nSee the [Scraping guide](https://bytekit.com/docs/guides/scraping) for those options.\n\nRequests that ask `/v1/fetch` for something it does not do are turned away, with these statuses:\n\n| Request | Result |\n| ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `format` set to `raw`, `markdown`, `links` or `images`, or to a spelling `/v1/scrape` has retired | `400 validation_error`, message `Use /v1/scrape for this format.` |\n| `formats`, or `format` sent as an array | `400 validation_error`, pointing at `/v1/scrape` |\n| `cookies` or `headers` in the `POST` body | `400 validation_error`, message `cookies is no longer accepted: caller-supplied cookies and headers were removed from the capture API. Every capture presents ByteKit's own identity to the target site.` (`headers` in place of `cookies` for that field) |\n| `wait_for_selector` or `wait_until` in the `POST` body | `400 validation_error`, message `wait_for_selector is not accepted by /v1/fetch.` (`wait_until` in place of `wait_for_selector` for that field) |\n| `delay_ms` in the `POST` body | `400 validation_error`, message `Use /v1/scrape for browser-backed options.` |\n| A `format` value that `/v1/fetch` has no name for, or a field it does not know | `422 validation_error`; `error.details` names the unrecognized key |\n\nThe retired spellings that get that `400` include `rawHtml`, `raw_html`\nand `html`.\n\nEach of those five fields gets its own message, because they have different destinations. Only\n`delay_ms` is a `/v1/scrape` option, so only its message points there (see the [Scraping guide](https://bytekit.com/docs/guides/scraping)).\n`wait_for_selector` and `wait_until` belong to `/v1/screenshots` and are not accepted by `/v1/scrape`, so\ntheir message names no other endpoint. No capture endpoint accepts `cookies` or `headers`, so theirs names none either.\n\nThe `400` checks run before field validation, so a body that carries both a rejected option and an\ninvalid field gets the `400`. On `GET`, `/v1/fetch` reads `url`, `country`, `timeout_ms`, `cache_ttl`,\n`custom` and `format`. A `delay_ms` in the query string is not rejected\nthere: `GET /v1/fetch?url=…&delay_ms=500` returned `200`, where the same field in a `POST` body gets the\n`400` above.\n\n## Cost\n\n`/v1/fetch` is billed on bandwidth: the bytes counted in `X-Raw-Bytes` (the bytes the target sent, or\nthe compressed size of the rendered page when `X-Fetch-Fast-Path` is `false`), at a factor of 1\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 23398 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/fetch]"
365
+ "body": "# Fetch\n\nFetch the raw response from a URL — a working request, the X-Fetch-* headers, the options that matter, what it costs, and the errors to handle.\n\n`GET /v1/fetch` and `POST /v1/fetch` request a URL and return the target's response as the body of a\nsuccessful reply. The metadata about the fetch travels in `X-Fetch-*` response headers rather than in\na JSON envelope. The endpoint takes no `format`: for Markdown, links, images, browser rendering or\nasynchronous delivery, use `/v1/scrape` (see\n[When to use /v1/scrape instead](#when-to-use-v1scrape-instead)).\n\n## Fetch a URL\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/fetch \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com/?page=guide-demo\"}'\n```\n\nThe response is the upstream page, with ByteKit's metadata in the headers:\n\n```http\nHTTP/2 200\ncontent-type: text/html\nx-billable-bytes: 334\nx-billing-multiplier: 1\nx-fetch-billing-multiplier: 1\nx-fetch-cache: miss\nx-fetch-completed-at: 2026-10-10T02:36:27.212Z\nx-fetch-content-length: 334\nx-fetch-content-type: text/html\nx-fetch-created-at: 2026-10-10T02:36:27.181Z\nx-fetch-credits-charged: 0\nx-fetch-duration-ms: 452\nx-fetch-expires-at: 2027-10-10T02:36:27.212Z\nx-fetch-fast-path: true\nx-fetch-id: ft_8cabc1f901d879c89f62e4bd5ef80083\nx-fetch-status: completed\nx-fetch-url: https://example.com/?page=guide-demo\nx-raw-bytes: 334\n\n<!doctype html><html lang=en><head><meta charset=utf-8>…<title>Example Domain</title>…\n```\n\n> This request was run for real and returned `200`. The `X-Quota-*` headers are left out and the\n> body is cut short.\n\nThe same request as `GET` puts the fields in the query string:\n\n```bash\ncurl -i \"https://api.bytekit.com/v1/fetch?url=https%3A%2F%2Fexample.com%2F%3Fpage%3Dguide-demo\" \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n> This request was run for real and returned `200`.\n\nA target that answers `201` comes back as `201`. Read the body as the page, and read the headers for\neverything else.\n\n## Response headers\n\nA `200` response carries these headers:\n\n| Header | Description |\n| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `X-Fetch-ID` | Fetch identifier, prefixed `ft_` |\n| `X-Fetch-Status` | `completed` on a successful response |\n| `X-Fetch-URL` | The URL that was fetched |\n| `X-Fetch-Content-Type` | The upstream `Content-Type` |\n| `X-Fetch-Content-Length` | Size of the upstream response in bytes, as the target sent it; see `X-Fetch-Fast-Path` below for the exception. When the target compresses its responses this is the compressed size |\n| `X-Fetch-Cache` | `hit`, `miss` or `bypass` — see [Caching](#caching) |\n| `X-Fetch-Cache-Age` | On a cache hit, the age of the cached copy in seconds |\n| `X-Fetch-Duration-Ms` | How long the fetch took, in milliseconds |\n| `X-Fetch-Created-At` | ISO 8601 timestamp of when the fetch started |\n| `X-Fetch-Completed-At` | ISO 8601 timestamp of when the fetch finished |\n| `X-Fetch-Expires-At` | ISO 8601 timestamp of when the stored fetch record expires |\n| `X-Fetch-Custom` | Your `custom` payload, base64-encoded JSON. Omitted when you sent no `custom` or an empty object |\n| `X-Fetch-Waf-Vendor` | The bot-protection vendor detected on the target site, or `suspected` when a low-confidence block marker was served. Omitted when none was detected |\n| `X-Fetch-Fast-Path` | `true` or `false`; see below |\n| `X-Fetch-Credits-Charged` | `0` on the responses shown here: `/v1/fetch` is billed on bandwidth, not credits (see [Cost](#cost)) |\n| `X-Raw-Bytes` | The byte count the charge starts from (see [Cost](#cost)) |\n| `X-Billing-Multiplier` | The factor applied to `X-Raw-Bytes`: `1`, or `0.5` on a cache hit |\n| `X-Fetch-Billing-Multiplier` | The same value as `X-Billing-Multiplier`, kept for clients that read the `X-Fetch-*` family. Prefer `X-Billing-Multiplier` |\n| `X-Billable-Bytes` | What the fetch is billed: `X-Raw-Bytes` times `X-Billing-Multiplier`, rounded |\n\nThe response also carries `X-Quota-Limit`, `X-Quota-Used`, `X-Quota-Remaining` and `X-Quota-Reset`,\nwhich report your quota.\n\nWhen the target compresses its responses, your HTTP client decodes the body, so the body you read can\nbe larger than `X-Fetch-Content-Length`.\n\n`X-Fetch-Fast-Path` is `false` when the page came from the fallback path that renders it, and `true`\notherwise. In the `false` case the body is the rendered page rather than the bytes the target sent, and\n`X-Fetch-Content-Length`, `X-Raw-Bytes` and the billing headers are based on the compressed size of\nthat rendered page, not on a response from the target. A cache hit reports `true` whatever produced\nthe cached copy.\n\n## Options\n\n`GET` takes `url`, `country`, `timeout_ms` and `cache_ttl` as query parameters, and `custom` as a\nJSON-encoded string. `POST` takes the same fields as a JSON body. Only `url` is required.\n\n| Option | Default | Description |\n| ------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `url` | — | The page to fetch. Must be an HTTP or HTTPS URL |\n| `country` | `US` | Two-letter country code the request is made from |\n| `timeout_ms` | `60000` | How long to allow for the fetch, in milliseconds, from `1000` to `90000` |\n| `cache_ttl` | `48h` | How old a cached copy may be and still be served: `Nh` (hours) or `Nd` (days) up to `168h` / `7d`, or `0` to skip the cache read. See [Caching](#caching) |\n| `custom` | `{}` | A JSON object of your own, echoed back in `X-Fetch-Custom`. At most 4096 bytes once serialized as JSON |\n\nOn `GET`, `custom` goes in the query as JSON:\n\n```bash\ncurl -G \"https://api.bytekit.com/v1/fetch\" \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n --data-urlencode \"url=https://example.com\" \\\n --data-urlencode 'custom={\"job\":\"abc\"}'\n```\n\n> This request was run for real and returned `200` with `x-fetch-custom: eyJqb2IiOiJhYmMifQ==`,\n> which decodes to `{\"job\":\"abc\"}`.\n\n`custom` does not take part in caching: requests that differ only in `custom` share one cache entry.\n\n## Caching\n\nA fetch can be served from cache when a copy exists that is no older than `cache_ttl`, and\n`X-Fetch-Cache` says what happened:\n\n| `X-Fetch-Cache` | Meaning |\n| --------------- | ---------------------------------------------------------------------------------------- |\n| `miss` | No usable cached copy; the URL was fetched fresh |\n| `hit` | Served from a cached copy; `X-Fetch-Cache-Age` gives its age in seconds |\n| `bypass` | You sent `cache_ttl` of `0`, so the cache read was skipped and the URL was fetched fresh |\n\nRepeating the request above returned a cache hit, with the billing headers showing the cache-hit\nfactor (see [Cost](#cost)):\n\n```http\nHTTP/2 200\nx-billable-bytes: 167\nx-billing-multiplier: 0.5\nx-fetch-billing-multiplier: 0.5\nx-fetch-cache: hit\nx-fetch-cache-age: 0\nx-fetch-content-length: 334\nx-raw-bytes: 334\n```\n\n> This response was returned by a real request; only the cache and billing headers are shown.\n\nA `cache_ttl` above seven days is rejected with `422 validation_error`. A fresh fetch is normally\nwritten to the cache even when you send `cache_ttl` of `0`, so a later request with a non-zero\n`cache_ttl` can be served from it. A response flagged as a suspected bot-protection block is not\nwritten, and a non-2xx answer other than `404` or `410` is kept for 60 seconds only.\n\n## When to use /v1/scrape instead\n\n`/v1/fetch` takes no `format` and does not return Markdown: naming a `/v1/scrape` format returns\n`400 validation_error` and points you at `/v1/scrape`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/fetch \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"format\": \"markdown\"}'\n```\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"validation_error\",\n \"message\": \"Use /v1/scrape for this format.\",\n \"http_status\": 400,\n \"failed_at\": \"2026-10-10T02:31:11.017Z\"\n }\n}\n```\n\n> This request was run for real and returned `400`.\n\nReach for `/v1/scrape` when you need:\n\n| You need | Where it lives |\n| ------------------------------------------------ | ------------------------------------------ |\n| Markdown, links or images from the page | the `formats` option on `/v1/scrape` |\n| The page rendered in a browser before it is read | options such as `delay_ms` on `/v1/scrape` |\n| A queued scrape you collect later | the `async` option on `/v1/scrape` |\n\nSee the [Scraping guide](https://bytekit.com/docs/guides/scraping) for those options.\n\nRequests that ask `/v1/fetch` for something it does not do are turned away, with these statuses:\n\n| Request | Result |\n| ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `format` set to `raw`, `markdown`, `links` or `images`, or to a spelling `/v1/scrape` has retired | `400 validation_error`, message `Use /v1/scrape for this format.` |\n| `formats`, or `format` sent as an array | `400 validation_error`, pointing at `/v1/scrape` |\n| `cookies` or `headers` in the `POST` body | `400 validation_error`, message `cookies is no longer accepted: caller-supplied cookies and headers were removed from the capture API. Every capture presents ByteKit's own identity to the target site.` (`headers` in place of `cookies` for that field) |\n| `wait_for_selector` or `wait_until` in the `POST` body | `400 validation_error`, message `wait_for_selector is not accepted by /v1/fetch.` (`wait_until` in place of `wait_for_selector` for that field) |\n| `delay_ms` in the `POST` body | `400 validation_error`, message `Use /v1/scrape for browser-backed options.` |\n| A `format` value that `/v1/fetch` has no name for, or a field it does not know | `422 validation_error`; `error.details` names the unrecognized key |\n\nThe retired spellings that get that `400` include `rawHtml`, `raw_html`\nand `html`.\n\nEach of those five fields gets its own message, because they have different destinations. Only\n`delay_ms` is a `/v1/scrape` option, so only its message points there (see the [Scraping guide](https://bytekit.com/docs/guides/scraping)).\n`wait_for_selector` and `wait_until` belong to `/v1/screenshots` and are not accepted by `/v1/scrape`, so\ntheir message names no other endpoint. No capture endpoint accepts `cookies` or `headers`, so theirs names none either.\n\nThe `400` checks run before field validation, so a body that carries both a rejected option and an\ninvalid field gets the `400`. On `GET`, `/v1/fetch` reads `url`, `country`, `timeout_ms`, `cache_ttl`,\n`custom` and `format`. A `delay_ms` in the query string is not rejected\nthere: `GET /v1/fetch?url=…&delay_ms=500` returned `200`, where the same field in a `POST` body gets the\n`400` above.\n\n## Cost\n\n`/v1/fetch` is billed on bandwidth: the bytes counted in `X-Raw-Bytes` (the bytes the target sent, or\nthe compressed size of the rendered page when `X-Fetch-Fast-Path` is `false`), at a factor of 1\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 24090 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/fetch]"
366
366
  },
367
367
  "guides/monitors": {
368
368
  "title": "Monitors",
@@ -377,7 +377,7 @@
377
377
  "guides/schema-extraction": {
378
378
  "title": "Schema extraction",
379
379
  "section": "Guides",
380
- "body": "# Schema extraction\n\nTurn any page into structured JSON — a working request, the options that matter, the response, what it costs, and the errors to handle.\n\n`POST /v1/schema` fetches a URL and returns data from it as JSON that follows a\n[JSON Schema](https://json-schema.org/) you provide. Send a `url` and a `schema` describing the\nfields you want, such as a product name and price, and you get back an object with those fields\nfilled in from the page. An optional `prompt` tells the extraction what to look for.\n\nThe call is synchronous: it returns `200` with the result in the response body. There is no\nasync mode, and a field this endpoint does not know is rejected (see [Errors](#errors)).\n\n## Run an extraction\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/schema \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"price\": { \"type\": \"number\" },\n \"in_stock\": { \"type\": \"boolean\" }\n }\n },\n \"prompt\": \"Extract the book title, its price as a number, and whether it is in stock.\"\n }'\n```\n\n```json\n{\n \"data\": {\n \"title\": \"A Light in the Attic\",\n \"price\": 51.77,\n \"in_stock\": true\n },\n \"model\": \"openai/gpt-oss-20b\",\n \"validated\": true,\n \"metrics\": {\n \"scrape_ms\": 1006,\n \"llm_total_ms\": 257,\n \"input_tokens\": 977,\n \"output_tokens\": 91,\n \"retries\": 0,\n \"total_ms\": 1502\n },\n \"scrape\": {\n \"url\": \"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html\",\n \"status_code\": 200,\n \"content_length\": 2303,\n \"truncated\": false\n },\n \"warnings\": []\n}\n```\n\n> This request was run for real and returned `200`. The response is printed as it came back,\n> reformatted for reading. The page is a public practice shop for scraping; the timings and token\n> counts will differ on your calls. It was captured before `id` and `credits_used` were added to the\n> response, so neither appears here.\n\n## Options\n\n`url` and `schema` are required. Send any of the others alongside them.\n\n| Option | Default | Description |\n| ------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------- |\n| `url` | — | The page to extract from. An `http` or `https` URL |\n| `schema` | — | A JSON Schema describing the output (see [Writing the schema](#writing-the-schema)) |\n| `prompt` | none | A hint in plain language about what to extract, up to 2000 characters |\n| `model` | `openai/gpt-oss-20b` | The extraction model: `openai/gpt-oss-20b` or `openai/gpt-oss-120b`. Any other value is rejected with `400 unsupported_model` |\n| `country` | `US` | Two-letter country code that sets where the page is fetched from, upper-cased for you. `null` is treated as `US` |\n| `language` | `null` | A string or `null`. The API accepts it, but the extraction does not use it today |\n| `wait_until` | `load` | `load` or `domcontentloaded`. `networkidle` is rejected (see [Rendering options](#rendering-options)) |\n| `wait_for_selector` | `null` | Must stay unset or `null` (see [Rendering options](#rendering-options)) |\n| `delay_ms` | `0` | Must stay `0` (see [Rendering options](#rendering-options)). A value outside `0`–`10000` is a `422 validation_error` |\n\n### Rendering options\n\n`/v1/schema` reads the page the quick way, without waiting on a browser to render it. Options\nthat ask for that waiting are therefore refused with `400 unsupported_option`:\n`wait_until` set to `networkidle`, a `wait_for_selector`, or a `delay_ms` above `0`. The error\nmessage lists the options this endpoint does not support; it does not say which of yours\ntriggered it.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"unsupported_option\",\n \"message\": \"Schema extraction does not support slow-path options (wait_for_selector, wait_until=networkidle, cookies, delay_ms, custom headers).\",\n \"http_status\": 400,\n \"failed_at\": \"2026-10-09T23:17:40.806Z\"\n }\n}\n```\n\n> This response came from a real request with `\"wait_until\": \"networkidle\"`.\n\nCaller-supplied `cookies` and `headers` are no longer accepted: sending either returns\n`400 validation_error`.\n\n### Writing the schema\n\nThe `schema` is a JSON Schema (draft 2020-12) object. To keep the output reliable, ByteKit\naccepts a deliberately small part of the language:\n\n- The root must be an object schema: `\"type\": \"object\"` with its `properties`.\n- These keywords are accepted: `type`, `properties`, `required`,\n `additionalProperties`, `items`, `enum`, `$defs`, `$ref`, `description`, `title` and\n `default`. A `$ref` can only point into your own `#/$defs`.\n- Other keywords are rejected with `422 schema_incompatible`, and `error.details.construct`\n names the one found. They include `pattern`, `format`, `minimum`, `maxLength`, `oneOf`, `anyOf`,\n `allOf`, `not` and `if`/`then`/`else`.\n- The schema can be at most 50,000 characters once serialized, and nested `properties` can go\n at most 8 levels deep (the count restarts inside `items`, and `$defs` entries are not counted). A schema over either\n limit, or one that is not valid JSON Schema, returns `422 validation_error`.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"schema_incompatible\",\n \"message\": \"schema_incompatible: unsupported construct \\\"pattern\\\" — unsupported keyword \\\"pattern\\\" found at #/properties/title\",\n \"http_status\": 422,\n \"failed_at\": \"2026-10-09T23:17:43.923Z\",\n \"details\": {\n \"construct\": \"pattern\"\n }\n }\n}\n```\n\n> This response came from a real request whose schema used `pattern`.\n\nEvery property you declare is asked for. What a missing value looks like depends on the\nproperty's type: a `string`, `number`, `integer`, `boolean` or `object` property the page does not\ncontain usually comes back as `null`, and a list (`array`) property usually comes back as an empty\narray, `[]`. Asking the book page above for an `isbn` it does not show returned `\"isbn\": null`.\nAsking it for a `title` and a list of literary awards, declared as an `array` of `string` items,\nreturned `\"awards\": []`. Both responses had `validated` set to `true`.\n\nA property limited by `enum`, such as `{\"type\": \"string\", \"enum\": [\"hardcover\", \"paperback\"]}`,\ncomes back as `null` when the page holds none of the listed values. The `type` is optional: an\n`enum` with no `type` behaves the same way. Your `enum` does not need to list `null`. Asking the\nbook page above for that `format` next to a `title` returned `\"format\": null` with `validated` set\nto `true`; asked for on its own, the same request returned `200` with `validated` set to `false`\nand an `empty_extraction` warning, which charges no credits. A model can also answer with one of the\nlisted values that the page does not support, so treat an `enum` result as a guess when the page is\nsilent. An `integer` property with `\"enum\": [1, 2]` returned `2` on a page that states no edition.\n\nOne kind of schema can instead fail with `503 provider_error` when the page has no value to give: a\nschema whose only properties are lists of strings, such as\n`{\"type\": \"object\", \"properties\": {\"awards\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}}}}`,\nwhen the page has no entries. The same schema returned `\"awards\": []` on one call and\n`503 provider_error` on others, so it does not fail every time. The `title` and `awards` request\nabove, which asks for a `title` as well, returned `[]`.\n\nThis failure can repeat on retry, and it keeps the page's bandwidth charge (see\n[Cost](#cost)), so change the schema instead of retrying the same request.\n\nLists work through `items`. This schema collects every book on a category page:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/schema \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://books.toscrape.com/catalogue/category/books/poetry_23/index.html\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"category\": { \"type\": \"string\" },\n \"books\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"price\": { \"type\": \"number\" }\n }\n }\n }\n }\n },\n \"prompt\": \"List every book on the page with its price as a number.\"\n }'\n```\n\n> This request was run for real and returned `200` with `\"validated\": true` and 19 books in\n> `data.books`. Its `scrape.content_length` was `4521`. The first two books were:\n> `{\"title\": \"A Light in the Attic\", \"price\": 51.77}` and\n> `{\"title\": \"The Black Maria\", \"price\": 52.15}`.\n\n## Response\n\n| Field | Description |\n| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | The request's ID, starting `sch_`. It is the same ID the request carries in the Logs feed |\n| `data` | The extracted object, shaped by your schema. `null` when `validated` is `false` |\n| `model` | The model that produced the result |\n| `validated` | `true` when the output matched your schema, unless it holds values and all of them are `null`. See below for when this is `false` |\n| `metrics` | Timings in milliseconds (`scrape_ms`, `llm_total_ms`, `total_ms`), the token counts (`input_tokens`, `output_tokens`) and `retries`, the number of extra attempts (0 to 2) |\n| `scrape` | The page that was read: its `url`, the `status_code` it answered with (or `null`), `content_length` (its size in bytes, which the bandwidth charge uses) and `truncated` |\n| `warnings` | Codes for results that are less complete than a clean run. An empty array on a clean run |\n| `credits_used` | The credits charged for this request: 10 when `validated` is `true`, 0 otherwise. Bandwidth is billed separately, on `scrape.content_length` |\n\nA `200` does not always mean you got data. `validated` is `false`, with `data: null`, when the\nmodel refused, when its retries ran out before it produced output that matched your schema, or\nwhen the output holds values and every one of them is `null`. That last case is still `true` if your\nschema allows it: each `null` value has to sit at a property whose `type` is a list that includes\n`\"null\"`, for example `[\"string\", \"null\"]`. Check `validated` before you use `data`.\n\n```json\n{\n \"data\": null,\n \"model\": \"openai/gpt-oss-20b\",\n \"validated\": false,\n \"metrics\": {\n \"scrape_ms\": 1455,\n \"llm_total_ms\": 220,\n \"input_tokens\": 303,\n \"output_tokens\": 102,\n \"retries\": 0,\n \"total_ms\": 1711\n },\n \"scrape\": {\n \"url\": \"https://example.com\",\n \"status_code\": 200,\n \"content_length\": 334,\n \"truncated\": false\n },\n \"warnings\": [\"empty_extraction\"]\n}\n```\n\n> This response came from a real request that asked `https://example.com`, which has no price,\n> for a `price` and a `sku`. It was captured before `id` and `credits_used` were added to the\n> response, so neither appears here.\n\nThe warning codes are:\n\n| Code | Meaning |\n| --------------------------- | -------------------------------------------------------------------------------------- |\n| `content_truncated` | The page was too long for the model and was cut short, so the result may be incomplete |\n| `extract_validation_failed` | The model's output did not match your schema |\n| `exhausted_retries` | The retries ran out before the model produced output that matched your schema |\n| `model_refusal` | The model declined to extract |\n| `empty_extraction` | The output matched your schema, but it held values and all of them were `null` |\n\n## Cost\n\nA request is billed on two things:\n\n- **A fixed credit charge.** Today a request costs 10 credits, whatever the page or the schema, and they are charged only when the extraction validates. The `200` response reports what was charged in `credits_used`: 10 when `validated` is `true`, 0 otherwise.\n- **The page's bandwidth.** The page is billed at the bytes it took to download, which is the\n `scrape.content_length` in the response, with no multiplier. While the page loads the account is\n charged an estimate of 100 KiB; when the download finishes the estimate is replaced by the real\n size.\n\nWhen a request fails, what you keep paying depends on how far it got:\n\n| What happened | Credits | Bandwidth |\n| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | ----------------------------- |\n| Rejected or failed before the page was fetched | Not charged, or refunded | Not charged, or refunded |\n| The page was fetched, but the extraction failed (`provider_error`, `provider_timeout`, `provider_rate_limited`, `content_too_large`, or `schema_incompatible` raised after the fetch) | Refunded | Kept: the page was downloaded |\n| The page was fetched and the call returned `200` with `validated: false` | Not charged | Kept: the page was downloaded |\n| A successful extraction | Charged | Charged |\n\n[Credit billing](https://bytekit.com/docs/billing/credits) covers the two charges and a failure before the fetch, and\n[Rate Limits](https://bytekit.com/docs/guides/rate-limits) covers a failed extraction after it. On real requests,\n`credits_scrape` on `GET /v1/usage` rose by 10 after a successful extraction and did not move after\nthe `validated: false` call or a request for a host that does not exist.\n\n> The credits for this endpoint appear in `credits_scrape` on `GET /v1/usage`.\n\n## Not in the SDKs\n\n`/v1/schema` is not available in the TypeScript SDK, the Python SDK or the CLI: none of \n\n---\n[Truncated to the 16384-byte per-page limit — this page is 24745 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/schema-extraction]"
380
+ "body": "# Schema extraction\n\nTurn any page into structured JSON — a working request, the options that matter, the response, what it costs, and the errors to handle.\n\n`POST /v1/schema` fetches a URL and returns data from it as JSON that follows a\n[JSON Schema](https://json-schema.org/) you provide. Send a `url` and a `schema` describing the\nfields you want, such as a product name and price, and you get back an object with those fields\nfilled in from the page. An optional `prompt` tells the extraction what to look for.\n\nThe call is synchronous: it returns `200` with the result in the response body. There is no\nasync mode, and a field this endpoint does not know is rejected (see [Errors](#errors)).\n\n## Run an extraction\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/schema \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"price\": { \"type\": \"number\" },\n \"in_stock\": { \"type\": \"boolean\" }\n }\n },\n \"prompt\": \"Extract the book title, its price as a number, and whether it is in stock.\"\n }'\n```\n\n```json\n{\n \"data\": {\n \"title\": \"A Light in the Attic\",\n \"price\": 51.77,\n \"in_stock\": true\n },\n \"model\": \"openai/gpt-oss-20b\",\n \"validated\": true,\n \"metrics\": {\n \"scrape_ms\": 1006,\n \"llm_total_ms\": 257,\n \"input_tokens\": 977,\n \"output_tokens\": 91,\n \"retries\": 0,\n \"total_ms\": 1502\n },\n \"scrape\": {\n \"url\": \"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html\",\n \"status_code\": 200,\n \"content_length\": 2303,\n \"truncated\": false\n },\n \"warnings\": []\n}\n```\n\n> This request was run for real and returned `200`. The response is printed as it came back,\n> reformatted for reading. The page is a public practice shop for scraping; the timings and token\n> counts will differ on your calls. It was captured before `id` and `credits_used` were added to the\n> response, so neither appears here.\n\n## Options\n\n`url` and `schema` are required. Send any of the others alongside them.\n\n| Option | Default | Description |\n| ------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------- |\n| `url` | — | The page to extract from. An `http` or `https` URL |\n| `schema` | — | A JSON Schema describing the output (see [Writing the schema](#writing-the-schema)) |\n| `prompt` | none | A hint in plain language about what to extract, up to 2000 characters |\n| `model` | `openai/gpt-oss-20b` | The extraction model: `openai/gpt-oss-20b` or `openai/gpt-oss-120b`. Any other value is rejected with `400 unsupported_model` |\n| `country` | `US` | Two-letter country code that sets where the page is fetched from, upper-cased for you. `null` is treated as `US` |\n| `language` | `null` | A string or `null`. The API accepts it, but the extraction does not use it today |\n| `wait_until` | `load` | `load` or `domcontentloaded`. `networkidle` is rejected (see [Rendering options](#rendering-options)) |\n| `wait_for_selector` | `null` | Must stay unset or `null` (see [Rendering options](#rendering-options)) |\n| `delay_ms` | `0` | Must stay `0` (see [Rendering options](#rendering-options)). A value outside `0`–`10000` is a `422 validation_error` |\n\n### Rendering options\n\n`/v1/schema` reads the page the quick way, without waiting on a browser to render it. Options\nthat ask for that waiting are therefore refused with `400 unsupported_option`:\n`wait_until` set to `networkidle`, a `wait_for_selector`, or a `delay_ms` above `0`. The error\nmessage lists the options this endpoint does not support; it does not say which of yours\ntriggered it.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"unsupported_option\",\n \"message\": \"Schema extraction does not support slow-path options (wait_for_selector, wait_until=networkidle, cookies, delay_ms, custom headers).\",\n \"http_status\": 400,\n \"failed_at\": \"2026-10-09T23:17:40.806Z\"\n }\n}\n```\n\n> This response came from a real request with `\"wait_until\": \"networkidle\"`.\n\nCaller-supplied `cookies` and `headers` are no longer accepted: sending either returns\n`400 validation_error`.\n\n### Writing the schema\n\nThe `schema` is a JSON Schema (draft 2020-12) object. To keep the output reliable, ByteKit\naccepts a deliberately small part of the language:\n\n- The root must be an object schema: `\"type\": \"object\"` with its `properties`.\n- These keywords are accepted: `type`, `properties`, `required`,\n `additionalProperties`, `items`, `enum`, `$defs`, `$ref`, `description`, `title` and\n `default`. A `$ref` can only point into your own `#/$defs`.\n- Other keywords are rejected with `422 schema_incompatible`, and `error.details.construct`\n names the one found. They include `pattern`, `format`, `minimum`, `maxLength`, `oneOf`, `anyOf`,\n `allOf`, `not` and `if`/`then`/`else`.\n- The schema can be at most 50,000 characters once serialized, and nested `properties` can go\n at most 8 levels deep (the count restarts inside `items`, and `$defs` entries are not counted). A schema over either\n limit, or one that is not valid JSON Schema, returns `422 validation_error`.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"schema_incompatible\",\n \"message\": \"schema_incompatible: unsupported construct \\\"pattern\\\" — unsupported keyword \\\"pattern\\\" found at #/properties/title\",\n \"http_status\": 422,\n \"failed_at\": \"2026-10-09T23:17:43.923Z\",\n \"details\": {\n \"construct\": \"pattern\"\n }\n }\n}\n```\n\n> This response came from a real request whose schema used `pattern`.\n\nEvery property you declare is asked for. What a missing value looks like depends on the\nproperty's type: a `string`, `number`, `integer`, `boolean` or `object` property the page does not\ncontain usually comes back as `null`, and a list (`array`) property usually comes back as an empty\narray, `[]`. Asking the book page above for an `isbn` it does not show returned `\"isbn\": null`.\nAsking it for a `title` and a list of literary awards, declared as an `array` of `string` items,\nreturned `\"awards\": []`. Both responses had `validated` set to `true`.\n\nA property limited by `enum`, such as `{\"type\": \"string\", \"enum\": [\"hardcover\", \"paperback\"]}`,\ncomes back as `null` when the page holds none of the listed values. The `type` is optional: an\n`enum` with no `type` behaves the same way. Your `enum` does not need to list `null`. Asking the\nbook page above for that `format` next to a `title` returned `\"format\": null` with `validated` set\nto `true`; asked for on its own, the same request returned `200` with `validated` set to `false`\nand an `empty_extraction` warning, which charges no credits. A model can also answer with one of the\nlisted values that the page does not support, so treat an `enum` result as a guess when the page is\nsilent. An `integer` property with `\"enum\": [1, 2]` returned `2` on a page that states no edition.\n\nOne kind of schema can instead fail with `503 provider_error` when the page has no value to give: a\nschema whose only properties are lists of strings, such as\n`{\"type\": \"object\", \"properties\": {\"awards\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}}}}`,\nwhen the page has no entries. The same schema returned `\"awards\": []` on one call and\n`503 provider_error` on others, so it does not fail every time. The `title` and `awards` request\nabove, which asks for a `title` as well, returned `[]`.\n\nThis failure can repeat on retry, and it keeps the page's bandwidth charge (see\n[Cost](#cost)), so change the schema instead of retrying the same request.\n\nLists work through `items`. This schema collects every book on a category page:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/schema \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://books.toscrape.com/catalogue/category/books/poetry_23/index.html\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"category\": { \"type\": \"string\" },\n \"books\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"price\": { \"type\": \"number\" }\n }\n }\n }\n }\n },\n \"prompt\": \"List every book on the page with its price as a number.\"\n }'\n```\n\n> This request was run for real and returned `200` with `\"validated\": true` and 19 books in\n> `data.books`. Its `scrape.content_length` was `4521`. The first two books were:\n> `{\"title\": \"A Light in the Attic\", \"price\": 51.77}` and\n> `{\"title\": \"The Black Maria\", \"price\": 52.15}`.\n\n## Response\n\n| Field | Description |\n| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | The request's ID, starting `sch_`. It is the same ID the request carries in the Logs feed |\n| `data` | The extracted object, shaped by your schema. `null` when `validated` is `false` |\n| `model` | The model that produced the result |\n| `validated` | `true` when the output matched your schema, unless it holds values and all of them are `null`. See below for when this is `false` |\n| `metrics` | Timings in milliseconds (`scrape_ms`, `llm_total_ms`, `total_ms`), the token counts (`input_tokens`, `output_tokens`) and `retries`, the number of extra attempts (0 to 2) |\n| `scrape` | The page that was read: its `url`, the `status_code` it answered with (or `null`), `content_length` (its size in bytes, which the bandwidth charge uses) and `truncated` |\n| `warnings` | Codes for results that are less complete than a clean run. An empty array on a clean run |\n| `credits_used` | The credits charged for this request: 10 when `validated` is `true`, 0 otherwise. Bandwidth is billed separately, on `scrape.content_length` |\n\nA `200` does not always mean you got data. `validated` is `false`, with `data: null`, when the\nmodel refused, when its retries ran out before it produced output that matched your schema, or\nwhen the output holds values and every one of them is `null`. That last case is still `true` if your\nschema allows it: each `null` value has to sit at a property whose `type` is a list that includes\n`\"null\"`, for example `[\"string\", \"null\"]`. Check `validated` before you use `data`.\n\n```json\n{\n \"data\": null,\n \"model\": \"openai/gpt-oss-20b\",\n \"validated\": false,\n \"metrics\": {\n \"scrape_ms\": 1455,\n \"llm_total_ms\": 220,\n \"input_tokens\": 303,\n \"output_tokens\": 102,\n \"retries\": 0,\n \"total_ms\": 1711\n },\n \"scrape\": {\n \"url\": \"https://example.com\",\n \"status_code\": 200,\n \"content_length\": 334,\n \"truncated\": false\n },\n \"warnings\": [\"empty_extraction\"]\n}\n```\n\n> This response came from a real request that asked `https://example.com`, which has no price,\n> for a `price` and a `sku`. It was captured before `id` and `credits_used` were added to the\n> response, so neither appears here.\n\nThe warning codes are:\n\n| Code | Meaning |\n| --------------------------- | -------------------------------------------------------------------------------------- |\n| `content_truncated` | The page was too long for the model and was cut short, so the result may be incomplete |\n| `extract_validation_failed` | The model's output did not match your schema |\n| `exhausted_retries` | The retries ran out before the model produced output that matched your schema |\n| `model_refusal` | The model declined to extract |\n| `empty_extraction` | The output matched your schema, but it held values and all of them were `null` |\n\n## Cost\n\nA request is billed on two things:\n\n- **A fixed credit charge.** Today a request costs 10 credits, whatever the page or the schema, and they are charged only when the extraction validates. The `200` response reports what was charged in `credits_used`: 10 when `validated` is `true`, 0 otherwise.\n- **The page's bandwidth.** The page is billed at the bytes it took to download, which is the\n `scrape.content_length` in the response, with no multiplier. While the page loads the account is\n charged an estimate of 100 KiB; when the download finishes the estimate is replaced by the real\n size.\n\nWhen a request fails, what you keep paying depends on how far it got:\n\n| What happened | Credits | Bandwidth |\n| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | ----------------------------- |\n| Rejected or failed before the page was fetched | Not charged, or refunded | Not charged, or refunded |\n| The page was fetched, but the extraction failed (`provider_error`, `provider_timeout`, `provider_rate_limited`, `content_too_large`, or `schema_incompatible` raised after the fetch) | Refunded | Kept: the page was downloaded |\n| The page was fetched and the call returned `200` with `validated: false` | Not charged | Kept: the page was downloaded |\n| A successful extraction | Charged | Charged |\n\n[Credit billing](https://bytekit.com/docs/billing/credits) covers the two charges and a failure before the fetch, and\n[Rate Limits](https://bytekit.com/docs/guides/rate-limits) covers a failed extraction after it. On real requests,\n`credits_scrape` on `GET /v1/usage` rose by 10 after a successful extraction and did not move after\nthe `validated: false` call or a request for a host that does not exist.\n\n> The credits for this endpoint appear in `credits_scrape` on `GET /v1/usage`.\n\n## Not in the SDKs\n\n`/v1/schema` is not available in the TypeScript SDK, the Python SDK or the CLI: none of \n\n---\n[Truncated to the 16384-byte per-page limit — this page is 25473 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/schema-extraction]"
381
381
  },
382
382
  "guides/scraping": {
383
383
  "title": "Scraping",
@@ -387,7 +387,7 @@
387
387
  "guides/screenshots": {
388
388
  "title": "Screenshots",
389
389
  "section": "Guides",
390
- "body": "# Screenshots\n\nCapture a screenshot of any URL — a working request, the options that matter, the response, what it costs, and the errors to handle.\n\n`POST /v1/screenshots` loads a URL in a real browser and returns an image of the page. Send a\nURL and you get back a `jpeg` (the default) or `png`, plus the page title and the image\ndimensions. Everything else — device, viewport, how long to wait, what to hide — is optional.\n\n## Capture a screenshot\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/screenshots \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\nBy default the call is **synchronous**: the request is held open for up to 28 seconds and\nreturns `200` with the finished screenshot. The response is JSON — `image_url` is a link to the\nimage, not the image bytes:\n\n```json\n{\n \"id\": \"ss_01a1210c210477f6838a6256629087e6\",\n \"status\": \"completed\",\n \"url\": \"https://example.com\",\n \"image_url\": \"https://<storage-host>/.../screenshot.jpeg?X-Amz-Signature=...\",\n \"page_title\": \"Example Domain\",\n \"image_width\": 1440,\n \"image_height\": 900,\n \"file_size_bytes\": 62635,\n \"credits_charged\": 1,\n \"billing\": {\n \"raw_bytes\": 334,\n \"factors\": [\n {\n \"name\": \"phase1_render\",\n \"value\": 1.5,\n \"reason\": \"phase 1 proxy fetch + render overhead\"\n }\n ],\n \"multiplier\": 1.5,\n \"billed_bytes\": 501\n },\n \"error_code\": null,\n \"error_message\": null,\n \"created_at\": \"2026-10-09T14:23:25.417Z\",\n \"completed_at\": \"2026-10-09T14:23:33.047Z\",\n \"expires_at\": \"2027-10-09T14:23:25.407Z\",\n \"poll_url\": \"https://api.bytekit.com/v1/screenshots/ss_01a1210c210477f6838a6256629087e6\"\n}\n```\n\n> This response was returned by a real request. Two values are edited for the page: the signed `image_url` is shortened, and `poll_url` shows the production\n> host.\n\n| Field | Description |\n| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | Screenshot id, prefixed `ss_`. Use it with `GET /v1/screenshots/{id}` |\n| `status` | `pending`, `processing`, `completed`, or `failed` |\n| `image_url` | Signed link to the image. It stays valid for 10 minutes — fetch a fresh one by polling `GET /v1/screenshots/{id}` |\n| `page_title` | The page's `<title>` |\n| `image_width`, `image_height` | Image dimensions in pixels |\n| `file_size_bytes` | Size of the image file. Informational only — it is not what you are billed on (see [Cost](#cost)) |\n| `billing` | What the capture was billed: `raw_bytes`, the `factors` applied, the resulting `multiplier`, and `billed_bytes` |\n| `error_code`, `error_message` | Why a capture failed. `null` on success. On `pending` or `processing`, a set value is the last failed attempt's error while the capture is retried; on `failed`, it is the final cause |\n| `expires_at` | When the stored image expires |\n| `poll_url` | Where to poll this screenshot |\n\nThe `200` response also carries `X-Screenshot-*` headers (the same id, status and timestamps as\nthe JSON) and `X-Quota-*` headers reporting your quota.\n\nIf the capture is still running when the 28 seconds are up, the call returns `202` with\n`status: \"processing\"` and the same `id`. The capture keeps running in the background — poll it\nas described in [Async captures](#async-captures).\n\n## Options\n\nSend any of these alongside `url`. All are optional and the defaults suit most pages. Unknown\nfields are rejected with `422 validation_error`.\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/screenshots \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"format\": \"png\",\n \"viewport\": {\"width\": 1280, \"height\": 720},\n \"dark_mode\": true,\n \"wait_until\": \"networkidle\"\n }'\n```\n\n> This request was run for real and returned `200` with\n> `\"image_width\": 1280` and `\"image_height\": 720`.\n\n**Output**\n\n| Option | Default | Description |\n| --------------------- | ------- | -------------------------------------------------------------------------------------------------------------------- |\n| `format` | `jpeg` | Image format: `jpeg` or `png` |\n| `quality` | `80` | Image quality, an integer from `1` to `100` |\n| `full_page` | `false` | Capture the whole scrollable page instead of only the viewport |\n| `clip` | `null` | Capture only a region: `{\"x\": 0, \"y\": 0, \"width\": 800, \"height\": 600}` in pixels (`width` and `height` at least `1`) |\n| `device_scale_factor` | `null` | Pixel density: `1` or `null`; any other value is a 422 `validation_error` |\n\n**Device**\n\n| Option | Default | Description |\n| ----------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `device` | `desktop` | `desktop` or `mobile` |\n| `viewport` | `null` | Browser window size, `{\"width\": 1280, \"height\": 720}` in pixels. Overrides the device default. Width 360 to 2544, height 1 to 1297; any other size is a 422 `validation_error` |\n| `dark_mode` | `false` | Render the page with a dark colour scheme preference |\n\n**Page readiness**\n\n| Option | Default | Description |\n| ------------------- | ------- | ------------------------------------------------------------------------------ |\n| `wait_until` | `load` | Navigation event to wait for: `load`, `domcontentloaded`, or `networkidle` |\n| `wait_for_selector` | `null` | CSS selector that must be visible before the capture is taken |\n| `delay_ms` | `0` | Extra wait after the page is ready, in milliseconds (`0` to `10000`) |\n| `scroll` | `true` | Scroll the page to the bottom before capturing, so lazy-loaded content appears |\n\n`wait_until` and `wait_for_selector` are Screenshot options. They are not `POST /v1/scrape`\noptions — sending either there returns `422`. See the [Scraping guide](https://bytekit.com/docs/guides/scraping).\n\n**Clean-up**\n\n| Option | Default | Description |\n| ---------------------- | ------- | --------------------------- |\n| `block_ads` | `true` | Block ads on the page |\n| `block_cookie_banners` | `true` | Hide cookie-consent banners |\n\n**Geo and language**\n\n| Option | Default | Description |\n| ---------- | ------- | ---------------------------------------------------------------------------------- |\n| `country` | `US` | Two-letter, upper-case country code the page is requested from |\n| `language` | `null` | Browser language, for example `de-DE`. When `null`, the language follows `country` |\n\n**Other**\n\n| Option | Default | Description |\n| -------------- | ------- | ----------------------------------------------------------------------------------------------------------- |\n| `include_html` | `false` | Also capture the page's rendered HTML alongside the image. The HTML is not returned in the response |\n| `metadata` | `{}` | Your own key-value pairs to attach to the capture. At most 4096 bytes as JSON; keys must not start with `_` |\n\n`cookies` and `headers` are not request options on any capture endpoint. Sending either returns\n`400 validation_error`.\n\n## Async captures\n\nFor pages that take a while, add `?async=true` to the URL, or send `\"async\": true` in the request\nbody. Either one is enough, and `false` in one never cancels `true` in the other. The call returns\n`202` immediately with an `ss_` id and `status: \"pending\"`, and the capture runs in the background.\n`POST /v1/scrape` accepts the same two spellings.\n\n```bash\n# Start an async capture\ncurl -X POST \"https://api.bytekit.com/v1/screenshots?async=true\" \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n\n# Poll for the result\ncurl https://api.bytekit.com/v1/screenshots/ss_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\nThe first call returns:\n\n```json\n{\n \"id\": \"ss_01a1210d0e3a719589e9c3d70c4791d2\",\n \"status\": \"pending\",\n \"url\": \"https://example.com\",\n \"image_url\": null,\n \"page_title\": null,\n \"image_width\": null,\n \"image_height\": null,\n \"file_size_bytes\": null,\n \"credits_charged\": 1,\n \"error_code\": null,\n \"error_message\": null,\n \"created_at\": \"2026-10-09T14:24:26.172Z\",\n \"completed_at\": null,\n \"expires_at\": \"2027-10-09T14:24:26.149Z\",\n \"poll_url\": \"https://api.bytekit.com/v1/screenshots/ss_01a1210d0e3a719589e9c3d70c4791d2\"\n}\n```\n\n> This response was returned by a real request; `poll_url` shows the production host.\n\n`GET /v1/screenshots/{id}` answers by state:\n\n| State | Status | Body |\n| ------------------------------- | ------ | ---------------------------------------------------------------------- |\n| Still `pending` or `processing` | `202` | The screenshot resource; poll again |\n| `completed` | `200` | The full screenshot resource, with a fresh signed `image_url` |\n| `failed` | `200` | The [error envelope](https://bytekit.com/docs/guides/errors), with the failure in `error.code` |\n\nA failed capture is a successfully retrieved terminal state, so check `status` before reading\n`image_url`.\n\n## Pages that are not HTML\n\nA URL that serves text-like content — plain text, JSON, XML — is captured as the browser displays\nit and billed as usual. A URL that serves anything else, such as an image, a PDF or binary data,\nfails with `unsupported_content_type` on its first attempt, is not retried, and bills nothing.\n\n## Cost\n\nScreenshots are billed on bandwidth, not credits. A capture is billed on the bytes of the\ninitial page fetch, multiplied by 1.5 — the extra 0.5 covers rendering the page. The size of the\nimage file is not the basis. If that initial fetch is skipped or fails, the capture bills nothing.\n\nIn the example above, the page fetch transferred 334 bytes (`raw_bytes`), so the capture was\nbilled 501 bytes (`billed_bytes`). The `billing` object is the authoritative breakdown; its\n`factors[].reason` text is descriptive and may change, so read `value` and `multiplier` rather\nthan parsing it. The same figures arrive in the `X-Raw-Bytes`, `X-Billing-Multiplier`, and\n`X-Billable-Bytes` response headers.\n\nThe `credits_charged` field and the `X-Screenshot-Credits-Charged` header carry a legacy weight\n(`1`, `2` or `4`, doubling for `full_page` and again for mobile). It is recorded for\nreporting only and is not what you are billed. For how capture bandwidth is billed,\nsee [Bandwidth billing](https://bytekit.com/docs/billing/bandwidth).\n\n## Errors\n\nErrors use the unified envelope described in the [Errors guide](https://bytekit.com/docs/guides/errors). These are the\nones you are most likely to meet on this endpoint:\n\n| Status | Code | When | Retry? |\n| ------ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------ |\n| `400` | `invalid_url` | `url` is not a valid HTTP(S) URL. `error.details.reason` says why, for example `scheme_unsupported` | No — fix the URL |\n| `400` | `request_too_large` | The request body is over 512 KB | No — send a smaller body |\n| `401` | `unauthorized`, `invalid_api_key` | The API key is missing, malformed, or not valid | No — check your key |\n| `400` | `validation_error` | The request carries a removed field such as `cookies` or `headers` | No — remove the field |\n| `402` | `quota_exceeded` | The balance cannot fund the capture. `error.details.required_bytes` and `available_bytes` give the numbers | No — add balance or upgrade |\n| `402` | `spending_cap_reached`, `billing_entitlement_impaired`, `billing_entitlement_expired` | The spending cap or the subscription state blocks the request — see the [Errors guide](https://bytekit.com/docs/guides/errors) | No — resolve the billing state first |\n| `403` | `host_forbidden`, `path_forbidden` | The URL's host \n\n---\n[Truncated to the 16384-byte per-page limit — this page is 19126 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/screenshots]"
390
+ "body": "# Screenshots\n\nCapture a screenshot of any URL — a working request, the options that matter, the response, what it costs, and the errors to handle.\n\n`POST /v1/screenshots` loads a URL in a real browser and returns an image of the page. Send a\nURL and you get back a `jpeg` (the default) or `png`, plus the page title and the image\ndimensions. Everything else — device, viewport, how long to wait, what to hide — is optional.\n\n## Capture a screenshot\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/screenshots \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\nBy default the call is **synchronous**: the request is held open for up to 28 seconds and\nreturns `200` with the finished screenshot. The response is JSON — `image_url` is a link to the\nimage, not the image bytes:\n\n```json\n{\n \"id\": \"ss_01a1210c210477f6838a6256629087e6\",\n \"status\": \"completed\",\n \"url\": \"https://example.com\",\n \"image_url\": \"https://<storage-host>/.../screenshot.jpeg?X-Amz-Signature=...\",\n \"page_title\": \"Example Domain\",\n \"image_width\": 1440,\n \"image_height\": 900,\n \"file_size_bytes\": 62635,\n \"credits_charged\": 1,\n \"billing\": {\n \"raw_bytes\": 334,\n \"factors\": [\n {\n \"name\": \"phase1_render\",\n \"value\": 1.5,\n \"reason\": \"phase 1 proxy fetch + render overhead\"\n }\n ],\n \"multiplier\": 1.5,\n \"billed_bytes\": 501\n },\n \"error_code\": null,\n \"error_message\": null,\n \"created_at\": \"2026-10-09T14:23:25.417Z\",\n \"completed_at\": \"2026-10-09T14:23:33.047Z\",\n \"expires_at\": \"2027-10-09T14:23:25.407Z\",\n \"poll_url\": \"https://api.bytekit.com/v1/screenshots/ss_01a1210c210477f6838a6256629087e6\"\n}\n```\n\n> This response was returned by a real request. Two values are edited for the page: the signed `image_url` is shortened, and `poll_url` shows the production\n> host.\n\n| Field | Description |\n| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | Screenshot id, prefixed `ss_`. Use it with `GET /v1/screenshots/{id}` |\n| `status` | `pending`, `processing`, `completed`, or `failed` |\n| `image_url` | Signed link to the image. It stays valid for 10 minutes — fetch a fresh one by polling `GET /v1/screenshots/{id}` |\n| `page_title` | The page's `<title>` |\n| `image_width`, `image_height` | Image dimensions in pixels |\n| `file_size_bytes` | Size of the image file. Informational only — it is not what you are billed on (see [Cost](#cost)) |\n| `billing` | What the capture was billed: `raw_bytes`, the `factors` applied, the resulting `multiplier`, and `billed_bytes` |\n| `error_code`, `error_message` | Why a capture failed. `null` on success. On `pending` or `processing`, a set value is the last failed attempt's error while the capture is retried; on `failed`, it is the final cause |\n| `expires_at` | When the stored image expires |\n| `poll_url` | Where to poll this screenshot |\n\nThe `200` response also carries `X-Screenshot-*` headers (the same id, status and timestamps as\nthe JSON) and `X-Quota-*` headers reporting your quota.\n\nIf the capture is still running when the 28 seconds are up, the call returns `202` with\n`status: \"processing\"` and the same `id`. The capture keeps running in the background — poll it\nas described in [Async captures](#async-captures).\n\n## Options\n\nSend any of these alongside `url`. All are optional and the defaults suit most pages. Unknown\nfields are rejected with `422 validation_error`.\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/screenshots \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"format\": \"png\",\n \"viewport\": {\"width\": 1280, \"height\": 720},\n \"dark_mode\": true,\n \"wait_until\": \"networkidle\"\n }'\n```\n\n> This request was run for real and returned `200` with\n> `\"image_width\": 1280` and `\"image_height\": 720`.\n\n**Output**\n\n| Option | Default | Description |\n| --------------------- | ------- | -------------------------------------------------------------------------------------------------------------------- |\n| `format` | `jpeg` | Image format: `jpeg` or `png` |\n| `quality` | `80` | Image quality, an integer from `1` to `100` |\n| `full_page` | `false` | Capture the whole scrollable page instead of only the viewport |\n| `clip` | `null` | Capture only a region: `{\"x\": 0, \"y\": 0, \"width\": 800, \"height\": 600}` in pixels (`width` and `height` at least `1`) |\n| `device_scale_factor` | `null` | Pixel density: `1` or `null`; any other value is a 422 `validation_error` |\n\n**Device**\n\n| Option | Default | Description |\n| ----------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `device` | `desktop` | `desktop` or `mobile` |\n| `viewport` | `null` | Browser window size, `{\"width\": 1280, \"height\": 720}` in pixels. Overrides the device default. Width 360 to 2544, height 1 to 1297; any other size is a 422 `validation_error` |\n| `dark_mode` | `false` | Render the page with a dark colour scheme preference |\n\n**Page readiness**\n\n| Option | Default | Description |\n| ------------------- | ------- | ------------------------------------------------------------------------------ |\n| `wait_until` | `load` | Navigation event to wait for: `load`, `domcontentloaded`, or `networkidle` |\n| `wait_for_selector` | `null` | CSS selector that must be visible before the capture is taken |\n| `delay_ms` | `0` | Extra wait after the page is ready, in milliseconds (`0` to `10000`) |\n| `scroll` | `true` | Scroll the page to the bottom before capturing, so lazy-loaded content appears |\n\n`wait_until` and `wait_for_selector` are Screenshot options. They are not `POST /v1/scrape`\noptions — sending either there returns `422`. See the [Scraping guide](https://bytekit.com/docs/guides/scraping).\n\n**Clean-up**\n\n| Option | Default | Description |\n| ---------------------- | ------- | --------------------------- |\n| `block_ads` | `true` | Block ads on the page |\n| `block_cookie_banners` | `true` | Hide cookie-consent banners |\n\n**Geo and language**\n\n| Option | Default | Description |\n| ---------- | ------- | ---------------------------------------------------------------------------------- |\n| `country` | `US` | Two-letter, upper-case country code the page is requested from |\n| `language` | `null` | Browser language, for example `de-DE`. When `null`, the language follows `country` |\n\n**Other**\n\n| Option | Default | Description |\n| -------------- | ------- | ----------------------------------------------------------------------------------------------------------- |\n| `include_html` | `false` | Also capture the page's rendered HTML alongside the image. The HTML is not returned in the response |\n| `metadata` | `{}` | Your own key-value pairs to attach to the capture. At most 4096 bytes as JSON; keys must not start with `_` |\n\n`cookies` and `headers` are not request options on any capture endpoint. Sending either returns\n`400 validation_error`.\n\n## Async captures\n\nFor pages that take a while, add `?async=true` to the URL, or send `\"async\": true` in the request\nbody. Either one is enough, and `false` in one never cancels `true` in the other. The call returns\n`202` immediately with an `ss_` id and `status: \"pending\"`, and the capture runs in the background.\n`POST /v1/scrape` accepts the same two spellings.\n\n```bash\n# Start an async capture\ncurl -X POST \"https://api.bytekit.com/v1/screenshots?async=true\" \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n\n# Poll for the result\ncurl https://api.bytekit.com/v1/screenshots/ss_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\nThe first call returns:\n\n```json\n{\n \"id\": \"ss_01a1210d0e3a719589e9c3d70c4791d2\",\n \"status\": \"pending\",\n \"url\": \"https://example.com\",\n \"image_url\": null,\n \"page_title\": null,\n \"image_width\": null,\n \"image_height\": null,\n \"file_size_bytes\": null,\n \"credits_charged\": 1,\n \"error_code\": null,\n \"error_message\": null,\n \"created_at\": \"2026-10-09T14:24:26.172Z\",\n \"completed_at\": null,\n \"expires_at\": \"2027-10-09T14:24:26.149Z\",\n \"poll_url\": \"https://api.bytekit.com/v1/screenshots/ss_01a1210d0e3a719589e9c3d70c4791d2\"\n}\n```\n\n> This response was returned by a real request; `poll_url` shows the production host.\n\n`GET /v1/screenshots/{id}` answers by state:\n\n| State | Status | Body |\n| ------------------------------- | ------ | ---------------------------------------------------------------------- |\n| Still `pending` or `processing` | `202` | The screenshot resource; poll again |\n| `completed` | `200` | The full screenshot resource, with a fresh signed `image_url` |\n| `failed` | `200` | The [error envelope](https://bytekit.com/docs/guides/errors), with the failure in `error.code` |\n\nA failed capture is a successfully retrieved terminal state, so check `status` before reading\n`image_url`.\n\n## Pages that are not HTML\n\nA URL that serves text-like content — plain text, JSON, XML — is captured as the browser displays\nit and billed as usual. A URL that serves anything else, such as an image, a PDF or binary data,\nfails with `unsupported_content_type` on its first attempt, is not retried, and bills nothing.\n\n## Cost\n\nScreenshots are billed on bandwidth, not credits. A capture is billed on the bytes of the\ninitial page fetch, multiplied by 1.5 — the extra 0.5 covers rendering the page. The size of the\nimage file is not the basis. If that initial fetch is skipped or fails, the capture bills nothing.\n\nIn the example above, the page fetch transferred 334 bytes (`raw_bytes`), so the capture was\nbilled 501 bytes (`billed_bytes`). The `billing` object is the authoritative breakdown; its\n`factors[].reason` text is descriptive and may change, so read `value` and `multiplier` rather\nthan parsing it. The same figures arrive in the `X-Raw-Bytes`, `X-Billing-Multiplier`, and\n`X-Billable-Bytes` response headers.\n\nThe `credits_charged` field and the `X-Screenshot-Credits-Charged` header carry a legacy weight\n(`1`, `2` or `4`, doubling for `full_page` and again for mobile). It is recorded for\nreporting only and is not what you are billed. For how capture bandwidth is billed,\nsee [Bandwidth billing](https://bytekit.com/docs/billing/bandwidth).\n\n## Errors\n\nErrors use the unified envelope described in the [Errors guide](https://bytekit.com/docs/guides/errors). These are the\nones you are most likely to meet on this endpoint:\n\n| Status | Code | When | Retry? |\n| ------ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------ |\n| `400` | `invalid_url` | `url` is not a valid HTTP(S) URL. `error.details.reason` says why, for example `scheme_unsupported` | No — fix the URL |\n| `400` | `request_too_large` | The request body is over 512 KB | No — send a smaller body |\n| `401` | `unauthorized`, `invalid_api_key` | The API key is missing, malformed, or not valid | No — check your key |\n| `400` | `validation_error` | The request carries a removed field such as `cookies` or `headers` | No — remove the field |\n| `402` | `quota_exceeded` | The balance cannot fund the capture. `error.details.required_bytes` and `available_bytes` give the numbers | No — add balance or upgrade |\n| `402` | `spending_cap_reached`, `billing_entitlement_impaired`, `billing_entitlement_expired` | The spending cap or the subscription state blocks the request — see the [Errors guide](https://bytekit.com/docs/guides/errors) | No — resolve the billing state first |\n| `403` | `host_forbidden`, `path_forbidden` | The URL's host \n\n---\n[Truncated to the 16384-byte per-page limit — this page is 19419 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/screenshots]"
391
391
  },
392
392
  "guides/search": {
393
393
  "title": "Search",
@@ -397,7 +397,7 @@
397
397
  "guides/sitemap": {
398
398
  "title": "Sitemap",
399
399
  "section": "Guides",
400
- "body": "# Sitemap\n\nDiscover the URLs on a domain — start a job, read its status, download the results file, get a webhook, and what it costs.\n\n`POST /v1/sitemap` finds the URLs of a website, and `GET /v1/sitemap/{id}` reports on the job.\nA valid request answers `202` with a job id. ByteKit discovers the URLs in the background and saves them as a results file that you download from `results_url`.\n\n## Start a job\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/sitemap \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://bytekit.com\", \"strategy\": \"quick\", \"max_urls\": 20}'\n```\n\n```json\n{\n \"id\": \"sm_c013b3fa71f94ff292f5c2fa74f8d77b\",\n \"url\": \"https://bytekit.com\",\n \"strategy\": \"quick\",\n \"max_depth\": 2,\n \"max_urls\": 20,\n \"status\": \"pending\",\n \"total_urls\": null,\n \"sources\": null,\n \"total_bytes\": null,\n \"results_url\": null,\n \"warnings\": null,\n \"error_code\": null,\n \"error_message\": null,\n \"compact\": false,\n \"process\": null,\n \"metadata\": null,\n \"created_at\": \"2026-10-10T14:59:44.602Z\",\n \"completed_at\": null,\n \"expires_at\": null,\n \"cache\": \"miss\",\n \"cache_age_s\": null\n}\n```\n\n> This request was run for real and returned `202`. `cache` is `miss` because no earlier job could answer it; see [Cache](#cache).\n\nOnly `url` is required. Keep the `id`: it is how you read the job.\n\n| Field | Default | What it does |\n| ---------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `url` | (required) | The site to discover. Only the scheme and host are used: a path, query string or fragment is accepted but ignored, and the `202` response carries a `warnings` entry saying so |\n| `strategy` | `standard` | `quick`, `standard` or `deep`: where ByteKit looks for URLs. See [Strategies](#strategies) |\n| `max_depth` | `2` | From 1 to 5. How many levels of page links a `deep` job follows |\n| `max_urls` | `5000` | From 1 to 100000. A new job stops collecting at this many URLs |\n| `process` | `null` | An object with an `action` and `options`. ByteKit accepts it and returns it on the job, and it has no other effect |\n| `compact` | `false` | `true` makes the results file a plain list of URLs, one per line, with no header |\n| `metadata` | none | An object of your own, up to 4096 bytes when serialized. It is returned on the job and in webhook deliveries. A key that starts with `_` is rejected with `422 validation_error` |\n| `webhook_url` | none | An `https://` URL to notify about the job. An `http://` URL is rejected with `400 invalid_url` and the reason `scheme_unsupported`. See [Webhooks](#webhooks) |\n| `webhook_secret` | `null` | Signs the webhook deliveries. It is ignored when there is no `webhook_url` |\n| `cache_ttl` | `30d` | How old a cached job may be and still answer the request. It is a string: `0`, hours such as `48h`, or days such as `30d`, up to 90 days. A number is rejected with `422 validation_error` |\n\nThe `202` response reports `url` after ByteKit has normalised it: the scheme and host are lowercased, an international host is in punycode, non-ASCII characters are percent-encoded, and surrounding spaces are trimmed. If the result is only a scheme and host, with or without a trailing `/`, it is returned as `scheme://host`. If it carries a path, query string or fragment, it is returned whole, together with the `warnings` entry. `GET` returns the host as `scheme://host`.\n\n## Strategies\n\n| Strategy | Where it looks |\n| ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `quick` | The sitemap files the site publishes. Every URL has the source `sitemap` |\n| `standard` | The same, plus URLs from your account's completed scrapes of the host in the last 90 days. These have the source `known` |\n| `deep` | The same as `standard`, plus URLs found by following links on pages, up to `max_depth` levels. These have the source `links` |\n\nThe sources run in that order, and each one fills only the room that `max_urls` leaves. A URL found by more than one source is counted once, under the first.\nA `deep` job follows links only from URLs the earlier sources found, so on a site with no sitemap files and no `known` URLs it finds no `links`.\nThe job's `sources` field counts the URLs per source. For a `deep` job run for real it read `{\"known\": 1, \"links\": 4, \"sitemap\": 119}`.\n\n## Check the job\n\n`GET /v1/sitemap/{id}` answers `200` with the job whatever its `status`: `pending`, `processing`, `completed` or `failed`. Poll it every few seconds until the status is `completed` or `failed`. The jobs on this page finished within a few seconds.\n\n```bash\ncurl -i https://api.bytekit.com/v1/sitemap/sm_c013b3fa71f94ff292f5c2fa74f8d77b \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n```json\n{\n \"id\": \"sm_c013b3fa71f94ff292f5c2fa74f8d77b\",\n \"url\": \"https://bytekit.com\",\n \"strategy\": \"quick\",\n \"max_depth\": 2,\n \"max_urls\": 20,\n \"status\": \"completed\",\n \"total_urls\": 20,\n \"sources\": { \"sitemap\": 20 },\n \"total_bytes\": 196,\n \"results_url\": \"https://…\",\n \"warnings\": [],\n \"error_code\": null,\n \"error_message\": null,\n \"compact\": false,\n \"process\": null,\n \"metadata\": null,\n \"created_at\": \"2026-10-10T14:59:44.602Z\",\n \"completed_at\": \"2026-10-10T14:59:47.405Z\",\n \"expires_at\": \"2027-01-08T14:59:47.405Z\",\n \"billing\": {\n \"factors\": [{ \"name\": \"endpoint\", \"value\": 1, \"reason\": \"sitemap\" }],\n \"raw_bytes\": 196,\n \"multiplier\": 1,\n \"billed_bytes\": 196\n }\n}\n```\n\n> This request was run for real and returned `200`. The signed `results_url` is shortened.\n\n| Field | Meaning |\n| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `status` | `pending`, `processing`, `completed` or `failed` |\n| `total_urls` | How many URLs the results hold. `null` until the job completes |\n| `sources` | The URLs per source: `sitemap`, `known` or `links` |\n| `total_bytes` | The size in bytes of the gzip-compressed results file. This is what the job is billed on; see [Cost](#cost) |\n| `results_url` | A signed link to the results file, present once the job is `completed`. Each `GET` of a completed job returns a new link, valid for 7 days |\n| `warnings` | Notes about the run, such as a source that could not be read |\n| `error_code`, `error_message` | Why a job failed. `null` otherwise |\n| `billing` | What the job was billed: `raw_bytes`, the `factors` applied, the `multiplier` and `billed_bytes` |\n| `expires_at` | When the job expires: 90 days after it completes, except that a cache hit keeps the expiry of the job that answered it. `null` until the job completes |\n\nA completed `200` also carries the headers `X-Raw-Bytes`, `X-Billing-Multiplier` and `X-Billable-Bytes`, which show the same figures as `billing`.\n\n### When a job fails\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/sitemap \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"strategy\": \"quick\", \"max_urls\": 20}'\n```\n\n> This request was run for real and returned `202`, with the same fields as above and `cache` `miss`. The job then failed, and polling it returned `200`:\n\n```json\n{\n \"id\": \"sm_a380b0ea64dd4b19a854699c58933499\",\n \"url\": \"https://example.com\",\n \"strategy\": \"quick\",\n \"max_depth\": 2,\n \"max_urls\": 20,\n \"status\": \"failed\",\n \"total_urls\": null,\n \"sources\": null,\n \"total_bytes\": null,\n \"results_url\": null,\n \"warnings\": [\"robots.txt unavailable (non-success fetch)\"],\n \"error_code\": \"no_urls_found\",\n \"error_message\": \"No URLs discovered for this domain\",\n \"compact\": false,\n \"process\": null,\n \"metadata\": null,\n \"created_at\": \"2026-10-10T14:59:54.408Z\",\n \"completed_at\": \"2026-10-10T14:59:55.941Z\",\n \"expires_at\": null\n}\n```\n\nA `robots.txt` or sitemap file that ByteKit cannot read does not fail a job by itself. It adds an entry to `warnings`, and discovery goes on with the other sources. A sitemap file that is not there (`404` or `410`) or is empty adds no warning, and neither does a page that cannot be fetched while a `deep` job follows links.\nThese are the `error_code` values you may meet:\n\n| `error_code` | When |\n| ---------------- | ------------------------------------------------------------------------ |\n| `no_urls_found` | Discovery ended without finding a URL |\n| `blocked` | The site blocks ByteKit's requests, so discovery did not start |\n| `job_timeout` | The job did not finish in time |\n| `internal_error` | A failure on ByteKit's side |\n| `worker_crash` | The job stopped making progress, and ByteKit failed it after a long wait |\n\nA job that fails with `worker_crash` sends no `sitemap.failed` webhook, so poll the job as well as listening for the webhook.\n\n## Download the results\n\n```bash\ncurl --compressed \"$RESULTS_URL\"\n```\n\n```csv\nurl,source\nhttps://bytekit.com/docs/changelog,sitemap\nhttps://bytekit.com/docs,sitemap\nhttps://bytekit.com/docs/introduction,sitemap\n```\n\n> This request was run for real and returned `200`. The file holds a header and 20 rows, and the first rows are shown.\n\nThe results file is a gzip-compressed CSV, served with `Content-Encoding: gzip`, so `--compressed` makes curl decode it. A client that does not decode gzip receives the compressed bytes, and their count is `total_bytes`.\nIt has the header `url,source` and one row per discovered URL, and `source` is `sitemap`, `known` or `links`. In that format a URL that contains a comma is wrapped in double quotes.\nWith `compact: true` the file is a plain list of URLs, one per line, with no header. The `lastmod` and `depth` columns are not emitted.\n\n## Cache\n\nBefore it queues discovery, ByteKit looks for a completed job of your account that has the same scheme and host and the same `strategy`, that finished within `cache_ttl`, and whose `max_depth` and `max_urls` are at least the ones you sent.\nA job that was itself a cache hit is never matched, only the job that ran discovery is, so `cache_ttl` counts from when that job finished.\nThe `cache` field of the `202` response says what it found. `GET` leaves out `cache` and `cache_age_s`.\n\n| `cache` | Meaning |\n| -------- | ------------------------------------------------------------------------------------------------------------------------------- |\n| `miss` | No such job. A new job is queued |\n| `hit` | A job matched. The response is already `completed` and has a `results_url`, and `cache_age_s` is the age of that job in seconds |\n| `bypass` | `cache_ttl` is `0`, so the cache was not read and a new job is queued |\n\nSending the request above again a few seconds later returned a hit:\n\n```json\n{\n \"id\": \"sm_6aa7e5ea6a854f19976754b0fdc8f438\",\n \"url\": \"https://bytekit.com\",\n \"strategy\": \"quick\",\n \"max_depth\": 2,\n \"max_urls\": 20,\n \"status\": \"completed\",\n \"total_urls\": 20,\n \"sources\": { \"sitemap\": 20 },\n \"total_bytes\": 196,\n \"results_url\": \"https://…\",\n \"warnings\": null,\n \"error_code\": null,\n \"error_message\": null,\n \"compact\": false,\n \"process\": null,\n \"metadata\": null,\n \"created_at\": \"2026-10-10T14:59:53.441Z\",\n \"completed_at\": \"2026-10-10T14:59:53.440Z\",\n \"expires_at\": \"2027-01-08T14:59:47.405Z\",\n \"billing\": {\n \"factors\": [\n { \"name\": \"endpoint\", \"value\": 1, \"reason\": \"sitemap\" },\n { \"name\": \"cache_hit\", \"value\": 0.5, \"reason\": \"hit\" }\n ],\n \"raw_bytes\": 196,\n \"multiplier\": 0.5,\n \"billed_bytes\": 98\n },\n \"cache\": \"hit\",\n \"cache_age_s\": 6\n}\n```\n\n> This request was run for real and returned `202`. The signed `results_url` is shortened.\n\nA hit has an `id` of its own and points at the same results file as the job that answered it.\nThe file is returned as that job stored it. It can hold more URLs than the `max_urls` you sent, and it keeps the format that job was created with, whatever `compact` you send, because `compact` is not part of the match.\nThe `compact` field of a hit's response repeats your request, not the format of the file, so tell the format from the file: only a non-compact file starts with the header line `url,source`.\nTo get a new job that follows your request, send `cache_ttl` `0`.\n\n## Webhooks\n\nSend a `webhook_url` and ByteKit POSTs the outcome to it. The header `X-ByteKit-Event` is `sitemap.completed` when the job completes and `sitemap.failed` when it fails, so you can dispatch on the header without reading the body. A cache hit sends `sitemap.completed` as well. A failure that sends no `sitemap.failed` is described under [When a job fails](#when-a-job-fails).\nWithout a `webhook_url` the job is poll-only. Set `webhook_secret` to have the deliveries signed; see the [Webhooks guide](https://bytekit.com/docs/guides/webhooks) for verification. The [Scraping guide](https://bytekit.com/docs/guides/scraping#webhook-event-header) lists the other event types.\n\nThe body has two keys, `event`, which repeats the header, and `data`. This page shows no captured delivery, only the fields:\n\n| Event | `data` holds |\n| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |\n| `sitemap.completed` | `id`, `url`, `strategy`, `status`, `total_urls`, `sources`, `total_bytes`, `res\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 20821 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/sitemap]"
400
+ "body": "# Sitemap\n\nDiscover the URLs on a domain — start a job, read its status, download the results file, get a webhook, and what it costs.\n\n`POST /v1/sitemap` finds the URLs of a website, and `GET /v1/sitemap/{id}` reports on the job.\nA valid request answers `202` with a job id. ByteKit discovers the URLs in the background and saves them as a results file that you download from `results_url`.\n\n## Start a job\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/sitemap \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://bytekit.com\", \"strategy\": \"quick\", \"max_urls\": 20}'\n```\n\n```json\n{\n \"id\": \"sm_c013b3fa71f94ff292f5c2fa74f8d77b\",\n \"url\": \"https://bytekit.com\",\n \"strategy\": \"quick\",\n \"max_depth\": 2,\n \"max_urls\": 20,\n \"status\": \"pending\",\n \"total_urls\": null,\n \"sources\": null,\n \"total_bytes\": null,\n \"results_url\": null,\n \"warnings\": null,\n \"error_code\": null,\n \"error_message\": null,\n \"compact\": false,\n \"process\": null,\n \"metadata\": null,\n \"created_at\": \"2026-10-10T14:59:44.602Z\",\n \"completed_at\": null,\n \"expires_at\": null,\n \"cache\": \"miss\",\n \"cache_age_s\": null\n}\n```\n\n> This request was run for real and returned `202`. `cache` is `miss` because no earlier job could answer it; see [Cache](#cache).\n\nOnly `url` is required. Keep the `id`: it is how you read the job.\n\n| Field | Default | What it does |\n| ---------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `url` | (required) | The site to discover. Only the scheme and host are used: a path, query string or fragment is accepted but ignored, and the `202` response carries a `warnings` entry saying so |\n| `strategy` | `standard` | `quick`, `standard` or `deep`: where ByteKit looks for URLs. See [Strategies](#strategies) |\n| `max_depth` | `2` | From 1 to 5. How many levels of page links a `deep` job follows |\n| `max_urls` | `5000` | From 1 to 100000. A new job stops collecting at this many URLs |\n| `process` | `null` | An object with an `action` and `options`. ByteKit accepts it and returns it on the job, and it has no other effect |\n| `compact` | `false` | `true` makes the results file a plain list of URLs, one per line, with no header |\n| `metadata` | none | An object of your own, up to 4096 bytes when serialized. It is returned on the job and in webhook deliveries. A key that starts with `_` is rejected with `422 validation_error` |\n| `webhook_url` | none | An `https://` URL to notify about the job. An `http://` URL is rejected with `400 invalid_url` and the reason `scheme_unsupported`. See [Webhooks](#webhooks) |\n| `webhook_secret` | `null` | Signs the webhook deliveries. It is ignored when there is no `webhook_url` |\n| `cache_ttl` | `30d` | How old a cached job may be and still answer the request. It is a string: `0`, hours such as `48h`, or days such as `30d`, up to 90 days. A number is rejected with `422 validation_error` |\n\nThe `202` response reports `url` after ByteKit has normalised it: the scheme and host are lowercased, an international host is in punycode, non-ASCII characters are percent-encoded, and surrounding spaces are trimmed. If the result is only a scheme and host, with or without a trailing `/`, it is returned as `scheme://host`. If it carries a path, query string or fragment, it is returned whole, together with the `warnings` entry. `GET` returns the host as `scheme://host`.\n\n## Strategies\n\n| Strategy | Where it looks |\n| ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `quick` | The sitemap files the site publishes. Every URL has the source `sitemap` |\n| `standard` | The same, plus URLs from your account's completed scrapes of the host in the last 90 days. These have the source `known` |\n| `deep` | The same as `standard`, plus URLs found by following links on pages, up to `max_depth` levels. These have the source `links` |\n\nThe sources run in that order, and each one fills only the room that `max_urls` leaves. A URL found by more than one source is counted once, under the first.\nA `deep` job follows links only from URLs the earlier sources found, so on a site with no sitemap files and no `known` URLs it finds no `links`.\nThe job's `sources` field counts the URLs per source. For a `deep` job run for real it read `{\"known\": 1, \"links\": 4, \"sitemap\": 119}`.\n\n## Check the job\n\n`GET /v1/sitemap/{id}` answers `200` with the job whatever its `status`: `pending`, `processing`, `completed` or `failed`. Poll it every few seconds until the status is `completed` or `failed`. The jobs on this page finished within a few seconds.\n\n```bash\ncurl -i https://api.bytekit.com/v1/sitemap/sm_c013b3fa71f94ff292f5c2fa74f8d77b \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n```json\n{\n \"id\": \"sm_c013b3fa71f94ff292f5c2fa74f8d77b\",\n \"url\": \"https://bytekit.com\",\n \"strategy\": \"quick\",\n \"max_depth\": 2,\n \"max_urls\": 20,\n \"status\": \"completed\",\n \"total_urls\": 20,\n \"sources\": { \"sitemap\": 20 },\n \"total_bytes\": 196,\n \"results_url\": \"https://…\",\n \"warnings\": [],\n \"error_code\": null,\n \"error_message\": null,\n \"compact\": false,\n \"process\": null,\n \"metadata\": null,\n \"created_at\": \"2026-10-10T14:59:44.602Z\",\n \"completed_at\": \"2026-10-10T14:59:47.405Z\",\n \"expires_at\": \"2027-01-08T14:59:47.405Z\",\n \"billing\": {\n \"factors\": [{ \"name\": \"endpoint\", \"value\": 1, \"reason\": \"sitemap\" }],\n \"raw_bytes\": 196,\n \"multiplier\": 1,\n \"billed_bytes\": 196\n }\n}\n```\n\n> This request was run for real and returned `200`. The signed `results_url` is shortened.\n\n| Field | Meaning |\n| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `status` | `pending`, `processing`, `completed` or `failed` |\n| `total_urls` | How many URLs the results hold. `null` until the job completes |\n| `sources` | The URLs per source: `sitemap`, `known` or `links` |\n| `total_bytes` | The size in bytes of the gzip-compressed results file. This is what the job is billed on; see [Cost](#cost) |\n| `results_url` | A signed link to the results file, present once the job is `completed`. Each `GET` of a completed job returns a new link, valid for 7 days |\n| `warnings` | Notes about the run, such as a source that could not be read |\n| `error_code`, `error_message` | Why a job failed. `null` otherwise |\n| `billing` | What the job was billed: `raw_bytes`, the `factors` applied, the `multiplier` and `billed_bytes` |\n| `expires_at` | When the job expires: 90 days after it completes, except that a cache hit keeps the expiry of the job that answered it. `null` until the job completes |\n\nA completed `200` also carries the headers `X-Raw-Bytes`, `X-Billing-Multiplier` and `X-Billable-Bytes`, which show the same figures as `billing`.\n\n### When a job fails\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/sitemap \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"strategy\": \"quick\", \"max_urls\": 20}'\n```\n\n> This request was run for real and returned `202`, with the same fields as above and `cache` `miss`. The job then failed, and polling it returned `200`:\n\n```json\n{\n \"id\": \"sm_a380b0ea64dd4b19a854699c58933499\",\n \"url\": \"https://example.com\",\n \"strategy\": \"quick\",\n \"max_depth\": 2,\n \"max_urls\": 20,\n \"status\": \"failed\",\n \"total_urls\": null,\n \"sources\": null,\n \"total_bytes\": null,\n \"results_url\": null,\n \"warnings\": [\"robots.txt unavailable (non-success fetch)\"],\n \"error_code\": \"no_urls_found\",\n \"error_message\": \"No URLs discovered for this domain\",\n \"compact\": false,\n \"process\": null,\n \"metadata\": null,\n \"created_at\": \"2026-10-10T14:59:54.408Z\",\n \"completed_at\": \"2026-10-10T14:59:55.941Z\",\n \"expires_at\": null\n}\n```\n\nA `robots.txt` or sitemap file that ByteKit cannot read does not fail a job by itself. It adds an entry to `warnings`, and discovery goes on with the other sources. A sitemap file that is not there (`404` or `410`) or is empty adds no warning, and neither does a page that cannot be fetched while a `deep` job follows links.\nThese are the `error_code` values you may meet:\n\n| `error_code` | When |\n| ---------------- | ------------------------------------------------------------------------ |\n| `no_urls_found` | Discovery ended without finding a URL |\n| `blocked` | The site blocks ByteKit's requests, so discovery did not start |\n| `job_timeout` | The job did not finish in time |\n| `internal_error` | A failure on ByteKit's side |\n| `worker_crash` | The job stopped making progress, and ByteKit failed it after a long wait |\n\nA job that fails with `worker_crash` sends no `sitemap.failed` webhook, so poll the job as well as listening for the webhook.\n\n## Download the results\n\n```bash\ncurl --compressed \"$RESULTS_URL\"\n```\n\n```csv\nurl,source\nhttps://bytekit.com/docs/changelog,sitemap\nhttps://bytekit.com/docs,sitemap\nhttps://bytekit.com/docs/introduction,sitemap\n```\n\n> This request was run for real and returned `200`. The file holds a header and 20 rows, and the first rows are shown.\n\nThe results file is a gzip-compressed CSV, served with `Content-Encoding: gzip`, so `--compressed` makes curl decode it. A client that does not decode gzip receives the compressed bytes, and their count is `total_bytes`.\nIt has the header `url,source` and one row per discovered URL, and `source` is `sitemap`, `known` or `links`. In that format a URL that contains a comma is wrapped in double quotes.\nWith `compact: true` the file is a plain list of URLs, one per line, with no header. The `lastmod` and `depth` columns are not emitted.\n\n## Cache\n\nBefore it queues discovery, ByteKit looks for a completed job of your account that has the same scheme and host and the same `strategy`, that finished within `cache_ttl`, and whose `max_depth` and `max_urls` are at least the ones you sent.\nA job that was itself a cache hit is never matched, only the job that ran discovery is, so `cache_ttl` counts from when that job finished.\nThe `cache` field of the `202` response says what it found. `GET` leaves out `cache` and `cache_age_s`.\n\n| `cache` | Meaning |\n| -------- | ------------------------------------------------------------------------------------------------------------------------------- |\n| `miss` | No such job. A new job is queued |\n| `hit` | A job matched. The response is already `completed` and has a `results_url`, and `cache_age_s` is the age of that job in seconds |\n| `bypass` | `cache_ttl` is `0`, so the cache was not read and a new job is queued |\n\nSending the request above again a few seconds later returned a hit:\n\n```json\n{\n \"id\": \"sm_6aa7e5ea6a854f19976754b0fdc8f438\",\n \"url\": \"https://bytekit.com\",\n \"strategy\": \"quick\",\n \"max_depth\": 2,\n \"max_urls\": 20,\n \"status\": \"completed\",\n \"total_urls\": 20,\n \"sources\": { \"sitemap\": 20 },\n \"total_bytes\": 196,\n \"results_url\": \"https://…\",\n \"warnings\": null,\n \"error_code\": null,\n \"error_message\": null,\n \"compact\": false,\n \"process\": null,\n \"metadata\": null,\n \"created_at\": \"2026-10-10T14:59:53.441Z\",\n \"completed_at\": \"2026-10-10T14:59:53.440Z\",\n \"expires_at\": \"2027-01-08T14:59:47.405Z\",\n \"billing\": {\n \"factors\": [\n { \"name\": \"endpoint\", \"value\": 1, \"reason\": \"sitemap\" },\n { \"name\": \"cache_hit\", \"value\": 0.5, \"reason\": \"hit\" }\n ],\n \"raw_bytes\": 196,\n \"multiplier\": 0.5,\n \"billed_bytes\": 98\n },\n \"cache\": \"hit\",\n \"cache_age_s\": 6\n}\n```\n\n> This request was run for real and returned `202`. The signed `results_url` is shortened.\n\nA hit has an `id` of its own and points at the same results file as the job that answered it.\nThe file is returned as that job stored it. It can hold more URLs than the `max_urls` you sent, and it keeps the format that job was created with, whatever `compact` you send, because `compact` is not part of the match.\nThe `compact` field of a hit's response repeats your request, not the format of the file, so tell the format from the file: only a non-compact file starts with the header line `url,source`.\nTo get a new job that follows your request, send `cache_ttl` `0`.\n\n## Webhooks\n\nSend a `webhook_url` and ByteKit POSTs the outcome to it. The header `X-ByteKit-Event` is `sitemap.completed` when the job completes and `sitemap.failed` when it fails, so you can dispatch on the header without reading the body. A cache hit sends `sitemap.completed` as well. A failure that sends no `sitemap.failed` is described under [When a job fails](#when-a-job-fails).\nWithout a `webhook_url` the job is poll-only. Set `webhook_secret` to have the deliveries signed; see the [Webhooks guide](https://bytekit.com/docs/guides/webhooks) for verification. The [Scraping guide](https://bytekit.com/docs/guides/scraping#webhook-event-header) lists the other event types.\n\nThe body has two keys, `event`, which repeats the header, and `data`. This page shows no captured delivery, only the fields:\n\n| Event | `data` holds |\n| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |\n| `sitemap.completed` | `id`, `url`, `strategy`, `status`, `total_urls`, `sources`, `total_bytes`, `res\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 21078 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/sitemap]"
401
401
  },
402
402
  "guides/structured-extraction": {
403
403
  "title": "Structured extraction",
@@ -457,7 +457,7 @@
457
457
  "sdk/python/bulk": {
458
458
  "title": "Bulk",
459
459
  "section": "SDK Reference",
460
- "body": "# Bulk\n\nFunctions for interacting with the `bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Bulk\n\nCreate 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**Parameters**\n\n- `body (CreateBulkBody): Provide `urls` (simple list) OR `items` (per-item config), not`\n- `both. `type` selects the capture kind per entry — only`\n- ``screenshot` and `scrape` are accepted (`recording` is`\n- `deactivated). Behaviour fields may be set per item or via`\n- ``defaults`; a per-item value overrides the matching default.`\n- `This includes `type`: an entry with no `type` of its own`\n- `inherits `defaults.type`, falling back to `screenshot` only`\n- `when neither is set.`\n- `The top-level object, each `items[]` entry, and `defaults``\n- `each reject unrecognized keys with a 422 `validation_error``\n- `(the offending key name appears in the error's `details``\n- `message text) rather than silently discarding them.`\n- ``items[]` and `defaults` do not share one field set`\n- ``device_scale_factor` is accepted only under `defaults` (a`\n- `per-item value 422s), and `duration`/`scenario` are accepted`\n- `only per item (a `defaults` value 422s). `metadata` is`\n- `different from those three: it is valid both at the top`\n- `level of the body and per item, but rejected with a 422 if`\n- `placed under `defaults`. See the `422` response below.`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `urls` — `list[str] | Unset` — Simple URL list. Provide urls OR items, not both.\n- `items` — `list[CreateBulkBodyItemsItem] | Unset` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `CreateBulkBodyDefaults | Unset` — Default behaviour applied to every entry unless the item overrides it.\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateBulkResponse202 | CreateBulkResponse403 | Error]\nsync(client=client, body=body) -> CreateBulkResponse202 | CreateBulkResponse403 | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateBulkResponse202 | CreateBulkResponse403 | Error]\nawait asyncio(client=client, body=body) -> CreateBulkResponse202 | CreateBulkResponse403 | Error | None\n```\n\n## Delete Bulk\n\nCancel a bulk job\n\nCancels an in-flight bulk job: drains its still-queued (pending) child jobs and refunds the quota\nheld for exactly those drained children. Children already completed, failed, or in progress are\nuntouched and keep their charge. Idempotent — cancelling an already-terminal job (completed, failed,\nor cancelled) is a no-op that returns 200 with the job's real, unchanged status and refunds nothing.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[DeleteBulkResponse200 | Error]\nsync(id=id, client=client) -> DeleteBulkResponse200 | Error | None\nawait asyncio_detailed(id=id, client=client) -> Response[DeleteBulkResponse200 | Error]\nawait asyncio(id=id, client=client) -> DeleteBulkResponse200 | Error | None\n```\n\n## Get Bulk\n\nGet bulk job status\n\nReturns the job envelope. Items are listed by `GET /v1/bulk/\\{id\\}/screenshots`.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/scrape/bulk` or `POST /v1/fetch/bulk` is found here too, not\na `404`, with that job's envelope. An id from another account answers `404`.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | GetBulkResponse200 | GetBulkResponse202]\nsync(id=id, client=client) -> Error | GetBulkResponse200 | GetBulkResponse202 | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | GetBulkResponse200 | GetBulkResponse202]\nawait asyncio(id=id, client=client) -> Error | GetBulkResponse200 | GetBulkResponse202 | None\n```\n\n## List Bulk Screenshots\n\nList bulk job items\n\nReturns the bulk job's items, discriminated by `type`.\n\n**Downloading item artifacts.** For a `completed` item with a storage key,\n`image_url` (`type: screenshot`) and both `content_url` and `markdown_url`\n(`type: scrape`) are **pre-signed** URLs, minted fresh on every read of\nthis endpoint and valid for **600 seconds (10 minutes)** —\nthe same signing lifetime as `content_url` on `GET /v1/fetch/bulk/\\{id\\}`.\nDownload inside that window, or re-poll this endpoint for a fresh\nsignature.\n\n**When no signature is minted.** Three cases mint none: an item that is not\n`completed`, a `completed` item with no storage key, and a `completed` item\nwhose object could not be signed — during an object-storage outage, for\ninstance. In all three the item's stored value is returned unchanged: `null`\nwhile nothing has been stored, and otherwise a **private, unsigned**\nobject-storage URL that answers `401`. These fields are neither nulled nor\nflagged in that case, so treat an artifact URL as usable only once you have\ndownloaded it, and re-poll for a fresh signature otherwise.\n`artifact_warnings` and its `artifact_unavailable` code describe the sibling\n`artifacts` object on `type: scrape` items only — they say nothing about\n`image_url`, `content_url`, or `markdown_url`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (str | Unset)`\n- `limit (int | Unset)`\n- `status (ListBulkScreenshotsStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | ListBulkScreenshotsResponse200]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | ListBulkScreenshotsResponse200 | None\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | ListBulkScreenshotsResponse200]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | ListBulkScreenshotsResponse200 | None\n```"
460
+ "body": "# Bulk\n\nFunctions for interacting with the `bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Bulk\n\nCreate 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**Parameters**\n\n- `body (CreateBulkBody): Provide `urls` (simple list) OR `items` (per-item config), not`\n- `both. `type` selects the capture kind per entry — only`\n- ``screenshot` and `scrape` are accepted (`recording` is`\n- `deactivated). Behaviour fields may be set per item or via`\n- ``defaults`; a per-item value overrides the matching default.`\n- `This includes `type`: an entry with no `type` of its own`\n- `inherits `defaults.type`, falling back to `screenshot` only`\n- `when neither is set.`\n- `The top-level object, each `items[]` entry, and `defaults``\n- `each reject unrecognized keys with a 422 `validation_error``\n- `(the offending key name appears in the error's `details``\n- `message text) rather than silently discarding them.`\n- ``items[]` and `defaults` do not share one field set`\n- ``device_scale_factor` is accepted only under `defaults` (a`\n- `per-item value 422s), and `duration`/`scenario` are accepted`\n- `only per item (a `defaults` value 422s). `metadata` is`\n- `different from those three: it is valid both at the top`\n- `level of the body and per item, but rejected with a 422 if`\n- `placed under `defaults`. See the `422` response below.`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `urls` — `list[str] | Unset` — Simple URL list. Provide urls OR items, not both.\n- `items` — `list[CreateBulkBodyItemsItem] | Unset` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `CreateBulkBodyDefaults | Unset` — Default behaviour applied to every entry unless the item overrides it.\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateBulkResponse202 | CreateBulkResponse403 | Error | Error]\nsync(client=client, body=body) -> CreateBulkResponse202 | CreateBulkResponse403 | Error | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateBulkResponse202 | CreateBulkResponse403 | Error | Error]\nawait asyncio(client=client, body=body) -> CreateBulkResponse202 | CreateBulkResponse403 | Error | Error | None\n```\n\n## Delete Bulk\n\nCancel a bulk job\n\nCancels an in-flight bulk job: drains its still-queued (pending) child jobs and refunds the quota\nheld for exactly those drained children. Children already completed, failed, or in progress are\nuntouched and keep their charge. Idempotent — cancelling an already-terminal job (completed, failed,\nor cancelled) is a no-op that returns 200 with the job's real, unchanged status and refunds nothing.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[DeleteBulkResponse200 | Error]\nsync(id=id, client=client) -> DeleteBulkResponse200 | Error | None\nawait asyncio_detailed(id=id, client=client) -> Response[DeleteBulkResponse200 | Error]\nawait asyncio(id=id, client=client) -> DeleteBulkResponse200 | Error | None\n```\n\n## Get Bulk\n\nGet bulk job status\n\nReturns the job envelope. Items are listed by `GET /v1/bulk/\\{id\\}/screenshots`.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/scrape/bulk` or `POST /v1/fetch/bulk` is found here too, not\na `404`, with that job's envelope. An id from another account answers `404`.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | GetBulkResponse200 | GetBulkResponse202]\nsync(id=id, client=client) -> Error | GetBulkResponse200 | GetBulkResponse202 | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | GetBulkResponse200 | GetBulkResponse202]\nawait asyncio(id=id, client=client) -> Error | GetBulkResponse200 | GetBulkResponse202 | None\n```\n\n## List Bulk Screenshots\n\nList bulk job items\n\nReturns the bulk job's items, discriminated by `type`.\n\n**Downloading item artifacts.** For a `completed` item with a storage key,\n`image_url` (`type: screenshot`) and both `content_url` and `markdown_url`\n(`type: scrape`) are **pre-signed** URLs, minted fresh on every read of\nthis endpoint and valid for **600 seconds (10 minutes)** —\nthe same signing lifetime as `content_url` on `GET /v1/fetch/bulk/\\{id\\}`.\nDownload inside that window, or re-poll this endpoint for a fresh\nsignature.\n\n**When no signature is minted.** Three cases mint none: an item that is not\n`completed`, a `completed` item with no storage key, and a `completed` item\nwhose object could not be signed — during an object-storage outage, for\ninstance. In all three the item's stored value is returned unchanged: `null`\nwhile nothing has been stored, and otherwise a **private, unsigned**\nobject-storage URL that answers `401`. These fields are neither nulled nor\nflagged in that case, so treat an artifact URL as usable only once you have\ndownloaded it, and re-poll for a fresh signature otherwise.\n`artifact_warnings` and its `artifact_unavailable` code describe the sibling\n`artifacts` object on `type: scrape` items only — they say nothing about\n`image_url`, `content_url`, or `markdown_url`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (str | Unset)`\n- `limit (int | Unset)`\n- `status (ListBulkScreenshotsStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | ListBulkScreenshotsResponse200]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | ListBulkScreenshotsResponse200 | None\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | ListBulkScreenshotsResponse200]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | ListBulkScreenshotsResponse200 | None\n```"
461
461
  },
462
462
  "sdk/python/client": {
463
463
  "title": "Client",
@@ -472,7 +472,7 @@
472
472
  "sdk/python/fetch-bulk": {
473
473
  "title": "Fetch Bulk",
474
474
  "section": "SDK Reference",
475
- "body": "# Fetch Bulk\n\nFunctions for interacting with the `fetch_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Fetch Bulk\n\nBulk 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**Parameters**\n\n- `body (CreateFetchBulkBody)`\n- `urls` — `list[CreateFetchBulkBodyUrlsItemType1 | str]`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `defaults` — `CreateFetchBulkBodyDefaults | Unset`\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error]\nsync(client=client, body=body) -> CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error]\nawait asyncio(client=client, body=body) -> CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error | None\n```\n\n## Get Fetch Bulk\n\nGet fetch bulk job status\n\nReturns the job envelope plus its per-URL items.\n\n**Downloading item content.** Each completed item's `content_url` is a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **600 seconds (10 minutes)** — the same signing lifetime as the\n`image_url` returned by `GET /v1/bulk/\\{id\\}/screenshots`. The underlying\nobjects are private, so an unsigned URL returns `401`: download the\ncontent inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, or completed items whose object cannot be signed, carry\n`null`; the latter report `artifact_unavailable`. The private unsigned\nstorage URL is never returned.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/scrape/bulk` or `POST /v1/bulk` is found here too, not a\n`404`, with the job envelope and `items: []`: only items fetched through\n`POST /v1/fetch/bulk` are listed. An id from another account answers `404`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (str | Unset)`\n- `limit (int | Unset)`\n- `status (GetFetchBulkStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetFetchBulkResponse200 | GetFetchBulkResponse202]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetFetchBulkResponse200 | GetFetchBulkResponse202 | None\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetFetchBulkResponse200 | GetFetchBulkResponse202]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetFetchBulkResponse200 | GetFetchBulkResponse202 | None\n```"
475
+ "body": "# Fetch Bulk\n\nFunctions for interacting with the `fetch_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Fetch Bulk\n\nBulk 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**Parameters**\n\n- `body (CreateFetchBulkBody)`\n- `urls` — `list[CreateFetchBulkBodyUrlsItemType1 | str]`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `defaults` — `CreateFetchBulkBodyDefaults | Unset`\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error | Error]\nsync(client=client, body=body) -> CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error | Error]\nawait asyncio(client=client, body=body) -> CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error | Error | None\n```\n\n## Get Fetch Bulk\n\nGet fetch bulk job status\n\nReturns the job envelope plus its per-URL items.\n\n**Downloading item content.** Each completed item's `content_url` is a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **600 seconds (10 minutes)** — the same signing lifetime as the\n`image_url` returned by `GET /v1/bulk/\\{id\\}/screenshots`. The underlying\nobjects are private, so an unsigned URL returns `401`: download the\ncontent inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, or completed items whose object cannot be signed, carry\n`null`; the latter report `artifact_unavailable`. The private unsigned\nstorage URL is never returned.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/scrape/bulk` or `POST /v1/bulk` is found here too, not a\n`404`, with the job envelope and `items: []`: only items fetched through\n`POST /v1/fetch/bulk` are listed. An id from another account answers `404`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (str | Unset)`\n- `limit (int | Unset)`\n- `status (GetFetchBulkStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetFetchBulkResponse200 | GetFetchBulkResponse202]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetFetchBulkResponse200 | GetFetchBulkResponse202 | None\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetFetchBulkResponse200 | GetFetchBulkResponse202]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetFetchBulkResponse200 | GetFetchBulkResponse202 | None\n```"
476
476
  },
477
477
  "sdk/python/monitors": {
478
478
  "title": "Monitors",
@@ -487,7 +487,7 @@
487
487
  "sdk/python/scrape-bulk": {
488
488
  "title": "Scrape Bulk",
489
489
  "section": "SDK Reference",
490
- "body": "# Scrape Bulk\n\nFunctions for interacting with the `scrape_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Scrape Bulk\n\nBulk 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**Unknown keys.** An unknown key on an `items[]` entry, or at the top level of\nthe body, is rejected with `422 validation_error`. An unknown key inside\n`defaults` is not: it is dropped without a warning and the request is accepted\nwith `202`. The exception is `cookies` and `headers`, on an item or in `defaults`: they\nanswer `400 validation_error`.\n\n**Parameters**\n\n- `body (CreateScrapeBulkBody)`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `urls` — `list[str] | Unset` — Simple URL list. Provide urls OR items, not both.\n- `items` — `list[CreateScrapeBulkBodyItemsItem] | Unset` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `CreateScrapeBulkBodyDefaults | Unset`\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n- `custom` — `CreateScrapeBulkBodyCustom | Unset` — Top-level user-supplied JSON payload, capped at 4096 UTF-8 bytes. Applied to every scrape-type entry that does not provide its own per-entry `custom` (the per-entry value wins). Echoed on each entry's success envelope in the bulk results response (the key is omitted when no `custom` was supplied at either level). Distinct from the system-owned `metadata` column and never used as a cache-key input.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error]\nsync(client=client, body=body) -> CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error]\nawait asyncio(client=client, body=body) -> CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error | None\n```\n\n## Get Scrape Bulk\n\nGet scrape bulk job status\n\nReturns the job envelope plus its rehydrated per-URL scrape envelopes.\n\n**Downloading item content.** A `raw` or `markdown` artifact within the\n10-MiB inline cap is returned inline. An oversized one is replaced by a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **86400 seconds (24 hours)**. The underlying objects are private, so an\nunsigned URL returns `401`: download the content inside that window, or\nre-poll this endpoint for a fresh signature. An artifact that was never\nstored, or whose object cannot be signed, is omitted from `formats` and\nreported as `artifact_unavailable` in `warnings`. The private unsigned\nstorage URL is never returned.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/fetch/bulk` or `POST /v1/bulk` is found here too, not a `404`.\nThe items listed are the job's scrape rows: a fetch-bulk job's items appear, and a\n`POST /v1/bulk` job shows its scrape items but not its screenshots. An id from another\naccount answers `404`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (str | Unset)`\n- `limit (int | Unset)`\n- `status (GetScrapeBulkStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202 | None\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202 | None\n```"
490
+ "body": "# Scrape Bulk\n\nFunctions for interacting with the `scrape_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Scrape Bulk\n\nBulk 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**Unknown keys.** An unknown key on an `items[]` entry, or at the top level of\nthe body, is rejected with `422 validation_error`. An unknown key inside\n`defaults` is not: it is dropped without a warning and the request is accepted\nwith `202`. The exception is `cookies` and `headers`, on an item or in `defaults`: they\nanswer `400 validation_error`.\n\n**Parameters**\n\n- `body (CreateScrapeBulkBody)`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `urls` — `list[str] | Unset` — Simple URL list. Provide urls OR items, not both.\n- `items` — `list[CreateScrapeBulkBodyItemsItem] | Unset` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `CreateScrapeBulkBodyDefaults | Unset`\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n- `custom` — `CreateScrapeBulkBodyCustom | Unset` — Top-level user-supplied JSON payload, capped at 4096 UTF-8 bytes. Applied to every scrape-type entry that does not provide its own per-entry `custom` (the per-entry value wins). Echoed on each entry's success envelope in the bulk results response (the key is omitted when no `custom` was supplied at either level). Distinct from the system-owned `metadata` column and never used as a cache-key input.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error | Error]\nsync(client=client, body=body) -> CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error | Error]\nawait asyncio(client=client, body=body) -> CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error | Error | None\n```\n\n## Get Scrape Bulk\n\nGet scrape bulk job status\n\nReturns the job envelope plus its rehydrated per-URL scrape envelopes.\n\n**Downloading item content.** A `raw` or `markdown` artifact within the\n10-MiB inline cap is returned inline. An oversized one is replaced by a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **86400 seconds (24 hours)**. The underlying objects are private, so an\nunsigned URL returns `401`: download the content inside that window, or\nre-poll this endpoint for a fresh signature. An artifact that was never\nstored, or whose object cannot be signed, is omitted from `formats` and\nreported as `artifact_unavailable` in `warnings`. The private unsigned\nstorage URL is never returned.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/fetch/bulk` or `POST /v1/bulk` is found here too, not a `404`.\nThe items listed are the job's scrape rows: a fetch-bulk job's items appear, and a\n`POST /v1/bulk` job shows its scrape items but not its screenshots. An id from another\naccount answers `404`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (str | Unset)`\n- `limit (int | Unset)`\n- `status (GetScrapeBulkStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202 | None\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202 | None\n```"
491
491
  },
492
492
  "sdk/python/screenshots": {
493
493
  "title": "Screenshots",
@@ -517,7 +517,7 @@
517
517
  "sdk/typescript/account": {
518
518
  "title": "Account",
519
519
  "section": "SDK Reference",
520
- "body": "# Account\n\nAccount info and API key management. Accessed via `client.account`.\n\n## get\n\n```ts\nclient.account.get(requestOptions?: RequestOptions): Promise<GetAccountResponse>\n```\n\nGET /v1/account — get the authenticated account.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`; both override the constructor's `timeoutMs` default.\n\n## apiKeys\n\n### create\n\n```ts\nclient.account.apiKeys.create(opts?: CreateApiKeyRequest, requestOptions?: RequestOptions): Promise<CreateApiKeyResponse>\n```\n\nPOST /v1/account/api-keys — create a new API key.\n\n`opts` is optional: the spec declares the request body itself as optional,\nso `create()` with no arguments is valid and sends no body.\n\n### list\n\n```ts\nclient.account.apiKeys.list(requestOptions?: RequestOptions): Promise<ListApiKeysResponse>\n```\n\nGET /v1/account/api-keys — list all API keys for the account\n\n### get\n\n```ts\nclient.account.apiKeys.get(id: ApiKeyId, requestOptions?: RequestOptions): Promise<GetApiKeyResponse>\n```\n\nGET /v1/account/api-keys/\\{id\\} — get an API key by ID\n\n### update\n\n```ts\nclient.account.apiKeys.update(id: ApiKeyId, opts: UpdateApiKeyRequest, requestOptions?: RequestOptions): Promise<UpdateApiKeyResponse>\n```\n\nPATCH /v1/account/api-keys/\\{id\\} — update an API key\n\n### revoke\n\n```ts\nclient.account.apiKeys.revoke(id: ApiKeyId, requestOptions?: RequestOptions): Promise<void>\n```\n\nDELETE /v1/account/api-keys/\\{id\\} — revoke an API key (idempotent).\n\nReturns 204 No Content: `operations['revokeApiKey']['responses'][204]`\ndeclares `content?: never`, so there is no JSON arm to derive a payload\nfrom — hence `Promise<void>`.\n\n`client.request()` short-circuits an empty body (204 or any empty response)\nto `undefined` before it would parse the body as JSON, so this\nmethod resolves cleanly on an empty 204 body.\n\n### reveal\n\n```ts\nclient.account.apiKeys.reveal(id: ApiKeyId, requestOptions?: RequestOptions): Promise<RevealApiKeyResponse>\n```\n\nPOST /v1/account/api-keys/\\{id\\}/reveal — reveal the plaintext API key value"
520
+ "body": "# Account\n\nAccount details. Accessed via `client.account`.\n\n## get\n\n```ts\nclient.account.get(requestOptions?: RequestOptions): Promise<GetAccountResponse>\n```\n\nGET /v1/account — get the authenticated account.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`; both override the constructor's `timeoutMs` default."
521
521
  },
522
522
  "sdk/typescript/bulk": {
523
523
  "title": "Bulk",
@@ -527,7 +527,7 @@
527
527
  "sdk/typescript/client": {
528
528
  "title": "Client",
529
529
  "section": "SDK Reference",
530
- "body": "# Client\n\nThe ByteKit TypeScript SDK is a thin, type-safe wrapper over the REST API. Create a\n client with your API key, then call resource methods.\n\n```ts\nimport { ByteKit } from '@hunt-labs/bytekit-sdk';\n\nconst client = new ByteKit({\n apiKey: process.env.BYTEKIT_API_KEY!, // your sk_live_… key\n});\n```\n\n## Options (`ByteKitOptions`)\n\n- `apiKey` (required) — `string`\n- `baseUrl` — `string` Defaults to `https://api.bytekit.com`.\n- `timeoutMs` — `number` — Default CLIENT-SIDE request timeout in ms — the abort budget for the whole HTTP\nround-trip made by this SDK, covering time-to-headers **and** the response body\nread (so a large legitimate body counts against it too). `0` disables the SDK-side\ntimeout. Default 120000.\n\nNOT the same thing as `ScrapeOpts.timeout_ms`, which is the SERVER-side budget\nByteKit applies to the scrape itself. Override per call with\n`RequestOptions.requestTimeoutMs`.\n\n## Resources\n\nThe client exposes one property per resource:\n\n- [`client.scrape`](https://bytekit.com/docs/sdk/typescript/scrape) — Fetch a URL as raw HTML, clean markdown, or structured content.\n- [`client.screenshots`](https://bytekit.com/docs/sdk/typescript/screenshots) — Capture full-page or viewport screenshots.\n- [`client.bulk`](https://bytekit.com/docs/sdk/typescript/bulk) — Fan out many URLs in parallel and get one webhook when the job completes.\n- [`client.fetch`](https://bytekit.com/docs/sdk/typescript/fetch) — Low-latency raw HTTP fetch with byte-for-byte upstream responses.\n- [`client.monitors`](https://bytekit.com/docs/sdk/typescript/monitors) — Watch a URL on a schedule and webhook on change.\n- [`client.sitemap`](https://bytekit.com/docs/sdk/typescript/sitemap) — Discover URLs from a domain's sitemap or by crawling.\n- [`client.search`](https://bytekit.com/docs/sdk/typescript/search) — Run a web search and return ranked organic results.\n- [`client.account`](https://bytekit.com/docs/sdk/typescript/account) — Account info and API key management.\n- [`client.usage`](https://bytekit.com/docs/sdk/typescript/usage) — Billing-period and daily usage breakdowns.\n- [`client.webhooks`](https://bytekit.com/docs/sdk/typescript/webhooks) — List and retry webhook deliveries.\n\n## Errors\n\nAny non-2xx response throws a `ByteKitError` carrying the HTTP `status` and the API `code`.\n\n```ts\nimport { ByteKit, ByteKitError } from '@hunt-labs/bytekit-sdk';\n\ntry {\n await client.scrape.create({ url: 'https://example.com' });\n} catch (err) {\n if (err instanceof ByteKitError) {\n console.error(`${err.status} ${err.code}: ${err.message}`);\n }\n}\n```"
530
+ "body": "# Client\n\nThe ByteKit TypeScript SDK is a thin, type-safe wrapper over the REST API. Create a\n client with your API key, then call resource methods.\n\n```ts\nimport { ByteKit } from '@hunt-labs/bytekit-sdk';\n\nconst client = new ByteKit({\n apiKey: process.env.BYTEKIT_API_KEY!, // your sk_live_… key\n});\n```\n\n## Options (`ByteKitOptions`)\n\n- `apiKey` (required) — `string`\n- `baseUrl` — `string` Defaults to `https://api.bytekit.com`.\n- `timeoutMs` — `number` — Default CLIENT-SIDE request timeout in ms — the abort budget for the whole HTTP\nround-trip made by this SDK, covering time-to-headers **and** the response body\nread (so a large legitimate body counts against it too). `0` disables the SDK-side\ntimeout. Default 120000.\n\nNOT the same thing as `ScrapeOpts.timeout_ms`, which is the SERVER-side budget\nByteKit applies to the scrape itself. Override per call with\n`RequestOptions.requestTimeoutMs`.\n\n## Resources\n\nThe client exposes one property per resource:\n\n- [`client.scrape`](https://bytekit.com/docs/sdk/typescript/scrape) — Fetch a URL as raw HTML, clean markdown, or structured content.\n- [`client.screenshots`](https://bytekit.com/docs/sdk/typescript/screenshots) — Capture full-page or viewport screenshots.\n- [`client.bulk`](https://bytekit.com/docs/sdk/typescript/bulk) — Fan out many URLs in parallel and get one webhook when the job completes.\n- [`client.fetch`](https://bytekit.com/docs/sdk/typescript/fetch) — Low-latency raw HTTP fetch with byte-for-byte upstream responses.\n- [`client.monitors`](https://bytekit.com/docs/sdk/typescript/monitors) — Watch a URL on a schedule and webhook on change.\n- [`client.sitemap`](https://bytekit.com/docs/sdk/typescript/sitemap) — Discover URLs from a domain's sitemap or by crawling.\n- [`client.search`](https://bytekit.com/docs/sdk/typescript/search) — Run a web search and return ranked organic results.\n- [`client.account`](https://bytekit.com/docs/sdk/typescript/account) — Account details.\n- [`client.usage`](https://bytekit.com/docs/sdk/typescript/usage) — Billing-period and daily usage breakdowns.\n- [`client.webhooks`](https://bytekit.com/docs/sdk/typescript/webhooks) — List and retry webhook deliveries.\n\n## Errors\n\nAny non-2xx response throws a `ByteKitError` carrying the HTTP `status` and the API `code`.\n\n```ts\nimport { ByteKit, ByteKitError } from '@hunt-labs/bytekit-sdk';\n\ntry {\n await client.scrape.create({ url: 'https://example.com' });\n} catch (err) {\n if (err instanceof ByteKitError) {\n console.error(`${err.status} ${err.code}: ${err.message}`);\n }\n}\n```"
531
531
  },
532
532
  "sdk/typescript/fetch": {
533
533
  "title": "Fetch",
@@ -39,7 +39,7 @@ export interface ScrapeStats {
39
39
  tokens: number;
40
40
  blocks: number;
41
41
  }
42
- export type ScrapeEnvelopeErrorCode = 'validation_error' | 'invalid_url' | 'request_too_large' | 'payload_too_large' | 'unsupported_content_type' | 'rate_limited' | 'upstream_error' | 'timeout' | 'blocked' | 'target_rate_limited' | 'internal_error';
42
+ export type ScrapeEnvelopeErrorCode = 'validation_error' | 'invalid_url' | 'request_too_large' | 'payload_too_large' | 'unsupported_content_type' | 'content_too_large' | 'rate_limited' | 'upstream_error' | 'timeout' | 'blocked' | 'target_rate_limited' | 'internal_error';
43
43
  export interface ScrapeFormats {
44
44
  /**
45
45
  * The untouched upstream source of whatever the URL served — HTML, JSON, XML or
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunt-labs/bytekit-mcp",
3
- "version": "0.3.27",
3
+ "version": "0.3.29",
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",