@hunt-labs/bytekit-mcp 0.3.16 → 0.3.18

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.
@@ -2,7 +2,7 @@
2
2
  "api": {
3
3
  "title": "API Reference",
4
4
  "section": "API Reference",
5
- "body": "# API Reference\n\nEvery ByteKit endpoint, request, and response.\n\nThe ByteKit REST API is organized by capability. Every endpoint shares one base\nURL and Bearer authentication — start with the [Quickstart](https://bytekit.com/docs/quickstart) and\n[Authentication](https://bytekit.com/docs/guides/authentication) guides.\n\n- [Scrape](https://bytekit.com/docs/api/scrape/createscrape) — Fetch any URL as raw HTML, clean markdown, or structured content.\n- [Screenshots](https://bytekit.com/docs/api/screenshots/createscreenshot) — Capture full-page or viewport PNG/JPEG.\n- [Bulk](https://bytekit.com/docs/api/bulk/createbulk) — Fan out many URLs in parallel with per-item webhooks.\n- [Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — Watch a URL on a schedule and webhook on change.\n- [Sitemap](https://bytekit.com/docs/api/sitemap/createsitemap) — Discover URLs from a domain's sitemap or by crawling.\n- [Fetch](https://bytekit.com/docs/api/fetch/postfetch) — Low-latency raw HTTP fetch with byte-for-byte upstream responses."
5
+ "body": "# API Reference\n\nEvery ByteKit endpoint, request, and response.\n\nThe ByteKit REST API is organized by capability. Every endpoint shares one base\nURL and Bearer authentication — start with the [Quickstart](https://bytekit.com/docs/quickstart) and\n[Authentication](https://bytekit.com/docs/guides/authentication) guides.\n\n- [Scrape](https://bytekit.com/docs/api/scrape/createscrape) — Fetch any URL as raw HTML, clean markdown, or structured content.\n- [Screenshots](https://bytekit.com/docs/api/screenshots/createscreenshot) — Capture full-page or viewport PNG/JPEG.\n- [Bulk](https://bytekit.com/docs/api/bulk/createbulk) — Fan out many URLs in parallel and get one webhook when the job completes.\n- [Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — Watch a URL on a schedule and webhook on change.\n- [Sitemap](https://bytekit.com/docs/api/sitemap/createsitemap) — Discover URLs from a domain's sitemap or by crawling.\n- [Fetch](https://bytekit.com/docs/api/fetch/postfetch) — Low-latency raw HTTP fetch with byte-for-byte upstream responses."
6
6
  },
7
7
  "api/account": {
8
8
  "title": "Account",
@@ -12,7 +12,7 @@
12
12
  "api/account/getaccount": {
13
13
  "title": "Get account details",
14
14
  "section": "API Reference",
15
- "body": "# Get account details\n\nReturns account, plan, and current API key details, including the\n`api_key` and `subscription` fields.\n\n**GET** `/v1/account`\n\n## Responses\n\n### 200 — Account, plan, and current API key details.\n- `id`\n- `email`\n- `name`\n- `plan`\n- `api_key`\n- `subscription`\n- `auto_topup`\n- `cancelled_at`\n- `grace_period_expires_at`\n- `created_at`\n- `owner_user_id`\n- `notifications`\n- `terms_version`\n- `has_activity`\n- `onboarding_completed`\n- `has_subscription`\n\n### 429 — Rate limit exceeded (`rate_limited`). Only reachable when authenticated via Clerk session (the 60-request/60-second per-user window) — the bearer and in-process auth branches are not rate-limited at this endpoint. Carries a `Retry-After` header derived from the same clock as the window reset.\n- `status`\n- `error`"
15
+ "body": "# Get account details\n\nReturns account, plan, and current API key details, including the\n`api_key` and `subscription` fields.\n\n**GET** `/v1/account`\n\n## Responses\n\n### 200 — Account, plan, and current API key details.\n- `id`\n- `email`\n- `name`\n- `plan`\n- `plan.id`\n- `plan.slug`\n- `plan.name`\n- `plan.included_screenshots`\n- `plan.has_overage`\n- `plan.overage_price_cents`\n- `plan.max_concurrency`\n- `plan.rate_limit_per_sec`\n- `plan.max_bulk_size`\n- `plan.max_monitors`\n- `plan.retention_days`\n- `api_key`\n- `api_key.id`\n- `api_key.prefix`\n- `api_key.label`\n- `api_key.environment`\n- `api_key.last_used_at`\n- `api_key.created_at`\n- `subscription`\n- `subscription.status`\n- `subscription.plan`\n- `subscription.plan.slug`\n- `subscription.plan.name`\n- `subscription.plan.included_bytes`\n- `subscription.plan.included_credits`\n- `subscription.plan.topup_price_per_mb_cents`\n- `subscription.plan.credit_topup_price_per_k_cents`\n- `auto_topup`\n- `auto_topup.enabled`\n- `auto_topup.threshold_cents`\n- `auto_topup.amount_cents`\n- `auto_topup.monthly_cap_cents`\n- `cancelled_at`\n- `grace_period_expires_at`\n- `created_at`\n- `owner_user_id`\n- `notifications`\n- `notifications.bandwidth_80_enabled`\n- `notifications.bandwidth_100_enabled`\n- `terms_version`\n- `has_activity`\n- `onboarding_completed`\n- `user_onboarding_completed`\n- `has_subscription`\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### 429 — Rate limit exceeded (`rate_limited`). Only reachable when authenticated via Clerk session (the 60-request/60-second per-user window) — the bearer and in-process auth branches are not rate-limited at this endpoint. Carries a `Retry-After` header derived from the same clock as the window reset.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
16
16
  },
17
17
  "api/bulk": {
18
18
  "title": "Bulk",
@@ -22,27 +22,27 @@
22
22
  "api/bulk/createbulk": {
23
23
  "title": "Create mixed bulk job",
24
24
  "section": "API Reference",
25
- "body": "# Create mixed bulk job\n\nEnqueues screenshots or scrapes in a single batch.\nProvide `urls` (simple list) or `items` (per-item config), not both.\nWebhook deliveries include `X-ByteKit-Event: bulk.completed` so\nreceivers can dispatch on the header without parsing the body shape.\nThe body follows `BulkCompletedWebhook`: at most 500 complete items and\n1 MiB, followed by cursor recovery through the existing mixed-item route\nwhenever `recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 4 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 32 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's richer per-item override\nbudget), which reaches 28.7 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 4 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**POST** `/v1/bulk`\n\n## Request Body\n\n- `urls`\n- `items`\n- `defaults`\n- `webhook_url` (required)\n- `webhook_secret`\n- `metadata`\n\n## Responses\n\n### 202 — Bulk job accepted.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `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\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error. `bulk_too_large` is returned when the item count\nexceeds the account plan's `max_bulk_size` cap (also surfaced as\n`max_bulk_size` on `GET /v1/account`). `validation_error` is\nreturned when the request body contains an unrecognized key\nanywhere in the top-level object, an `items[]` entry, or\n`defaults` — all three reject unknown keys with a 422\n`validation_error` whose `details` message names the offending\nkey, instead of silently discarding it. The two nested objects\ndo not accept the same field set: `device_scale_factor` is\n`defaults`-only (rejected per item), and `duration`/`scenario`\nare `items[]`-only (rejected under `defaults`). `metadata` is\nvalid both at the top level of the body and per item, but is\nrejected with this same 422 if placed under `defaults`.\n- `status`\n- `error`"
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.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.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`.\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",
29
29
  "section": "API Reference",
30
- "body": "# Cancel a bulk job\n\nCancels an in-flight bulk job: drains its still-queued (pending) child jobs and refunds the quota held for exactly those drained children. Children already completed, failed, or in progress are untouched and keep their charge. Idempotent — cancelling an already-terminal job (completed, failed, or cancelled) is a no-op that returns 200 with the job's real, unchanged status and refunds nothing.\n\n**DELETE** `/v1/bulk/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Bulk job after the cancel attempt. `status` is `cancelled` when the job was in flight, or its real terminal status when it had already finished.\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### 404 — Resource not found.\n- `status`\n- `error`"
30
+ "body": "# Cancel a bulk job\n\nCancels an in-flight bulk job: drains its still-queued (pending) child jobs and refunds the quota held for exactly those drained children. Children already completed, failed, or in progress are untouched and keep their charge. Idempotent — cancelling an already-terminal job (completed, failed, or cancelled) is a no-op that returns 200 with the job's real, unchanged status and refunds nothing.\n\n**DELETE** `/v1/bulk/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Bulk job after the cancel attempt. `status` is `cancelled` when the job was in flight, or its real terminal status when it had already finished.\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### 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### 404 — Resource not found.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
31
31
  },
32
32
  "api/bulk/getbulk": {
33
33
  "title": "Get bulk job status",
34
34
  "section": "API Reference",
35
- "body": "# Get bulk job status\n\n**GET** `/v1/bulk/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Successful response.\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### 202 — Bulk job still processing. `routes/bulk.ts` ends the poll handler with\n`status: isTerminal ? 200 : 202` over an identical body, so this is the\nSAME envelope the 200 documents — only the status code and the reachable\n`status` values differ. Keep polling until you get a 200 (issue #3533).\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### 404 — Resource not found.\n- `status`\n- `error`"
35
+ "body": "# Get 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**GET** `/v1/bulk/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Successful response.\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### 202 — Bulk job still processing. `routes/bulk.ts` ends the poll handler with\n`status: isTerminal ? 200 : 202` over an identical body, so this is the\nSAME envelope the 200 documents — only the status code and the reachable\n`status` values differ. Keep polling until you get a 200 (issue #3533).\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### 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### 404 — Resource not found.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
36
36
  },
37
37
  "api/bulk/listbulk": {
38
38
  "title": "List bulk jobs",
39
39
  "section": "API Reference",
40
- "body": "# List bulk jobs\n\nReturns the caller's bulk jobs, most recent first, one cursor-paginated\npage at a time. Optionally filter to a single status; when omitted, jobs\nof every status are returned. `status` narrows the set and the cursor\naddresses a position inside that already-ordered, already-filtered set,\nso the two can be combined in one request. Follow `next_cursor` while\n`has_more` is true.\n\n**GET** `/v1/bulk`\n\n## Parameters\n\n- `limit` (query, integer)\n- `cursor` (query, string) — Pagination cursor from a previous response.\n- `status` (query, string)\n\n## Responses\n\n### 200 — Successful response.\n- `next_cursor`\n- `has_more`\n- `data`\n\n### 422 — Validation error. Returned when `status` is not one of the documented values, or when `cursor` is not a cursor this endpoint issued.\n- `status`\n- `error`"
40
+ "body": "# List bulk jobs\n\nReturns the caller's bulk jobs, most recent first, one cursor-paginated\npage at a time. Optionally filter to a single status; when omitted, jobs\nof every status are returned. `status` narrows the set and the cursor\naddresses a position inside that already-ordered, already-filtered set,\nso the two can be combined in one request. Follow `next_cursor` while\n`has_more` is true.\n\n**GET** `/v1/bulk`\n\n## Parameters\n\n- `limit` (query, integer)\n- `cursor` (query, string) — Pagination cursor from a previous response.\n- `status` (query, string)\n\n## Responses\n\n### 200 — Successful response.\n- `next_cursor`\n- `has_more`\n- `data`\n- `data.id`\n- `data.status`\n- `data.total`\n- `data.completed`\n- `data.failed`\n- `data.created_at`\n- `data.completed_at`\n- `data.total_credits_charged`\n- `data.total_billed_bytes`\n- `data.estimated_credits`\n- `data.webhook_url`\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### 422 — Validation error. Returned when `status` is not one of the documented values, or when `cursor` is not a cursor this endpoint issued.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
41
41
  },
42
42
  "api/bulk/listbulkscreenshots": {
43
43
  "title": "List bulk job items",
44
44
  "section": "API Reference",
45
- "body": "# List 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**GET** `/v1/bulk/{id}/screenshots`\n\n## Parameters\n\n- `id` (path, string, required)\n- `cursor` (query, string) — Opaque per-type seek cursor returned by the preceding page. It is bound to this bulk id, this mixed recovery route, and the exact status filter; cross-scope cursors return 422.\n- `limit` (query, integer) — Maximum rows selected per requested item type; the 16-MiB response bound may stop sooner.\n- `status` (query, string) — Optional item-status filter. A cursor may be reused only with the same filter.\n\n## Responses\n\n### 200 — Successful response.\n- `bulk_id`\n- `total`\n- `next_cursor`\n- `has_more`\n- `job_counters`\n- `items`"
45
+ "body": "# List 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**GET** `/v1/bulk/{id}/screenshots`\n\n## Parameters\n\n- `id` (path, string, required)\n- `cursor` (query, string) — Opaque per-type seek cursor returned by the preceding page. It is bound to this bulk id, this mixed recovery route, and the exact status filter; cross-scope cursors return 422.\n- `limit` (query, integer) — Maximum rows selected per requested item type; the 16-MiB response bound may stop sooner.\n- `status` (query, string) — Optional item-status filter. A cursor may be reused only with the same filter.\n\n## Responses\n\n### 200 — Successful response.\n- `bulk_id`\n- `total`\n- `next_cursor`\n- `has_more`\n- `job_counters`\n- `job_counters.total`\n- `job_counters.completed`\n- `job_counters.failed`\n- `items`\n- `items.type`\n- `items.id`\n- `items.status`\n- `items.url`\n- `items.credits_charged`\n- `items.billing`\n- `items.billing.raw_bytes`\n- `items.billing.factors`\n- `items.billing.factors.name`\n- `items.billing.factors.value`\n- `items.billing.factors.reason`\n- `items.billing.multiplier`\n- `items.billing.billed_bytes`\n- `items.error_code`\n- `items.error_message`\n- `items.created_at`\n- `items.completed_at`\n- `items.image_url`\n- `items.page_title`\n- `items.format`\n- `items.video_url`\n- `items.content_url`\n- `items.content_type`\n- `items.content_length`\n- `items.markdown`\n- `items.markdown_url`\n- `items.artifacts`\n- `items.artifacts.raw`\n- `items.artifacts.markdown`\n- `items.artifacts.links`\n- `items.artifacts.links.url`\n- `items.artifacts.links.text`\n- `items.artifacts.links.isInternal`\n- `items.artifacts.links.rel`\n- `items.artifacts.images`\n- `items.artifacts.images.url`\n- `items.artifacts.images.alt`\n- `items.artifacts.images.width`\n- `items.artifacts.images.height`\n- `items.artifacts.images.format`\n- `items.artifacts.images.score`\n- `items.artifact_warnings`\n- `items.artifact_warnings.code`\n- `items.artifact_warnings.message`\n- `items.artifact_warnings.element`\n- `items.terminal_outcome`\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`"
46
46
  },
47
47
  "api/fetch": {
48
48
  "title": "Fetch",
@@ -57,22 +57,22 @@
57
57
  "api/fetch-bulk/createfetchbulk": {
58
58
  "title": "Bulk fetch URLs",
59
59
  "section": "API Reference",
60
- "body": "# Bulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (wait_for_selector, etc.).\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/fetch/bulk/{id}` whenever\n`recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 2 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 20 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's per-item override budget),\nwhich reaches 16.8 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 2 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**POST** `/v1/fetch/bulk`\n\n## Request Body\n\n- `urls` (required)\n- `defaults`\n- `webhook_url` (required)\n- `webhook_secret`\n- `metadata`\n\n## Responses\n\n### 202 — Fetch bulk job accepted.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `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\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error. `bulk_too_large` is returned when the item count\nexceeds the account plan's `max_bulk_size` cap (also surfaced as\n`max_bulk_size` on `GET /v1/account`).\n- `status`\n- `error`"
60
+ "body": "# Bulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (wait_for_selector, etc.).\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/fetch/bulk/{id}` whenever\n`recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 2 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 20 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's per-item override budget),\nwhich reaches 16.8 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 2 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**POST** `/v1/fetch/bulk`\n\n## Request Body\n\n- `urls` (required)\n- `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`"
61
61
  },
62
62
  "api/fetch-bulk/getfetchbulk": {
63
63
  "title": "Get fetch bulk job status",
64
64
  "section": "API Reference",
65
- "body": "# Get 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**GET** `/v1/fetch/bulk/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n- `cursor` (query, string) — Opaque cursor returned by the preceding page. It is bound to this bulk id, this recovery route, and the exact status filter; cross-scope cursors return 422.\n- `limit` (query, integer) — Maximum result rows considered for this page; the 16-MiB response bound may stop sooner.\n- `status` (query, string) — Optional item-status filter. A cursor may be reused only with the same filter.\n\n## Responses\n\n### 200 — Successful response.\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- `next_cursor`\n- `has_more`\n- `items`\n\n### 202 — Bulk job still processing. The poll answers 200 for a job in\n`BULK_TERMINAL_STATUSES` (`completed`, `failed`, `cancelled`) and 202\notherwise, over an identical body, so this is the SAME envelope the 200\ndocuments — only the status code and the reachable `status` values\ndiffer. Keep polling until you get a 200; a **cancelled** job is served\n200, not 202 (issues #3533, #4754).\n\nItem `content_url` values are pre-signed exactly as on the 200 — a fresh\n600-second signature on every poll.\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- `next_cursor`\n- `has_more`\n- `items`\n\n### 404 — Resource not found.\n- `status`\n- `error`"
65
+ "body": "# Get 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**GET** `/v1/fetch/bulk/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n- `cursor` (query, string) — Opaque cursor returned by the preceding page. It is bound to this bulk id, this recovery route, and the exact status filter; cross-scope cursors return 422.\n- `limit` (query, integer) — Maximum result rows considered for this page; the 16-MiB response bound may stop sooner.\n- `status` (query, string) — Optional item-status filter. A cursor may be reused only with the same filter.\n\n## Responses\n\n### 200 — Successful response.\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- `next_cursor`\n- `has_more`\n- `items`\n- `items.id`\n- `items.url`\n- `items.status`\n- `items.content_type`\n- `items.content_length`\n- `items.content_url`\n- `items.waf_vendor`\n- `items.cache_hit`\n- `items.billing`\n- `items.billing.raw_bytes`\n- `items.billing.factors`\n- `items.billing.factors.name`\n- `items.billing.factors.value`\n- `items.billing.factors.reason`\n- `items.billing.multiplier`\n- `items.billing.billed_bytes`\n- `items.error_code`\n- `items.error_message`\n- `items.created_at`\n- `items.completed_at`\n- `items.type`\n- `items.terminal_outcome`\n\n### 202 — Bulk job still processing. The poll answers 200 for a job in\n`BULK_TERMINAL_STATUSES` (`completed`, `failed`, `cancelled`) and 202\notherwise, over an identical body, so this is the SAME envelope the 200\ndocuments — only the status code and the reachable `status` values\ndiffer. Keep polling until you get a 200; a **cancelled** job is served\n200, not 202 (issues #3533, #4754).\n\nItem `content_url` values are pre-signed exactly as on the 200 — a fresh\n600-second signature on every poll.\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- `next_cursor`\n- `has_more`\n- `items`\n- `items.id`\n- `items.url`\n- `items.status`\n- `items.content_type`\n- `items.content_length`\n- `items.content_url`\n- `items.waf_vendor`\n- `items.cache_hit`\n- `items.billing`\n- `items.billing.raw_bytes`\n- `items.billing.factors`\n- `items.billing.factors.name`\n- `items.billing.factors.value`\n- `items.billing.factors.reason`\n- `items.billing.multiplier`\n- `items.billing.billed_bytes`\n- `items.error_code`\n- `items.error_message`\n- `items.created_at`\n- `items.completed_at`\n- `items.type`\n- `items.terminal_outcome`\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### 404 — Resource not found.\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/getfetch": {
68
68
  "title": "Fetch a URL (GET)",
69
69
  "section": "API Reference",
70
- "body": "# Fetch a URL (GET)\n\nDirect HTTP fetch. Successful responses return the upstream response bytes verbatim;\nmetadata is returned in X-Fetch-* headers. Non-2xx upstream responses use the\n`upstream_error` JSON envelope with the upstream HTTP status.\n\n**GET** `/v1/fetch`\n\n## Parameters\n\n- `url` (query, string, required)\n- `country` (query, string)\n- `timeout_ms` (query, integer)\n- `cache_ttl` (query) — How long a freshly fetched URL may be served from cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts `Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values receive a 422 validation_error with an actionable message.\n\n## Responses\n\n### 200 — Content from upstream.\n\n### 400 — Invalid URL (`invalid_url`) or oversized request.\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error (e.g. slow-path-only field), or a fetch that failed for a\ntarget-side reason.\n\nTwo distinct conditions answer `422`. Read `error.code` to tell them apart.\n\n- **`validation_error`** — the request itself was rejected.\n- **`blocked`** or **`upstream_error`** — the fetch ran and the target could not\n be read. `blocked` means the target's bot protection refused every attempt;\n `upstream_error` (message `Failed to fetch URL.`) is any other exhausted-retries\n failure, such as a host that does not resolve. This is a result about the URL,\n not an outage of this API, so it is a `4xx` rather than `502` or `503`. No\n upstream HTTP status was received, so `error.http_status` reports `422`,\n mirroring what was served — unlike the relayed `upstream_error` under `502`\n below, whose status is the target's own. The request transfers no billable\n bytes and is charged nothing (#4669).\n- `status`\n- `error`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n\n### 503 — Two distinct conditions answer `503`, and they disagree about what the body's\n`error.http_status` reports. Read `error.code` to tell them apart.\n\n- **`upstream_error`** — the target returned HTTP `502` or `504`, relayed here as\n `503`. Cloudflare fronts this API and replaces a clean origin 502 or 504 with its\n own generic `text/plain` error page, discarding the envelope before it reaches\n you, while a 503 is passed through unchanged. The body's `error.http_status`\n still reports the **true upstream status**, `502` or `504` — not `503` — and is\n the only surviving record of what the target answered, so the body rather than\n the HTTP status is authoritative here (#3355, #4891). Every other non-2xx\n upstream response is relayed at its own HTTP status with the same\n `upstream_error` envelope, so any other 4xx/5xx the target returns surfaces as an\n Error envelope rather than a raw body (#1462).\n- **`internal_error`** (message `Fetch service unavailable.`) — no fetch service\n endpoint could be resolved on this deployment, a fault of this API and not of the\n target. There is no upstream status to preserve: the `503` is this API's own\n choice of wire status, so the body's `error.http_status` reports `503`, mirroring\n what was served (#3373). A fetch that ran and failed for a target-side reason\n answers `422` instead (#4669).\n- `status`\n- `error`"
70
+ "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)\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\nTwo distinct conditions answer `422`. Read `error.code` to tell them apart.\n\n- **`validation_error`** — the request itself was rejected.\n- **`blocked`** or **`upstream_error`** — the fetch ran and the target could not\n be read. `blocked` means the target's bot protection refused every attempt;\n `upstream_error` (message `Failed to fetch URL.`) is any other exhausted-retries\n failure, such as a host that does not resolve. This is a result about the URL,\n not an outage of this API, so it is a `4xx` rather than `502` or `503`. No\n upstream HTTP status was received, so `error.http_status` reports `422`,\n mirroring what was served — unlike the relayed `upstream_error` under `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- `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`"
71
71
  },
72
72
  "api/fetch/postfetch": {
73
73
  "title": "Fetch a URL (POST)",
74
74
  "section": "API Reference",
75
- "body": "# Fetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/fetch`\n\n## Request Body\n\n- `url` (required)\n- `country`\n- `timeout_ms`\n- `cache_ttl`\n- `custom`\n\n## Responses\n\n### 200 — Content from upstream.\n\n### 400 — Invalid URL (`invalid_url`) or oversized request body.\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error (e.g. malformed JSON, unsupported fetch format, or slow-path-only\nfield), or a fetch that failed for a target-side reason.\n\nTwo distinct conditions answer `422`. Read `error.code` to tell them apart.\n\n- **`validation_error`** — the request itself was rejected.\n- **`blocked`** or **`upstream_error`** — the fetch ran and the target could not\n be read. `blocked` means the target's bot protection refused every attempt;\n `upstream_error` (message `Failed to fetch URL.`) is any other exhausted-retries\n failure, such as a host that does not resolve. This is a result about the URL,\n not an outage of this API, so it is a `4xx` rather than `502` or `503`. No\n upstream HTTP status was received, so `error.http_status` reports `422`,\n mirroring what was served — unlike the relayed `upstream_error` under `502`\n below, whose status is the target's own. The request transfers no billable\n bytes and is charged nothing (#4669).\n- `status`\n- `error`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n\n### 503 — Two distinct conditions answer `503`, and they disagree about what the body's\n`error.http_status` reports. Read `error.code` to tell them apart.\n\n- **`upstream_error`** — the target returned HTTP `502` or `504`, relayed here as\n `503`. Cloudflare fronts this API and replaces a clean origin 502 or 504 with its\n own generic `text/plain` error page, discarding the envelope before it reaches\n you, while a 503 is passed through unchanged. The body's `error.http_status`\n still reports the **true upstream status**, `502` or `504` — not `503` — and is\n the only surviving record of what the target answered, so the body rather than\n the HTTP status is authoritative here (#3355, #4891). Every other non-2xx\n upstream response is relayed at its own HTTP status with the same\n `upstream_error` envelope, so any other 4xx/5xx the target returns surfaces as an\n Error envelope rather than a raw body (#1462).\n- **`internal_error`** (message `Fetch service unavailable.`) — no fetch service\n endpoint could be resolved on this deployment, a fault of this API and not of the\n target. There is no upstream status to preserve: the `503` is this API's own\n choice of wire status, so the body's `error.http_status` reports `503`, mirroring\n what was served (#3373). A fetch that ran and failed for a target-side reason\n answers `422` instead (#4669).\n- `status`\n- `error`"
75
+ "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\nTwo distinct conditions answer `422`. Read `error.code` to tell them apart.\n\n- **`validation_error`** — the request itself was rejected.\n- **`blocked`** or **`upstream_error`** — the fetch ran and the target could not\n be read. `blocked` means the target's bot protection refused every attempt;\n `upstream_error` (message `Failed to fetch URL.`) is any other exhausted-retries\n failure, such as a host that does not resolve. This is a result about the URL,\n not an outage of this API, so it is a `4xx` rather than `502` or `503`. No\n upstream HTTP status was received, so `error.http_status` reports `422`,\n mirroring what was served — unlike the relayed `upstream_error` under `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- `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/health": {
78
78
  "title": "Health",
@@ -92,32 +92,32 @@
92
92
  "api/monitors/createmonitor": {
93
93
  "title": "Create a change-detection monitor",
94
94
  "section": "API Reference",
95
- "body": "# Create a change-detection monitor\n\nCreates a recurring change-detection monitor for a URL, delivering results via webhook.\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/monitors`\n\n## Request Body\n\n- `url` (required)\n- `type`\n- `interval_type` (required)\n- `cron_expression`\n- `change_threshold`\n- `notify_on`\n- `webhook_url` (required)\n- `webhook_secret`\n- `webhook_headers`\n- `options`\n- `scrape_options`\n- `metadata`\n\n## Responses\n\n### 201 — Monitor created.\n- `id`\n- `type`\n- `url`\n- `status`\n- `interval_type`\n- `cron_expression`\n- `next_capture_at`\n- `notify_on`\n- `webhook_url`\n- `webhook_headers`\n- `change_threshold`\n- `scrape_options`\n- `last_content_hash`\n- `captures_count`\n- `changes_count`\n- `skipped_captures`\n- `last_captured_at`\n- `last_changed_at`\n- `consecutive_failures`\n- `last_error_code`\n- `suspension_reason`\n- `metadata`\n- `created_at`\n- `updated_at`\n- `cancelled_at`\n- `webhook_secret`\n\n### 400 — Bad request. When the `url` (or `webhook_url`) field fails strict\nvalidation the error code is `invalid_url` and the `details` object\ncontains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 409 — Duplicate monitor for this URL.\n- `status`\n- `error`\n\n### 422 — Validation error.\n- `status`\n- `error`"
95
+ "body": "# Create a change-detection monitor\n\nCreates a recurring change-detection monitor for a URL, delivering results via webhook.\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/monitors`\n\n## Request Body\n\n- `url` (required)\n- `type`\n- `interval_type` (required)\n- `cron_expression`\n- `change_threshold`\n- `notify_on`\n- `webhook_url` (required)\n- `webhook_secret`\n- `webhook_headers`\n- `options`\n- `scrape_options`\n- `metadata`\n\n## Responses\n\n### 201 — Monitor created.\n- `id`\n- `type`\n- `url`\n- `status`\n- `interval_type`\n- `cron_expression`\n- `next_capture_at`\n- `notify_on`\n- `webhook_url`\n- `webhook_headers`\n- `change_threshold`\n- `scrape_options`\n- `last_content_hash`\n- `captures_count`\n- `changes_count`\n- `skipped_captures`\n- `last_captured_at`\n- `last_changed_at`\n- `consecutive_failures`\n- `last_error_code`\n- `suspension_reason`\n- `metadata`\n- `created_at`\n- `updated_at`\n- `cancelled_at`\n- `webhook_secret`\n\n### 400 — Bad request. When the `url` (or `webhook_url`) field fails strict\nvalidation the error code is `invalid_url` and the `details` object\ncontains:\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### 409 — Duplicate monitor for this URL.\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`"
96
96
  },
97
97
  "api/monitors/deletemonitor": {
98
98
  "title": "Cancel monitor",
99
99
  "section": "API Reference",
100
- "body": "# Cancel monitor\n\n**DELETE** `/v1/monitors/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 204 — Monitor cancelled.\n\n### 404 — Resource not found.\n- `status`\n- `error`"
100
+ "body": "# Cancel monitor\n\n**DELETE** `/v1/monitors/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 204 — Monitor cancelled.\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### 404 — Resource not found.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
101
101
  },
102
102
  "api/monitors/getmonitor": {
103
103
  "title": "Get monitor",
104
104
  "section": "API Reference",
105
- "body": "# Get monitor\n\n**GET** `/v1/monitors/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Successful response.\n- `id`\n- `type`\n- `url`\n- `status`\n- `interval_type`\n- `cron_expression`\n- `next_capture_at`\n- `notify_on`\n- `webhook_url`\n- `webhook_headers`\n- `change_threshold`\n- `scrape_options`\n- `last_content_hash`\n- `captures_count`\n- `changes_count`\n- `skipped_captures`\n- `last_captured_at`\n- `last_changed_at`\n- `consecutive_failures`\n- `last_error_code`\n- `suspension_reason`\n- `metadata`\n- `created_at`\n- `updated_at`\n- `cancelled_at`\n\n### 404 — Resource not found.\n- `status`\n- `error`"
105
+ "body": "# Get monitor\n\n**GET** `/v1/monitors/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Successful response.\n- `id`\n- `type`\n- `url`\n- `status`\n- `interval_type`\n- `cron_expression`\n- `next_capture_at`\n- `notify_on`\n- `webhook_url`\n- `webhook_headers`\n- `change_threshold`\n- `scrape_options`\n- `last_content_hash`\n- `captures_count`\n- `changes_count`\n- `skipped_captures`\n- `last_captured_at`\n- `last_changed_at`\n- `consecutive_failures`\n- `last_error_code`\n- `suspension_reason`\n- `metadata`\n- `created_at`\n- `updated_at`\n- `cancelled_at`\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### 404 — Resource not found.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
106
106
  },
107
107
  "api/monitors/listmonitorcaptures": {
108
108
  "title": "List monitor captures",
109
109
  "section": "API Reference",
110
- "body": "# List monitor captures\n\n**GET** `/v1/monitors/{id}/captures`\n\n## Parameters\n\n- `id` (path, string, required)\n- `limit` (query, integer)\n- `cursor` (query, string) — Pagination cursor from a previous response.\n\n## Responses\n\n### 200 — Successful response.\n- `data`\n- `next_cursor`\n- `has_more`"
110
+ "body": "# List monitor captures\n\n**GET** `/v1/monitors/{id}/captures`\n\n## Parameters\n\n- `id` (path, string, required)\n- `limit` (query, integer)\n- `cursor` (query, string) — Pagination cursor from a previous response.\n\n## Responses\n\n### 200 — Successful response.\n- `data`\n- `data.id`\n- `data.monitor_id`\n- `data.screenshot_id`\n- `data.scrape_id`\n- `data.image_url`\n- `data.content_hash`\n- `data.previous_hash`\n- `data.hash_distance`\n- `data.change_pct`\n- `data.has_change`\n- `data.title_changed`\n- `data.outcome`\n- `data.captured_at`\n- `next_cursor`\n- `has_more`\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`"
111
111
  },
112
112
  "api/monitors/listmonitors": {
113
113
  "title": "List monitors",
114
114
  "section": "API Reference",
115
- "body": "# List monitors\n\n**GET** `/v1/monitors`\n\n## Parameters\n\n- `limit` (query, integer)\n- `cursor` (query, string) — Pagination cursor from a previous response.\n- `status` (query, string)\n\n## Responses\n\n### 200 — Successful response.\n- `data`\n- `next_cursor`\n- `has_more`"
115
+ "body": "# List monitors\n\n**GET** `/v1/monitors`\n\n## Parameters\n\n- `limit` (query, integer)\n- `cursor` (query, string) — Pagination cursor from a previous response.\n- `status` (query, string)\n\n## Responses\n\n### 200 — Successful response.\n- `data`\n- `data.id`\n- `data.type`\n- `data.url`\n- `data.status`\n- `data.interval_type`\n- `data.cron_expression`\n- `data.next_capture_at`\n- `data.notify_on`\n- `data.webhook_url`\n- `data.webhook_headers`\n- `data.change_threshold`\n- `data.scrape_options`\n- `data.last_content_hash`\n- `data.captures_count`\n- `data.changes_count`\n- `data.skipped_captures`\n- `data.last_captured_at`\n- `data.last_changed_at`\n- `data.consecutive_failures`\n- `data.last_error_code`\n- `data.suspension_reason`\n- `data.metadata`\n- `data.created_at`\n- `data.updated_at`\n- `data.cancelled_at`\n- `next_cursor`\n- `has_more`\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`"
116
116
  },
117
117
  "api/monitors/updatemonitor": {
118
118
  "title": "Update monitor",
119
119
  "section": "API Reference",
120
- "body": "# Update monitor\n\n**PATCH** `/v1/monitors/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Request Body\n\n- `url`\n- `interval_type`\n- `cron_expression`\n- `change_threshold`\n- `notify_on`\n- `webhook_url`\n- `webhook_secret`\n- `webhook_headers`\n- `status`\n- `options`\n- `scrape_options`\n- `metadata`\n\n## Responses\n\n### 200 — Successful response.\n- `id`\n- `type`\n- `url`\n- `status`\n- `interval_type`\n- `cron_expression`\n- `next_capture_at`\n- `notify_on`\n- `webhook_url`\n- `webhook_headers`\n- `change_threshold`\n- `scrape_options`\n- `last_content_hash`\n- `captures_count`\n- `changes_count`\n- `skipped_captures`\n- `last_captured_at`\n- `last_changed_at`\n- `consecutive_failures`\n- `last_error_code`\n- `suspension_reason`\n- `metadata`\n- `created_at`\n- `updated_at`\n- `cancelled_at`\n\n### 400 — Bad request. When the `url` (or `webhook_url`) field fails strict\nvalidation the error code is `invalid_url` and the `details` object\ncontains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 404 — Resource not found.\n- `status`\n- `error`\n\n### 409 — Duplicate URL.\n- `status`\n- `error`\n\n### 422 — Validation error.\n- `status`\n- `error`"
120
+ "body": "# Update monitor\n\n**PATCH** `/v1/monitors/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Request Body\n\n- `url`\n- `interval_type`\n- `cron_expression`\n- `change_threshold`\n- `notify_on`\n- `webhook_url`\n- `webhook_secret`\n- `webhook_headers`\n- `status`\n- `options`\n- `scrape_options`\n- `metadata`\n\n## Responses\n\n### 200 — Successful response.\n- `id`\n- `type`\n- `url`\n- `status`\n- `interval_type`\n- `cron_expression`\n- `next_capture_at`\n- `notify_on`\n- `webhook_url`\n- `webhook_headers`\n- `change_threshold`\n- `scrape_options`\n- `last_content_hash`\n- `captures_count`\n- `changes_count`\n- `skipped_captures`\n- `last_captured_at`\n- `last_changed_at`\n- `consecutive_failures`\n- `last_error_code`\n- `suspension_reason`\n- `metadata`\n- `created_at`\n- `updated_at`\n- `cancelled_at`\n\n### 400 — Bad request. When the `url` (or `webhook_url`) field fails strict\nvalidation the error code is `invalid_url` and the `details` object\ncontains:\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### 404 — Resource not found.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 409 — Duplicate URL.\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`"
121
121
  },
122
122
  "api/plans": {
123
123
  "title": "Plans",
@@ -127,7 +127,7 @@
127
127
  "api/plans/listplans": {
128
128
  "title": "List public plan catalog",
129
129
  "section": "API Reference",
130
- "body": "# List public plan catalog\n\nReturns the catalog of public plans (`is_custom = false`) as the\npricing source-of-truth for the dashboard and marketing site. Custom\ncontract plans are excluded. Unauthenticated — this is catalog data,\nnot per-account state (per-account plan lives on `GET /v1/account`).\n\n**GET** `/v1/plans`\n\n## Responses\n\n### 200 — The public plan catalog.\n- `plans`"
130
+ "body": "# List public plan catalog\n\nReturns the catalog of public plans (`is_custom = false`) as the\npricing source-of-truth for the dashboard and marketing site. Custom\ncontract plans are excluded. Unauthenticated — this is catalog data,\nnot per-account state (per-account plan lives on `GET /v1/account`).\n\n**GET** `/v1/plans`\n\n## Responses\n\n### 200 — The public plan catalog.\n- `plans`\n- `plans.id`\n- `plans.slug`\n- `plans.name`\n- `plans.price_cents`\n- `plans.included_bytes`\n- `plans.included_credits`\n- `plans.topup_price_per_mb_cents`\n- `plans.credit_topup_price_per_k_cents`\n- `plans.max_concurrency`\n- `plans.rate_limit_per_sec`\n- `plans.is_custom`"
131
131
  },
132
132
  "api/schema": {
133
133
  "title": "Schema",
@@ -137,7 +137,7 @@
137
137
  "api/schema/createschemaextraction": {
138
138
  "title": "Schema-driven structured extraction",
139
139
  "section": "API Reference",
140
- "body": "# Schema-driven structured extraction\n\nFetches `url` and extracts structured JSON conforming to the supplied\nJSON Schema (draft 2020-12) using an LLM. Fast-path only — slow-path\nrendering options (`wait_until=networkidle`, `delay_ms`,\n`wait_for_selector`) cause a `400 unsupported_option`.\n\nDual-axis billing: a fixed per-request credit charge **plus** the\nunderlying page's bandwidth, billed at its upstream wire bytes with no\nendpoint factor (a 100 KiB estimate is pre-charged, then reconciled). The\nbandwidth is still billed when the scrape succeeds but extraction later\nfails; both axes are refunded only when the scrape itself never runs.\n\nAvailability is gated by a server-side feature flag; when disabled the\nendpoint returns `404`.\n\n**POST** `/v1/schema`\n\n## Request Body\n\n- `url` (required)\n- `schema` (required)\n- `prompt`\n- `model`\n- `wait_for_selector`\n- `wait_until`\n- `delay_ms`\n- `country`\n- `language`\n\n## Responses\n\n### 200 — Extraction completed (success or graceful extract failure).\n- `data`\n- `model`\n- `validated`\n- `metrics`\n- `scrape`\n- `warnings`\n\n### 400 — Invalid URL (`invalid_url`), unsupported model (`unsupported_model`), or unsupported slow-path option (`unsupported_option`).\n- `status`\n- `error`\n\n### 401 — Missing or invalid bearer key.\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 404 — Endpoint not available (feature flag disabled).\n- `status`\n- `error`\n\n### 422 — Validation error (`validation_error`) or non-normalizable schema (`schema_incompatible`).\n- `status`\n- `error`\n\n### 429 — Per-account rate limit (`rate_limited`) or upstream provider rate limit (`provider_rate_limited`); a `Retry-After` header may be present.\n- `status`\n- `error`\n\n### 503 — Read `error.code` to tell the conditions apart: underlying scrape failed or the\nextraction service was unreachable (`scrape_failed`), upstream provider error\n(`provider_error`), extraction provider unconfigured (`provider_unavailable`), or\nupstream provider timed out (`provider_timeout`). None of these answers `502` or\n`504`: Cloudflare fronts this API and replaces an origin 502 or 504 with its own\n`text/plain` page, discarding the error envelope, while a 503 passes through\nunchanged (#4891).\n- `status`\n- `error`"
140
+ "body": "# Schema-driven structured extraction\n\nFetches `url` and extracts structured JSON conforming to the supplied\nJSON Schema (draft 2020-12) using an LLM. Fast-path only — slow-path\nrendering options (`wait_until=networkidle`, `delay_ms`,\n`wait_for_selector`) cause a `400 unsupported_option`.\n\nDual-axis billing: a fixed per-request credit charge **plus** the\nunderlying page's bandwidth, billed at its upstream wire bytes with no\nendpoint factor (a 100 KiB estimate is pre-charged, then reconciled). The\nbandwidth is still billed when the scrape succeeds but extraction later\nfails; both axes are refunded only when the scrape itself never runs.\n\n**POST** `/v1/schema`\n\n## Request Body\n\n- `url` (required)\n- `schema` (required)\n- `prompt`\n- `model`\n- `wait_for_selector`\n- `wait_until`\n- `delay_ms`\n- `country`\n- `language`\n\n## Responses\n\n### 200 — Extraction completed (success or graceful extract failure).\n- `data`\n- `model`\n- `validated`\n- `metrics`\n- `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\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`"
141
141
  },
142
142
  "api/scrape": {
143
143
  "title": "Scrape",
@@ -152,22 +152,22 @@
152
152
  "api/scrape-bulk/createscrapebulk": {
153
153
  "title": "Bulk scrape URLs",
154
154
  "section": "API Reference",
155
- "body": "# Bulk scrape URLs\n\nEnqueues multiple URLs for scraping. Results delivered via webhook.\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/scrape/bulk/{id}` whenever\n`recovery_required` is true.\n\n**POST** `/v1/scrape/bulk`\n\n## Request Body\n\n- `urls`\n- `items`\n- `defaults`\n- `webhook_url` (required)\n- `webhook_secret`\n- `metadata`\n- `custom`\n\n## Responses\n\n### 202 — Bulk scrape job accepted.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `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\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error. `bulk_too_large` is returned when the item count\nexceeds the account plan's `max_bulk_size` cap (also surfaced as\n`max_bulk_size` on `GET /v1/account`).\n- `status`\n- `error`"
155
+ "body": "# Bulk scrape URLs\n\nEnqueues multiple URLs for scraping. Results delivered via webhook.\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/scrape/bulk/{id}` whenever\n`recovery_required` is true.\n\n**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.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.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\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`"
156
156
  },
157
157
  "api/scrape-bulk/getscrapebulk": {
158
158
  "title": "Get scrape bulk job status",
159
159
  "section": "API Reference",
160
- "body": "# Get 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**GET** `/v1/scrape/bulk/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n- `cursor` (query, string) — Opaque cursor returned by the preceding page. It is bound to this bulk id, this recovery route, and the exact status filter; cross-scope cursors return 422.\n- `limit` (query, integer) — Maximum result rows considered for this page; the 16-MiB response bound may stop sooner.\n- `status` (query, string) — Optional item-status filter. A cursor may be reused only with the same filter.\n\n## Responses\n\n### 200 — Bulk job status with rehydrated item envelopes. Each completed scrape\nresult entry echoes its `custom` payload (resolved per entry as\n`entry.custom ?? body.custom`) at the same position it occupies in the\n`/v1/scrape` success envelope. The key is omitted when no `custom` was\nsupplied for that entry.\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- `next_cursor`\n- `has_more`\n- `items`\n\n### 202 — Bulk job still processing. `routes/scrape-bulk.ts` ends the poll handler\nwith `status: isTerminal ? 200 : 202` over an identical body, so this is\nthe SAME envelope the 200 documents — only the status code and the\nreachable `status` values differ. Keep polling until you get a 200\n(issue #3533).\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- `next_cursor`\n- `has_more`\n- `items`\n\n### 404 — Resource not found.\n- `status`\n- `error`"
160
+ "body": "# Get 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**GET** `/v1/scrape/bulk/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n- `cursor` (query, string) — Opaque cursor returned by the preceding page. It is bound to this bulk id, this recovery route, and the exact status filter; cross-scope cursors return 422.\n- `limit` (query, integer) — Maximum result rows considered for this page; the 16-MiB response bound may stop sooner.\n- `status` (query, string) — Optional item-status filter. A cursor may be reused only with the same filter.\n\n## Responses\n\n### 200 — Bulk job status with rehydrated item envelopes. Each completed scrape\nresult entry echoes its `custom` payload (resolved per entry as\n`entry.custom ?? body.custom`) at the same position it occupies in the\n`/v1/scrape` success envelope. The key is omitted when no `custom` was\nsupplied for that entry.\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- `next_cursor`\n- `has_more`\n- `items`\n- `items.schema_version`\n- `items.status`\n- `items.id`\n- `items.url`\n- `items.final_url`\n- `items.content_type`\n- `items.content_length`\n- `items.status_code`\n- `items.retrieved_at`\n- `items.formats`\n- `items.formats.raw`\n- `items.formats.markdown`\n- `items.formats.links`\n- `items.formats.links.url`\n- `items.formats.links.text`\n- `items.formats.links.isInternal`\n- `items.formats.links.rel`\n- `items.formats.images`\n- `items.formats.images.url`\n- `items.formats.images.alt`\n- `items.formats.images.width`\n- `items.formats.images.height`\n- `items.formats.images.format`\n- `items.formats.images.score`\n- `items.formats.json`\n- `items.formats.json.data`\n- `items.formats.json.validated`\n- `items.formats.json.model`\n- `items.metadata`\n- `items.metadata.title`\n- `items.metadata.description`\n- `items.metadata.language`\n- `items.metadata.canonicalUrl`\n- `items.metadata.ogTitle`\n- `items.metadata.ogDescription`\n- `items.metadata.ogImage`\n- `items.metadata.ogUrl`\n- `items.metadata.ogSiteName`\n- `items.metadata.robots`\n- `items.metadata.byline`\n- `items.metadata.publishedAt`\n- `items.tables`\n- `items.tables.kind`\n- `items.tables.gfm`\n- `items.tables.rows`\n- `items.tables.cols`\n- `items.warnings`\n- `items.warnings.code`\n- `items.warnings.message`\n- `items.warnings.element`\n- `items.stats`\n- `items.stats.chars`\n- `items.stats.tokens`\n- `items.stats.blocks`\n- `items.markdown_tokens`\n- `items.markdown_tokens.kept`\n- `items.markdown_tokens.total`\n- `items.markdown_tokens.truncated`\n- `items.billing`\n- `items.billing.raw_bytes`\n- `items.billing.factors`\n- `items.billing.factors.name`\n- `items.billing.factors.value`\n- `items.billing.factors.reason`\n- `items.billing.multiplier`\n- `items.billing.billed_bytes`\n- `items.custom`\n- `items.cache`\n- `items.cache_age_s`\n- `items.error`\n- `items.error.code`\n- `items.error.message`\n- `items.error.http_status`\n- `items.error.retry_after_seconds`\n- `items.error.failed_at`\n- `items.status_url`\n- `items.queued_at`\n- `items.events`\n- `items.type`\n- `items.terminal_outcome`\n\n### 202 — Bulk job still processing. `routes/scrape-bulk.ts` ends the poll handler\nwith `status: isTerminal ? 200 : 202` over an identical body, so this is\nthe SAME envelope the 200 documents — only the status code and the\nreachable `status` values differ. Keep polling until you get a 200\n(issue #3533).\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- `next_cursor`\n- `has_more`\n- `items`\n- `items.schema_version`\n- `items.status`\n- `items.id`\n- `items.url`\n- `items.final_url`\n- `items.content_type`\n- `items.content_length`\n- `items.status_code`\n- `items.retrieved_at`\n- `items.formats`\n- `items.formats.raw`\n- `items.formats.markdown`\n- `items.formats.links`\n- `items.formats.links.url`\n- `items.formats.links.text`\n- `items.formats.links.isInternal`\n- `items.formats.links.rel`\n- `items.formats.images`\n- `items.formats.images.url`\n- `items.formats.images.alt`\n- `items.formats.images.width`\n- `items.formats.images.height`\n- `items.formats.images.format`\n- `items.formats.images.score`\n- `items.formats.json`\n- `items.formats.json.data`\n- `items.formats.json.validated`\n- `items.formats.json.model`\n- `items.metadata`\n- `items.metadata.title`\n- `items.metadata.description`\n- `items.metadata.language`\n- `items.metadata.canonicalUrl`\n- `items.metadata.ogTitle`\n- `items.metadata.ogDescription`\n- `items.metadata.ogImage`\n- `items.metadata.ogUrl`\n- `items.metadata.ogSiteName`\n- `items.metadata.robots`\n- `items.metadata.byline`\n- `items.metadata.publishedAt`\n- `items.tables`\n- `items.tables.kind`\n- `items.tables.gfm`\n- `items.tables.rows`\n- `items.tables.cols`\n- `items.warnings`\n- `items.warnings.code`\n- `items.warnings.message`\n- `items.warnings.element`\n- `items.stats`\n- `items.stats.chars`\n- `items.stats.tokens`\n- `items.stats.blocks`\n- `items.markdown_tokens`\n- `items.markdown_tokens.kept`\n- `items.markdown_tokens.total`\n- `items.markdown_tokens.truncated`\n- `items.billing`\n- `items.billing.raw_bytes`\n- `items.billing.factors`\n- `items.billing.factors.name`\n- `items.billing.factors.value`\n- `items.billing.factors.reason`\n- `items.billing.multiplier`\n- `items.billing.billed_bytes`\n- `items.custom`\n- `items.cache`\n- `items.cache_age_s`\n- `items.error`\n- `items.error.code`\n- `items.error.message`\n- `items.error.http_status`\n- `items.error.retry_after_seconds`\n- `items.error.failed_at`\n- `items.status_url`\n- `items.queued_at`\n- `items.events`\n- `items.type`\n- `items.terminal_outcome`\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### 404 — Resource not found.\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/createscrape": {
163
163
  "title": "Scrape a URL",
164
164
  "section": "API Reference",
165
- "body": "# Scrape a URL\n\nFetches and processes a URL, returning content in one or more formats wrapped in a ScrapeEnvelope.\n\n**The response shape is decided by your request, not by how we route it.** In precedence order:\n\n1. `async: true` → **202** with a `ScrapeQueuedEnvelope` receipt, returned immediately. Poll `GET /v1/scrape/{id}` for the result.\n2. Otherwise, a request that needs a full page render — today that is `delay_ms > 0` — is **held open** until the render reaches a terminal state, then returns **200** with the content envelope (`success` or `failed`). If the render is still running when the hold window expires (28 seconds by default), the request returns the **202** receipt instead and the job continues in the background.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content envelope, typically in under a second.\n\n**A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all come back on the same **200** as a `failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A failure the fast path decides inline is recorded as a failed job, so its envelope normally carries that job's `id` and `GET /v1/scrape/{id}` returns the same envelope; if recording the failed job itself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is nothing to poll. A failure a held render reaches carries that render's real `id`. Either way the request transfers no billable bytes and is charged nothing.\n\nSo a 202 means one of exactly two things: you asked for one with `async: true`, or the hold window expired. `wait_for_selector` and `wait_until` are `ScreenshotRequest` options, not `ScrapeRequest` options — sending either to this endpoint returns `422 validation_error`, so neither can produce a 202 here.\n\n**POST** `/v1/scrape`\n\n## Request Body\n\n- `url` (required)\n- `formats`\n- `country`\n- `delay_ms`\n- `timeout_ms`\n- `async`\n- `webhook_url`\n- `events`\n- `markdown_mode`\n- `markdown_query`\n- `markdown_links`\n- `markdown_images`\n- `with_links_summary`\n- `with_images_summary`\n- `markdown_compact`\n- `markdown_filter_images`\n- `markdown_include_media`\n- `markdown_include_warnings`\n- `markdown_include_stats`\n- `token_budget`\n- `token_encoding`\n- `mobile`\n- `solve_challenge`\n- `remove_base64_images`\n- `include_tags`\n- `exclude_tags`\n- `cache_ttl`\n- `custom`\n- `clean_markdown`\n- `x_internal_scrape_path`\n\n## Responses\n\n### 200 — Scrape reached a terminal state and the body is that terminal envelope: `success` carrying content, or `failed` carrying the error envelope. Returned by the fast HTTP path in one round trip, and by a browser-path request without `async: true` once its render reaches a terminal state inside the hold window. A held render that ends in failure answers 200 with the same `failed` envelope `GET /v1/scrape/{id}` returns — narrow on `status` before reading the body. A definitive upstream outcome is a result, not a transport error: an unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all answer 200 with the `failed` envelope, never a 5xx. An inline failure is recorded as a failed job, so its envelope normally carries that job's `id` and polling it returns the same envelope; `id` is `null` only when recording the failed job itself failed. `error.http_status` is present only when a real upstream HTTP status is known.\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `final_url`\n- `content_type`\n- `content_length`\n- `status_code`\n- `retrieved_at`\n- `formats`\n- `metadata`\n- `tables`\n- `warnings`\n- `stats`\n- `markdown_tokens`\n- `billing`\n- `custom`\n- `cache`\n- `cache_age_s`\n- `error`\n\n### 202 — Scrape accepted for background processing; the body is a receipt, not content. Returned when `async: true` was requested, or when a browser-path request's hold window expired before the render finished. Poll `GET /v1/scrape/{id}` for the result.\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `status_url`\n- `queued_at`\n- `events`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error.\n- `status`\n- `error`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n\n### 500 — Internal server error.\n- `status`\n- `error`"
165
+ "body": "# Scrape a URL\n\nFetches and processes a URL, returning content in one or more formats wrapped in a ScrapeEnvelope.\n\n**The response shape is decided by your request, not by how we route it.** In precedence order:\n\n1. `async: true` 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 `delay_ms > 0` — is **held open** until the render reaches a terminal state, then returns **200** with the content envelope (`success` or `failed`). If the render is still running when the hold window expires (28 seconds by default), the request returns the **202** receipt instead and the job continues in the background.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content envelope, typically in under a second.\n\n**A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all come back on the same **200** as a `failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A failure the fast path decides inline is recorded as a failed job, so its envelope normally carries that job's `id` and `GET /v1/scrape/{id}` returns the same envelope; if recording the failed job itself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is nothing to poll. A failure a held render reaches carries that render's real `id`. Either way the request transfers no billable bytes and is charged nothing.\n\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- `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### 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`"
166
166
  },
167
167
  "api/scrape/getscrape": {
168
168
  "title": "Get scrape result",
169
169
  "section": "API Reference",
170
- "body": "# Get scrape result\n\nAlways returns 200. Check the `status` discriminator for the scrape state.\n\n**GET** `/v1/scrape/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Scrape state (queued, success, or failed).\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `final_url`\n- `content_type`\n- `content_length`\n- `status_code`\n- `retrieved_at`\n- `formats`\n- `metadata`\n- `tables`\n- `warnings`\n- `stats`\n- `markdown_tokens`\n- `billing`\n- `custom`\n- `cache`\n- `cache_age_s`\n- `error`\n- `status_url`\n- `queued_at`\n- `events`\n\n### 404 — Resource not found.\n- `status`\n- `error`"
170
+ "body": "# Get scrape result\n\nAlways returns 200. Check the `status` discriminator for the scrape state.\n\n**GET** `/v1/scrape/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Scrape state (queued, success, or failed).\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- `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- `status_url`\n- `queued_at`\n- `events`\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### 404 — Resource not found.\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/screenshots": {
173
173
  "title": "Screenshots",
@@ -177,12 +177,12 @@
177
177
  "api/screenshots/createscreenshot": {
178
178
  "title": "Capture a screenshot",
179
179
  "section": "API Reference",
180
- "body": "# Capture a screenshot\n\nSync by default (holds up to 28s). Pass `?async=true` to return 202 immediately.\nPoll via GET /v1/screenshots/{id}.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/screenshots`\n\n## Parameters\n\n- `async` (query, boolean)\n\n## Request Body\n\n- `url` (required)\n- `device`\n- `viewport`\n- `full_page`\n- `format`\n- `quality`\n- `block_ads`\n- `block_cookie_banners`\n- `wait_until`\n- `wait_for_selector`\n- `delay_ms`\n- `scroll`\n- `clip`\n- `dark_mode`\n- `device_scale_factor`\n- `include_html`\n- `country`\n- `language`\n- `metadata`\n\n## Responses\n\n### 200 — Screenshot completed (sync mode).\n- `id`\n- `status`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 202 — Screenshot accepted (async mode or sync timeout).\n- `id`\n- `status`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error, or a screenshot that failed inside the sync hold.\nThe two carry DIFFERENT bodies (issue #2679):\n\n- A request-validation failure returns the unified `Error` envelope\n with code `validation_error`.\n- A capture that reached a terminal `failed` state inside the sync\n hold returns the full `ScreenshotResponse` resource, whose\n `error_code`/`error_message` carry the real failure (`blocked`,\n `timeout`, …). This is the canonical shape for that case: the\n resource body is what carries the `ss_` handle, `poll_url` and\n `expires_at` a client needs to redeem the failed capture, none of\n which fit the `Error` envelope.\n\nDiscriminate on the shape of the top-level `error` key. The envelope\nform carries `error` as an OBJECT (`{ code, message, http_status,\nfailed_at }`); the resource form has no `error` key at all, and\ncarries the flat `error_code`/`error_message` pair plus `id` instead.\n\nDo NOT discriminate on `status`. Both forms carry\n`\"status\": \"failed\"` on this response — `Error.status` is a required\nproperty with `enum: [failed]` — so it separates nothing here.\n\n`X-Screenshot-ID` accompanies the resource form only: a\nrequest-validation failure is raised before a screenshot row exists,\nso no screenshot headers travel with it.\n- `status`\n- `error`\n- `id`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`"
180
+ "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 `.gov` host, 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`.\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`"
181
181
  },
182
182
  "api/screenshots/getscreenshot": {
183
183
  "title": "Get screenshot status",
184
184
  "section": "API Reference",
185
- "body": "# Get screenshot status\n\n**GET** `/v1/screenshots/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Screenshot completed or failed. A `completed` screenshot returns the\nfull `ScreenshotResponse` resource (signed `image_url`, dimensions,\netc.). A terminal-`failed` screenshot is a successfully retrieved\nterminal state (like a failed async scrape) and instead returns the\nunified failed envelope (`Error` schema) populated from the\nscreenshot's own `error_code`/`error_message` (issue #2027).\n- `id`\n- `status`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n- `error`\n\n### 202 — Screenshot still processing.\n- `id`\n- `status`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 404 — Resource not found.\n- `status`\n- `error`"
185
+ "body": "# Get screenshot status\n\n**GET** `/v1/screenshots/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Screenshot completed or failed. A `completed` screenshot returns the\nfull `ScreenshotResponse` resource (signed `image_url`, dimensions,\netc.). A terminal-`failed` screenshot is a successfully retrieved\nterminal state (like a failed async scrape) and instead returns the\nunified failed envelope (`Error` schema) populated from the\nscreenshot's own `error_code`/`error_message` (issue #2027).\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- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 202 — Screenshot still processing.\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### 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### 404 — Resource not found.\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/search": {
188
188
  "title": "Search",
@@ -192,7 +192,7 @@
192
192
  "api/search/createsearch": {
193
193
  "title": "Search the web",
194
194
  "section": "API Reference",
195
- "body": "# Search the web\n\nRuns a web search for `query` and returns ranked organic results with\ncontiguous `position` values from 1.\n\nUse `limit` (1–100, default 10) to request more results in a single\ncall. Results are fetched in pages of 10, so a call consumes\n`ceil(limit / 10)` credits (capped at 10) from the account's monthly\ncredits bucket — for example `limit=10` costs 1 credit and `limit=35`\ncosts 4. Credits are charged for every page fetched regardless of how\nmany results a page returns. The credit count is reported as\n`credits_used` in the response.\n\n**POST** `/v1/search`\n\n## Request Body\n\n- `query` (required)\n- `type`\n- `limit`\n- `country`\n- `language`\n- `date_range`\n\n## Responses\n\n### 200 — Search completed.\n- `id`\n- `query`\n- `results`\n- `related_searches`\n- `credits_used`\n\n### 400 — Bad request (e.g. missing or empty `query`).\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 429 — Rate limit exceeded (`rate_limited`). Carries the `X-RateLimit-Limit`/`X-RateLimit-Remaining`/`X-RateLimit-Reset` triplet and a `Retry-After` header. The window is per-second for a bearer API key, or the 60-request/60-second Clerk session window when authenticated via `resolveDualAuth` — `Retry-After` reflects whichever window applies to the request.\n- `status`\n- `error`\n\n### 500 — Internal error (code `internal_error`) — the search request could not\nbe recorded before the provider call. The pre-incremented credits are\nrefunded and no provider call is made.\n- `status`\n- `error`\n\n### 503 — Upstream search provider error, answered at `503` rather than `502` because\nCloudflare replaces an origin 502 body with its own page (#4891). The body is a fixed,\nvendor-masked shape — deliberately NOT the unified `Error`\nenvelope. The upstream provider's identity and message are\nnever surfaced, so the response carries only the constant\n`error` code `search_provider_error`.\n- `error`"
195
+ "body": "# Search the web\n\nRuns a web search for `query` and returns ranked organic results with\ncontiguous `position` values from 1.\n\nUse `limit` (1–100, default 10) to request more results in a single\ncall. Results are fetched in pages of 10, so a call consumes\n`ceil(limit / 10)` credits (capped at 10) from the account's monthly\ncredits bucket — for example `limit=10` costs 1 credit and `limit=35`\ncosts 4. Credits are charged for every page fetched regardless of how\nmany results a page returns. The credit count is reported as\n`credits_used` in the response.\n\n**POST** `/v1/search`\n\n## Request Body\n\n- `query` (required)\n- `type`\n- `limit`\n- `country`\n- `language`\n- `date_range`\n\n## Responses\n\n### 200 — Search completed.\n- `id`\n- `query`\n- `results`\n- `results.position`\n- `results.title`\n- `results.url`\n- `results.snippet`\n- `results.date`\n- `results.source`\n- `results.domain`\n- `results.image`\n- `results.image.url`\n- `results.image.width`\n- `results.image.height`\n- `results.image.thumbnail_url`\n- `results.image.thumbnail_width`\n- `results.image.thumbnail_height`\n- `related_searches`\n- `credits_used`\n\n### 400 — Bad request (e.g. missing or empty `query`).\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### 429 — Rate limit exceeded (`rate_limited`). Carries the `X-RateLimit-Limit`/`X-RateLimit-Remaining`/`X-RateLimit-Reset` triplet and a `Retry-After` header. The window is per-second for a bearer API key, or the 60-request/60-second Clerk session window when authenticated via `resolveDualAuth` — `Retry-After` reflects whichever window applies to the request.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 500 — Internal error (code `internal_error`) — the search request could not\nbe recorded before the provider call. The pre-incremented credits are\nrefunded and no provider call is made.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 503 — Two different bodies travel under this status. Tell them apart by the\ntype of the top-level `error` key: a string is the first, an object\nis the second.\n\n- **Upstream search provider error**, answered at `503` rather than\n `502` because Cloudflare replaces an origin 502 body with its own\n page (#4891). The body is a fixed, vendor-masked shape —\n deliberately NOT the unified `Error` envelope. The upstream\n provider's identity and message are never surfaced, so the\n response carries only the constant `error` code\n `search_provider_error`.\n- **Billing entitlement unavailable** (`billing_entitlement_missing`),\n raised before any search runs, when the account has a Stripe\n subscription but its plan could not be resolved. This one is the\n unified `Error` envelope. No search is run and nothing is charged.\n- `error`\n- `status`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
196
196
  },
197
197
  "api/sitemap": {
198
198
  "title": "Sitemap",
@@ -202,12 +202,12 @@
202
202
  "api/sitemap/createsitemap": {
203
203
  "title": "Discover URLs on a domain",
204
204
  "section": "API Reference",
205
- "body": "# Discover URLs on a domain\n\nCrawls a domain to build a sitemap. Returns cached results if available\nwithin cache_ttl. Results delivered via webhook and downloadable from results_url.\nWebhook deliveries include `X-ByteKit-Event: sitemap.completed` or\n`X-ByteKit-Event: sitemap.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/sitemap`\n\n## Request Body\n\n- `url` (required)\n- `strategy`\n- `max_depth`\n- `max_urls`\n- `process`\n- `webhook_url`\n- `webhook_secret`\n- `cache_ttl`\n- `compact`\n- `metadata`\n\n## Responses\n\n### 202 — Sitemap job accepted (or cached result returned).\n- `id`\n- `url`\n- `strategy`\n- `max_depth`\n- `max_urls`\n- `status`\n- `total_urls`\n- `sources`\n- `total_bytes`\n- `results_url`\n- `cache`\n- `cache_age_s`\n- `billing`\n- `warnings`\n- `error_code`\n- `error_message`\n- `compact`\n- `process`\n- `metadata`\n- `created_at`\n- `completed_at`\n- `expires_at`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n\n### 422 — Validation error.\n- `status`\n- `error`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`"
205
+ "body": "# Discover URLs on a domain\n\nCrawls a domain to build a sitemap. Returns cached results if available\nwithin cache_ttl. Results delivered via webhook and downloadable from results_url.\nWebhook deliveries include `X-ByteKit-Event: sitemap.completed` or\n`X-ByteKit-Event: sitemap.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\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 `.gov` host, 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`"
206
206
  },
207
207
  "api/sitemap/getsitemap": {
208
208
  "title": "Get sitemap job status",
209
209
  "section": "API Reference",
210
- "body": "# Get sitemap job status\n\n**GET** `/v1/sitemap/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Successful response.\n- `id`\n- `url`\n- `strategy`\n- `max_depth`\n- `max_urls`\n- `status`\n- `total_urls`\n- `sources`\n- `total_bytes`\n- `results_url`\n- `cache`\n- `cache_age_s`\n- `billing`\n- `warnings`\n- `error_code`\n- `error_message`\n- `compact`\n- `process`\n- `metadata`\n- `created_at`\n- `completed_at`\n- `expires_at`\n\n### 404 — Resource not found.\n- `status`\n- `error`\n\n### 422 — The id path segment is not a well-formed sitemap job id (genuinely malformed — a well-formed-but-absent id returns 404, not 422; see the Inverse case in issue\n- `status`\n- `error`"
210
+ "body": "# Get sitemap job status\n\n**GET** `/v1/sitemap/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Successful response.\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### 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### 404 — Resource not found.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — The id path segment is not a well-formed sitemap job id (genuinely malformed — a well-formed-but-absent id returns 404, not 422; see the Inverse case in issue\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/usage": {
213
213
  "title": "Usage",
@@ -217,17 +217,17 @@
217
217
  "api/usage/getusage": {
218
218
  "title": "Get current billing period usage",
219
219
  "section": "API Reference",
220
- "body": "# Get current billing period usage\n\n**GET** `/v1/usage`\n\n## Responses\n\n### 200 — Period summary. In bytes or dual billing mode, includes byte fields\nand structured bandwidth/credits objects.\n- `period_start`\n- `period_end`\n- `credits_used`\n- `credits_single`\n- `credits_bulk`\n- `credits_monitor`\n- `credits_scrape`\n- `credits_search`\n- `credits_limit`\n- `credits_remaining`\n- `has_overage`\n- `overage_credits`\n- `plan_name`\n- `plan_price_cents`\n- `plan_type`\n- `topup_spent_cents`\n- `topup_balance_bytes`\n- `period_days_elapsed`\n- `bytes_used`\n- `bytes_single`\n- `bytes_bulk`\n- `bytes_scrape`\n- `bytes_monitor`\n- `bytes_limit`\n- `bytes_remaining`\n- `rollover_bytes`\n- `topup_bytes`\n- `request_count`\n- `request_count_previous_period`\n- `playground_api_key_id`\n- `bandwidth`\n- `credits`"
220
+ "body": "# Get current billing period usage\n\n**GET** `/v1/usage`\n\n## Responses\n\n### 200 — Period summary. In bytes or dual billing mode, includes byte fields\nand structured bandwidth/credits objects.\n- `period_start`\n- `period_end`\n- `credits_used`\n- `credits_single`\n- `credits_bulk`\n- `credits_monitor`\n- `credits_scrape`\n- `credits_search`\n- `credits_limit`\n- `credits_remaining`\n- `has_overage`\n- `overage_credits`\n- `plan_name`\n- `plan_price_cents`\n- `plan_type`\n- `topup_spent_cents`\n- `topup_balance_bytes`\n- `period_days_elapsed`\n- `bytes_used`\n- `bytes_single`\n- `bytes_bulk`\n- `bytes_scrape`\n- `bytes_monitor`\n- `bytes_limit`\n- `bytes_remaining`\n- `rollover_bytes`\n- `topup_bytes`\n- `request_count`\n- `request_count_previous_period`\n- `playground_api_key_id`\n- `bandwidth`\n- `bandwidth.used_bytes`\n- `bandwidth.limit_bytes`\n- `bandwidth.remaining_bytes`\n- `bandwidth.topup_bytes`\n- `bandwidth.purchased_topup_bytes`\n- `bandwidth.granted_topup_bytes`\n- `bandwidth.rollover_bytes`\n- `credits`\n- `credits.used`\n- `credits.limit`\n- `credits.remaining`\n- `credits.topup_credits`\n- `credits.purchased_topup_credits`\n- `credits.granted_topup_credits`\n- `credits.rollover_credits`\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`"
221
221
  },
222
222
  "api/usage/getusagebyendpoint": {
223
223
  "title": "Get per-endpoint bandwidth breakdown",
224
224
  "section": "API Reference",
225
- "body": "# Get per-endpoint bandwidth breakdown\n\nReturns bandwidth usage broken down by endpoint (screenshots, recordings, scrape, scrape_md, fetch, fetch_md, crawl, crawl_links, sitemap, monitors) for a date range. Each row carries raw bytes, the billing multiplier, and billable bytes. Endpoints with zero raw bytes for the range are omitted from `rows`; `totals` is always present. Default range is the last 30 days; max 366 days.\n\n**GET** `/v1/usage/by-endpoint`\n\n## Parameters\n\n- `from` (query, string) — Start date (YYYY-MM-DD). Default 30 days ago.\n- `to` (query, string) — End date (YYYY-MM-DD). Default today.\n- `api_key` (query, string) — Filter by API key (prefixed ID, e.g. `ak_xxx`). When provided, scopes the breakdown to that key only. The key must belong to the requesting account; cross-account keys return an empty breakdown. When absent, aggregates across all keys.\n\n## Responses\n\n### 200 — Successful response.\n- `from`\n- `to`\n- `rows`\n- `totals`"
225
+ "body": "# Get per-endpoint bandwidth breakdown\n\nReturns bandwidth usage broken down by endpoint (screenshots, recordings, scrape, scrape_md, fetch, fetch_md, crawl, crawl_links, sitemap, monitors) for a date range. Each row carries raw bytes, the billing multiplier, and billable bytes. Endpoints with zero raw bytes for the range are omitted from `rows`; `totals` is always present. Default range is the last 30 days; max 366 days.\n\n**GET** `/v1/usage/by-endpoint`\n\n## Parameters\n\n- `from` (query, string) — Start date (YYYY-MM-DD). Default 30 days ago.\n- `to` (query, string) — End date (YYYY-MM-DD). Default today.\n- `api_key` (query, string) — Filter by API key (prefixed ID, e.g. `ak_xxx`). When provided, scopes the breakdown to that key only. The key must belong to the requesting account; cross-account keys return an empty breakdown. When absent, aggregates across all keys.\n\n## Responses\n\n### 200 — Successful response.\n- `from`\n- `to`\n- `rows`\n- `rows.endpoint`\n- `rows.raw_bytes`\n- `rows.multiplier`\n- `rows.billable_bytes`\n- `totals`\n- `totals.raw_bytes`\n- `totals.billable_bytes`\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`"
226
226
  },
227
227
  "api/usage/getusagedaily": {
228
228
  "title": "Get daily usage breakdown",
229
229
  "section": "API Reference",
230
- "body": "# Get daily usage breakdown\n\nDefault range is last 30 days. Max range is 366 days.\n\n**GET** `/v1/usage/daily`\n\n## Parameters\n\n- `from` (query, string) — Start date (YYYY-MM-DD). Default 30 days ago.\n- `to` (query, string) — End date (YYYY-MM-DD). Default today.\n- `api_key` (query, string) — Filter by API key (prefixed ID, e.g. `ak_xxx`). When provided, returns usage rows attributed to that key only. The key must belong to the requesting account; cross-account keys return empty data. Revoked keys still return historical data. When absent, aggregates across all keys.\n\n## Responses\n\n### 200 — Successful response.\n- `from`\n- `to`\n- `data`"
230
+ "body": "# Get daily usage breakdown\n\nDefault range is last 30 days. Max range is 366 days.\n\n**GET** `/v1/usage/daily`\n\n## Parameters\n\n- `from` (query, string) — Start date (YYYY-MM-DD). Default 30 days ago.\n- `to` (query, string) — End date (YYYY-MM-DD). Default today.\n- `api_key` (query, string) — Filter by API key (prefixed ID, e.g. `ak_xxx`). When provided, returns usage rows attributed to that key only. The key must belong to the requesting account; cross-account keys return empty data. Revoked keys still return historical data. When absent, aggregates across all keys.\n\n## Responses\n\n### 200 — Successful response.\n- `from`\n- `to`\n- `data`\n- `data.date`\n- `data.credits_single`\n- `data.credits_bulk`\n- `data.credits_monitor`\n- `data.credits_scrape`\n- `data.credits_search`\n- `data.credits_total`\n- `data.bytes_total`\n- `data.bytes_single`\n- `data.bytes_bulk`\n- `data.bytes_scrape`\n- `data.bytes_monitor`\n- `data.bytes_screenshot`\n- `data.bytes_recording`\n- `data.bytes_scrape_md`\n- `data.bytes_fetch`\n- `data.bytes_fetch_md`\n- `data.bytes_crawl`\n- `data.bytes_crawl_links`\n- `data.bytes_sitemap`\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`"
231
231
  },
232
232
  "api/webhooks": {
233
233
  "title": "Webhooks",
@@ -237,27 +237,27 @@
237
237
  "api/webhooks/listwebhookdeliveries": {
238
238
  "title": "List webhook deliveries",
239
239
  "section": "API Reference",
240
- "body": "# List webhook deliveries\n\n**GET** `/v1/webhook-deliveries`\n\n## Parameters\n\n- `limit` (query, integer)\n- `cursor` (query, string) — Pagination cursor from a previous response.\n- `status` (query, string)\n- `since` (query, string) — Filter deliveries created after this ISO date.\n\n## Responses\n\n### 200 — Successful response.\n- `data`\n- `next_cursor`\n- `has_more`"
240
+ "body": "# List webhook deliveries\n\n**GET** `/v1/webhook-deliveries`\n\n## Parameters\n\n- `limit` (query, integer)\n- `cursor` (query, string) — Pagination cursor from a previous response.\n- `status` (query, string)\n- `since` (query, string) — Filter deliveries created after this ISO date.\n\n## Responses\n\n### 200 — Successful response.\n- `data`\n- `data.id`\n- `data.event_type`\n- `data.target_url`\n- `data.status`\n- `data.attempts`\n- `data.max_attempts`\n- `data.next_attempt_at`\n- `data.response_status`\n- `data.response_ms`\n- `data.created_at`\n- `data.delivered_at`\n- `data.screenshot_id`\n- `data.recording_id`\n- `data.bulk_id`\n- `data.monitor_id`\n- `data.scrape_id`\n- `next_cursor`\n- `has_more`\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`"
241
241
  },
242
242
  "api/webhooks/retrywebhookdelivery": {
243
243
  "title": "Retry a webhook delivery",
244
244
  "section": "API Reference",
245
- "body": "# Retry a webhook delivery\n\nRequeues a failed or exhausted webhook delivery for another attempt.\n\n**Limits:** this endpoint takes no request body; any body sent is\ncapped at 64 KB. An oversized body returns a `400` with error code\n`request_too_large`.\n\n**POST** `/v1/webhook-deliveries/{id}/retry`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Successful response.\n- `id`\n- `event_type`\n- `target_url`\n- `status`\n- `attempts`\n- `max_attempts`\n- `next_attempt_at`\n- `response_status`\n- `response_ms`\n- `created_at`\n- `delivered_at`\n- `screenshot_id`\n- `recording_id`\n- `bulk_id`\n- `monitor_id`\n- `scrape_id`\n\n### 400 — Bad request. Returned when the request body exceeds this\nendpoint's size limit; the error code is `request_too_large`.\n- `status`\n- `error`\n\n### 404 — Delivery not found or not in a retryable state.\n- `status`\n- `error`"
245
+ "body": "# Retry a webhook delivery\n\nRequeues a failed or exhausted webhook delivery for another attempt.\n\n**Limits:** this endpoint takes no request body; any body sent is\ncapped at 64 KB. An oversized body returns a `400` with error code\n`request_too_large`.\n\n**POST** `/v1/webhook-deliveries/{id}/retry`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Successful response.\n- `id`\n- `event_type`\n- `target_url`\n- `status`\n- `attempts`\n- `max_attempts`\n- `next_attempt_at`\n- `response_status`\n- `response_ms`\n- `created_at`\n- `delivered_at`\n- `screenshot_id`\n- `recording_id`\n- `bulk_id`\n- `monitor_id`\n- `scrape_id`\n\n### 400 — Bad request. Returned when the request body exceeds this\nendpoint's size limit; the error code is `request_too_large`.\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### 404 — Delivery not found or not in a retryable state.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
246
246
  },
247
247
  "billing": {
248
248
  "title": "Billing",
249
249
  "section": "General",
250
- "body": "# Billing\n\nHow ByteKit prices bandwidth and credits, and how balances, top-ups, and spending controls behave.\n\nByteKit meters two separate things: **bandwidth**, which pays for the capture endpoints, and\n**credits**, which pay for search and schema extraction. The relevant balance is checked before\nany billable work is admitted, so a request either runs against a balance or is rejected — it\nnever continues as unpriced usage.\n\n- [Balance and exhausted quota](https://bytekit.com/docs/billing/balance) — What happens when a ByteKit bandwidth or credit balance reaches zero.\n- [Bandwidth billing](https://bytekit.com/docs/billing/bandwidth) — How ByteKit measures billed bandwidth for capture and sitemap endpoints.\n- [Credit billing](https://bytekit.com/docs/billing/credits) — How search and schema extraction consume credits.\n- [Top-ups and rollover](https://bytekit.com/docs/billing/top-ups) — How your USD balance is spent, why it never expires, and how plan allowance rolls over.\n- [Spending controls](https://bytekit.com/docs/billing/spending) — How spending caps and automatic bandwidth top-ups behave."
250
+ "body": "# Billing\n\nHow ByteKit prices bandwidth and credits, and how balances, top-ups, and spending controls behave.\n\nByteKit meters two separate things: **bandwidth**, which pays for the capture endpoints, and\n**credits**, which pay for search and schema extraction. The relevant balance is checked before\nany billable work is admitted, so a request either runs against a balance or is rejected — it\nnever continues as unpriced usage.\n\n## Terms\n\nThe billing pages and guides use these words in the sense given here.\n\n- **Bandwidth** — the meter, counted in bytes, for scrape, fetch, screenshot, sitemap and monitor-run requests, and schema extraction also consumes it for its source-page fetch. See [Bandwidth billing](https://bytekit.com/docs/billing/bandwidth).\n- **Credits** — the meter for search and schema extraction. See [Credit billing](https://bytekit.com/docs/billing/credits).\n- **Included allowance** — the bandwidth and credits your plan includes for each billing period. Unused bandwidth can roll over to the next period under the rules in [Top-ups and rollover](https://bytekit.com/docs/billing/top-ups#billing-period-rollover); credits do not roll over and reset every billing period.\n- **USD balance** — the dollars you add with top-ups, including automatic top-ups. It never expires and is not tied to the plan you held when you added it. See [Top-ups and rollover](https://bytekit.com/docs/billing/top-ups#the-usd-balance).\n- **Starter grant** — the one-time 100 MB of bandwidth and 100 credits a new pay-as-you-go account receives. It is not a purchase and does not expire. See [the starter grant](https://bytekit.com/docs/billing/balance#starter-grant).\n- **Balance** — the umbrella term for what a request draws from: your included allowance, then your USD balance, then your starter grant. A request is checked against the bandwidth balance, the credit balance or both before it is admitted. See [what happens when a balance runs out](https://bytekit.com/docs/billing/balance).\n\n## Prices and plan limits\n\nThis section explains how usage is metered, not what it costs. For each plan's monthly price,\nincluded bandwidth and credits, top-up rates, concurrent captures and requests per second, see\n[bytekit.com/pricing](https://bytekit.com/pricing). `GET /v1/plans` returns the same public plan\ncatalog programmatically, with no authentication.\n\n- [When your balance runs out](https://bytekit.com/docs/billing/balance) — What happens when a ByteKit bandwidth or credit balance reaches zero.\n- [Bandwidth billing](https://bytekit.com/docs/billing/bandwidth) — How ByteKit measures billed bandwidth for capture and sitemap endpoints.\n- [Credit billing](https://bytekit.com/docs/billing/credits) — How search and schema extraction consume credits.\n- [Top-ups and rollover](https://bytekit.com/docs/billing/top-ups) — How your USD balance is spent, why it never expires, and how plan allowance rolls over.\n- [Spending controls](https://bytekit.com/docs/billing/spending) — How spending caps and automatic bandwidth top-ups behave."
251
251
  },
252
252
  "billing/balance": {
253
253
  "title": "Balance and exhausted quota",
254
254
  "section": "General",
255
- "body": "# Balance and exhausted quota\n\nWhat happens when a ByteKit bandwidth or credit balance reaches zero.\n\nByteKit checks the relevant balance before admitting billable work. Capture endpoints use the bandwidth balance; search uses the credit balance; schema extraction requires both.\n\nWhen a request would exceed an enforced balance, ByteKit returns **HTTP 402** with the error code `quota_exceeded`. The request does not continue as unpriced usage.\n\nThere is no automatic overage: availability is an explicit plan setting, reported as the `has_overage` field on your plan (`GET /v1/account`, `GET /v1/plans`) and on `GET /v1/usage`. No standard plan enables it — Starter, Growth and Scale report `has_overage: false`, so a credit-metered request past the included allowance is refused with 402 `quota_exceeded` rather than admitted as billable overage. Only a custom plan arranged with ByteKit can enable overage; on such a plan a configured spending cap can permit or reject additional usage, returning 402 `spending_cap_reached` when the cap is crossed. Capture endpoints still enforce their bandwidth budget.\n\n## Starter grant\n\nA new pay-as-you-go account receives a one-time starter grant when it is first created: **50 MB of bandwidth and 100 credits**. It is issued once per account, is not a purchase, and does not expire. Granted value is spent last — after your plan's included allowance and after any purchased top-up — so a top-up you paid for is never consumed while free grant remains.\n\n`GET /v1/billing/balance` reports the grant separately from purchases: `granted_topup_bytes` and `granted_topup_credits` hold the grant, `purchased_topup_bytes` and `purchased_topup_credits` hold what you bought, and `topup_bytes` / `topup_credits` are the two added together.\n\nTo continue after a hard balance stop, purchase a top-up or move to a plan with more included usage. Auto-top-up can add funds to your USD balance when your remaining value drops below the configured dollar threshold, but it must be enabled and configured in advance; reaching zero does not silently enable it.\n\nSee **Dashboard → Settings → Billing** for included usage, purchased and rollover balances, and auto-top-up status."
255
+ "body": "# Balance and exhausted quota\n\nWhat happens when a ByteKit bandwidth or credit balance reaches zero.\n\nByteKit checks the relevant balance before admitting billable work. Capture endpoints use the bandwidth balance; search uses the credit balance; schema extraction requires both.\n\nWhen a request would exceed an enforced balance, ByteKit returns **HTTP 402** with the error code `quota_exceeded`. The request does not continue as unpriced usage.\n\nThere is no automatic overage: availability is an explicit plan setting, reported as the `has_overage` field on your plan (`GET /v1/account`, `GET /v1/plans`) and on `GET /v1/usage`. No standard plan enables it — Starter, Growth and Scale report `has_overage: false`, so a credit-metered request past the included allowance is refused with 402 `quota_exceeded` rather than admitted as billable overage. Only a custom plan arranged with ByteKit can enable overage; on such a plan a configured spending cap can permit or reject additional usage, returning 402 `spending_cap_reached` when the cap is crossed. Capture endpoints still enforce their bandwidth budget.\n\n## Starter grant\n\nA new pay-as-you-go account receives a one-time starter grant when it is first created: **100 MB of bandwidth and 100 credits**. It is issued once per account, is not a purchase, and does not expire. Granted value is spent last — after your plan's included allowance and after any purchased top-up — so a top-up you paid for is never consumed while free grant remains.\n\n`GET /v1/billing/balance` reports the grant separately from purchases: `granted_topup_bytes` and `granted_topup_credits` hold the grant, `purchased_topup_bytes` and `purchased_topup_credits` hold what you bought, and `topup_bytes` / `topup_credits` are the two added together.\n\nTo continue after a hard balance stop, purchase a top-up or move to a plan with more included usage. Auto-top-up can add funds to your USD balance when your remaining value drops below the configured dollar threshold, but it must be enabled and configured in advance; reaching zero does not silently enable it.\n\nSee **Dashboard → Settings → Billing** for included usage, purchased and rollover balances, and auto-top-up status."
256
256
  },
257
257
  "billing/bandwidth": {
258
258
  "title": "Bandwidth billing",
259
259
  "section": "General",
260
- "body": "# Bandwidth billing\n\nHow ByteKit measures billed bandwidth for capture and sitemap endpoints.\n\nByteKit bills most capture endpoints from bytes transferred over the upstream wire, not from the size of the final JSON, Markdown, image, or recording artifact. Sitemap jobs use the generated results artifact instead, as described below.\n\n## Upstream wire-byte endpoints\n\nFor scrape, fetch, crawl, and monitor requests, the amount taken from your balance is calculated once, at settlement, and rounded once:\n\n```\nbalance deduction = round(upstream wire bytes × endpoint factor × cache factor × clean-Markdown factor)\n```\n\nA cache hit contributes a **0.5×** factor. Successful clean-Markdown processing contributes a separate **3×** factor. The endpoint factor is listed below. All three compose; they are not alternative rates.\n\n### Endpoint factors\n\nEach endpoint carries a factor reflecting the work it performs:\n\n| Endpoint | Factor |\n| --------------------------- | -----: |\n| Scrape | 1× |\n| Scrape with Markdown output | 1.5× |\n| Fetch | 1× |\n| Fetch with Markdown output | 1.5× |\n| Crawl | 1.5× |\n| Crawl links | 1× |\n| Monitor run | 1× |\n\nRequesting Markdown output raises a scrape **or a fetch** from 1× to 1.5×, so a Markdown scrape and a Markdown fetch each deduct one and a half times their upstream wire bytes. The surcharge is not scrape-only.\n\nThis factor is part of what you are charged. `GET /v1/usage/by-endpoint`, the per-endpoint table under **Dashboard → Usage**, the `billing` object on each response and the `X-Billable-Bytes` header all report the same amount your balance lost — there is no separate reporting weight to reconcile.\n\nScreenshot and recording captures bill on a different basis, described under [Other capture artifacts](#other-capture-artifacts).\n\n## Bulk\n\nA bulk job has **no endpoint factor of its own**. Each item settles independently, on exactly the basis the same request would use on its own: a scrape item as a scrape and a fetch item as a fetch, at that endpoint's factor from the table above, and a screenshot item — the type `/v1/bulk` assumes when you do not name one — on the separate capture basis under [Other capture artifacts](#other-capture-artifacts), which the table above does not cover.\n\nWhatever factors an item would carry alone, it carries in bulk: a cache hit still contributes **0.5×**, and successful clean-Markdown processing still contributes **3×** on the `/v1/scrape/bulk` items that can request it. A job's billed total is the sum of its items, with no per-job fee, no bulk surcharge and no bulk discount.\n\nSo a bulk job of Markdown scrapes bills at **1.5× per item, not 1×**: the Markdown surcharge is an endpoint factor, and bulk does not suppress it. Sending URLs in bulk saves you round trips, not bytes — the charge for each item is the same as it would be on its own request.\n\n## Sitemap\n\nSitemap billing uses the byte length of the **gzip-compressed generated results CSV**. ByteKit builds the results CSV for the job, compresses it, and bills that compressed length — the same figure your sitemap usage reports.\n\nDiscovery fetch bytes are not accumulated into the sitemap charge. The charged byte count is the compressed results artifact, not the upstream bytes transferred while discovering URLs.\n\n## Other capture artifacts\n\nScreenshots and recordings use a separate capture basis: `phase1WireBytes × 1.5`, rounded to whole bytes. The 1.5× combines the upstream Phase 1 fetch with rendering overhead. If Phase 1 has no positive wire-byte measurement, that capture contributes zero billable bytes.\n\nYour current allowance, purchased bandwidth, rollover bandwidth, and remaining balance are shown under **Dashboard → Settings → Billing**."
260
+ "body": "# Bandwidth billing\n\nHow ByteKit measures billed bandwidth for capture and sitemap endpoints.\n\nByteKit bills most capture endpoints from bytes transferred over the upstream wire, not from the size of the final JSON, Markdown, or image artifact. Sitemap jobs use the generated results artifact instead, as described below.\n\n## Upstream wire-byte endpoints\n\nFor scrape, fetch, and monitor requests, the amount taken from your balance is calculated once, at settlement, and rounded once:\n\n```\nbalance deduction = round(upstream wire bytes × endpoint factor × cache factor × clean-Markdown factor)\n```\n\nA page that only a hosted browser could retrieve has no single upstream response, so its upstream wire bytes are the browser's full measured transfer: every response the page loaded plus the requests the browser sent.\n\nA cache hit contributes a **0.5×** factor. Successful clean-Markdown processing contributes a separate **3×** factor. The endpoint factor is listed below. All three compose; they are not alternative rates.\n\n### Endpoint factors\n\nEach endpoint carries a factor reflecting the work it performs:\n\n| Endpoint | Factor |\n| --------------------------- | -----: |\n| Scrape | 1× |\n| Scrape with Markdown output | 1.5× |\n| Fetch | 1× |\n| Monitor run | 1× |\n\nRequesting Markdown output raises a scrape from 1× to 1.5×, so a Markdown scrape deducts one and a half times its upstream wire bytes. `/v1/fetch` takes no `format` and has no Markdown output; request Markdown from `/v1/scrape`.\n\nThis factor is part of what you are charged. `GET /v1/usage/by-endpoint`, the per-endpoint table under **Dashboard → Usage**, the `billing` object on each response and the `X-Billable-Bytes` header all report the same amount your balance lost — there is no separate reporting weight to reconcile.\n\nScreenshot captures bill on a different basis, described under [Other capture artifacts](#other-capture-artifacts).\n\n### Legacy usage buckets\n\nThe legacy buckets below are not endpoints you can call. They stay in the list of values `GET /v1/usage/by-endpoint` can report, with these factors:\n\n| Usage bucket | Factor |\n| ----------------------------------- | -----: |\n| Crawl (legacy) | 1.5× |\n| Crawl links (legacy) | 1× |\n| Fetch with Markdown output (legacy) | 1.5× |\n\nByteKit has no crawl endpoint. `/v1/fetch` has no Markdown output, so the Markdown-fetch bucket appears only in historical usage reports. The deactivated recordings endpoint likewise leaves a legacy bucket that appears only in historical usage reports; its basis is under [Other capture artifacts](#other-capture-artifacts).\n\n## Charges that survive a failure\n\nA request that fails with a terminal error has its pre-incremented amount rolled back, as the [Usage counting](https://bytekit.com/docs/guides/rate-limits#usage-counting) section describes. Two charges survive a failure. A `/v1/fetch` request answered from the cache with a non-2xx upstream status is billed at the cache-hit rate, and a failed schema extraction refunds the credits it pre-charged but keeps the source page's bandwidth. That cached non-2xx hit returns the `upstream_error` envelope — the same JSON a cache miss with the same upstream status returns — not the cached body, which stays the billing basis even though it is not served.\n\n## Bulk\n\nA bulk job has **no endpoint factor of its own**. Each item settles independently, on exactly the basis the same request would use on its own: a scrape item as a scrape and a fetch item as a fetch, at that endpoint's factor from the table above, and a screenshot item — the type `/v1/bulk` assumes when you do not name one — on the separate capture basis under [Other capture artifacts](#other-capture-artifacts), which the table above does not cover.\n\nWhatever factors an item would carry alone, it carries in bulk: a cache hit still contributes **0.5×**, and successful clean-Markdown processing still contributes **3×** on the `/v1/scrape/bulk` items that can request it. A job's billed total is the sum of its items, with no per-job fee, no bulk surcharge and no bulk discount.\n\nSo a bulk job of Markdown scrapes bills at **1.5× per item, not 1×**: the Markdown surcharge is an endpoint factor, and bulk does not suppress it. Sending URLs in bulk saves you round trips, not bytes — the charge for each item is the same as it would be on its own request.\n\n## Sitemap\n\nSitemap billing uses the byte length of the **gzip-compressed generated results CSV**. ByteKit builds the results CSV for the job, compresses it, and bills that compressed length — the same figure your sitemap usage reports.\n\nDiscovery fetch bytes are not accumulated into the sitemap charge. The charged byte count is the compressed results artifact, not the upstream bytes transferred while discovering URLs.\n\nA sitemap request that reuses an earlier job's results (`cache: hit` on the `202` response) carries the **0.5×** cache-hit factor on that same compressed size.\n\n## Other capture artifacts\n\nScreenshots use a separate capture basis: 1.5× the wire bytes of the initial page fetch, rounded to whole bytes. The extra 0.5× covers rendering the page. If that initial fetch has no positive wire-byte measurement, the capture contributes zero billable bytes.\n\nRecordings were billed on that same basis, except older recordings in historical usage reports, which were billed on the size of the recording file. The `/v1/recordings` endpoint is deactivated, so the `recordings` bucket can appear only in historical usage reports.\n\nYour current allowance, purchased bandwidth, rollover bandwidth, and remaining balance are shown under **Dashboard → Settings → Billing**."
261
261
  },
262
262
  "billing/credits": {
263
263
  "title": "Credit billing",
@@ -272,7 +272,7 @@
272
272
  "billing/top-ups": {
273
273
  "title": "Top-ups and rollover",
274
274
  "section": "General",
275
- "body": "# Top-ups and rollover\n\nHow your USD balance is spent, why it never expires, and how plan allowance rolls over.\n\nTop-ups add dollars to your account's USD balance without changing your plan's included allowance. Value is spent in one order: your plan's included allowance, including any rollover from earlier periods, then the USD balance, then the one-time starter grant.\n\n## The USD balance\n\nYour USD balance never expires. It is not tied to the plan you were on when you added it: a cancellation or plan change does not freeze it, hold it, or reset its value. Usage beyond your included allowance draws from the balance at your current plan's top-up rate for the resource it uses — bandwidth or search credits — so the same dollars buy more on a plan with a lower rate. The bandwidth and credit amounts shown beside your balance are estimates at those current rates; the dollar figure is what you hold.\n\n## Bandwidth you owe\n\nA request is billed on the bandwidth it actually used, which can turn out larger than the amount set aside when it started. When that overage is more than your allowance, USD balance and starter grant can cover, the uncovered bandwidth is recorded as bandwidth you owe. It is not waived, and it does not make your USD balance negative. The amount you owe appears under **Dashboard → Settings → Billing**.\n\nYour next top-up, billing-period renewal or plan upgrade pays it off before anything else, oldest first, and only what is left over becomes spendable. A top-up first brings a USD balance that a refund or dispute took below zero back up to zero, then converts only as many of the remaining dollars as it needs to bandwidth at your current plan's top-up rate, and the rest stays in your USD balance. On a plan whose top-up rate is zero, only a renewal or plan upgrade can pay it off.\n\nWhile you owe anything, whether bandwidth or a USD balance below zero, new billable requests are refused with `402 quota_exceeded`, even if you still have allowance left. Requests already in progress finish and are billed as usual.\n\n## Billing-period rollover\n\nUnused bandwidth from your monthly plan allowance rolls over to the next billing period with no cap, for as long as the subscription stays on its plan or moves to a higher one. A downgrade or cancellation freezes it: the frozen balance stops being spendable, and resubscribing at the same tier or higher within 90 days restores it in full — after that it is permanently lost. The USD balance is separate from the billing period, so it is not reset when that period rolls over.\n\nCredits do not roll over — they reset every billing period. This does not affect your USD balance, which never expires.\n\nYour USD balance and rollover balances appear under **Dashboard → Settings → Billing**."
275
+ "body": "# Top-ups and rollover\n\nHow your USD balance is spent, why it never expires, and how plan allowance rolls over.\n\nTop-ups add dollars to your account's USD balance without changing your plan's included allowance. Value is spent in one order: your plan's included allowance, including any rollover from earlier periods, then the USD balance, then the one-time starter grant.\n\n## The USD balance\n\nYour USD balance never expires. It is not tied to the plan you were on when you added it: a cancellation or plan change does not freeze it, hold it, or reset its value. Usage beyond your included allowance draws from the balance at your current plan's top-up rate for the resource it uses — bandwidth or search credits — so the same dollars buy more on a plan with a lower rate. The bandwidth and credit amounts shown beside your balance are estimates at those current rates; the dollar figure is what you hold.\n\n## Bandwidth you owe\n\nA request is billed on the bandwidth it actually used, which can turn out larger than the amount set aside when it started. Bandwidth beyond what your allowance, USD balance and starter grant can cover is recorded as bandwidth you owe, not waived, and the amount appears under **Dashboard → Settings → Billing**. Your next top-up, billing-period renewal or plan upgrade pays it off before anything else, oldest first, and only what is left over becomes spendable. A top-up first brings any USD balance below zero back up to zero, so a small one may not reach what you owe; on a plan whose top-up rate is zero, only a renewal or plan upgrade can pay it off. While you owe anything, including a USD balance that a refund or dispute took below zero, new billable requests are refused with `402 quota_exceeded`, even if you still have allowance left. Requests already in progress finish and are billed as usual.\n\n## Billing-period rollover\n\nUnused bandwidth from your monthly plan allowance rolls over to the next billing period with no cap, for as long as the subscription stays on its plan or moves to a higher one. A downgrade or cancellation freezes it: the frozen balance stops being spendable, and resubscribing at the same tier or higher within 90 days restores it in full — after that it is permanently lost. The USD balance is separate from the billing period, so it is not reset when that period rolls over.\n\nCredits do not roll over — they reset every billing period. This does not affect your USD balance, which never expires.\n\nYour USD balance and rollover balances appear under **Dashboard → Settings → Billing**."
276
276
  },
277
277
  "cli": {
278
278
  "title": "Install & Authenticate",
@@ -332,32 +332,67 @@
332
332
  "guides": {
333
333
  "title": "Guides",
334
334
  "section": "Guides",
335
- "body": "# Guides\n\nTask-oriented walkthroughs of authentication, scraping, errors, limits, monitors, and webhooks.\n\nTask-oriented walkthroughs of the ByteKit API. Start with\n[Authentication](https://bytekit.com/docs/guides/authentication) to get a key onto a request, then follow whichever\nguide matches the job in front of you. Per-endpoint request and response shapes live in the\n[API Reference](https://bytekit.com/docs/api).\n\n- [Authentication](https://bytekit.com/docs/guides/authentication) — How to authenticate with the ByteKit API using API keys.\n- [Scraping](https://bytekit.com/docs/guides/scraping) — Scrape any URL as HTML, markdown, or structured content — formats, options, latency, and async polling.\n- [Errors](https://bytekit.com/docs/guides/errors) — ByteKit error response shape, common error codes, and retry guidance.\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — How ByteKit enforces quotas, concurrency slots, and rate limits.\n- [Monitors](https://bytekit.com/docs/guides/monitors) — Detect page changes on any URL and receive webhook notifications.\n- [Webhooks](https://bytekit.com/docs/guides/webhooks) — Verify webhook deliveries — signature and timestamp headers, the HMAC scheme, and verification code."
335
+ "body": "# Guides\n\nTask-oriented walkthroughs of authentication, scraping, errors, limits, monitors, screenshots, search, and webhooks.\n\nTask-oriented walkthroughs of the ByteKit API. Start with\n[Choosing an endpoint](https://bytekit.com/docs/guides/choosing-an-endpoint) to find the endpoint that fits the job in\nfront of you, then follow its guide. Every request carries an API key;\n[Authentication](https://bytekit.com/docs/guides/authentication) covers getting one onto a request. Per-endpoint request\nand response shapes live in the [API Reference](https://bytekit.com/docs/api).\n\n- [Choosing an endpoint](https://bytekit.com/docs/guides/choosing-an-endpoint) — Which endpoint to use when two look alike — scrape or fetch, the three bulk APIs, schema or scrape, the monitor types, and search or sitemap.\n- [Authentication](https://bytekit.com/docs/guides/authentication) — How to authenticate with the ByteKit API using API keys.\n- [Scraping](https://bytekit.com/docs/guides/scraping) — Scrape any URL as HTML, markdown, or structured content — formats, options, latency, and async polling.\n- [Fetch](https://bytekit.com/docs/guides/fetch) — Fetch the raw response from any URL — the X-Fetch-* headers, options, cost, and errors.\n- [Errors](https://bytekit.com/docs/guides/errors) — ByteKit error response shape, common error codes, and retry guidance.\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — How ByteKit enforces rate limits, concurrency slots, and balance checks.\n- [Monitors](https://bytekit.com/docs/guides/monitors) — Detect page changes on any URL and receive webhook notifications.\n- [Screenshots](https://bytekit.com/docs/guides/screenshots) — Capture a screenshot of any URL — options, response, cost, and errors.\n- [Search](https://bytekit.com/docs/guides/search) — Search the web — options, response, cost in credits, and errors.\n- [Schema extraction](https://bytekit.com/docs/guides/schema-extraction) — Turn a page into structured JSON that follows your schema — options, response, cost, and errors.\n- [Bulk](https://bytekit.com/docs/guides/bulk) — Submit many URLs in one request — which bulk API to use, results by webhook or polling, cancelling, cost, and limits.\n- [Sitemap](https://bytekit.com/docs/guides/sitemap) — Discover the URLs on a domain — start a job, read its status, download the results file, get a webhook, and what it costs.\n- [Webhooks](https://bytekit.com/docs/guides/webhooks) — Verify webhook deliveries — signature and timestamp headers, the HMAC scheme, and verification code."
336
336
  },
337
337
  "guides/authentication": {
338
338
  "title": "Authentication",
339
339
  "section": "Guides",
340
340
  "body": "# Authentication\n\nHow to authenticate with the ByteKit API using API keys.\n\nByteKit authenticates requests with Bearer API keys. Every request to a capture or data\nendpoint must include an `Authorization` header.\n\n## API key format\n\nKeys are prefixed `sk_live_` so they are easy to identify in logs and config. Treat\nthe full value as a secret.\n\n## Sending the Bearer header\n\nInclude the key in every request:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\nThe key is stored as a SHA-256 hash on the server. The plaintext value is only ever visible\nonce — at creation time.\n\n## Managing API keys\n\nCreate, rename, and revoke API keys from the [dashboard](https://app.bytekit.com). Each account\ncan hold up to **50 active keys**, with per-key billing attribution so you can split usage cleanly\nacross services.\n\nThe plaintext key is shown **once**, at creation time — copy it immediately and store it as a\nsecret. Revoke a key from the dashboard to free a slot; revoked keys do not count toward the limit.\n\n## Next steps\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — make your first API call\n- [API Reference: Account](https://bytekit.com/docs/api/account/getaccount) — read your account, plan, and usage"
341
341
  },
342
+ "guides/bulk": {
343
+ "title": "Bulk",
344
+ "section": "Guides",
345
+ "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` 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.` (for a `urls` object the message starts with `Item 0: `, using the object's position). No bulk route accepts `cookies`, so there is no other route to send it 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## 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 returns `200` with the job's current status. An id that does not exist, or that belongs to another account, returns `404 not_found`.\n\nByteKit can also cancel a job without a `DELETE`. When your balance has run out as the next waiting item is about to start, the waiting items are cancelled, their quota is refunded, and the job's `status` becomes `cancelled`. No webhook is sent for it, so poll the job.\n\n```bash\ncurl -i -X DELETE https://api.bytekit.com/v1/bulk/bulk_01a125a69bd67a32b9adea17a5d931a2 \\\n -H \"Au\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 22087 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]"
346
+ },
347
+ "guides/choosing-an-endpoint": {
348
+ "title": "Choosing an endpoint",
349
+ "section": "Guides",
350
+ "body": "# Choosing an endpoint\n\nPick the right endpoint when two look alike — scrape or fetch, which bulk API, schema or scrape, which monitor type, and search or sitemap.\n\nSeveral ByteKit endpoints overlap. Each choice below says which one to use and links to the guide with the detail.\n\n## Scrape or fetch\n\nUse [`/v1/scrape`](https://bytekit.com/docs/guides/scraping) when you want a JSON envelope with the content as `raw`, `markdown`, `links` or `images`, plus metadata, or when you need rendering options or `async`.\nUse [`/v1/fetch`](https://bytekit.com/docs/guides/fetch) when you want the target's response as the body of a successful reply instead of a JSON envelope, with metadata in `X-Fetch-*` headers; it takes no `format`, and a scrape format such as `markdown` returns `400 validation_error` that points at `/v1/scrape` ([details](https://bytekit.com/docs/guides/fetch#when-to-use-v1scrape-instead)).\n\n## Which bulk API\n\nUse [`/v1/bulk`](https://bytekit.com/docs/guides/bulk#which-bulk-api-to-use) when the job includes screenshots, alone or together with scrapes.\nUse [`/v1/scrape/bulk`](https://bytekit.com/docs/guides/bulk#scrapes-only) for a job of scrapes and [`/v1/fetch/bulk`](https://bytekit.com/docs/guides/bulk#raw-fetches) for a job of raw fetches.\n\n## Schema or scrape\n\nUse [`/v1/schema`](https://bytekit.com/docs/guides/schema-extraction) when you want only data from a page as a JSON object that follows a JSON Schema you supply; today a successful extraction costs 10 credits plus the page's bandwidth ([Cost](https://bytekit.com/docs/guides/schema-extraction#cost)).\nUse [`/v1/scrape`](https://bytekit.com/docs/guides/scraping) when you want the page's content itself, or when you also want that object in the same response, by adding a `json` entry to `formats`; the entry costs 10 credits, charged only when the extraction validates, on top of the scrape's own bandwidth charge ([`json` entry](https://bytekit.com/docs/api/scrape/createscrape)).\n\n## Screenshot monitor or scrape monitor\n\nSet `type` to `screenshot`, the default, to detect visual change: it compares perceptual hashes of successive captures and alerts when the change reaches `change_threshold` ([Monitors](https://bytekit.com/docs/guides/monitors)).\nSet `type` to `scrape` to detect content change: it alerts when the content hash differs from the previous capture's ([Monitors](https://bytekit.com/docs/guides/monitors)).\n\n## Search or sitemap\n\nUse [`/v1/search`](https://bytekit.com/docs/guides/search) to find URLs from a query; it returns ranked results and costs credits.\nUse [`/v1/sitemap`](https://bytekit.com/docs/guides/sitemap) to discover the URLs on one domain; it starts a job whose results you download as a file."
351
+ },
342
352
  "guides/errors": {
343
353
  "title": "Errors",
344
354
  "section": "Guides",
345
- "body": "# Errors\n\nByteKit error response shape, common error codes, and retry guidance.\n\nAll errors from the ByteKit API follow a consistent envelope shape so you can handle them\nprogrammatically.\n\n## Error response shape\n\nEvery `4xx`/`5xx` response across the API uses one unified envelope. `status` is\nalways the literal string `\"failed\"`, so you can branch on the response body alone.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"rate_limited\",\n \"message\": \"Rate limit exceeded. Allowed 5 requests per second.\",\n \"http_status\": 429,\n \"failed_at\": \"2026-08-27T12:17:46.234Z\"\n }\n}\n```\n\nThe number in a `rate_limited` message is your own plan's per-second limit — the same value the `X-RateLimit-Limit` response header carries.\n\n| Field | Description |\n| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |\n| `status` | Always `\"failed\"` on an error response — the top-level discriminator |\n| `error.code` | Machine-readable string identifier |\n| `error.message` | Human-readable explanation |\n| `error.http_status` | Mirrors the HTTP response status (useful for logged or replayed bodies) |\n| `error.failed_at` | ISO-8601 UTC timestamp of when the error was produced |\n| `error.details` | Optional object with additional context (e.g. which field failed validation). Absent — not `{}` — when the error carries no context |\n\n## Common error codes\n\n| HTTP status | Code | Meaning |\n| ----------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `400` | `invalid_url` | A supplied URL (including `webhook_url`) is malformed or uses an unsupported scheme |\n| `400` | `validation_error` | Field errors on `/v1/search`, `POST /v1/billing/checkout` and `PUT`/`DELETE /v1/billing/payment-methods/{id}`, plus rejections that run before schema validation on any endpoint: a removed field such as `cookies` or `headers` on a capture endpoint, or a `/v1/fetch` or `/v1/fetch/bulk` request asking for an option only `/v1/scrape` or `/v1/bulk` serves |\n| `401` | `unauthorized` | Missing or malformed `Authorization` header |\n| `401` | `invalid_api_key` | API key is present but not valid |\n| `402` | `quota_exceeded` | The balance cannot fund this request. Capture endpoints reject when it cannot fund the request's byte reservation, and `error.details.required_bytes` and `error.details.available_bytes` give the bytes the request reserves and the bytes available; `/v1/search` meters credits and rejects when its monthly credits are used up |\n| `402` | `spending_cap_reached` | A credit-metered request would push overage spend past the account's cap. Only reachable on a custom plan with an overage agreement — standard plans have no automatic overage and stop at `quota_exceeded` |\n| `402` | `billing_entitlement_impaired` | The paid subscription is in a payment impairment (e.g. `past_due`); `error.message` names the reason |\n| `402` | `billing_entitlement_expired` | The paid subscription's entitlement period has ended, or its dunning grace period has run out |\n| `403` | `forbidden` | Key is valid but lacks permission for this action |\n| `422` | `validation_error` | Malformed JSON, or a request field failed validation, everywhere the `400` row above does not name |\n| `422` | `blocked`, `upstream_error` | `/v1/fetch` only: the fetch ran and the target could not be read (bot protection refused every attempt, or another exhausted-retries failure such as an unresolvable host). This is a result about the URL, not an outage of this API, and it is charged nothing. `upstream_error` can also come from a relay fault on our side, so the code alone does not prove the target is at fault. The `X-Fetch-ID` response header, when present, names the failed request's row in Logs |\n| `429` | `rate_limited` | Too many requests per second; back off and retry |\n| `429` | `concurrency_limit` | Too many simultaneous in-flight requests; back off and retry |\n| `500` | `internal_error` | The upstream fetch or browser render failed |\n\n## Webhook URLs Must Use HTTPS\n\nAll webhook URLs submitted to the ByteKit API must use HTTPS. Plain HTTP URLs (e.g. `http://example.com/webhook`) are rejected with a `400` `invalid_url` error.\n\n**Why HTTPS only?** Webhook payloads may contain sensitive data (API keys, session tokens, scrape results). HTTPS encryption protects this data in transit.\n\n**Request with an invalid webhook URL:**\n\n```json\n{\n \"webhook_url\": \"http://example.com/webhook\"\n}\n```\n\n**Response (HTTP 400)** — the same unified envelope as every other error; `error.details` names the offending field and reason:\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"invalid_url\",\n \"message\": \"url is not a valid HTTP(S) URL: scheme_unsupported\",\n \"http_status\": 400,\n \"failed_at\": \"2026-08-27T12:16:29.033Z\",\n \"details\": {\n \"url\": \"http://example.com/webhook\",\n \"field\": \"webhook_url\",\n \"reason\": \"scheme_unsupported\"\n }\n }\n}\n```\n\n**Working example:**\n\n```json\n{\n \"webhook_url\": \"https://example.com/webhook\"\n}\n```\n\nThis applies to all endpoints that accept a `webhook_url` parameter: `/v1/scrape` (async), `/v1/scrape/bulk`, `/v1/fetch/bulk`, `/v1/bulk`, `/v1/monitors`, and `/v1/sitemap`.\n\n## Retry guidance\n\nNot all errors are retryable. Use this table to decide:\n\n| Code | Retry? | Guidance |\n| ---------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `invalid_url` | No | Fix the URL before retrying |\n| `validation_error` | No | Fix the request body before retrying |\n| `unauthorized` / `invalid_api_key` | No | Check your API key |\n| `quota_exceeded` | No | Retrying the same request cannot succeed while the balance is short. Compare `error.details.required_bytes` with `error.details.available_bytes`: add balance (upgrade your plan or top up), or send a smaller request. On `/v1/search`, upgrade your plan or wait for the credit reset |\n| `spending_cap_reached` | No | The overage cap is account-level and has no self-service control — [contact support](https://bytekit.com/docs/billing/spending) to raise it, or upgrade the plan |\n| `billing_entitlement_impaired` | No | Settle the outstanding invoice — retrying cannot succeed while the subscription is impaired |\n| `billing_entitlement_expired` | No | Restore or renew the subscription; the entitlement period has ended |\n| `forbidden` | No | You do not have access to this resource |\n| `rate_limited` | Yes | Exponential backoff; honour the `Retry-After` header |\n| `concurrency_limit` | Yes | Honour the `Retry-After` header (a short fixed back-off — a slot frees on job completion, not a fixed window) |\n| `internal_error` | Yes | Exponential backoff; most resolve on retry |\n\nFor retriable errors, start with a 1-second delay and double on each subsequent failure, up to\na maximum of 60 seconds. Respect the `Retry-After` header value when it is present on `429`\nresponses.\n\n## Example: handling errors in curl\n\n```bash\nrespo\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 16967 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]"
355
+ "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` | `/v1/fetch` only: the fetch ran and the target could not be read (bot protection refused every attempt, or another exhausted-retries failure such as an unresolvable host). This is a result about the URL, not an outage of this API, and it is charged nothing. `upstream_error` can also come from a relay fault on our side, so the code alone does not prove the target is at fault. The `X-Fetch-ID` response header, when present, names the failed request's row in Logs |\n| `429` | `rate_limited` | Too many requests per second; back off and retry |\n| `429` | `concurrency_limit` | Too many simultaneous in-flight requests; back off and retry |\n| `500` | `internal_error` | 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| `rate_limited` | Yes | Exponential backoff; honour the `Retry-After` header |\n| `concurrency_limit` | Yes | Honour the `Retry-After` header (a short fixed back-off — a slot frees on job completion, not a fixed window) |\n| `internal_error` | Yes | Exponential backoff; most resolve on retry |\n\nFor retriable errors, start with a 1-second delay and double on each subsequent failure, up to\na maximum of 60 seconds. Respect the `Retry-After` header value when it is present on `429`\nresponses.\n\n## Example: handling error\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 16983 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]"
356
+ },
357
+ "guides/fetch": {
358
+ "title": "Fetch",
359
+ "section": "Guides",
360
+ "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`, `wait_for_selector`, `delay_ms` or `wait_until` 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\nThe message about browser-backed options is the server's wording for those four fields. Of them, only\n`delay_ms` is a `/v1/scrape` option; `wait_for_selector` and `wait_until` belong to `/v1/screenshots`,\nand `cookies` is not accepted by `/v1/scrape` either (see the [Scraping guide](https://bytekit.com/docs/guides/scraping)).\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×. A cache hit is billed at a 0.5× factor instead. In the two requests above, the fresh\nfetch transferred 334 bytes and was billed 334 bytes (`X-Billing-Multiplier: 1`), and the repeat\nserved from cache was billed 167 bytes (`X-Billing-Multiplier: 0.5`). `X-Billable-Bytes` reports\nthe amount, and `X-Fetch-Credits-Charged` reads `0` because credits are not the unit here.\n\nA `422` with the code `blocked` or `upstream_error` is\ncharged nothing, and so is a fresh fetch whose target answered with a non-2xx status. A non-2xx answer\nserved from the cache is billed at the cache-hit rate, as\n[Charges that survive a failure](https://bytekit.com/docs/billing/bandwidth#charges-that-survive-a-failure) describes. For how\nbandwidth charges are composed, see [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 ones\nyou 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_un\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 21511 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]"
346
361
  },
347
362
  "guides/monitors": {
348
363
  "title": "Monitors",
349
364
  "section": "Guides",
350
- "body": "# Monitors\n\nDetect page changes on any URL — by screenshot or scrape — and receive webhook notifications.\n\nMonitors periodically capture a URL and notify you when the page changes. Each monitor uses one\nof two capture types: `screenshot` (perceptual/visual change detection) or `scrape` (content and\nmarkdown change detection). Use them for price tracking, content alerts, uptime monitoring, or\ncompetitor surveillance.\n\n## Create a monitor\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com/pricing\",\n \"interval_type\": \"hourly\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\"\n }'\n```\n\n| Field | Description |\n| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `url` | The page to monitor (required) |\n| `interval_type` | Check frequency — one of `hourly`, `daily`, `weekly`, or `cron` (required) |\n| `webhook_url` | HTTPS webhook endpoint to receive notifications. `http://` is rejected with a 400 `invalid_url` (reason `scheme_unsupported`) (required) |\n| `cron_expression` | 5-field cron expression. Required when `interval_type` is `cron` |\n| `type` | Capture mode — `screenshot` (default) or `scrape` |\n| `change_threshold` | Percentage of change required to trigger a notification (0–100, default `5`). Screenshot monitors only |\n| `notify_on` | `change` (default — notify only when content changed) or `every` (notify on every capture) |\n| `webhook_secret` | Optional secret used to sign webhook deliveries. Deliveries carry `X-Webhook-Signature` and `X-Webhook-Timestamp` — see [Webhooks](https://bytekit.com/docs/guides/webhooks) to verify them |\n| `webhook_headers` | Optional custom headers (max 20) to include on each webhook delivery |\n\nA successful response returns the monitor object with an `id` prefixed `mon_`:\n\n```json\n{\n \"id\": \"mon_...\",\n \"type\": \"screenshot\",\n \"url\": \"https://example.com/pricing\",\n \"status\": \"active\",\n \"interval_type\": \"hourly\",\n \"cron_expression\": null,\n \"next_capture_at\": \"2026-01-01T01:00:00Z\",\n \"notify_on\": \"change\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\",\n \"captures_count\": 0,\n \"changes_count\": 0,\n \"created_at\": \"2026-01-01T00:00:00Z\"\n}\n```\n\nTo monitor on a schedule, set `interval_type` to `cron` and supply a 5-field `cron_expression`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com/pricing\",\n \"interval_type\": \"cron\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\"\n }'\n```\n\n## List monitors\n\n```bash\ncurl https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Get a monitor\n\n```bash\ncurl https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Update a monitor\n\n```bash\ncurl -X PATCH https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"interval_type\": \"daily\"}'\n```\n\nYou can update any subset of the monitor's mutable fields — for example `interval_type`,\n`cron_expression`, `webhook_url`, `notify_on`, `change_threshold`, or `status`\n(`active` / `paused`). Switching to a `cron` schedule requires a `cron_expression`:\n\n```bash\ncurl -X PATCH https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"interval_type\": \"cron\", \"cron_expression\": \"*/30 * * * *\"}'\n```\n\n## Delete a monitor\n\n```bash\ncurl -X DELETE https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Monitor captures\n\nEach time a monitor fires it records a capture event — on **every** run, whether or not the\ncontent changed. Each capture carries a `has_change` flag marking whether the content differed\nfrom the previous capture. Webhook delivery is separate: the capture is always recorded, but\nwhether a webhook is _sent_ depends on `has_change` and the monitor's `notify_on` setting (see\n[Webhook payload](#webhook-payload) below). Retrieve the capture history with:\n\n```bash\ncurl https://api.bytekit.com/v1/monitors/mon_.../captures \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\nEach capture in the list represents one capture event and includes change metadata — the\ntimestamp, whether the content changed (`has_change`), the percentage of content that changed\n(`change_pct`), and the perceptual hash distance from the previous capture. Captures record\n_that_ the content changed and by how much; they do not include a line-by-line textual diff.\n\n### First-capture behavior (silent baseline for both types)\n\nThe very first capture of a monitor has **no previous capture to compare against**. Both monitor\ntypes treat that first run as a **silent baseline** — one universal \"first capture\" behavior,\nno per-type divergence:\n\n| Monitor type | First capture | `has_change` | `change_pct` | Webhook on first capture |\n| ------------ | --------------- | ------------ | ------------ | ----------------------------------------------------------------------------------- |\n| `scrape` | Silent baseline | `false` | `null` | **No** `monitor.change_detected`-equivalent webhook (the baseline is just recorded) |\n| `screenshot` | Silent baseline | `false` | `null` | **No** `monitor.change_detected` webhook (the baseline is just recorded) |\n\nNeither a **scrape** nor a **screenshot** monitor alerts you on its first run — both only alert\nonce a _subsequent_ capture differs (scrape by exact content-hash inequality, screenshot by at\nleast `change_threshold`). A monitor with `notify_on: \"every\"` still sends a `monitor.captured`\nwebhook on the first capture — that is the per-capture notification, not a change alert, and it\nfires for both monitor types. From the second capture onward both types behave the same way each\nnew capture is compared against the previous one — scrape by exact SHA-256 content equality,\nscreenshot by perceptual-hash distance against `change_threshold`.\n\n**Repointing a monitor's `url`:** `PATCH`-ing a monitor's `url` to a different address re-enters\nthis same silent-baseline behavior — the capture immediately after a repoint is treated as a\nfresh first capture (`has_change: false`, `change_pct: null`, no `monitor.change_detected`-equivalent\nwebhook for `scrape` monitors, no `monitor.change_detected` webhook for `screenshot` monitors),\nsince the stored comparison baseline for the old URL no longer applies to the new one.\nSteady-state alerting resumes from the _second_ capture after the repoint.\n\nThis silence isn't guaranteed if a capture was already in flight against the old URL when the\n`PATCH` landed: that capture can still complete and write its result back as the new baseline,\nso the repoint's silent-baseline behavior is deferred to the _next_ capture rather than applying\nto the in-flight one.\n\n## Webhook payload\n\nWhen a monitor fires, ByteKit sends a `POST` to your `webhook_url`. Every delivery carries an\n`X-ByteKit-Event` header naming the event type — dispatch on that header rather than inspecting\nthe body shape. The event type and payload depend on the monitor's `type`.\n\n### Screenshot monitors (`type: \"screenshot\"`, default)\n\nScreenshot captures send `monitor.change_detected` when the page changed (`X-ByteKit-Event:\nmonitor.change_detected`) and `monitor.captured` when there was no change but\n`notify_on: \"every\"` is set (`X-ByteKit-Event: monitor.captured`). The body carries the capture\nmetadata:\n\n```json\n{\n \"monitor_id\": \"mon_...\",\n \"screenshot_id\": \"ss_...\",\n \"has_change\": true,\n \"change_pct\": 42.0,\n \"hash_distance\": 18,\n \"url\": \"https://example.com/pricing\"\n}\n```\n\n| Field | Description |\n| --------------- | ------------------------------------------------------------------ |\n| `has_change` | `true` when the captured content differs from the previous capture |\n| `change_pct` | Percentage of content that changed (0–100) |\n| `hash_distance` | Perceptual-hash distance from the previous capture |\n| `screenshot_id` | The screenshot that triggered the notification |\n\n### Scrape monitors (`type: \"scrape\"`)\n\nScrape captures send `scrape.completed` (`X-ByteKit-Event: scrape.completed`) with the full\nscrape result envelope inline:\n\n```json\n{\n \"success\": true,\n \"type\": \"scrape.completed\",\n \"id\": \"mon_...\",\n \"scrape_id\": \"sc_...\",\n \"has_change\": true,\n \"change_pct\": 100.0,\n \"metadata\": {},\n \"scrape\": {\n \"status\": \"success\",\n \"id\": \"sc_...\",\n \"url\": \"https://example.com/pricing\",\n \"final_url\": \"https://example.com/pricing\",\n \"content_length\": 1256,\n \"status_code\": 200,\n \"formats\": {\n \"markdown\": \"...\"\n }\n }\n}\n```\n\n| Field | Description |\n| ------------ | ---------------------------------------------------------------------- |\n| `has_change` | `true` when the captured content differs from the previous capture |\n| `change_pct` | Percentage of content that changed (0–100) |\n| `scrape` | Full scrape result envelope (same shape as `POST /v1/scrape` response) |\n\nYour endpoint must respond with `2xx` within 10 seconds. Failed deliveries are retried with\nexponential backoff.\n\n## Next steps\n\n- [Webhooks](https://bytekit.com/docs/guides/webhooks) — verify the `X-Webhook-Signature` on every delivery\n- [API Reference: Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — full endpoint schema\n- [Errors](https://bytekit.com/docs/guides/errors) — error codes returned by monitor endpoints"
365
+ "body": "# Monitors\n\nDetect page changes on any URL — by screenshot or scrape — and receive webhook notifications.\n\nMonitors periodically capture a URL and notify you when the page changes. Each monitor uses one\nof two capture types: `screenshot` (perceptual/visual change detection) or `scrape` (content and\nmarkdown change detection). Use them for price tracking, content alerts, uptime monitoring, or\ncompetitor surveillance.\n\n## Create a monitor\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com/pricing\",\n \"interval_type\": \"hourly\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\"\n }'\n```\n\n| Field | Description |\n| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `url` | The page to monitor (required) |\n| `interval_type` | Check frequency — one of `hourly`, `daily`, `weekly`, or `cron` (required) |\n| `webhook_url` | HTTPS webhook endpoint to receive notifications. `http://` is rejected with a 400 `invalid_url` (reason `scheme_unsupported`) (required) |\n| `cron_expression` | 5-field cron expression. Required when `interval_type` is `cron` |\n| `type` | Capture mode — `screenshot` (default) or `scrape` |\n| `change_threshold` | Percentage of change required to trigger a notification (0–100, default `5`). Screenshot monitors only |\n| `notify_on` | `change` (default — notify only when content changed) or `every` (notify on every capture) |\n| `webhook_secret` | Optional secret used to sign webhook deliveries. Deliveries carry `X-Webhook-Signature` and `X-Webhook-Timestamp` — see [Webhooks](https://bytekit.com/docs/guides/webhooks) to verify them |\n| `webhook_headers` | Optional custom headers (max 20) to include on each webhook delivery |\n\nA successful response returns the monitor object with an `id` prefixed `mon_`:\n\n```json\n{\n \"id\": \"mon_...\",\n \"type\": \"screenshot\",\n \"url\": \"https://example.com/pricing\",\n \"status\": \"active\",\n \"interval_type\": \"hourly\",\n \"cron_expression\": null,\n \"next_capture_at\": \"2026-01-01T01:00:00Z\",\n \"notify_on\": \"change\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\",\n \"captures_count\": 0,\n \"changes_count\": 0,\n \"created_at\": \"2026-01-01T00:00:00Z\"\n}\n```\n\nTo monitor on a schedule, set `interval_type` to `cron` and supply a 5-field `cron_expression`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com/pricing\",\n \"interval_type\": \"cron\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\"\n }'\n```\n\n## List monitors\n\n```bash\ncurl https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Get a monitor\n\n```bash\ncurl https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Update a monitor\n\n```bash\ncurl -X PATCH https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"interval_type\": \"daily\"}'\n```\n\nYou can update any subset of the monitor's mutable fields — for example `interval_type`,\n`cron_expression`, `webhook_url`, `notify_on`, `change_threshold`, or `status`\n(`active` / `paused`). Switching to a `cron` schedule requires a `cron_expression`:\n\n```bash\ncurl -X PATCH https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"interval_type\": \"cron\", \"cron_expression\": \"*/30 * * * *\"}'\n```\n\n## Delete a monitor\n\n```bash\ncurl -X DELETE https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Monitor captures\n\nEach time a monitor fires it records a capture event — on **every** run, whether or not the\ncontent changed. Each capture carries a `has_change` flag marking whether the content differed\nfrom the previous capture. Webhook delivery is separate: the capture is always recorded, but\nwhether a webhook is _sent_ depends on `has_change` and the monitor's `notify_on` setting (see\n[Webhook payload](#webhook-payload) below). Retrieve the capture history with:\n\n```bash\ncurl https://api.bytekit.com/v1/monitors/mon_.../captures \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\nEach capture in the list represents one capture event and includes change metadata — the\ntimestamp, whether the content changed (`has_change`), the percentage of content that changed\n(`change_pct`), and the perceptual hash distance from the previous capture. Captures record\n_that_ the content changed and by how much; they do not include a line-by-line textual diff.\n\n### First-capture behavior (silent baseline for both types)\n\nThe very first capture of a monitor has **no previous capture to compare against**, so both\nmonitor types record it as the baseline instead of alerting:\n\n| Monitor type | First capture | `has_change` | `change_pct` | Webhook on first capture |\n| ------------ | --------------- | ------------ | ------------ | -------------------------------------------------------------------------------------------------- |\n| `scrape` | Silent baseline | `false` | `null` | **No** change alert (no `scrape.completed` with `has_change: true`; the baseline is just recorded) |\n| `screenshot` | Silent baseline | `false` | `null` | **No** `monitor.change_detected` webhook (the baseline is just recorded) |\n\nNeither a **scrape** nor a **screenshot** monitor alerts you on its first run — both only alert\nonce a _subsequent_ capture differs (scrape by exact content-hash inequality, screenshot by at\nleast `change_threshold`). A monitor with `notify_on: \"every\"` still sends a webhook on the first\ncapture — that is the per-capture notification, not a change alert. A screenshot monitor sends\n`monitor.captured`; a scrape monitor sends `scrape.completed` with `has_change: false`.\n**Repointing a monitor's `url`** with `PATCH` starts over the same way: the next capture is\ntreated as a fresh first capture, as in the table above, because the stored comparison baseline\nbelongs to the old URL, and steady-state alerting resumes from the _second_ capture after the\nrepoint. A capture already\nin flight against the old URL when the `PATCH` lands can still write its result back as the new\nbaseline, which defers the first-capture treatment to the _next_ capture.\n\n## Webhook payload\n\nWhen a monitor fires, ByteKit sends a `POST` to your `webhook_url`. Every delivery carries an\n`X-ByteKit-Event` header naming the event type — dispatch on that header rather than inspecting\nthe body shape. The event type and payload depend on the monitor's `type`.\n\n### Screenshot monitors (`type: \"screenshot\"`, default)\n\nScreenshot captures send `monitor.change_detected` when the page changed (`X-ByteKit-Event:\nmonitor.change_detected`) and `monitor.captured` when there was no change but\n`notify_on: \"every\"` is set (`X-ByteKit-Event: monitor.captured`). The body carries the capture\nmetadata:\n\n```json\n{\n \"monitor_id\": \"mon_...\",\n \"screenshot_id\": \"ss_...\",\n \"has_change\": true,\n \"change_pct\": 42.0,\n \"hash_distance\": 18,\n \"url\": \"https://example.com/pricing\"\n}\n```\n\n| Field | Description |\n| --------------- | ------------------------------------------------------------------------ |\n| `has_change` | `true` when the captured content differs from the previous capture |\n| `change_pct` | Percentage of content that changed (0–100), or `null` on a first capture |\n| `hash_distance` | Perceptual-hash distance from the previous capture |\n| `screenshot_id` | The screenshot that triggered the notification |\n\n### Scrape monitors (`type: \"scrape\"`)\n\nScrape monitors never send `monitor.change_detected` or `monitor.captured`. Every delivered scrape\ncapture sends `scrape.completed` (`X-ByteKit-Event: scrape.completed`) with the full scrape result\nenvelope inline, and `has_change` tells a change from a no-change capture. With\n`notify_on: \"change\"` only captures where `has_change` is `true` are delivered; with\n`notify_on: \"every\"` every capture is.\n\n```json\n{\n \"success\": true,\n \"type\": \"scrape.completed\",\n \"id\": \"mon_...\",\n \"scrape_id\": \"sc_...\",\n \"has_change\": true,\n \"change_pct\": 100.0,\n \"was_preflight\": false,\n \"metadata\": {},\n \"scrape\": {\n \"status\": \"success\",\n \"id\": \"sc_...\",\n \"url\": \"https://example.com/pricing\",\n \"final_url\": \"https://example.com/pricing\",\n \"content_length\": 1256,\n \"status_code\": 200,\n \"formats\": {\n \"markdown\": \"...\"\n }\n }\n}\n```\n\n| Field | Description |\n| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `has_change` | `true` when the captured content differs from the previous capture |\n| `change_pct` | Percentage of content that changed (0–100), or `null` on a first capture |\n| `was_preflight` | `true` when ByteKit confirmed the page unchanged without a full capture (`has_change` is `false`, `scrape` carries no page content); `false` on a normal capture |\n| `scrape` | Full scrape result envelope (same shape as `POST /v1/scrape` response) |\n\nYour endpoint must respond with `2xx` within 10 seconds. Failed deliveries are retried with\nexponential backoff.\n\n## Next steps\n\n- [Webhooks](https://bytekit.com/docs/guides/webhooks) — verify the `X-Webhook-Signature` on every delivery\n- [API Reference: Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — full endpoint schema\n- [Errors](https://bytekit.com/docs/guides/errors) — error codes returned by monitor endpoints"
351
366
  },
352
367
  "guides/rate-limits": {
353
368
  "title": "Rate Limits",
354
369
  "section": "Guides",
355
- "body": "# Rate Limits\n\nHow ByteKit enforces quotas, concurrency slots, and rate limits.\n\nByteKit enforces three independent limits: **rate limits** (requests per second),\n**concurrency slots** (simultaneous in-flight requests), and **quota** (monthly usage caps).\nAll three are enforced before any capture work begins.\n\n## Quota model\n\nQuota is pre-incremented on every request and corrected after the request completes:\n\n1. **Pre-increment** — your usage counter is incremented by an estimate before the capture\n starts. This prevents over-committing capacity even for concurrent requests.\n2. **Adjust** — once the response returns, the actual `content_length` (compressed wire bytes)\n replaces the estimate for bandwidth accounting.\n3. **Compensating decrement** — if the request fails with a terminal error, the pre-incremented\n amount is rolled back, so a capture that returns no bytes costs nothing.\n\nTwo charges survive a failure. A `/v1/fetch` request answered from the cache with a non-2xx\nupstream status is billed at the cache-hit rate, and a failed schema extraction refunds the credits\nit pre-charged but keeps the source page's bandwidth. That cached non-2xx hit returns the\n`upstream_error` envelope — the same JSON a cache miss with the same upstream status returns,\nwhatever `format` asked for — not the cached body, which stays the billing basis even though it is\nnot served.\n\nThis means your dashboard usage counter may briefly read higher than actual consumption during\na burst of requests, then settle to the true value.\n\n## Concurrency slots\n\nEach account has a concurrency limit — the maximum number of in-flight requests at one time.\nSlots are released automatically a few minutes after a client disconnects, so a crashed client\ncannot permanently hold them.\n\nWhen you exceed your concurrency limit, you receive `429 concurrency_limit` (not\n`rate_limited` — a distinct error code) with a `Retry-After` header indicating how long to\nwait before retrying.\n\n## Rate limit headers\n\nEvery response includes headers that show your current position:\n\n| Header | Description |\n| ----------------------- | ------------------------------------------------------- |\n| `X-RateLimit-Limit` | Your account's request-per-second limit |\n| `X-RateLimit-Remaining` | Requests remaining in the current window |\n| `X-RateLimit-Reset` | Unix timestamp when the window resets |\n| `Retry-After` | Seconds to wait before retrying (present on `429` only) |\n\n## Bandwidth metering\n\nBandwidth usage is measured as `content_length` — the compressed wire bytes returned by the\norigin server. If the origin sends gzip or Brotli-encoded content, the compressed size is what\ncounts, not the decompressed size. This matches what your client actually receives over the\nnetwork.\n\nThat measurement is the basis, not the charge. Your balance is deducted by the wire bytes times\nthe endpoint factor, so a Markdown scrape deducts 1.5× its `content_length` — and so does a\nMarkdown fetch. See [Bandwidth billing](https://bytekit.com/docs/billing/bandwidth) for the full composition.\n\n## Handling 429 responses\n\nWhen you receive `429 rate_limited` or `429 concurrency_limit`:\n\n1. Read the `Retry-After` header value (in seconds).\n2. Wait at least that long before retrying.\n3. If no `Retry-After` is present, use exponential backoff starting at 1 second.\n\n```bash\n# Check rate limit headers\ncurl -I -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n## Next steps\n\n- [Errors](https://bytekit.com/docs/guides/errors) — full error code reference and retry guidance\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, latency, and async polling"
370
+ "body": "# Rate Limits\n\nHow ByteKit enforces rate limits, concurrency slots, and balance checks.\n\nByteKit enforces three independent limits: **rate limits** (requests per second),\n**concurrency slots** (simultaneous in-flight requests), and your **[balance](https://bytekit.com/docs/billing#terms)**\n(what a request draws from: your included allowance, then your USD balance, then your starter\ngrant). All three are enforced before any capture work begins.\n\nEach plan sets its own limits. For the per-plan requests per second, concurrent captures, and\nprices, see [bytekit.com/pricing](https://bytekit.com/pricing); `GET /v1/plans` returns the same\npublic plan catalog programmatically, with no authentication.\n\n## Usage counting\n\nYour usage counter is pre-incremented on every request and corrected after the request completes:\n\n1. **Pre-increment** — your usage counter is incremented by an estimate before the capture\n starts. This prevents over-committing capacity even for concurrent requests.\n2. **Adjust** — once the response returns, the actual `content_length` (compressed wire bytes)\n replaces the estimate for bandwidth accounting.\n3. **Compensating decrement** — if the request fails with a terminal error, the pre-incremented\n amount is rolled back, so a capture that returns no bytes costs nothing.\n\nTwo charges survive a failure. Both are billing detail: see\n[Charges that survive a failure](https://bytekit.com/docs/billing/bandwidth#charges-that-survive-a-failure).\n\nThis means your dashboard usage counter may briefly read higher than actual consumption during\na burst of requests, then settle to the true value.\n\n## Concurrency slots\n\nEach account has a concurrency limit — the maximum number of in-flight requests at one time.\nSlots are released automatically a few minutes after a client disconnects, so a crashed client\ncannot permanently hold them.\n\nWhen you exceed your concurrency limit, you receive `429 concurrency_limit` (not\n`rate_limited` — a distinct error code) with a `Retry-After` header indicating how long to\nwait before retrying.\n\n## Rate limit headers\n\nEvery response includes headers that show your current position:\n\n| Header | Description |\n| ----------------------- | ------------------------------------------------------- |\n| `X-RateLimit-Limit` | Your account's request-per-second limit |\n| `X-RateLimit-Remaining` | Requests remaining in the current window |\n| `X-RateLimit-Reset` | Unix timestamp when the window resets |\n| `Retry-After` | Seconds to wait before retrying (present on `429` only) |\n\n## Bandwidth metering\n\nBandwidth usage is measured as `content_length` — the compressed wire bytes returned by the\norigin server. If the origin sends gzip or Brotli-encoded content, the compressed size is what\ncounts, not the decompressed size. This matches what your client actually receives over the\nnetwork.\n\nThat measurement is the basis, not the charge. Your balance is deducted by the wire bytes times\nthe endpoint factor, so a Markdown scrape deducts 1.5× its `content_length`. See\n[Bandwidth billing](https://bytekit.com/docs/billing/bandwidth) for the full composition.\n\n## Handling 429 responses\n\nWhen you receive `429 rate_limited` or `429 concurrency_limit`:\n\n1. Read the `Retry-After` header value (in seconds).\n2. Wait at least that long before retrying.\n3. If no `Retry-After` is present, use exponential backoff starting at 1 second.\n\n```bash\n# Check rate limit headers\ncurl -I -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n## Request size limits\n\nEach route below carries its own body-size limit, sized to that route's shape (a bulk\nendpoint's realistic payload is far larger than a single scrape request). A body over the\nlimit is rejected with the error shown. The hosted `POST /mcp` endpoint has its own 1 MB cap,\ndescribed under [MCP limits](https://bytekit.com/docs/mcp#limits).\n\n| Endpoint | Limit | Error |\n| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ----------------------- |\n| `POST /v1/scrape`, `/v1/search`, `/v1/scrape/bulk`, `/v1/schema` | 512 KB | `400 request_too_large` |\n| `POST /v1/fetch` | 512 KB | `400 request_too_large` |\n| `POST /v1/screenshots` | 512 KB | `400 request_too_large` |\n| `POST /v1/monitors` | 512 KB | `400 request_too_large` |\n| `POST /v1/sitemap` | 512 KB | `400 request_too_large` |\n| `POST /v1/bulk` | 4 MB pre-auth (chunked) / 32 MB fail-safe (declared length) / per-plan up to 28.7 MB | `400 request_too_large` |\n| `POST /v1/fetch/bulk` | 2 MB pre-auth (chunked) / 20 MB fail-safe (declared length) / per-plan up to 16.8 MB | `400 request_too_large` |\n| `POST /v1/webhook-deliveries/{id}/retry` | 64 KB | `400 request_too_large` |\n\nThe two bulk endpoints are guarded in a two-tier shape, not by a single\nceiling. A streamed body with no `Content-Length` header is capped at the\nsmall pre-auth limit (4 MB / 2 MB) before your API key is checked; a body\nthat declares `Content-Length` is instead bounded there by a larger fail-safe\n(32 MB / 20 MB) rather than the real limit, since that branch reads nothing\nuntil your key is verified. Once your key is verified, a second check\nre-gates the body against your account's own `max_bulk_size`, the number of\nURLs or per-item configs your plan allows in one call. A custom plan with a\n`max_bulk_size` of 50,000 reaches 28.7 MB / 16.8 MB at that second check. A\nstandard-plan account's effective ceiling is exactly the pre-auth limit;\neither tier's overrun returns `400 request_too_large`.\n\n## Next steps\n\n- [Errors](https://bytekit.com/docs/guides/errors) — full error code reference and retry guidance\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, latency, and async polling"
371
+ },
372
+ "guides/schema-extraction": {
373
+ "title": "Schema extraction",
374
+ "section": "Guides",
375
+ "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.\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| `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\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`.\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.\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`, 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 them has a\nmethod for it. Call the HTTP endpoint directly, as in the examples above. Any HTTP client works\nwith the same `Authorization: Bearer` header; see [Authentication](https://bytekit.com/docs/guides/authentication).\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. The Errors guide does not list\n`unsupported_option`, `unsupported_model`, `schema_incompatible`, `scrape_failed` or the\n`provider_*` codes, so handle those here.\n\n| Status | Code | When \n\n---\n[Truncated to the 16384-byte per-page limit — this page is 23515 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]"
356
376
  },
357
377
  "guides/scraping": {
358
378
  "title": "Scraping",
359
379
  "section": "Guides",
360
- "body": "# Scraping\n\nScrape any URL as HTML, markdown, or structured content — formats, options, latency, and async polling.\n\n`POST /v1/scrape` fetches a URL and returns its content in the format you ask for. The same\nrequest shape works for every site; the options you pass determine the output and how long the\ncall takes.\n\n## Rendering & latency\n\nMost scrapes return in well under a second. Some options require ByteKit to fully render the page\nbefore it can return content, which takes longer — typically a few seconds. Pass these only when\nyou need them:\n\n| Option | When it adds latency |\n| ---------- | -------------------------------------------------------------- |\n| `delay_ms` | Greater than `0` |\n| `async` | `true` (the request is queued and processed in the background) |\n\nThe `country` option routes the request through a geo-located proxy. On its own it does not add\nrendering latency; it only does so when combined with one of the options above.\n\nLooking for `wait_for_selector` or `wait_until`? Those are not `ScrapeRequest` options — they\nbelong to the [Screenshot](https://bytekit.com/docs/api/screenshots/createscreenshot) endpoint. Sending them to\n`/v1/scrape` returns `422`.\n\n`cookies` and `headers` are no longer request options on any capture endpoint. Sending either\nreturns `400 validation_error`.\n\n```bash\n# A simple, low-latency scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n```bash\n# Slower: delay_ms forces a full render and waits before returning\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"delay_ms\": 2000\n }'\n```\n\n## Response fields\n\nThe default format is `raw` — pass `formats` to request others (`markdown`, `links`,\n`images`). The `formats` object in the response is keyed by the format you requested.\n\nEnvelope fields are `snake_case`; the keys inside `metadata` are the page's own metadata and\nstay `camelCase`.\n\n| Field | Description |\n| ---------------- | --------------------------------------------------------------------------------------------------------- |\n| `schema_version` | Response envelope version (currently `1`) |\n| `formats.raw` | Page content in the requested format (`raw` is the default when `formats` is omitted) |\n| `final_url` | URL the fetch landed on after redirects |\n| `content_type` | `Content-Type` reported by the origin |\n| `content_length` | Compressed wire bytes — the _basis_ for bandwidth billing, before the endpoint factor (see `billing`) |\n| `status_code` | HTTP status code of the origin page |\n| `retrieved_at` | ISO-8601 UTC timestamp of the fetch |\n| `cache` | `\"hit\"` or `\"miss\"` |\n| `cache_age_s` | Age of the cached entry in seconds — present only on a hit |\n| `billing` | What the request cost: `raw_bytes`, the `factors` applied, the resulting `multiplier`, and `billed_bytes` |\n| `metadata.title` | Page `<title>` element |\n\nThe `X-Scrape-*` response headers describe how each request was handled (cache status, timing,\nand the final URL) — useful for debugging.\n\n## Async scrapes\n\nFor long-running pages, pass `\"async\": true` to get a `202 Accepted` response with a scrape\n`id` prefixed `sc_`. Poll the result with `GET /v1/scrape/{id}`.\n\n```bash\n# Start async scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"async\": true}'\n\n# Poll for result\ncurl https://api.bytekit.com/v1/scrape/sc_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Webhook event header\n\nEvery outbound webhook POST includes an `X-ByteKit-Event` header with the event type:\n\n| Event type | Trigger |\n| ------------------------- | ------------------------------------------------------------ |\n| `bulk.completed` | A bulk job finishes (all items processed) |\n| `scrape.completed` | An async scrape succeeds |\n| `scrape.failed` | An async scrape fails terminally |\n| `monitor.change_detected` | A monitor fires and detects a change (screenshot or content) |\n| `monitor.captured` | A monitor fires with no change detected (notify_on: every) |\n| `sitemap.completed` | A sitemap job finishes |\n| `sitemap.failed` | A sitemap job fails terminally |\n\nUse this header to dispatch events without inspecting the body shape:\n\n```python\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route(\"/webhooks/bytekit\", methods=[\"POST\"])\ndef handle():\n event = request.headers.get(\"X-ByteKit-Event\")\n if event == \"bulk.completed\":\n handle_bulk(request.json)\n elif event == \"scrape.completed\":\n handle_scrape(request.json)\n return \"\", 200\n```\n\n`X-ByteKit-Event` is a reserved header — you cannot supply it via `webhook_headers` in\nmonitor or bulk configuration. Attempts to do so will be rejected with a `422` at request\ntime.\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model and concurrency slots\n- [Errors](https://bytekit.com/docs/guides/errors) — how to interpret and retry error responses\n- [API Reference: Scrape](https://bytekit.com/docs/api/scrape/createscrape) — full request/response schema"
380
+ "body": "# Scraping\n\nScrape any URL as HTML, markdown, or structured content — formats, options, latency, and async polling.\n\n`POST /v1/scrape` fetches a URL and returns its content in the format you ask for. The same\nrequest shape works for every site; the options you pass determine the output and how long the\ncall takes.\n\n## Rendering & latency\n\nMost scrapes return in well under a second. Some options require ByteKit to fully render the page\nbefore it can return content, which takes longer — typically a few seconds. Pass these only when\nyou need them:\n\n| Option | When it adds latency |\n| ---------- | -------------------------------------------------------------- |\n| `delay_ms` | Greater than `0` |\n| `async` | `true` (the request is queued and processed in the background) |\n\nThe `country` option routes the request through a geo-located proxy. On its own it does not add\nrendering latency; it only does so when combined with one of the options above.\n\nLooking for `wait_for_selector` or `wait_until`? Those are not `ScrapeRequest` options — they\nbelong to the [Screenshot](https://bytekit.com/docs/api/screenshots/createscreenshot) endpoint. Sending them to\n`/v1/scrape` returns `422`.\n\n`cookies` and `headers` are no longer request options on any capture endpoint. Sending either\nreturns `400 validation_error`.\n\n```bash\n# A simple, low-latency scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n```bash\n# Slower: delay_ms forces a full render and waits before returning\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"delay_ms\": 2000\n }'\n```\n\n## Options\n\nEvery `POST /v1/scrape` option is listed here by the job it does. Only `url` is required. The\n[API reference](https://bytekit.com/docs/api/scrape/createscrape) carries the full request schema.\n\n### Output shaping\n\n- `url` — the page to scrape.\n- `formats` — what to return: any of `raw` (the default), `markdown`, `links` and `images`. The\n `formats` object in the response is keyed by what you asked for.\n- `markdown_mode` — how the page becomes markdown: `article` (the default) extracts the article\n content, `raw` applies minimal cleanup, and `llm` produces compact, LLM-optimised output.\n- `markdown_query` — a BM25 query string (up to 200 characters) that filters the markdown by\n relevance to it. Omit it or leave it empty to disable.\n- `include_tags` and `exclude_tags` — HTML element names (not CSS selectors). `include_tags` keeps\n only the content inside those elements in the `markdown` output; `exclude_tags` strips them from\n it. `include_tags` is applied first, then `exclude_tags`. Neither affects `raw`, which always\n returns the full page.\n- `clean_markdown` — when `true` and `markdown` is in `formats`, the converted markdown is sent to\n an LLM (Groq) to remove boilerplate and ads and improve formatting before it is returned. If that\n step fails for any reason (key unset, 4xx/5xx, timeout, empty response), you get the raw markdown\n unchanged plus a warning in the `warnings` array. Billing is 3× credits and bytes, applied only\n when cleaning succeeds.\n- `markdown_links` — how links are written in the markdown: `inline` (the default) keeps\n `[text](url)`, `text` keeps only the anchor text, `none` strips URLs and removes reference\n definitions, and `references` converts to numbered `[text][N]` references with a Links footer.\n- `markdown_images` — how images are written in the markdown: `inline` (the default) keeps\n `![alt](url)`, `text` keeps only the alt text, `none` removes images entirely, and `references`\n converts to numbered `![alt][N]` references with an Images footer. This is distinct from\n `markdown_filter_images`, which drops low-signal images before conversion.\n- `with_links_summary` and `with_images_summary` — append a `Links:` or `Images:` footer, a\n numbered list of the extracted URLs, to the markdown. `with_links_summary` is enabled\n automatically when `markdown_links` is `references`.\n- `markdown_compact` — collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — filter low-signal images out of the markdown output.\n- `markdown_include_media` — return `formats.links` and `formats.images` as rich scored objects\n instead of string arrays, and include a top-level `tables` array. Only effective when `markdown`\n is in `formats`.\n- `markdown_include_warnings` — enable markdown-pipeline and tag-filter warnings for requests that\n include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may\n appear independently of this flag.\n- `remove_base64_images` — base64-encoded `data:` image sources are stripped from the HTML before\n markdown conversion (the default, `true`). Set it to `false` to keep them. It does not affect\n `raw`, which always returns the original source unchanged.\n\n### Token control\n\n- `token_budget` — the maximum token count for the markdown output. When set and `markdown` is in\n `formats`, the output is truncated at the last paragraph, then sentence, then token boundary that\n keeps the estimated count under the limit. Leave it out for no truncation. Setting it adds a\n `markdown_tokens` field to the response.\n- `token_encoding` — the tokenizer hint for `token_budget`: `cl100k_base` (the default) matches\n GPT-4/4o and `o200k_base` matches GPT-4o-mini and the o-series. Both use the same 4-characters-\n per-token heuristic internally.\n- `markdown_include_stats` — include a top-level `stats` object (characters, tokens, blocks) in the\n response. Only effective when `markdown` is in `formats`.\n\n### Rendering and access\n\n- `delay_ms` — milliseconds to wait after page load before capturing, for content that renders\n late. See [Rendering & latency](#rendering--latency) above.\n- `country` — a two-letter uppercase country code (default `US`) that routes the request through a\n geo-located proxy.\n- `mobile` — emulate a mobile device: the request uses a mobile (Android) user agent and viewport\n so the upstream serves its mobile page. The default is `false` (desktop). The value is part of\n the cache key, so mobile and desktop responses are cached independently.\n- `solve_challenge` — attempts to clear a Cloudflare challenge. Success is not guaranteed, and it\n is billed as a normal browser render.\n- `timeout_ms` — the request timeout in milliseconds, from `1000` to `90000` (default `60000`).\n\n### Caching and delivery\n\n- `cache_ttl` — how long a freshly fetched URL may be served from cache. `0` (string or integer)\n skips the cache read, though cache-eligible results are still written. `Nh` or `Nd` sets a TTL,\n capped at 168 h / 7 d. The default is `48h`. Safety-classified WAF husks are returned live but\n never stored in the shared cache. It is honoured on both the synchronous and asynchronous paths.\n- `async` — queue the scrape and get a `202` receipt immediately; see\n [Async scrapes](#async-scrapes) below.\n- `webhook_url` — an HTTPS endpoint to notify. An `http://` URL is rejected with `400 invalid_url`\n (reason `scheme_unsupported`).\n- `events` — which webhook events to deliver when `webhook_url` is set: any of `queued`,\n `completed` and `failed`. All three are delivered by default; send a subset to receive fewer.\n- `custom` — a JSON object of your own, echoed back on the success envelope (sync, async and\n webhook). It is capped at 4096 UTF-8 bytes and does not affect the cache key, so two requests\n that differ only in `custom` resolve to the same cache entry.\n\n### Examples\n\nA markdown scrape trimmed to a token budget, with the response's token statistics:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"formats\": [\"markdown\"],\n \"markdown_mode\": \"llm\",\n \"token_budget\": 4000,\n \"token_encoding\": \"o200k_base\",\n \"markdown_include_stats\": true\n }'\n```\n\nA content-only scrape: keep the `article` and `main` elements, then strip navigation and footers\nfrom what is left.\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"formats\": [\"markdown\"],\n \"include_tags\": [\"article\", \"main\"],\n \"exclude_tags\": [\"nav\", \"footer\", \"aside\"]\n }'\n```\n\n## Response fields\n\nThe default format is `raw` — pass `formats` to request others (`markdown`, `links`,\n`images`). The `formats` object in the response is keyed by the format you requested.\n\nThe `scrape_url` tool in the [MCP server](https://bytekit.com/docs/mcp) differs: it returns markdown when `formats` is\nomitted. A request that includes `markdown` bills the 1.5× `scrape_md` endpoint factor; one that\ndoes not bills 1× (`scrape`). The API default stays `raw` so that omitting `formats` does not\nsilently raise a request's cost.\n\nEnvelope fields are `snake_case`; the keys inside `metadata` are the page's own metadata and\nstay `camelCase`.\n\n| Field | Description |\n| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `schema_version` | Response envelope version (currently `1`) |\n| `formats.raw` | Page content in the requested format (`raw` is the default when `formats` is omitted) |\n| `final_url` | URL the fetch landed on after redirects |\n| `content_type` | `Content-Type` reported by the origin |\n| `content_length` | Compressed wire bytes — the _basis_ for bandwidth billing, before the endpoint factor (see `billing`). A page served by a hosted browser reports the browser's full measured transfer |\n| `status_code` | HTTP status code of the origin page |\n| `retrieved_at` | ISO-8601 UTC timestamp of the fetch |\n| `cache` | `\"hit\"` or `\"miss\"` |\n| `cache_age_s` | Age of the cached entry in seconds — present only on a hit |\n| `billing` | What the request cost: `raw_bytes`, the `factors` applied, the resulting `multiplier`, and `billed_bytes` |\n| `metadata.title` | Page `<title>` element |\n\nThe `X-Scrape-*` response headers describe how each request was handled (cache status, timing,\nand the final URL) — useful for debugging.\n\n## Async scrapes\n\nFor long-running pages, pass `\"async\": true` to get a `202 Accepted` response with a scrape\n`id` prefixed `sc_`. Poll the result with `GET /v1/scrape/{id}`.\n\n```bash\n# Start async scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"async\": true}'\n\n# Poll for result\ncurl https://api.bytekit.com/v1/scrape/sc_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Webhook event header\n\nEvery outbound webhook POST includes an `X-ByteKit-Event` header with the event type:\n\n| Event type | Trigger |\n| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |\n| `bulk.completed` | A bulk job finishes (all items processed) |\n| `scrape.completed` | An async scrape succeeds, or a scrape monitor delivers a capture (`has_change` tells a change from a no-change capture) |\n| `scrape.failed` | An async scrape fails terminally |\n| `monitor.change_detected` | A screenshot monitor fires and detects a change |\n| `monitor.captured` | A screenshot monitor fires with no change detected (notify_on: every) |\n| `monitor.suspended` | A monitor is suspended because the account ran out of balance (reason `insufficient_balance`) |\n| `sitemap.completed` | A sitemap job finishes |\n| `sitemap.failed` | A sitemap job fails terminally |\n\nUse this header to dispatch events without inspecting the body shape:\n\n```python\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route(\"/webhooks/bytekit\", methods=[\"POST\"])\ndef handle():\n event = request.headers.get(\"X-ByteKit-Event\")\n if event == \"bulk.completed\":\n handle_bulk(request.json)\n elif event == \"scrape.completed\":\n handle_scrape(request.json)\n return \"\", 200\n```\n\n`X-ByteKit-Event` is a reserved header — you cannot supply it via `webhook_headers` in\nmonitor or bulk configuration. Attempts to do so will be rejected with a `422` at request\ntime.\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — usage counting and concurrency slots\n- [Errors](https://bytekit.com/docs/guides/errors) — how to interpret and retry error responses\n- [API Reference: Scrape](https://bytekit.com/docs/api/scrape/createscrape) — full request/response schema"
381
+ },
382
+ "guides/screenshots": {
383
+ "title": "Screenshots",
384
+ "section": "Guides",
385
+ "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 |\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 `2` (`2` for a retina-sharp image) |\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 |\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## 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 retina or 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 or path is not allowed as a capture target | No — use a different URL |\n| `422` | `validation_error` | A field failed validation (`error.details` names the field), an unknown field was sent, or the body is not valid JSON (no `details`) | No — fix the request |\n| `422` | `blocked`, `timeout`, … | The capture ran and failed inside the 28-second hold. The body is the screenshot resource, with `error_code` and `error_message` set | Possibly — a retry is a new capture |\n| `429` | `rate_limited` | Too many requests per second | Yes — wait for the `Retry-After` header, then back off |\n| `429` | `concurrency_limit` | Too many captures in flight at once | Yes — wait for the `Retry-After` header |\n| `404` | `not_found` | `GET /v1/screenshots/{id}` for an id that does not exist on your account \n\n---\n[Truncated to the 16384-byte per-page limit — this page is 17580 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]"
386
+ },
387
+ "guides/search": {
388
+ "title": "Search",
389
+ "section": "Guides",
390
+ "body": "# Search\n\nSearch the web from one request — a working call, the options that matter, the response, what it costs, and the errors to handle.\n\n`POST /v1/search` runs a web search and returns ranked results: a title, a URL and, when\navailable, a snippet for each. Send a `query` and you get back up to ten results. Everything\nelse — how many results, which country and language, news or images, how recent — is optional.\n\n## Run a search\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/search \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"query\": \"best web scraping tools\", \"limit\": 3}'\n```\n\nThe call is synchronous: it returns `200` with the results in the response body.\n\n```json\n{\n \"id\": \"sr_742ffcf841d24db7a2261f6a8c087469\",\n \"query\": \"best web scraping tools\",\n \"results\": [\n {\n \"position\": 1,\n \"title\": \"Best web scraping tools I've tried (and what I learned from ...\",\n \"url\": \"https://www.reddit.com/r/automation/comments/1ncuv8k/best_web_scraping_tools_ive_tried_and_what_i/\",\n \"snippet\": \"Playwright: Great for structured. Hyperbrowser: The one I'm using most now. . Playwright is powerful and well-structured, Selenium / Playwright ...\",\n \"date\": \"1 year ago\"\n },\n {\n \"position\": 2,\n \"title\": \"5 best AI web scraper tools I'm using in 2026 (free + paid)\",\n \"url\": \"https://www.gumloop.com/blog/best-ai-web-scrapers\",\n \"snippet\": \"5 best AI web scraper tools to use in 2026 · 1. Gumloop · 2. Octoparse · 3. Browse AI · 4. Thunderbit · 5. Firecrawl. Firecrawl web scraper. Best ...\",\n \"date\": null\n },\n {\n \"position\": 3,\n \"title\": \"Best web scraping tools (ideally premium instead of open source)?\",\n \"url\": \"https://www.reddit.com/r/Entrepreneur/comments/1pc9u5k/best_web_scraping_tools_ideally_premium_instead/\",\n \"date\": null\n }\n ],\n \"related_searches\": [\n \"Best web scraping tools reddit\",\n \"Best web scraping tools free\",\n \"AI web scraping tool free\",\n \"Best web scraper Python\"\n ],\n \"credits_used\": 1\n}\n```\n\n> This request was run for real and returned `200`. The response is shortened for the page: the\n> real one listed eight `related_searches`, and four are shown. Results are live search results,\n> so yours will differ.\n\n| Field | Description |\n| ------------------ | ---------------------------------------------------------------------------------------------------------------------- |\n| `id` | Search id, prefixed `sr_` |\n| `query` | The query that was searched |\n| `results` | The ranked results, best first. `position` starts at `1` and runs without gaps; the list holds at most `limit` results |\n| `related_searches` | Related queries the search suggests. An empty array when there are none |\n| `credits_used` | Credits this search cost (see [Cost](#cost)) |\n\nEach item in `results` has:\n\n| Field | Description |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `position` | Rank of the result, from `1` |\n| `title` | The result's title |\n| `url` | The result's URL |\n| `snippet` | A short text excerpt. Not every result has one — in the example, result 3 has none — and it is never present for `images` results |\n| `date` | When the result was published, as the search reports it. A string such as `1 year ago` (the wording follows `language`) or `null` when no date is reported. Not a fixed date format, so do not parse it as ISO. Absent for `images` results |\n\nA search can return fewer results than `limit`, and an empty `results` array is a valid answer.\n\n## Options\n\nOnly `query` is required. Send any of the others alongside it.\n\n| Option | Default | Description |\n| ------------ | ------- | ------------------------------------------------------------------------------------------------------------- |\n| `query` | — | The search query, 1 to 2048 characters |\n| `limit` | `10` | Maximum number of results, an integer from `1` to `100`. It also sets what the call costs (see [Cost](#cost)) |\n| `type` | `web` | Which index to search: `web`, `news`, or `images` |\n| `country` | `us` | Two-letter country code to localize results, for example `us` or `de` |\n| `language` | `en` | Two-letter ISO 639-1 language code, for example `en` or `fr`. Region forms such as `en-US` are rejected |\n| `date_range` | `any` | Only results from a recent window: `any` (no filter), `hour`, `day`, `week`, `month`, or `year` |\n\n`country` and `language` are not case sensitive. An unknown value for `type` or `date_range`, a\n`limit` outside `1`–`100`, a `country` that is not two characters, or a `language` that is not a\nreal ISO 639-1 code is rejected with `400 validation_error`.\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/search \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"query\": \"web scraping\",\n \"type\": \"news\",\n \"limit\": 2,\n \"country\": \"de\",\n \"language\": \"de\",\n \"date_range\": \"week\"\n }'\n```\n\n> This request was run for real and returned `200` with two results, each carrying a `source`\n> (the publisher) and an `image`, and `\"credits_used\": 1`. The `date` values came back in German\n> (`vor 3 Tagen`), following `language`.\n\n### Result types\n\n`type` changes which fields a result carries. The rest of the response is the same, and so is the\ncost.\n\n| `type` | What `results` holds |\n| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `web` | Ranked web results with `title`, `url`, `snippet` and `date` |\n| `news` | News articles. Adds `source` (the publisher) and `image`, a thumbnail whose only field is `url` |\n| `images` | Image results. Adds `source`, `domain` (the page hosting the image) and a fuller `image` object: `url`, `width`, `height`, `thumbnail_url`, `thumbnail_width`, `thumbnail_height`. Has no `snippet` or `date` |\n\nThe extra fields are present when the search reports them, so treat each as optional.\n\n## Cost\n\nSearch is billed in credits, not bandwidth. A search costs one credit for every ten results\nrequested, rounded up, and never more than ten credits:\n\n```\ncredits = min(ceil(limit / 10), 10)\n```\n\n| `limit` | Credits |\n| ------------------ | ------- |\n| `10` (the default) | `1` |\n| `11` | `2` |\n| `35` | `4` |\n| `100` | `10` |\n\nThe charge follows the `limit` you ask for, not the number of results you get back: a search\nthat returns fewer results than `limit` still costs the full amount. Ask for no more than you\nneed. `credits_used` in the response reports what the call cost.\n\n> The `11` row was run for real: the response held 11 results at `position` 1 through 11 and\n> reported `\"credits_used\": 2`. The other rows follow from the formula, which\n> [Credit billing](https://bytekit.com/docs/billing/credits) also states.\n\nA search that is rejected before it runs (`400`, `401`, `402`, `429`) is not charged, and a\nsearch that fails with `500` or `503` is refunded. For how the credit balance works, see\n[Credit billing](https://bytekit.com/docs/billing/credits).\n\n## Use it from an SDK\n\nTypeScript:\n\n```ts\nimport { ByteKit } from '@hunt-labs/bytekit-sdk';\n\nconst client = new ByteKit({ apiKey: process.env.BYTEKIT_API_KEY! });\n\nconst res = await client.search.query({ query: 'best web scraping tools', limit: 3 });\nfor (const r of res.results) console.log(r.position, r.title, r.url);\nconsole.log('credits used:', res.credits_used);\n```\n\nPython:\n\n```python\nimport os\n\nfrom bytekit import AuthenticatedClient\n\nclient = AuthenticatedClient(token=os.environ[\"BYTEKIT_API_KEY\"])\n\nres = client.search(\"best web scraping tools\", limit=3)\nfor r in res.results:\n print(r.position, r.title, r.url)\nprint(\"credits used:\", res.credits_used)\n```\n\n> Both snippets were run for real and printed three results and `credits used: 1`. The\n> endpoint accepts the same options as the table above, passed as `type`, `limit`, `country`,\n> `language` and `date_range`. A non-`200` response raises an error carrying the status and the\n> error `code` (`ByteKitError` in TypeScript, `errors.UnexpectedStatus` in Python). See the\n> [TypeScript](https://bytekit.com/docs/sdk/typescript/search) and [Python](https://bytekit.com/docs/sdk/python/search) references.\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` | `validation_error` | `query` is missing or empty, an option is out of range or not an allowed value, or the body is not valid JSON | No — fix the request |\n| `401` | `unauthorized`, `invalid_api_key` | The API key is missing, malformed, or not valid | No — check your key |\n| `402` | `quota_exceeded` | Your credit balance cannot fund the search. The message states the credit total that is exhausted | No — add credits or upgrade; a retry fails until then |\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| `429` | `rate_limited` | Too many requests per second | Yes — wait for the `Retry-After` header, then back off |\n| `500` | `internal_error` | The search could not be recorded, so it did not run | Yes — back off and retry |\n| `503` | `search_provider_error` | The search service failed to answer | Yes — back off and retry |\n\n`400 validation_error` is the status this endpoint uses for validation failures; the\n[Errors guide](https://bytekit.com/docs/guides/errors) lists it as such for `/v1/search`. The error body carries the first\nfailing check in `error.message` and no `error.details`:\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"validation_error\",\n \"message\": \"Number must be less than or equal to 100\",\n \"http_status\": 400,\n \"failed_at\": \"2026-10-09T20:46:17.996Z\"\n }\n}\n```\n\n> This response was returned by a real request with `\"limit\": 101`.\n\nA `429` carries a `Retry-After` header, in seconds. A real burst of requests past a\n5-requests-per-second limit returned:\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-10-09T20:46:28.344Z\"\n }\n}\n```\n\nwith the headers `Retry-After: 1` and `X-RateLimit-Limit: 5`. Your own limit depends on your\nplan; see [Rate Limits](https://bytekit.com/docs/guides/rate-limits).\n\nA `503 search_provider_error` does not use the unified envelope. Its body is exactly `{\"error\": \"search_provider_error\"}`\n— a bare string, not an object. The [Errors guide](https://bytekit.com/docs/guides/errors) does not list this code, so\nhandle it here: check for a top-level `error` that is a string. The TypeScript SDK raises a\n`ByteKitError` whose `code` is `search_provider_error`; the Python SDK raises\n`errors.UnexpectedStatus` with `status_code` `503` and the raw body in `content`, and its `code` is\n`None` for this body.\n\n## Next steps\n\n- [Scraping](https://bytekit.com/docs/guides/scraping) — fetch the content of a result's URL\n- [Errors](https://bytekit.com/docs/guides/errors) — the error envelope and retry guidance\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — requests per second and concurrency slots\n- [Credit billing](https://bytekit.com/docs/billing/credits) — how credits are charged\n- [API Reference: Search](https://bytekit.com/docs/api/search/createsearch) — full request and response schema"
391
+ },
392
+ "guides/sitemap": {
393
+ "title": "Sitemap",
394
+ "section": "Guides",
395
+ "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]"
361
396
  },
362
397
  "guides/webhooks": {
363
398
  "title": "Webhooks",
@@ -367,12 +402,12 @@
367
402
  "introduction": {
368
403
  "title": "Introduction",
369
404
  "section": "General",
370
- "body": "# Introduction\n\nA REST API for screenshots, scraping, and page-change monitoring — one key, one base URL, every output.\n\n## What ByteKit is\n\nByteKit is a REST API for capturing what a webpage looks like and what it says —\nscreenshots, raw HTML or clean markdown, and page-change monitoring.\nOne API key, one base URL, every output you'd otherwise stitch together from a headless-browser\nfarm and a scraping proxy.\n\n## Integrate in 60 seconds\n\n- **Base URL:** `https://api.bytekit.com`\n- **Auth:** send `Authorization: Bearer $BYTEKIT_API_KEY` on every request. Create a key in the\n [ByteKit dashboard](https://app.bytekit.com) and export it as `BYTEKIT_API_KEY`.\n- **Install:** `npm install @hunt-labs/bytekit-sdk` for TypeScript, or `pip install bytekit-sdk`\n for Python (import name `bytekit`).\n\nThe npm package is `@hunt-labs/bytekit-sdk` — not `bytekit`, which is an unrelated package.\n\nOne call with curl:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer $BYTEKIT_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\":\"https://example.com\"}'\n```\n\nThe same call with the TypeScript SDK:\n\n```ts\nimport { ByteKit } from '@hunt-labs/bytekit-sdk';\n\nconst client = new ByteKit({ apiKey: process.env.BYTEKIT_API_KEY! });\nconst result = await client.scrape.create({ url: 'https://example.com' });\nconsole.log(result);\n```\n\nFull SDK guides: [TypeScript](https://bytekit.com/docs/libraries/typescript) and [Python](https://bytekit.com/docs/libraries/python).\n\n## What you can do with it\n\n- **Scrape** — Fetch a URL as raw HTML, clean markdown, or structured content.\n- **Screenshot** — Capture full-page or viewport PNG/JPEG.\n- **Monitor** — Watch a URL on a schedule and webhook you when the rendered output changes.\n- **Bulk** — Fan out thousands of URLs in parallel and receive a webhook as each finishes.\n- **Sitemap** — Discover URLs from a domain's sitemap or by light crawling.\n\nScrape calls accept an `\"async\": true` body field, in which case the API returns `202` with a `sc_…`\nID that you poll or receive via webhook. Screenshots are synchronous by default (the call holds up to\n28s and returns `200`); pass the `?async=true` query parameter to get back `202` with an `ss_…` ID\nimmediately.\n\n## Authentication and accounts\n\nEvery request carries a Bearer API key, prefixed `sk_live_`. Manage keys from the [dashboard](https://app.bytekit.com) —\nup to 50 active keys per account, with per-key billing attribution so you can split usage\ncleanly across services.\n\nFull details in the [Authentication guide](https://bytekit.com/docs/guides/authentication).\n\n## Where to go next\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — first call in under five minutes, no SDK required.\n- [Client Libraries](https://bytekit.com/docs/libraries/typescript) — official TypeScript and Python SDKs.\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, async polling.\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, response headers.\n- [Monitors](https://bytekit.com/docs/guides/monitors) — schedule-based change detection with webhooks.\n- [API Reference](https://bytekit.com/docs/api) — every endpoint, request, and response."
405
+ "body": "# Introduction\n\nA REST API for screenshots, scraping, and page-change monitoring — one key, one base URL, every output.\n\n## What ByteKit is\n\nByteKit is a REST API for capturing what a webpage looks like and what it says —\nscreenshots, raw HTML or clean markdown, and page-change monitoring.\nOne API key, one base URL, every output you'd otherwise stitch together from a headless-browser\nfarm and a scraping proxy.\n\n## Integrate in 60 seconds\n\n- **Base URL:** `https://api.bytekit.com`\n- **Auth:** send `Authorization: Bearer $BYTEKIT_API_KEY` on every request. Create a key in the\n [ByteKit dashboard](https://app.bytekit.com) and export it as `BYTEKIT_API_KEY`.\n- **Install:** `npm install @hunt-labs/bytekit-sdk` for TypeScript, or `pip install bytekit-sdk`\n for Python (import name `bytekit`).\n- **Try it without paying:** a new pay-as-you-go account receives a one-time starter grant of\n **100 MB of bandwidth and 100 credits**, issued once per account and not a purchase. It does not\n expire, and real requests draw it down. Details on the\n [balance page](https://bytekit.com/docs/billing/balance#starter-grant).\n\nThe npm package is `@hunt-labs/bytekit-sdk` — not `bytekit`, which is an unrelated package.\n\nThe first call with curl is in the [Quickstart](https://bytekit.com/docs/quickstart). With the TypeScript SDK:\n\n```ts\nimport { ByteKit } from '@hunt-labs/bytekit-sdk';\n\nconst client = new ByteKit({ apiKey: process.env.BYTEKIT_API_KEY! });\nconst result = await client.scrape.create({ url: 'https://example.com', formats: ['markdown'] });\nif (result.status === 'success') {\n console.log(result.metadata.title);\n console.log(result.formats.markdown);\n} else {\n console.log(result); // the queued receipt; a failed scrape throws ByteKitError instead\n}\n```\n\nThe same call with the Python SDK:\n\n```python\nimport os\n\nfrom bytekit import ByteKit\nfrom bytekit.models import ScrapeSuccessEnvelope\n\nclient = ByteKit(api_key=os.environ[\"BYTEKIT_API_KEY\"])\nresult = client.scrape.create(url=\"https://example.com\", formats=[\"markdown\"])\nif isinstance(result, ScrapeSuccessEnvelope):\n print(result.metadata.title)\n print(result.formats.markdown)\nelse:\n print(result) # the queued receipt; a non-2xx response or a failed scrape raises ByteKitError\n```\n\nFull SDK guides: [TypeScript](https://bytekit.com/docs/libraries/typescript) and [Python](https://bytekit.com/docs/libraries/python).\n\n## What you can do with it\n\n- **Scrape** — Fetch a URL as raw HTML, clean markdown, or structured content.\n- **Screenshot** — Capture full-page or viewport PNG/JPEG.\n- **Monitor** — Watch a URL on a schedule and webhook you when the rendered output changes.\n- **Bulk** — Fan out thousands of URLs in parallel and receive one webhook when the job completes.\n- **Sitemap** — Discover URLs from a domain's sitemap or by light crawling.\n- **[Fetch](https://bytekit.com/docs/api/fetch/postfetch)** — Low-latency raw HTTP fetch: the target's response comes back as the body, with metadata in headers.\n- **[Search](https://bytekit.com/docs/api/search/createsearch)** — Run a web search and get ranked organic results.\n- **[Schema extraction](https://bytekit.com/docs/api/schema/createschemaextraction)** — Extract structured JSON from a URL against a JSON Schema.\n\nScrape and screenshot calls can both be made asynchronous: send `\"async\": true` in the JSON body or\n`?async=true` in the query string (either one is enough, on either endpoint). The API then returns\n`202` with a `sc_…` (scrape) or `ss_…` (screenshot) ID immediately, which you poll (scrapes can also\ndeliver via webhook). Without it, screenshots hold up to 28s and return `200`.\n\n## Authentication and accounts\n\nEvery request carries a Bearer API key, prefixed `sk_live_`. Manage keys from the [dashboard](https://app.bytekit.com) —\nup to 50 active keys per account, with per-key billing attribution so you can split usage\ncleanly across services.\n\nFull details in the [Authentication guide](https://bytekit.com/docs/guides/authentication).\n\n## Where to go next\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — first call in under five minutes, no SDK required.\n- [Client Libraries](https://bytekit.com/docs/libraries) — official TypeScript and Python SDKs.\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, async polling.\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — usage counting, concurrency slots, response headers.\n- [Monitors](https://bytekit.com/docs/guides/monitors) — schedule-based change detection with webhooks.\n- [API Reference](https://bytekit.com/docs/api) — every endpoint, request, and response."
371
406
  },
372
407
  "libraries": {
373
408
  "title": "Client Libraries",
374
409
  "section": "Libraries",
375
- "body": "# Client Libraries\n\nThe official TypeScript and Python clients, and how to call ByteKit from Go.\n\nByteKit ships official SDKs for TypeScript and Python. Both are thin wrappers over the same\nREST endpoints, so nothing they do is out of reach from a language without an SDK — the Go page\nshows the plain standard-library equivalent. These pages cover installing and configuring each\nclient; the per-method reference is in the [SDK Reference](https://bytekit.com/docs/sdk).\n\nInstall `@hunt-labs/bytekit-sdk` (npm) / `bytekit-sdk` (PyPI). The npm package named `bytekit` is not ours.\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — Type-safe ByteKit client for Node.js and modern JavaScript runtimes.\n- [Python SDK](https://bytekit.com/docs/libraries/python) — Official Python client for ByteKit, with sync and async support.\n- [Go](https://bytekit.com/docs/libraries/go) — Call the ByteKit REST API from Go with the standard library."
410
+ "body": "# Client Libraries\n\nThe official TypeScript and Python clients, and how to call ByteKit from Go.\n\nByteKit ships official SDKs for TypeScript and Python. Both are thin wrappers over the same\nREST endpoints, so nothing they do is out of reach from a language without an SDK — the Go page\nshows the plain standard-library equivalent. These pages cover installing and configuring each\nclient; the per-method reference is in the [SDK Reference](https://bytekit.com/docs/sdk).\n\nInstall `@hunt-labs/bytekit-sdk` (npm) / `bytekit-sdk` (PyPI).\n\nTypeScript:\n\n```bash\nnpm install @hunt-labs/bytekit-sdk\n```\n\n```ts\nimport { ByteKit } from '@hunt-labs/bytekit-sdk';\n\nconst client = new ByteKit({ apiKey: process.env.BYTEKIT_API_KEY! });\nconst result = await client.scrape.create({ url: 'https://example.com', formats: ['markdown'] });\nif (result.status === 'success') {\n console.log(result.metadata.title);\n console.log(result.formats.markdown);\n} else {\n console.log(result); // the queued receipt; a failed scrape throws ByteKitError instead\n}\n```\n\nPython:\n\n```bash\npip install bytekit-sdk\n```\n\n```python\nimport os\n\nfrom bytekit import ByteKit\nfrom bytekit.models import ScrapeSuccessEnvelope\n\nclient = ByteKit(api_key=os.environ[\"BYTEKIT_API_KEY\"])\nresult = client.scrape.create(url=\"https://example.com\", formats=[\"markdown\"])\nif isinstance(result, ScrapeSuccessEnvelope):\n print(result.metadata.title)\n print(result.formats.markdown)\nelse:\n print(result) # the queued receipt; a non-2xx response or a failed scrape raises ByteKitError\n```\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — Type-safe ByteKit client for Node.js and modern JavaScript runtimes.\n- [Python SDK](https://bytekit.com/docs/libraries/python) — Official Python client for ByteKit, with sync and async support.\n- [Go](https://bytekit.com/docs/libraries/go) — Call the ByteKit REST API from Go with the standard library."
376
411
  },
377
412
  "libraries/go": {
378
413
  "title": "Go",
@@ -382,7 +417,7 @@
382
417
  "libraries/python": {
383
418
  "title": "Python SDK",
384
419
  "section": "Libraries",
385
- "body": "# Python SDK\n\nOfficial Python client for ByteKit, with sync and async support.\n\nThe official Python SDK is generated from the ByteKit OpenAPI spec, so its models and\nmethods always match the API. Every operation ships in both synchronous and asynchronous form.\n\n## Install\n\n```bash\npip install bytekit-sdk\n```\n\nThe PyPI distribution is `bytekit-sdk`; the import name is `bytekit`. Install `@hunt-labs/bytekit-sdk` (npm) / `bytekit-sdk` (PyPI). The npm package named `bytekit` is not ours.\n\n## Your first scrape\n\n```python\nfrom bytekit import AuthenticatedClient\nfrom bytekit.api.scrape import create_scrape\nfrom bytekit.models.scrape_request import ScrapeRequest\nfrom bytekit.models.scrape_request_formats_item import ScrapeRequestFormatsItem\nfrom bytekit.models.scrape_success_envelope import ScrapeSuccessEnvelope\n\nclient = AuthenticatedClient(\n base_url=\"https://api.bytekit.com\",\n token=\"sk_live_your_api_key_here\",\n)\n\n# Request the markdown format explicitly — otherwise response.formats.markdown is UNSET.\nbody = ScrapeRequest(\n url=\"https://example.com\",\n formats=[ScrapeRequestFormatsItem.MARKDOWN],\n)\nresponse = create_scrape.sync(client=client, body=body)\n\n# .sync() returns None on a transport error, and a queued/error envelope on the\n# async or failure paths. Only a ScrapeSuccessEnvelope carries populated formats.\nif response is None:\n print(\"Request failed — no response returned.\")\nelif isinstance(response, ScrapeSuccessEnvelope) and isinstance(response.formats.markdown, str):\n print(response.formats.markdown)\nelse:\n # Queued (ScrapeQueuedEnvelope) or error (ScrapeErrorEnvelope) — inspect `response`.\n print(f\"Scrape not complete: {response}\")\n```\n\nEach operation exposes four call styles:\n\n- `create_scrape.sync(...)` — returns the parsed model (or `None`).\n- `create_scrape.sync_detailed(...)` — returns the full `Response` (status code, headers, body).\n- `create_scrape.asyncio(...)` — awaitable form of `sync`.\n- `create_scrape.asyncio_detailed(...)` — awaitable form of `sync_detailed`.\n\n## Async usage\n\n```python\nimport asyncio\nfrom bytekit import AuthenticatedClient\nfrom bytekit.api.screenshots import create_screenshot\nfrom bytekit.models.screenshot_request import ScreenshotRequest\n\nasync def main():\n client = AuthenticatedClient(\n base_url=\"https://api.bytekit.com\",\n token=\"sk_live_your_api_key_here\",\n )\n body = ScreenshotRequest(url=\"https://example.com\")\n response = await create_screenshot.asyncio(client=client, body=body)\n print(response)\n\nasyncio.run(main())\n```\n\n## What's available\n\nOperations are grouped by capability under `bytekit.api.*`: `scrape`, `scrape_bulk`,\n`screenshots`, `bulk`, `fetch`, `fetch_bulk`, `monitors`, `sitemap`, and\n`account`.\n\nSee the [Python SDK Reference](https://bytekit.com/docs/sdk/python/client) for every module, function, and model.\n\n## Next steps\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — the same API surface in TypeScript.\n- [API Reference](https://bytekit.com/docs/api) — the underlying REST endpoints.\n- [Errors](https://bytekit.com/docs/guides/errors) — error codes and retry guidance."
420
+ "body": "# Python SDK\n\nOfficial Python client for ByteKit, with sync and async support.\n\nThe official Python SDK is generated from the ByteKit OpenAPI spec, so its models and\nmethods always match the API. `ByteKit` is a thin client on top of it for everyday use; the\ngenerated operations underneath ship in both synchronous and asynchronous form.\n\n## Install\n\n```bash\npip install bytekit-sdk\n```\n\nThe PyPI distribution is `bytekit-sdk`; the import name is `bytekit`.\n\n## Your first scrape\n\n```python\nfrom bytekit import ByteKit\n\nclient = ByteKit(api_key=\"sk_live_your_api_key_here\")\n\nresult = client.scrape.create(url=\"https://example.com\", formats=[\"markdown\"])\nprint(result.formats.markdown)\n```\n\n`result` is the parsed `ScrapeSuccessEnvelope`. Request fields are keyword arguments under the\nAPI's own field names, with plain JSON values, so `formats=[\"markdown\"]` needs no enum import.\nOnly the fields you pass are sent.\n\n## Handle errors\n\nAny non-2xx response raises `ByteKitError`, as does a `scrape.create` call that comes back as\nHTTP 200 with a `failed` envelope. So does a response the generated operation cannot turn into a\ndocumented model: an undocumented status (even a 2xx), a body that is not JSON, or a body that\ndoes not match the documented shape. It carries the HTTP `status_code` and the API's `code` and\n`message` (both `None` when the body is not an error envelope):\n\n```python\nimport httpx\nfrom bytekit import ByteKit, ByteKitError\n\nclient = ByteKit(api_key=\"sk_live_your_api_key_here\")\n\ntry:\n client.scrape.create(url=\"https://example.com\")\nexcept ByteKitError as err:\n print(err.status_code, err.code, err.message)\nexcept httpx.HTTPError:\n print(\"Could not reach the API\") # connection refused, DNS failure, timeout, ...\n```\n\n`ByteKitError` subclasses `bytekit.errors.UnexpectedStatus`, so code that already catches that\nkeeps working. A transport failure is not wrapped: it propagates as the `httpx` exception.\n\n## Async scrapes\n\nPass `async_=True` to get a queued receipt back and poll it by ID. A `202` is returned, not\nraised:\n\n```python\nqueued = client.scrape.create(url=\"https://example.com\", async_=True)\njob = client.scrape.get(queued.id)\n```\n\n`scrape.get` returns the job's envelope as it stands, so a job that ended in failure comes back\nas a `ScrapeErrorEnvelope` rather than raising.\n\n## Other resources\n\nEvery API operation is a method on the client, grouped by resource. Path IDs are the first\npositional argument, query parameters are keywords (`limit=5`, `status=\"completed\"`), and every\nother keyword is a request-body field. Pass body fields as keywords, not as a `body=` argument\n(that raises `TypeError`). A string for an enum-valued query parameter is converted, and one that\nis not a valid value raises `ValueError`.\n\n| Resource | Methods |\n| ------------- | ------------------------------------------------------------ |\n| `account` | `get` |\n| `bulk` | `create`, `get`, `delete`, `list_screenshots` |\n| `fetch` | `create`, `get` |\n| `fetch_bulk` | `create`, `get` |\n| `monitors` | `create`, `list`, `get`, `update`, `delete`, `list_captures` |\n| `scrape` | `create`, `get` |\n| `scrape_bulk` | `create`, `get` |\n| `screenshots` | `create`, `get` |\n| `search` | `create` |\n| `sitemap` | `create`, `get` |\n| `usage` | `get`, `get_daily`, `get_by_endpoint` |\n| `webhooks` | `list_deliveries`, `retry_delivery` |\n\nParameters keep the generated spelling: `from_` on `usage.get_daily` and\n`usage.get_by_endpoint`, `async_` on `scrape.create` and `screenshots.create`, and `url_query`\n(the `url` query parameter) on `fetch.get`. Date parameters take objects, not strings:\n`datetime.date` for `from_` and `to` on the `usage` methods, `datetime.datetime` for `since` on\n`webhooks.list_deliveries`.\n\n## The generated client\n\n`ByteKit` calls the generated operations in `bytekit.api.*`, which you can use directly when you\nwant the typed request models and the full response:\n\n```python\nfrom bytekit import AuthenticatedClient\nfrom bytekit.api.scrape import create_scrape\nfrom bytekit.models.scrape_request import ScrapeRequest\nfrom bytekit.models.scrape_request_formats_item import ScrapeRequestFormatsItem\nfrom bytekit.models.scrape_success_envelope import ScrapeSuccessEnvelope\n\nclient = AuthenticatedClient(\n base_url=\"https://api.bytekit.com\",\n token=\"sk_live_your_api_key_here\",\n)\n\nbody = ScrapeRequest(\n url=\"https://example.com\",\n formats=[ScrapeRequestFormatsItem.MARKDOWN],\n)\nresponse = create_scrape.sync(client=client, body=body)\n\n# A documented error status (400, 429, 500, ...) comes back as an `Error` model, and a queued\n# receipt as a ScrapeQueuedEnvelope. Only a ScrapeSuccessEnvelope carries populated formats.\nif isinstance(response, ScrapeSuccessEnvelope) and isinstance(response.formats.markdown, str):\n print(response.formats.markdown)\nelse:\n print(f\"Scrape not complete: {response}\")\n```\n\nEach operation exposes four call styles:\n\n- `create_scrape.sync(...)` — returns the parsed model.\n- `create_scrape.sync_detailed(...)` — returns the full `Response` (status code, headers, body).\n- `create_scrape.asyncio(...)` — awaitable form of `sync`.\n- `create_scrape.asyncio_detailed(...)` — awaitable form of `sync_detailed`.\n\nWhat a call does with a response it cannot turn into a documented model depends on the client's\n`raise_on_unexpected_status`, which defaults to `True`:\n\n- An undocumented status, a body that is not JSON or does not match the documented shape, or a\n `200` scrape carrying the `failed` envelope raises `bytekit.errors.UnexpectedStatus` (with `status_code`, `code` and `message`).\n- `sync` and `asyncio` return `None` for those only when you construct the client with\n `raise_on_unexpected_status=False`.\n- A transport failure never returns `None`: it raises the `httpx` exception.\n\n### Async usage\n\n```python\nimport asyncio\nfrom bytekit import AuthenticatedClient\nfrom bytekit.api.screenshots import create_screenshot\nfrom bytekit.models.screenshot_request import ScreenshotRequest\n\nasync def main():\n client = AuthenticatedClient(\n base_url=\"https://api.bytekit.com\",\n token=\"sk_live_your_api_key_here\",\n )\n body = ScreenshotRequest(url=\"https://example.com\")\n response = await create_screenshot.asyncio(client=client, body=body)\n print(response)\n\nasyncio.run(main())\n```\n\n## Reference\n\nThe [Python SDK Reference](https://bytekit.com/docs/sdk/python/client) covers the generated client classes and operations\nby resource. `ByteKit` and `ByteKitError` are documented on this page.\n\n## Next steps\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — the same API surface in TypeScript.\n- [API Reference](https://bytekit.com/docs/api) — the underlying REST endpoints.\n- [Errors](https://bytekit.com/docs/guides/errors) — error codes and retry guidance."
386
421
  },
387
422
  "libraries/typescript": {
388
423
  "title": "TypeScript SDK",
@@ -392,12 +427,12 @@
392
427
  "mcp": {
393
428
  "title": "MCP Server",
394
429
  "section": "General",
395
- "body": "# MCP Server\n\nCall ByteKit web capture as a native tool from Claude, Cursor, and any MCP-compatible agent — hosted over HTTP or run locally over stdio.\n\nThe ByteKit **MCP server** exposes scraping, search, screenshots, and account\nlookups as [Model Context Protocol](https://modelcontextprotocol.io) tools. Your\nagent calls `scrape_url` or `screenshot_url` the same way it calls any other\ntool — no wrapper to write, no headless browser to manage.\n\nThere are two ways to connect: a **hosted HTTP endpoint** (nothing to install)\nand a **local stdio server** (`npx @hunt-labs/bytekit-mcp`).\n\n## Authentication\n\nBoth paths authenticate with a ByteKit API key. Sign up at\n[app.bytekit.com](https://app.bytekit.com) and create a key (prefixed\n`sk_live_`). The local server reads it from the `BYTEKIT_API_KEY` environment\nvariable (or the `--api-key` flag); the hosted endpoint takes it as a bearer\ntoken.\n\n## Option 1 — Hosted HTTP (no install)\n\nPoint any MCP client that speaks the Streamable HTTP transport at:\n\n```\nhttps://api.bytekit.com/mcp\n```\n\nSend your API key as a bearer token. Example client config for a host that\nspeaks Streamable HTTP directly (Cursor and most hosts accept this shape):\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"url\": \"https://api.bytekit.com/mcp\",\n \"headers\": {\n \"Authorization\": \"Bearer sk_live_xxx\"\n }\n }\n }\n}\n```\n\n**Paste your real key in place of `sk_live_xxx`.** A JSON config file is not a\nshell: most hosts read these values verbatim and do not substitute environment\nvariables inside `headers`, so writing `Bearer $BYTEKIT_API_KEY` here sends that\ntext to the API as the token, verbatim, and the API answers `401`.\n\n**Claude Desktop does not accept this shape.** `claude_desktop_config.json`\nonly launches local **stdio** subprocesses (`command`/`args`/`env`) — it has\nno native `url`-based remote-server entry, so pasting the config above into\nit will not connect. To reach the hosted endpoint from Claude Desktop, either:\n\n- add ByteKit as a [Connector](https://claude.com/connectors) (Settings →\n Connectors → Add custom connector), or\n- bridge it locally with [`mcp-remote`](https://www.npmjs.com/package/mcp-remote):\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"mcp-remote\",\n \"https://api.bytekit.com/mcp\",\n \"--header\",\n \"Authorization:${AUTH_HEADER}\"\n ],\n \"env\": {\n \"AUTH_HEADER\": \"Bearer sk_live_xxx\"\n }\n }\n }\n}\n```\n\nTwo details in that snippet are load-bearing, and both are documented by\n`mcp-remote` itself:\n\n- **`${AUTH_HEADER}`, not `$AUTH_HEADER`.** Claude Desktop launches\n `command`/`args` directly, with no shell in between, so it does not expand\n `$VAR` anywhere in the config. `mcp-remote` does its own substitution on\n `--header` values, but only of the braced `${VAR}` form, reading it from the\n process environment the `env` block supplies. A bare `$BYTEKIT_API_KEY` is\n passed through untouched and authenticates as that literal string — a\n guaranteed `401`.\n- **No space after the colon in `Authorization:${AUTH_HEADER}`.** The header\n value carries the space (`Bearer sk_live_xxx`) instead. `mcp-remote`'s README\n documents this as the workaround for a Cursor / Claude Desktop (Windows) bug\n where spaces inside `args` are not escaped when it invokes `npx`, mangling the\n value: `\"Authorization:${AUTH_HEADER}\" // note no spaces around ':'` with\n `\"AUTH_HEADER\": \"Bearer <auth-token>\" // spaces OK in env vars`.\n\nOr skip the hosted endpoint entirely and run the **local stdio server**\n(Option 2 below), which Claude Desktop supports natively.\n\n## Option 2 — Local stdio (`npx`)\n\nRun the server as a local subprocess over stdio. Nothing to install globally —\n`npx` fetches it on demand:\n\n```bash\nnpx @hunt-labs/bytekit-mcp --api-key $BYTEKIT_API_KEY\n```\n\nOr set the key in your environment and omit the flag:\n\n```bash\nexport BYTEKIT_API_KEY=sk_live_xxx\nnpx @hunt-labs/bytekit-mcp\n```\n\nClient config for a stdio server:\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@hunt-labs/bytekit-mcp\"],\n \"env\": {\n \"BYTEKIT_API_KEY\": \"sk_live_xxx\"\n }\n }\n }\n}\n```\n\n### API-key resolution order\n\nThe local server resolves the key in this order:\n\n1. `--api-key <key>` flag\n2. `BYTEKIT_API_KEY` environment variable\n\n## Tool inventory\n\n| Tool | What it does |\n| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `scrape_url` | Fetch a URL and return HTML, clean markdown, links, or images. Optional `solve_challenge` (boolean): Attempt to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render. |\n| `web_search` | Run a web search and return ranked organic results. |\n| `screenshot_url` | Capture a screenshot of a page (desktop/mobile, PNG/JPEG). |\n| `get_result` | Fetch a previously created screenshot by id. |\n| `get_account` | Return account details, plan, and current usage/quota. |\n| `list_docs` | List every page in the bundled ByteKit documentation. |\n| `search_docs` | Search the bundled documentation. |\n| `get_doc` | Fetch the full markdown of one documentation page. |\n\nThe server also exposes **resources** (`bytekit://account`,\n`bytekit://screenshot/{id}`) and **prompts** (`summarize_webpage`,\n`extract_structured_data`, `research_topic`) that MCP hosts can surface directly.\n\n## Limits\n\nThe hosted `POST /mcp` endpoint caps request bodies at **1 MB**. MCP tool\narguments are small (a URL plus a few options), so this comfortably covers\nevery tool and prompt in the matrix above — including `research_topic`, the\nlargest legitimate call, which carries a list of URLs. An oversized request\ngets a `413` with a JSON-RPC-shaped error body rather than a dropped\nconnection.\n\nEvery route in the table below carries its own body-size limit, sized to\nthat route's shape rather than reused from `/mcp` (a bulk endpoint's\nrealistic payload is far larger than an MCP tool call):\n\n| Endpoint | Limit | Error |\n| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ----------------------- |\n| `POST /v1/scrape`, `/v1/search`, `/v1/scrape/bulk`, `/v1/schema` | 512 KB | `400 request_too_large` |\n| `POST /v1/fetch` | 512 KB | `400 request_too_large` |\n| `POST /v1/screenshots` | 512 KB | `400 request_too_large` |\n| `POST /v1/monitors` | 512 KB | `400 request_too_large` |\n| `POST /v1/sitemap` | 512 KB | `400 request_too_large` |\n| `POST /v1/bulk` | 4 MB pre-auth (chunked) / 32 MB fail-safe (declared length) / per-plan up to 28.7 MB | `400 request_too_large` |\n| `POST /v1/fetch/bulk` | 2 MB pre-auth (chunked) / 20 MB fail-safe (declared length) / per-plan up to 16.8 MB | `400 request_too_large` |\n| `POST /v1/webhook-deliveries/{id}/retry` | 64 KB | `400 request_too_large` |\n| `POST /mcp` | 1 MB | `413` (JSON-RPC error) |\n\nThe two bulk endpoints are guarded in a two-tier shape, not by a single\nceiling. A streamed body with no `Content-Length` header is capped at the\nsmall pre-auth limit (4 MB / 2 MB) before your API key is checked; a body\nthat declares `Content-Length` is instead bounded there by a larger fail-safe\n(32 MB / 20 MB) rather than the real limit, since that branch reads nothing\nuntil your key is verified. Once your key is verified, a second check\nre-gates the body against your account's own `max_bulk_size`, the number of\nURLs or per-item configs your plan allows in one call. A custom plan with a\n`max_bulk_size` of 50,000 reaches 28.7 MB / 16.8 MB at that second check. A\nstandard-plan account's effective ceiling is exactly the pre-auth limit;\neither tier's overrun returns `400 request_too_large`.\n\n## Next steps\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — make your first ByteKit API call.\n- [Authentication](https://bytekit.com/docs/guides/authentication) — key formats and management."
430
+ "body": "# MCP Server\n\nCall ByteKit web capture as a native tool from Claude, Cursor, and any MCP-compatible agent — hosted over HTTP or run locally over stdio.\n\nThe ByteKit **MCP server** exposes scraping, search, screenshots, and account\nlookups as [Model Context Protocol](https://modelcontextprotocol.io) tools. Your\nagent calls `scrape_url` or `screenshot_url` the same way it calls any other\ntool — no wrapper to write, no headless browser to manage.\n\nThere are two ways to connect: a **hosted HTTP endpoint** (nothing to install)\nand a **local stdio server** (`npx @hunt-labs/bytekit-mcp`).\n\n## Authentication\n\nBoth paths authenticate with a ByteKit API key. Sign up at\n[app.bytekit.com](https://app.bytekit.com) and create a key (prefixed\n`sk_live_`). The local server reads it from the `BYTEKIT_API_KEY` environment\nvariable (or the `--api-key` flag); the hosted endpoint takes it as a bearer\ntoken.\n\n## Option 1 — Hosted HTTP (no install)\n\nPoint any MCP client that speaks the Streamable HTTP transport at:\n\n```\nhttps://api.bytekit.com/mcp\n```\n\nSend your API key as a bearer token. Example client config for a host that\nspeaks Streamable HTTP directly (Cursor and most hosts accept this shape):\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"url\": \"https://api.bytekit.com/mcp\",\n \"headers\": {\n \"Authorization\": \"Bearer sk_live_xxx\"\n }\n }\n }\n}\n```\n\n**Paste your real key in place of `sk_live_xxx`.** A JSON config file is not a\nshell: most hosts read these values verbatim and do not substitute environment\nvariables inside `headers`, so writing `Bearer $BYTEKIT_API_KEY` here sends that\ntext to the API as the token, verbatim, and the API answers `401`.\n\n**Claude Desktop does not accept this shape.** `claude_desktop_config.json`\nonly launches local **stdio** subprocesses (`command`/`args`/`env`) — it has\nno native `url`-based remote-server entry, so pasting the config above into\nit will not connect. To reach the hosted endpoint from Claude Desktop, either:\n\n- add ByteKit as a [Connector](https://claude.com/connectors) (Settings →\n Connectors → Add custom connector), or\n- bridge it locally with [`mcp-remote`](https://www.npmjs.com/package/mcp-remote):\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"mcp-remote\",\n \"https://api.bytekit.com/mcp\",\n \"--header\",\n \"Authorization:${AUTH_HEADER}\"\n ],\n \"env\": {\n \"AUTH_HEADER\": \"Bearer sk_live_xxx\"\n }\n }\n }\n}\n```\n\nTwo details in that snippet are load-bearing, and both are documented by\n`mcp-remote` itself:\n\n- **`${AUTH_HEADER}`, not `$AUTH_HEADER`.** Claude Desktop launches\n `command`/`args` directly, with no shell in between, so it does not expand\n `$VAR` anywhere in the config. `mcp-remote` does its own substitution on\n `--header` values, but only of the braced `${VAR}` form, reading it from the\n process environment the `env` block supplies. A bare `$BYTEKIT_API_KEY` is\n passed through untouched and authenticates as that literal string — a\n guaranteed `401`.\n- **No space after the colon in `Authorization:${AUTH_HEADER}`.** The header\n value carries the space (`Bearer sk_live_xxx`) instead. `mcp-remote`'s README\n documents this as the workaround for a Cursor / Claude Desktop (Windows) bug\n where spaces inside `args` are not escaped when it invokes `npx`, mangling the\n value: `\"Authorization:${AUTH_HEADER}\" // note no spaces around ':'` with\n `\"AUTH_HEADER\": \"Bearer <auth-token>\" // spaces OK in env vars`.\n\nOr skip the hosted endpoint entirely and run the **local stdio server**\n(Option 2 below), which Claude Desktop supports natively.\n\n## Option 2 — Local stdio (`npx`)\n\nRun the server as a local subprocess over stdio. Nothing to install globally —\n`npx` fetches it on demand:\n\n```bash\nnpx @hunt-labs/bytekit-mcp --api-key $BYTEKIT_API_KEY\n```\n\nOr set the key in your environment and omit the flag:\n\n```bash\nexport BYTEKIT_API_KEY=sk_live_xxx\nnpx @hunt-labs/bytekit-mcp\n```\n\nClient config for a stdio server:\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@hunt-labs/bytekit-mcp\"],\n \"env\": {\n \"BYTEKIT_API_KEY\": \"sk_live_xxx\"\n }\n }\n }\n}\n```\n\n### API-key resolution order\n\nThe local server resolves the key in this order:\n\n1. `--api-key <key>` flag\n2. `BYTEKIT_API_KEY` environment variable\n\n## Tool inventory\n\n| Tool | What it does |\n| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `scrape_url` | Fetch a URL and return HTML, clean markdown, links, or images. Optional `solve_challenge` (boolean): Attempt to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render. |\n| `web_search` | Run a web search and return ranked organic results. |\n| `screenshot_url` | Capture a screenshot of a page (desktop/mobile, PNG/JPEG). |\n| `get_result` | Fetch a previously created screenshot by id. |\n| `get_account` | Return account details, plan, and current usage/quota. |\n| `list_docs` | List every page in the bundled ByteKit documentation. |\n| `search_docs` | Search the bundled documentation. |\n| `get_doc` | Fetch the full markdown of one documentation page. |\n\nWhen `formats` is omitted, `scrape_url` returns markdown, whereas `POST /v1/scrape` returns\nraw. Pass `formats` to choose the format explicitly on either. The\n[Scraping guide](https://bytekit.com/docs/guides/scraping#response-fields) covers how markdown changes the cost.\n\nThe server also exposes **resources** (`bytekit://account`,\n`bytekit://screenshot/{id}`) and **prompts** (`summarize_webpage`,\n`extract_structured_data`, `research_topic`) that MCP hosts can surface directly.\n\n## Limits\n\nThe hosted `POST /mcp` endpoint caps request bodies at **1 MB**. MCP tool\narguments are small (a URL plus a few options), so this comfortably covers\nevery tool and prompt in the matrix above — including `research_topic`, the\nlargest legitimate call, which carries a list of URLs. An oversized request\ngets a `413` with a JSON-RPC-shaped error body rather than a dropped\nconnection.\n\nBody-size limits for the REST API routes are listed under\n[Request size limits](https://bytekit.com/docs/guides/rate-limits#request-size-limits).\n\n## Next steps\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — make your first ByteKit API call.\n- [Authentication](https://bytekit.com/docs/guides/authentication) — key formats and management."
396
431
  },
397
432
  "quickstart": {
398
433
  "title": "Quickstart",
399
434
  "section": "General",
400
- "body": "# Quickstart\n\nMake your first ByteKit API call in under 5 minutes — no SDK required.\n\nNothing to install. You only need `curl` and an API key.\n\n## Get an API key\n\nSign up at [app.bytekit.com](https://app.bytekit.com) and create an API key from the\ndashboard. Keys are prefixed `sk_live_`.\n\nSee [Authentication](https://bytekit.com/docs/guides/authentication) for details on key formats and management.\n\n## Make your first scrape\n\nSet your API key and run this — no file to save, no `chmod`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer $BYTEKIT_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\":\"https://example.com\"}'\n```\n\nWant a full-featured script with error handling and `jq` formatting? Use this instead:\n\n```bash\n#!/usr/bin/env bash\n# POST /v1/scrape — scrape a URL and return its content as markdown.\n# Usage: BYTEKIT_API_KEY=sk_... bash examples/curl/scrape.sh\n\nset -euo pipefail\n\n: \"${BYTEKIT_API_KEY:?BYTEKIT_API_KEY is required}\"\nBASE_URL=\"${BYTEKIT_BASE_URL:-https://api.bytekit.com}\"\n\ncurl -sf -X POST \"$BASE_URL/v1/scrape\" \\\n -H \"Authorization: Bearer $BYTEKIT_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"formats\": [\"markdown\"]}' \\\n | jq .\n```\n\nA successful response looks like this — every envelope field is `snake_case`:\n\n```json\n{\n \"schema_version\": 1,\n \"status\": \"success\",\n \"id\": \"sc_84c14b1058184045b97ae360ad74888b\",\n \"url\": \"https://example.com\",\n \"final_url\": \"https://example.com\",\n \"content_type\": \"text/html\",\n \"content_length\": 318,\n \"status_code\": 200,\n \"retrieved_at\": \"2026-08-27T12:16:01.872Z\",\n \"formats\": {\n \"raw\": \"<!doctype html><html lang=\\\"en\\\"><head><title>Example Domain</title>…</html>\\n\"\n },\n \"metadata\": {\n \"title\": \"Example Domain\",\n \"description\": null,\n \"language\": \"en\",\n \"canonicalUrl\": null,\n \"ogTitle\": null,\n \"ogDescription\": null,\n \"ogImage\": null,\n \"ogUrl\": null,\n \"ogSiteName\": null,\n \"robots\": null,\n \"byline\": null,\n \"publishedAt\": null\n },\n \"cache\": \"miss\",\n \"billing\": {\n \"raw_bytes\": 318,\n \"factors\": [{ \"name\": \"endpoint\", \"value\": 1, \"reason\": \"scrape\" }],\n \"multiplier\": 1,\n \"billed_bytes\": 318\n }\n}\n```\n\n`content_length` is the compressed wire size in bytes (used for bandwidth billing), and\n`billing` breaks down what the request actually cost. `cache` is `\"miss\"` or `\"hit\"`, and a\nhit adds a `cache_age_s` field. The `id` field uses the `sc_` prefix — you can poll\n`GET /v1/scrape/{id}` if the scrape was queued asynchronously.\n\nThe keys inside `metadata` stay `camelCase` (`canonicalUrl`, `ogTitle`, …): they are the\npage's own metadata, not envelope fields.\n\n## Ask for markdown\n\nThe default format is `raw` — that is why the response above carries no\n`formats.markdown`. Request markdown explicitly:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer $BYTEKIT_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\":\"https://example.com\",\"formats\":[\"markdown\"]}'\n```\n\nMarkdown output is billed at **1.5×** the request's upstream wire bytes — the `endpoint`\nfactor in the `billing` node below is the rate your balance is charged, not a display\nweighting. See [Bandwidth billing](https://bytekit.com/docs/billing/bandwidth) for how the factors compose.\n\nThe response's `formats` object is keyed by what you asked for:\n\n```json\n{\n \"schema_version\": 1,\n \"status\": \"success\",\n \"id\": \"sc_f659fa67dfb244159767132c2aa50917\",\n \"url\": \"https://example.com\",\n \"final_url\": \"https://example.com\",\n \"content_type\": \"text/html\",\n \"content_length\": 318,\n \"status_code\": 200,\n \"retrieved_at\": \"2026-08-27T12:16:11.337Z\",\n \"formats\": {\n \"markdown\": \"---\\ntitle: \\\"Example Domain\\\"\\nurl: \\\"https://example.com\\\"\\ncaptured_at: \\\"2026-08-27T12:16:11.416Z\\\"\\n---\\nThis domain is for use in documentation examples without needing permission. Avoid use in operations.\\n\\n[Learn more](https://iana.org/domains/example)\"\n },\n \"metadata\": {\n \"title\": \"Example Domain\",\n \"description\": null,\n \"language\": \"en\",\n \"canonicalUrl\": null,\n \"ogTitle\": null,\n \"ogDescription\": null,\n \"ogImage\": null,\n \"ogUrl\": null,\n \"ogSiteName\": null,\n \"robots\": null,\n \"byline\": null,\n \"publishedAt\": null\n },\n \"cache\": \"hit\",\n \"cache_age_s\": 8,\n \"billing\": {\n \"raw_bytes\": 318,\n \"factors\": [\n { \"name\": \"endpoint\", \"value\": 1.5, \"reason\": \"scrape_md\" },\n { \"name\": \"cache_hit\", \"value\": 0.5, \"reason\": \"hit, age 8s\" }\n ],\n \"multiplier\": 0.75,\n \"billed_bytes\": 239\n }\n}\n```\n\nSee [Scraping](https://bytekit.com/docs/guides/scraping) for the other formats (`markdown`, `links`, `images`).\n\n## Prefer an SDK?\n\nSkip the raw HTTP and use an official client:\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — `npm install @hunt-labs/bytekit-sdk`\n- [Python SDK](https://bytekit.com/docs/libraries/python) — `pip install bytekit-sdk`\n\nInstall `@hunt-labs/bytekit-sdk` (npm) / `bytekit-sdk` (PyPI). The npm package named `bytekit` is not ours.\n\n## Next steps\n\n- [Authentication](https://bytekit.com/docs/guides/authentication) — key formats, Bearer header, self-serve key management\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, latency, and async polling\n- [Errors](https://bytekit.com/docs/guides/errors) — error shape, common codes, retry guidance\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, rate limit headers\n- [Monitors](https://bytekit.com/docs/guides/monitors) — page-change detection (screenshot or scrape) with webhook notifications\n- [API Reference](https://bytekit.com/docs/api) — full endpoint documentation"
435
+ "body": "# Quickstart\n\nMake your first ByteKit API call in under 5 minutes — no SDK required.\n\nNothing to install. You only need `curl` and an API key.\n\n## Get an API key\n\nSign up at [app.bytekit.com](https://app.bytekit.com) and create an API key from the\ndashboard. Keys are prefixed `sk_live_`.\n\nSee [Authentication](https://bytekit.com/docs/guides/authentication) for details on key formats and management.\n\n## What you can try without paying\n\nA new pay-as-you-go account receives a one-time starter grant of **100 MB of bandwidth and\n100 credits**. It is issued once per account, is not a purchase, and does not expire, so you can\nrun the requests below without buying anything first. Real requests draw it down. See\n[Balance and exhausted quota](https://bytekit.com/docs/billing/balance#starter-grant) for how the grant is spent and what\nhappens when a balance reaches zero.\n\n## Make your first scrape\n\nSet your API key and run this — no file to save, no `chmod`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer $BYTEKIT_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\":\"https://example.com\"}'\n```\n\nA successful response looks like this — every envelope field is `snake_case`:\n\n```json\n{\n \"schema_version\": 1,\n \"status\": \"success\",\n \"id\": \"sc_84c14b1058184045b97ae360ad74888b\",\n \"url\": \"https://example.com\",\n \"final_url\": \"https://example.com\",\n \"content_type\": \"text/html\",\n \"content_length\": 318,\n \"status_code\": 200,\n \"retrieved_at\": \"2026-08-27T12:16:01.872Z\",\n \"formats\": {\n \"raw\": \"<!doctype html><html lang=\\\"en\\\"><head><title>Example Domain</title>…</html>\\n\"\n },\n \"metadata\": {\n \"title\": \"Example Domain\",\n \"description\": null,\n \"language\": \"en\",\n \"canonicalUrl\": null,\n \"ogTitle\": null,\n \"ogDescription\": null,\n \"ogImage\": null,\n \"ogUrl\": null,\n \"ogSiteName\": null,\n \"robots\": null,\n \"byline\": null,\n \"publishedAt\": null\n },\n \"cache\": \"miss\",\n \"billing\": {\n \"raw_bytes\": 318,\n \"factors\": [{ \"name\": \"endpoint\", \"value\": 1, \"reason\": \"scrape\" }],\n \"multiplier\": 1,\n \"billed_bytes\": 318\n }\n}\n```\n\n`content_length` is the compressed wire size in bytes (used for bandwidth billing), and\n`billing` breaks down what the request actually cost. `cache` is `\"miss\"` or `\"hit\"`, and a\nhit adds a `cache_age_s` field. The `id` field uses the `sc_` prefix — you can poll\n`GET /v1/scrape/{id}` if the scrape was queued asynchronously. A page that only a hosted\nbrowser could retrieve bills that browser's full measured transfer instead of one response.\n\nThe keys inside `metadata` stay `camelCase` (`canonicalUrl`, `ogTitle`, …): they are the\npage's own metadata, not envelope fields.\n\n## Ask for markdown\n\nThe default format is `raw` — that is why the response above carries no\n`formats.markdown`. Request markdown explicitly:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer $BYTEKIT_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\":\"https://example.com\",\"formats\":[\"markdown\"]}'\n```\n\nMarkdown output is billed at **1.5×** the request's upstream wire bytes — the `endpoint`\nfactor in the `billing` node below is the rate your balance is charged, not a display\nweighting. See [Bandwidth billing](https://bytekit.com/docs/billing/bandwidth) for how the factors compose.\n\nThe response's `formats` object is keyed by what you asked for:\n\n```json\n{\n \"schema_version\": 1,\n \"status\": \"success\",\n \"id\": \"sc_f659fa67dfb244159767132c2aa50917\",\n \"url\": \"https://example.com\",\n \"final_url\": \"https://example.com\",\n \"content_type\": \"text/html\",\n \"content_length\": 318,\n \"status_code\": 200,\n \"retrieved_at\": \"2026-08-27T12:16:11.337Z\",\n \"formats\": {\n \"markdown\": \"---\\ntitle: \\\"Example Domain\\\"\\nurl: \\\"https://example.com\\\"\\ncaptured_at: \\\"2026-08-27T12:16:11.416Z\\\"\\n---\\nThis domain is for use in documentation examples without needing permission. Avoid use in operations.\\n\\n[Learn more](https://iana.org/domains/example)\"\n },\n \"metadata\": {\n \"title\": \"Example Domain\",\n \"description\": null,\n \"language\": \"en\",\n \"canonicalUrl\": null,\n \"ogTitle\": null,\n \"ogDescription\": null,\n \"ogImage\": null,\n \"ogUrl\": null,\n \"ogSiteName\": null,\n \"robots\": null,\n \"byline\": null,\n \"publishedAt\": null\n },\n \"cache\": \"hit\",\n \"cache_age_s\": 8,\n \"billing\": {\n \"raw_bytes\": 318,\n \"factors\": [\n { \"name\": \"endpoint\", \"value\": 1.5, \"reason\": \"scrape_md\" },\n { \"name\": \"cache_hit\", \"value\": 0.5, \"reason\": \"hit, age 8s\" }\n ],\n \"multiplier\": 0.75,\n \"billed_bytes\": 239\n }\n}\n```\n\nSee [Scraping](https://bytekit.com/docs/guides/scraping) for the other formats (`markdown`, `links`, `images`).\n\n## Prefer an SDK?\n\nSkip the raw HTTP and use an official client:\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — `npm install @hunt-labs/bytekit-sdk`\n- [Python SDK](https://bytekit.com/docs/libraries/python) — `pip install bytekit-sdk`\n\nInstall `@hunt-labs/bytekit-sdk` (npm) / `bytekit-sdk` (PyPI). The npm package named `bytekit` is not ours.\n\n## Next steps\n\n- [Authentication](https://bytekit.com/docs/guides/authentication) — key formats, Bearer header, self-serve key management\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, latency, and async polling\n- [Errors](https://bytekit.com/docs/guides/errors) — error shape, common codes, retry guidance\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — usage counting, concurrency slots, rate limit headers\n- [Monitors](https://bytekit.com/docs/guides/monitors) — page-change detection (screenshot or scrape) with webhook notifications\n- [API Reference](https://bytekit.com/docs/api) — full endpoint documentation"
401
436
  },
402
437
  "sdk": {
403
438
  "title": "SDK Reference",
@@ -412,62 +447,62 @@
412
447
  "sdk/python/bulk": {
413
448
  "title": "Bulk",
414
449
  "section": "SDK Reference",
415
- "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` — `Union[Unset, list[str]]` — Simple URL list. Provide urls OR items, not both.\n- `items` — `Union[Unset, list['CreateBulkBodyItemsItem']]` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `Union[Unset, CreateBulkBodyDefaults]` — Default behaviour applied to every entry unless the item overrides it.\n- `webhook_secret` — `Union[Unset, str]` — 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` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateBulkResponse202, Error]]\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[Union[DeleteBulkResponse200, Error]]\nsync(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[DeleteBulkResponse200, Error]]\nawait asyncio(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\n```\n\n## Get Bulk\n\nGet bulk job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200, GetBulkResponse202]]\nsync(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200, GetBulkResponse202]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200, GetBulkResponse202]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200, GetBulkResponse202]]\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 (Union[Unset, str])`\n- `limit (Union[Unset, int])`\n- `status (Union[Unset, ListBulkScreenshotsStatus])`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[ListBulkScreenshotsResponse200]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[ListBulkScreenshotsResponse200]\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[ListBulkScreenshotsResponse200]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[ListBulkScreenshotsResponse200]\n```"
450
+ "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` — `Union[Unset, list[str]]` — Simple URL list. Provide urls OR items, not both.\n- `items` — `Union[Unset, list['CreateBulkBodyItemsItem']]` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `Union[Unset, CreateBulkBodyDefaults]` — Default behaviour applied to every entry unless the item overrides it.\n- `webhook_secret` — `Union[Unset, str]` — 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` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, CreateBulkResponse403, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateBulkResponse202, CreateBulkResponse403, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, CreateBulkResponse403, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateBulkResponse202, CreateBulkResponse403, Error]]\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[Union[DeleteBulkResponse200, Error]]\nsync(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[DeleteBulkResponse200, Error]]\nawait asyncio(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\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[Union[Error, GetBulkResponse200, GetBulkResponse202]]\nsync(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200, GetBulkResponse202]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200, GetBulkResponse202]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200, GetBulkResponse202]]\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 (Union[Unset, str])`\n- `limit (Union[Unset, int])`\n- `status (Union[Unset, ListBulkScreenshotsStatus])`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, ListBulkScreenshotsResponse200]]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, ListBulkScreenshotsResponse200]]\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, ListBulkScreenshotsResponse200]]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, ListBulkScreenshotsResponse200]]\n```"
416
451
  },
417
452
  "sdk/python/client": {
418
453
  "title": "Client",
419
454
  "section": "SDK Reference",
420
- "body": "# Client\n\nThe ByteKit Python SDK provides two client classes for making API requests.\n\n## Client\n\nA class for keeping track of data related to the API\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded. A connection that never gets established at\nall — DNS failure, refused connection, TLS handshake failure — raises its transport\nsibling httpx.ConnectError instead. Neither is caught by this SDK: both propagate to the\ncaller, on the generated operations and on ``AuthenticatedClient.search`` alike.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'Client'\n```\n\nGet a new client matching this one with a new timeout (in seconds)\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> 'Client'\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> 'Client'\n```\n\nManually the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set\n\n## AuthenticatedClient\n\nA Client which has been authenticated for use on secured endpoints\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded. A connection that never gets established at\nall — DNS failure, refused connection, TLS handshake failure — raises its transport\nsibling httpx.ConnectError instead. Neither is caught by this SDK: both propagate to the\ncaller, on the generated operations and on ``AuthenticatedClient.search`` alike.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\ntoken: The token to use for authentication. KEYWORD-ONLY.\nprefix: The prefix to use for the Authorization header. KEYWORD-ONLY.\nauth_header_name: The name of the Authorization header. KEYWORD-ONLY.\nAll three are keyword-only so that the pre-0.3.0 positional call\n``AuthenticatedClient(base_url, token)`` raises TypeError instead of\nsilently binding the base URL to ``token`` and the API key to ``prefix``.\n\n### search\n\n```python\nsearch(query: str, type: Optional[Union['CreateSearchBodyType', Literal['web', 'news', 'images']]] = None, limit: Optional[int] = None, country: Optional[str] = None, language: Optional[str] = None, date_range: Optional[Union['CreateSearchBodyDateRange', Literal['any', 'hour', 'day', 'week', 'month', 'year']]] = None) -> 'CreateSearchResponse200'\n```\n\nRun a web search and return ranked organic results.\n\nThin, statically-declared delegate to the hand-written ``_search`` appended at the\nbottom of this module; the full contract (argument semantics, the\n``errors.UnexpectedStatus`` guarantee) is documented there.\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with a new timeout (in seconds)\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> 'AuthenticatedClient'\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> 'AuthenticatedClient'\n```\n\nManually the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set"
455
+ "body": "# Client\n\nThe ByteKit Python SDK provides two client classes for making API requests.\n\nInstall the SDK, create a client, run a scrape and read the markdown:\n\n```python\n# pip install bytekit-sdk (import name: bytekit)\nimport os\n\nfrom bytekit import ByteKit\nfrom bytekit.models import ScrapeSuccessEnvelope\n\nclient = ByteKit(api_key=os.environ[\"BYTEKIT_API_KEY\"])\nresult = client.scrape.create(url=\"https://example.com\", formats=[\"markdown\"])\nif isinstance(result, ScrapeSuccessEnvelope):\n print(result.formats.markdown)\n```\n\n## Client\n\nA class for keeping track of data related to the API\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded. A connection that never gets established at\nall — DNS failure, refused connection, TLS handshake failure — raises its transport\nsibling httpx.ConnectError instead. Neither is caught by this SDK: both propagate to the\ncaller, on the generated operations and on ``AuthenticatedClient.search`` alike.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'Client'\n```\n\nGet a new client matching this one with a new timeout (in seconds)\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> 'Client'\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> 'Client'\n```\n\nManually the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set\n\n## AuthenticatedClient\n\nA Client which has been authenticated for use on secured endpoints\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded. A connection that never gets established at\nall — DNS failure, refused connection, TLS handshake failure — raises its transport\nsibling httpx.ConnectError instead. Neither is caught by this SDK: both propagate to the\ncaller, on the generated operations and on ``AuthenticatedClient.search`` alike.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\ntoken: The token to use for authentication. KEYWORD-ONLY.\nprefix: The prefix to use for the Authorization header. KEYWORD-ONLY.\nauth_header_name: The name of the Authorization header. KEYWORD-ONLY.\nAll three are keyword-only so that the pre-0.3.0 positional call\n``AuthenticatedClient(base_url, token)`` raises TypeError instead of\nsilently binding the base URL to ``token`` and the API key to ``prefix``.\n\n### search\n\n```python\nsearch(query: str, type: Optional[Union['CreateSearchBodyType', Literal['web', 'news', 'images']]] = None, limit: Optional[int] = None, country: Optional[str] = None, language: Optional[str] = None, date_range: Optional[Union['CreateSearchBodyDateRange', Literal['any', 'hour', 'day', 'week', 'month', 'year']]] = None) -> 'CreateSearchResponse200'\n```\n\nRun a web search and return ranked organic results.\n\nThin, statically-declared delegate to the hand-written ``_search`` appended at the\nbottom of this module; the full contract (argument semantics, the\n``errors.UnexpectedStatus`` guarantee) is documented there.\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with a new timeout (in seconds)\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> 'AuthenticatedClient'\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> 'AuthenticatedClient'\n```\n\nManually the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set"
421
456
  },
422
457
  "sdk/python/fetch": {
423
458
  "title": "Fetch",
424
459
  "section": "SDK Reference",
425
- "body": "# Fetch\n\nFunctions for interacting with the `fetch` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Fetch\n\nFetch a URL (GET)\n\nDirect HTTP fetch. Successful responses return the upstream response bytes verbatim;\nmetadata is returned in X-Fetch-* headers. Non-2xx upstream responses use the\n`upstream_error` JSON envelope with the upstream HTTP status.\n\n**Parameters**\n\n- `url_query (str)`\n- `country (Union[Unset, str])`\n- `timeout_ms (Union[Unset, int])`\n- `cache_ttl (Union[GetFetchCacheTtlType1, Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl) -> Response[Union[Error, str]]\nsync(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl) -> Optional[Union[Error, str]]\nawait asyncio_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl) -> Response[Union[Error, str]]\nawait asyncio(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl) -> Optional[Union[Error, str]]\n```\n\n## Post Fetch\n\nFetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (FetchRequest)`\n- `url` — `str`\n- `country` — `Union[Unset, str]`\n- `timeout_ms` — `Union[Unset, int]`\n- `cache_ttl` — `Union[FetchRequestCacheTtlType1, Unset, str]` — 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` — `Union[Unset, FetchRequestCustom]` — User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom` response header so callers can correlate the response back to caller-side state (job IDs, batch metadata, etc.). Capped at 4096 UTF-8 bytes after JSON serialization. Does NOT affect cache-key inputs — two requests differing only in `custom` share the same cache slot.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[Error, str]]\nsync(client=client, body=body) -> Optional[Union[Error, str]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[Error, str]]\nawait asyncio(client=client, body=body) -> Optional[Union[Error, str]]\n```"
460
+ "body": "# Fetch\n\nFunctions for interacting with the `fetch` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Fetch\n\nFetch 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**Parameters**\n\n- `url_query (str)`\n- `country (Union[Unset, str])`\n- `timeout_ms (Union[Unset, int])`\n- `cache_ttl (Union[GetFetchCacheTtlType1, Unset, str])`\n- `custom (Union[Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Response[Union[Error, str]]\nsync(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Optional[Union[Error, str]]\nawait asyncio_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Response[Union[Error, str]]\nawait asyncio(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Optional[Union[Error, str]]\n```\n\n## Post Fetch\n\nFetch 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**Parameters**\n\n- `body (FetchRequest)`\n- `url` — `str`\n- `country` — `Union[Unset, str]` — Two-letter country code. Either case is accepted; the value is upper-cased.\n- `timeout_ms` — `Union[Unset, int]`\n- `cache_ttl` — `Union[FetchRequestCacheTtlType1, Unset, str]` — 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` — `Union[Unset, FetchRequestCustom]` — User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom` response header so callers can correlate the response back to caller-side state (job IDs, batch metadata, etc.). Capped at 4096 UTF-8 bytes after JSON serialization. Does NOT affect cache-key inputs — two requests differing only in `custom` share the same cache slot.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[Error, str]]\nsync(client=client, body=body) -> Optional[Union[Error, str]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[Error, str]]\nawait asyncio(client=client, body=body) -> Optional[Union[Error, str]]\n```"
426
461
  },
427
462
  "sdk/python/fetch-bulk": {
428
463
  "title": "Fetch Bulk",
429
464
  "section": "SDK Reference",
430
- "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[Union['CreateFetchBulkBodyUrlsItemType1', str]]`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `defaults` — `Union[Unset, CreateFetchBulkBodyDefaults]`\n- `webhook_secret` — `Union[Unset, str]` — 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` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, Error]]\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**Parameters**\n\n- `id (str)`\n- `cursor (Union[Unset, str])`\n- `limit (Union[Unset, int])`\n- `status (Union[Unset, GetFetchBulkStatus])`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\n```"
465
+ "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[Union['CreateFetchBulkBodyUrlsItemType1', str]]`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `defaults` — `Union[Unset, CreateFetchBulkBodyDefaults]`\n- `webhook_secret` — `Union[Unset, str]` — 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` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, CreateFetchBulkResponse403, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, CreateFetchBulkResponse403, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, CreateFetchBulkResponse403, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, CreateFetchBulkResponse403, Error]]\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 (Union[Unset, str])`\n- `limit (Union[Unset, int])`\n- `status (Union[Unset, GetFetchBulkStatus])`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\n```"
431
466
  },
432
467
  "sdk/python/monitors": {
433
468
  "title": "Monitors",
434
469
  "section": "SDK Reference",
435
- "body": "# Monitors\n\nFunctions for interacting with the `monitors` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\nFirst-capture behavior is the same for both monitor types: the first capture is a silent baseline (`has_change=False`, `change_pct=None`) with no `change_detected` webhook, whether the monitor is `scrape` or `screenshot`. From the second capture onward both types diff against the previous capture.\n\n## Create Monitor\n\nCreate a change-detection monitor\n\nCreates a recurring change-detection monitor for a URL, delivering results via webhook.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (MonitorCreateRequest)`\n- `url` — `str`\n- `interval_type` — `MonitorCreateRequestIntervalType`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `type_` — `Union[Unset, MonitorCreateRequestType]`\n- `cron_expression` — `Union[Unset, str]` — 5-field cron expression. Required when interval_type is \"cron\".\n- `change_threshold` — `Union[Unset, float]`\n- `notify_on` — `Union[Unset, MonitorCreateRequestNotifyOn]`\n- `webhook_secret` — `Union[Unset, str]` — 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- `webhook_headers` — `Union[Unset, MonitorCreateRequestWebhookHeaders]` — Max 20 headers. Keys must match /^[A-Za-z0-9-]+$/ and not be reserved.\n- `options` — `Union[Unset, MonitorCreateRequestOptions]` — Screenshot monitor options (device, viewport, format, etc.).\n- `scrape_options` — `Union[Unset, MonitorCreateRequestScrapeOptions]` — Scrape monitor options (formats, country, wait_for_selector, wait_until, delay_ms). Only for type=scrape.\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[Error, MonitorCreateResponse]]\nsync(client=client, body=body) -> Optional[Union[Error, MonitorCreateResponse]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[Error, MonitorCreateResponse]]\nawait asyncio(client=client, body=body) -> Optional[Union[Error, MonitorCreateResponse]]\n```\n\n## Delete Monitor\n\nCancel monitor\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Any, Error]]\nsync(id=id, client=client) -> Optional[Union[Any, Error]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Any, Error]]\nawait asyncio(id=id, client=client) -> Optional[Union[Any, Error]]\n```\n\n## Get Monitor\n\nGet monitor\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, MonitorResponse]]\nsync(id=id, client=client) -> Optional[Union[Error, MonitorResponse]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, MonitorResponse]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, MonitorResponse]]\n```\n\n## List Monitor Captures\n\nList monitor captures\n\n**Parameters**\n\n- `id (str)`\n- `limit (Union[Unset, int])`\n- `cursor (Union[Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, limit=limit, cursor=cursor) -> Response[ListMonitorCapturesResponse200]\nsync(id=id, client=client, limit=limit, cursor=cursor) -> Optional[ListMonitorCapturesResponse200]\nawait asyncio_detailed(id=id, client=client, limit=limit, cursor=cursor) -> Response[ListMonitorCapturesResponse200]\nawait asyncio(id=id, client=client, limit=limit, cursor=cursor) -> Optional[ListMonitorCapturesResponse200]\n```\n\n## List Monitors\n\nList monitors\n\n**Parameters**\n\n- `limit (Union[Unset, int])`\n- `cursor (Union[Unset, str])`\n- `status (Union[Unset, ListMonitorsStatus])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, limit=limit, cursor=cursor, status=status) -> Response[ListMonitorsResponse200]\nsync(client=client, limit=limit, cursor=cursor, status=status) -> Optional[ListMonitorsResponse200]\nawait asyncio_detailed(client=client, limit=limit, cursor=cursor, status=status) -> Response[ListMonitorsResponse200]\nawait asyncio(client=client, limit=limit, cursor=cursor, status=status) -> Optional[ListMonitorsResponse200]\n```\n\n## Update Monitor\n\nUpdate monitor\n\n**Parameters**\n\n- `id (str)`\n- `body (MonitorUpdateRequest)`\n- `url` — `Union[Unset, str]`\n- `interval_type` — `Union[Unset, MonitorUpdateRequestIntervalType]`\n- `cron_expression` — `Union[Unset, str]`\n- `change_threshold` — `Union[Unset, float]`\n- `notify_on` — `Union[Unset, MonitorUpdateRequestNotifyOn]`\n- `webhook_url` — `Union[Unset, str]` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `webhook_secret` — `Union[Unset, str]` — 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- `webhook_headers` — `Union[Unset, MonitorUpdateRequestWebhookHeaders]`\n- `status` — `Union[Unset, MonitorUpdateRequestStatus]`\n- `options` — `Union[Unset, MonitorUpdateRequestOptions]`\n- `scrape_options` — `Union[Unset, MonitorUpdateRequestScrapeOptions]`\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, body=body) -> Response[Union[Error, MonitorResponse]]\nsync(id=id, client=client, body=body) -> Optional[Union[Error, MonitorResponse]]\nawait asyncio_detailed(id=id, client=client, body=body) -> Response[Union[Error, MonitorResponse]]\nawait asyncio(id=id, client=client, body=body) -> Optional[Union[Error, MonitorResponse]]\n```"
470
+ "body": "# Monitors\n\nFunctions for interacting with the `monitors` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\nFirst-capture behavior is the same for both monitor types: the first capture is a silent baseline (`has_change=False`, `change_pct=None`) with no `change_detected` webhook, whether the monitor is `scrape` or `screenshot`. From the second capture onward both types diff against the previous capture.\n\n## Create Monitor\n\nCreate a change-detection monitor\n\nCreates a recurring change-detection monitor for a URL, delivering results via webhook.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (MonitorCreateRequest)`\n- `url` — `str`\n- `interval_type` — `MonitorCreateRequestIntervalType`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `type_` — `Union[Unset, MonitorCreateRequestType]`\n- `cron_expression` — `Union[Unset, str]` — 5-field cron expression. Required when interval_type is \"cron\".\n- `change_threshold` — `Union[Unset, float]`\n- `notify_on` — `Union[Unset, MonitorCreateRequestNotifyOn]`\n- `webhook_secret` — `Union[Unset, str]` — 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- `webhook_headers` — `Union[Unset, MonitorCreateRequestWebhookHeaders]` — Max 20 headers. Keys must match /^[A-Za-z0-9-]+$/ and not be reserved.\n- `options` — `Union[Unset, MonitorCreateRequestOptions]` — Screenshot monitor options (device, viewport, format, etc.).\n- `scrape_options` — `Union[Unset, MonitorCreateRequestScrapeOptions]` — Scrape monitor options (formats, country, wait_for_selector, wait_until, delay_ms). Only for type=scrape.\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[Error, MonitorCreateResponse]]\nsync(client=client, body=body) -> Optional[Union[Error, MonitorCreateResponse]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[Error, MonitorCreateResponse]]\nawait asyncio(client=client, body=body) -> Optional[Union[Error, MonitorCreateResponse]]\n```\n\n## Delete Monitor\n\nCancel monitor\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Any, Error]]\nsync(id=id, client=client) -> Optional[Union[Any, Error]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Any, Error]]\nawait asyncio(id=id, client=client) -> Optional[Union[Any, Error]]\n```\n\n## Get Monitor\n\nGet monitor\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, MonitorResponse]]\nsync(id=id, client=client) -> Optional[Union[Error, MonitorResponse]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, MonitorResponse]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, MonitorResponse]]\n```\n\n## List Monitor Captures\n\nList monitor captures\n\n**Parameters**\n\n- `id (str)`\n- `limit (Union[Unset, int])`\n- `cursor (Union[Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, limit=limit, cursor=cursor) -> Response[Union[Error, ListMonitorCapturesResponse200]]\nsync(id=id, client=client, limit=limit, cursor=cursor) -> Optional[Union[Error, ListMonitorCapturesResponse200]]\nawait asyncio_detailed(id=id, client=client, limit=limit, cursor=cursor) -> Response[Union[Error, ListMonitorCapturesResponse200]]\nawait asyncio(id=id, client=client, limit=limit, cursor=cursor) -> Optional[Union[Error, ListMonitorCapturesResponse200]]\n```\n\n## List Monitors\n\nList monitors\n\n**Parameters**\n\n- `limit (Union[Unset, int])`\n- `cursor (Union[Unset, str])`\n- `status (Union[Unset, ListMonitorsStatus])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, limit=limit, cursor=cursor, status=status) -> Response[Union[Error, ListMonitorsResponse200]]\nsync(client=client, limit=limit, cursor=cursor, status=status) -> Optional[Union[Error, ListMonitorsResponse200]]\nawait asyncio_detailed(client=client, limit=limit, cursor=cursor, status=status) -> Response[Union[Error, ListMonitorsResponse200]]\nawait asyncio(client=client, limit=limit, cursor=cursor, status=status) -> Optional[Union[Error, ListMonitorsResponse200]]\n```\n\n## Update Monitor\n\nUpdate monitor\n\n**Parameters**\n\n- `id (str)`\n- `body (MonitorUpdateRequest)`\n- `url` — `Union[Unset, str]`\n- `interval_type` — `Union[Unset, MonitorUpdateRequestIntervalType]`\n- `cron_expression` — `Union[Unset, str]`\n- `change_threshold` — `Union[Unset, float]`\n- `notify_on` — `Union[Unset, MonitorUpdateRequestNotifyOn]`\n- `webhook_url` — `Union[Unset, str]` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `webhook_secret` — `Union[Unset, str]` — 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- `webhook_headers` — `Union[Unset, MonitorUpdateRequestWebhookHeaders]`\n- `status` — `Union[Unset, MonitorUpdateRequestStatus]`\n- `options` — `Union[Unset, MonitorUpdateRequestOptions]`\n- `scrape_options` — `Union[Unset, MonitorUpdateRequestScrapeOptions]`\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, body=body) -> Response[Union[Error, MonitorResponse]]\nsync(id=id, client=client, body=body) -> Optional[Union[Error, MonitorResponse]]\nawait asyncio_detailed(id=id, client=client, body=body) -> Response[Union[Error, MonitorResponse]]\nawait asyncio(id=id, client=client, body=body) -> Optional[Union[Error, MonitorResponse]]\n```"
436
471
  },
437
472
  "sdk/python/scrape": {
438
473
  "title": "Scrape",
439
474
  "section": "SDK Reference",
440
- "body": "# Scrape\n\nFunctions for interacting with the `scrape` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Scrape\n\nScrape a URL\n\nFetches and processes a URL, returning content in one or more formats wrapped in a ScrapeEnvelope.\n\n**The response shape is decided by your request, not by how we route it.** In precedence order:\n\n1. `async: true` → **202** with a `ScrapeQueuedEnvelope` receipt, returned immediately. Poll `GET\n/v1/scrape/\\{id\\}` for the result.\n2. Otherwise, a request that needs a full page render — today that is `delay_ms > 0` — is **held\nopen** until the render reaches a terminal state, then returns **200** with the content envelope\n(`success` or `failed`). If the render is still running when the hold window expires (28 seconds by\ndefault), the request returns the **202** receipt instead and the job continues in the background.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content\nenvelope, typically in under a second.\n\n**A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or\na target whose bot protection defeats every proxy tier all come back on the same **200** as a\n`failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A\nfailure the fast path decides inline is recorded as a failed job, so its envelope normally carries\nthat job's `id` and `GET /v1/scrape/\\{id\\}` returns the same envelope; if recording the failed job\nitself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is\nnothing to poll. A failure a held render reaches carries that render's real `id`. Either way the\nrequest transfers no billable bytes and is charged nothing.\n\nSo a 202 means one of exactly two things: you asked for one with `async: true`, or the hold window\nexpired. `wait_for_selector` and `wait_until` are `ScreenshotRequest` options, not `ScrapeRequest`\noptions — sending either to this endpoint returns `422 validation_error`, so neither can produce a\n202 here.\n\n**Parameters**\n\n- `body (ScrapeRequest)`\n- `url` — `str`\n- `formats` — `Union[Unset, list[ScrapeRequestFormatsItem]]`\n- `country` — `Union[Unset, str]`\n- `delay_ms` — `Union[Unset, int]` — Milliseconds to wait after page load before capturing, for content that renders late. Any value above 0 puts the request on the full browser render path. Unless `async: true` is also set, the request is then HELD until the render finishes and returns 200 with the content envelope, or returns the 202 receipt if the hold window expires first. `0` (the default) keeps the request on the fast HTTP path, which returns 200 in one round trip.\n- `timeout_ms` — `Union[Unset, int]`\n- `async_` — `Union[Unset, bool]` — When true, the request returns 202 with a `ScrapeQueuedEnvelope` receipt immediately and the scrape runs in the background; poll `GET /v1/scrape/\\{id\\}` for the result. This is the only way to ASK for a receipt, and it outranks every routing consequence: with `async: false` (the default) a browser-path request is held to completion instead of being receipted. A 202 can still arrive with `async: false`, but only when the hold window expires.\n- `webhook_url` — `Union[Unset, str]` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `events` — `Union[Unset, list[ScrapeRequestEventsItem]]` — Webhook event types to deliver when webhook_url is set. Defaults to all three (queued, completed, failed); send an explicit subset to receive fewer.\n- `markdown_mode` — `Union[Unset, ScrapeRequestMarkdownMode]` — Markdown processing mode. article=article extraction (default), raw=minimal cleanup, llm=compact LLM-optimised output.\n- `markdown_query` — `Union[Unset, str]` — BM25 query string for relevance-ranked content filtering. Omit or leave empty to disable.\n- `markdown_links` — `Union[Unset, ScrapeRequestMarkdownLinks]` — Link rendering style in the markdown output. 'inline' (default) keeps `[text](url)` as-is. 'text' strips URLs, keeping only anchor text. 'none' strips URLs and removes reference definitions. 'references' converts to numbered `[text][N]` refs with a Links footer.\n- `markdown_images` — `Union[Unset, ScrapeRequestMarkdownImages]` — Image retention mode in the markdown output. 'inline' (default) keeps `![alt](url)` as-is. 'text' strips the URL, keeping only alt text. 'none' removes images entirely. 'references' converts to numbered `![alt][N]` refs with an Images footer. Distinct from markdown_filter_images (which drops low-signal images before conversion).\n- `with_links_summary` — `Union[Unset, bool]` — When true, appends a 'Links:\\n[1]: url\\n...' footer to the markdown output, built from the extracted link list. Automatically enabled when markdown_links is 'references'.\n- `with_images_summary` — `Union[Unset, bool]` — When true, appends an 'Images:\\n[1]: url\\n...' footer to the markdown output, built from the extracted image list.\n- `markdown_compact` — `Union[Unset, bool]` — Collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — `Union[Unset, bool]` — Filter low-signal images from the markdown output.\n- `markdown_include_media` — `Union[Unset, bool]` — When true, `formats.links` and `formats.images` return `ScrapeScoredLink[]` / `ScrapeScoredImage[]` (rich objects) instead of `string[]`, and a top-level `tables` array is included. Only effective when `markdown` is in `formats`.\n- `markdown_include_warnings` — `Union[Unset, bool]` — When true, enables markdown-pipeline and tag-filter warnings for requests that include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may appear independently of this flag.\n- `markdown_include_stats` — `Union[Unset, bool]` — When true, the response includes a top-level `stats` object with `ScrapeStats` (chars, tokens, blocks). Only effective when `markdown` is in `formats`.\n- `token_budget` — `Union[Unset, int]` — Maximum token count for the markdown output. When set and `markdown` is in `formats`, the output is truncated at the last paragraph → sentence → token boundary that keeps the estimated count under this limit. Absent → no truncation. Triggers a `markdown_tokens` field in the response.\n- `token_encoding` — `Union[Unset, ScrapeRequestTokenEncoding]` — Tokenizer encoding hint for `token_budget`. `cl100k_base` (default) matches GPT-4/4o; `o200k_base` matches GPT-4o-mini / o-series. Both use the same 4-char/token heuristic internally.\n- `mobile` — `Union[Unset, bool]` — When true, emulate a mobile device — the request uses a mobile (Android) user agent and a mobile viewport, so the upstream serves the mobile version of the page. Default false (desktop). The value is part of the cache key, so mobile and desktop responses are cached independently.\n- `solve_challenge` — `Union[Unset, bool]` — Attempts to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render.\n- `remove_base64_images` — `Union[Unset, bool]` — When true (default), base64-encoded `data:` image sources are stripped from the HTML before markdown conversion. Set to false to preserve base64 images in the pipeline output. Does not affect `raw`, which always returns the original source unchanged.\n- `include_tags` — `Union[Unset, list[str]]` — HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in the `markdown` output. Applied before `exclude_tags`. Does not affect `raw`, which always returns the full page.\n- `exclude_tags` — `Union[Unset, list[str]]` — HTML element names (not CSS selectors) to strip from the `markdown` output. Applied after `include_tags` when both are present. Does not affect `raw`, which always returns the full page.\n- `cache_ttl` — `Union[ScrapeRequestCacheTtlType1, Unset, str]` — How long a freshly fetched URL may be served from cache. `0` (string or integer) skips the cache read; cache-eligible results are still written. `Nh`/`Nd` set a TTL (capped at 168 h / 7 d). Safety-classified WAF husks are returned live but never stored in the shared cache. Honoured on both the synchronous and asynchronous paths; the async success envelope reports the lookup outcome via the `cache` field.\n- `custom` — `Union[Unset, ScrapeRequestCustom]` — User-supplied JSON payload, echoed back on the success envelope (sync, async, webhook). Capped at 4096 UTF-8 bytes (`Buffer.byteLength`). Distinct from the system-owned `metadata` column. Does NOT affect cache-key inputs — two requests differing only in `custom` resolve to the same cache entry.\n- `clean_markdown` — `Union[Unset, bool]` — When `true` and `markdown` is in `formats`, the converted markdown is sent to Groq LLM for cleaning (boilerplate removal, ad stripping, formatting improvement) before being returned. Graceful degradation: any Groq failure (key unset, 4xx/5xx, timeout, empty response) returns the raw markdown unchanged plus a warning in the `warnings` array. Billing: 3× credits and bytes applied only when cleaning succeeds.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\nsync(client=client, body=body) -> Optional[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio(client=client, body=body) -> Optional[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\n```\n\n## Get Scrape\n\nGet scrape result\n\nAlways returns 200. Check the `status` discriminator for the scrape state.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\nsync(id=id, client=client) -> Optional[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\n```"
475
+ "body": "# Scrape\n\nFunctions for interacting with the `scrape` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Scrape\n\nScrape 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\none never cancels `true` in the other) → **202** with a `ScrapeQueuedEnvelope` receipt, returned\nimmediately. Poll `GET /v1/scrape/\\{id\\}` for the result.\n2. Otherwise, a request that needs a full page render — today that is `delay_ms > 0` — is **held\nopen** until the render reaches a terminal state, then returns **200** with the content envelope\n(`success` or `failed`). If the render is still running when the hold window expires (28 seconds by\ndefault), the request returns the **202** receipt instead and the job continues in the background.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content\nenvelope, typically in under a second.\n\n**A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or\na target whose bot protection defeats every proxy tier all come back on the same **200** as a\n`failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A\nfailure the fast path decides inline is recorded as a failed job, so its envelope normally carries\nthat job's `id` and `GET /v1/scrape/\\{id\\}` returns the same envelope; if recording the failed job\nitself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is\nnothing to poll. A failure a held render reaches carries that render's real `id`. Either way the\nrequest 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\n`error.code` is `target_rate_limited` when the target rate-limits the request. On the fast path that\nmeans our proxy attempts end on an HTTP 429 and no bot protection is identified on any attempt, even\nif the browser fallback then fails or reaches only an unidentified block page; the inline failure\ncarries `error.retry_after_seconds` when the target sent a usable `Retry-After`. On a held render\nthe browser's own answer decides: it observes a 429 on the page itself, or it fails outright after\nthe proxy attempts ended on an HTTP 429. A bot-protection verdict on an earlier fetch attempt does\nnot keep a held render `blocked` when the browser then observes the 429. A held render never carries\n`error.retry_after_seconds`. Retrying a `target_rate_limited` failure later is likely to work. A\nheld render whose browser reaches an unidentified 403 or 503 page after a proxy 429 is `blocked`. A\n429 that bot protection sends as a block stays `blocked` when it is the answer that decides the\ncode: the fast path's proxy attempts, or the browser render on a held render. Your own per-key limit\nis a separate case: it answers HTTP 429 `rate_limited` with a `Retry-After` header (see the `429`\nresponse).\n\nSo a 202 means one of exactly two things: you asked for one with `async: true` or `?async=true`, or\nthe hold window expired. `wait_for_selector` and `wait_until` are `ScreenshotRequest` options, not\n`ScrapeRequest` options — sending either to this endpoint returns `422 validation_error`, so neither\ncan produce a 202 here.\n\n**Parameters**\n\n- `async_ (Union[Unset, bool])`\n- `body (ScrapeRequest)`\n- `url` — `str`\n- `formats` — `Union[Unset, list[Union['ScrapeRequestJsonFormat', ScrapeRequestFormatsItem]]]` — What to return. Each entry is either a string format (`raw`, `markdown`, `links` or `images`) or a `json` object entry that extracts structured data from the page. The string `\"json\"` is not a format value; the `json` entry is an object, described by `ScrapeRequestJsonFormat`. A list may hold at most one `json` entry, and a list holding only the `json` entry still captures `raw`. The `json` entry exists on `POST /v1/scrape` only: the bulk and monitor `formats` fields accept the string formats alone. Its result is `formats.json` on the response, and its price is described on `ScrapeRequestJsonFormat`.\n- `country` — `Union[Unset, str]`\n- `delay_ms` — `Union[Unset, int]` — Milliseconds to wait after page load before capturing, for content that renders late. Any value above 0 puts the request on the full browser render path. Unless `async: true` is also set, the request is then HELD until the render finishes and returns 200 with the content envelope, or returns the 202 receipt if the hold window expires first. `0` (the default) keeps the request on the fast HTTP path, which returns 200 in one round trip.\n- `timeout_ms` — `Union[Unset, int]`\n- `async_` — `Union[Unset, bool]` — When true, the request returns 202 with a `ScrapeQueuedEnvelope` receipt immediately and the scrape runs in the background; poll `GET /v1/scrape/\\{id\\}` for the result. The `?async=true` query parameter is a second spelling of this field: the request is async when either one says true, and `false` in one never cancels `true` in the other. Asking for a receipt this way outranks every routing consequence: when neither is set (the default) a browser-path request is held to completion instead of being receipted. A 202 can still arrive without either, but only when the hold window expires.\n- `webhook_url` — `Union[Unset, str]` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `events` — `Union[Unset, list[ScrapeRequestEventsItem]]` — Webhook event types to deliver when webhook_url is set. Defaults to all three (queued, completed, failed); send an explicit subset to receive fewer.\n- `markdown_mode` — `Union[Unset, ScrapeRequestMarkdownMode]` — Markdown processing mode. article=article extraction (default), raw=minimal cleanup, llm=compact LLM-optimised output.\n- `markdown_query` — `Union[Unset, str]` — BM25 query string for relevance-ranked content filtering. Omit or leave empty to disable.\n- `markdown_links` — `Union[Unset, ScrapeRequestMarkdownLinks]` — Link rendering style in the markdown output. 'inline' (default) keeps `[text](url)` as-is. 'text' strips URLs, keeping only anchor text. 'none' strips URLs and removes reference definitions. 'references' converts to numbered `[text][N]` refs with a Links footer.\n- `markdown_images` — `Union[Unset, ScrapeRequestMarkdownImages]` — Image retention mode in the markdown output. 'inline' (default) keeps `![alt](url)` as-is. 'text' strips the URL, keeping only alt text. 'none' removes images entirely. 'references' converts to numbered `![alt][N]` refs with an Images footer. Distinct from markdown_filter_images (which drops low-signal images before conversion).\n- `with_links_summary` — `Union[Unset, bool]` — When true, appends a 'Links:\\n[1]: url\\n...' footer to the markdown output, built from the extracted link list. Automatically enabled when markdown_links is 'references'.\n- `with_images_summary` — `Union[Unset, bool]` — When true, appends an 'Images:\\n[1]: url\\n...' footer to the markdown output, built from the extracted image list.\n- `markdown_compact` — `Union[Unset, bool]` — Collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — `Union[Unset, bool]` — Filter low-signal images from the markdown output.\n- `markdown_include_media` — `Union[Unset, bool]` — When true, `formats.links` and `formats.images` return `ScrapeScoredLink[]` / `ScrapeScoredImage[]` (rich objects) instead of `string[]`, and a top-level `tables` array is included. Only effective when `markdown` is in `formats`.\n- `markdown_include_warnings` — `Union[Unset, bool]` — When true, enables markdown-pipeline and tag-filter warnings for requests that include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may appear independently of this flag.\n- `markdown_include_stats` — `Union[Unset, bool]` — When true, the response includes a top-level `stats` object with `ScrapeStats` (chars, tokens, blocks). Only effective when `markdown` is in `formats`.\n- `token_budget` — `Union[Unset, int]` — Maximum token count for the markdown output. When set and `markdown` is in `formats`, the output is truncated at the last paragraph → sentence → token boundary that keeps the estimated count under this limit. Absent → no truncation. Triggers a `markdown_tokens` field in the response.\n- `token_encoding` — `Union[Unset, ScrapeRequestTokenEncoding]` — Tokenizer encoding hint for `token_budget`. `cl100k_base` (default) matches GPT-4/4o; `o200k_base` matches GPT-4o-mini / o-series. Both use the same 4-char/token heuristic internally.\n- `mobile` — `Union[Unset, bool]` — When true, emulate a mobile device — the request uses a mobile (Android) user agent and a mobile viewport, so the upstream serves the mobile version of the page. Default false (desktop). The value is part of the cache key, so mobile and desktop responses are cached independently.\n- `solve_challenge` — `Union[Unset, bool]` — Attempts to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render.\n- `remove_base64_images` — `Union[Unset, bool]` — When true (default), base64-encoded `data:` image sources are stripped from the HTML before markdown conversion. Set to false to preserve base64 images in the pipeline output. Does not affect `raw`, which always returns the original source unchanged.\n- `include_tags` — `Union[Unset, list[str]]` — HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in the `markdown` output. Applied before `exclude_tags`. Does not affect `raw`, which always returns the full page.\n- `exclude_tags` — `Union[Unset, list[str]]` — HTML element names (not CSS selectors) to strip from the `markdown` output. Applied after `include_tags` when both are present. Does not affect `raw`, which always returns the full page.\n- `cache_ttl` — `Union[ScrapeRequestCacheTtlType1, Unset, str]` — How long a freshly fetched URL may be served from cache. `0` (string or integer) skips the cache read; cache-eligible results are still written. `Nh`/`Nd` set a TTL (capped at 168 h / 7 d). Safety-classified WAF husks are returned live but never stored in the shared cache. Honoured on both the synchronous and asynchronous paths; the async success envelope reports the lookup outcome via the `cache` field.\n- `custom` — `Union[Unset, ScrapeRequestCustom]` — User-supplied JSON payload, echoed back on the success envelope (sync, async, webhook). Capped at 4096 UTF-8 bytes (`Buffer.byteLength`). Distinct from the system-owned `metadata` column. Does NOT affect cache-key inputs — two requests differing only in `custom` resolve to the same cache entry.\n- `clean_markdown` — `Union[Unset, bool]` — When `true` and `markdown` is in `formats`, the converted markdown is sent to Groq LLM for cleaning (boilerplate removal, ad stripping, formatting improvement) before being returned. Graceful degradation: any Groq failure (key unset, 4xx/5xx, timeout, empty response) returns the raw markdown unchanged plus a warning in the `warnings` array. Billing: 3× credits and bytes applied only when cleaning succeeds.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\nsync(client=client, body=body, async_=async_) -> Optional[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio(client=client, body=body, async_=async_) -> Optional[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\n```\n\n## Get Scrape\n\nGet scrape result\n\nAlways returns 200. Check the `status` discriminator for the scrape state.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\nsync(id=id, client=client) -> Optional[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\n```"
441
476
  },
442
477
  "sdk/python/scrape-bulk": {
443
478
  "title": "Scrape Bulk",
444
479
  "section": "SDK Reference",
445
- "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**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` — `Union[Unset, list[str]]` — Simple URL list. Provide urls OR items, not both.\n- `items` — `Union[Unset, list['CreateScrapeBulkBodyItemsItem']]` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `Union[Unset, CreateScrapeBulkBodyDefaults]`\n- `webhook_secret` — `Union[Unset, str]` — 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` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n- `custom` — `Union[Unset, CreateScrapeBulkBodyCustom]` — 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[Union[CreateScrapeBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateScrapeBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateScrapeBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateScrapeBulkResponse202, Error]]\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**Parameters**\n\n- `id (str)`\n- `cursor (Union[Unset, str])`\n- `limit (Union[Unset, int])`\n- `status (Union[Unset, GetScrapeBulkStatus])`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\n```"
480
+ "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` — `Union[Unset, list[str]]` — Simple URL list. Provide urls OR items, not both.\n- `items` — `Union[Unset, list['CreateScrapeBulkBodyItemsItem']]` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `Union[Unset, CreateScrapeBulkBodyDefaults]`\n- `webhook_secret` — `Union[Unset, str]` — 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` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n- `custom` — `Union[Unset, CreateScrapeBulkBodyCustom]` — 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[Union[CreateScrapeBulkResponse202, CreateScrapeBulkResponse403, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateScrapeBulkResponse202, CreateScrapeBulkResponse403, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateScrapeBulkResponse202, CreateScrapeBulkResponse403, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateScrapeBulkResponse202, CreateScrapeBulkResponse403, Error]]\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 (Union[Unset, str])`\n- `limit (Union[Unset, int])`\n- `status (Union[Unset, GetScrapeBulkStatus])`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\n```"
446
481
  },
447
482
  "sdk/python/screenshots": {
448
483
  "title": "Screenshots",
449
484
  "section": "SDK Reference",
450
- "body": "# Screenshots\n\nFunctions for interacting with the `screenshots` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Screenshot\n\nCapture a screenshot\n\nSync by default (holds up to 28s). Pass `?async=true` to return 202 immediately.\nPoll via GET /v1/screenshots/\\{id\\}.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `async_ (Union[Unset, bool])`\n- `body (ScreenshotRequest)`\n- `url` — `str`\n- `device` — `Union[Unset, ScreenshotRequestDevice]`\n- `viewport` — `Union['Viewport', None, Unset]`\n- `full_page` — `Union[Unset, bool]`\n- `format_` — `Union[Unset, ScreenshotRequestFormat]`\n- `quality` — `Union[Unset, int]`\n- `block_ads` — `Union[Unset, bool]`\n- `block_cookie_banners` — `Union[Unset, bool]`\n- `wait_until` — `Union[Unset, ScreenshotRequestWaitUntil]`\n- `wait_for_selector` — `Union[None, Unset, str]`\n- `delay_ms` — `Union[Unset, int]`\n- `scroll` — `Union[Unset, bool]`\n- `clip` — `Union['Clip', None, Unset]`\n- `dark_mode` — `Union[Unset, bool]`\n- `device_scale_factor` — `Union[None, ScreenshotRequestDeviceScaleFactorType1, ScreenshotRequestDeviceScaleFactorType2Type1, ScreenshotRequestDeviceScaleFactorType3Type1, Unset]`\n- `include_html` — `Union[Unset, bool]`\n- `country` — `Union[Unset, str]`\n- `language` — `Union[None, Unset, str]`\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nsync(client=client, body=body, async_=async_) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio(client=client, body=body, async_=async_) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\n```\n\n## Get Screenshot\n\nGet screenshot status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nsync(id=id, client=client) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\n```"
485
+ "body": "# Screenshots\n\nFunctions for interacting with the `screenshots` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Screenshot\n\nCapture 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**Parameters**\n\n- `async_ (Union[Unset, bool])`\n- `body (ScreenshotRequest)`\n- `url` — `str`\n- `device` — `Union[Unset, ScreenshotRequestDevice]`\n- `viewport` — `Union['Viewport', None, Unset]`\n- `async_` — `Union[Unset, bool]` — When true, the request returns 202 immediately and the screenshot is captured in the background; poll `GET /v1/screenshots/\\{id\\}`. The `?async=true` query parameter is a second spelling of this field: the request is async when either one says true, and `false` in one never cancels `true` in the other.\n- `full_page` — `Union[Unset, bool]`\n- `format_` — `Union[Unset, ScreenshotRequestFormat]`\n- `quality` — `Union[Unset, int]`\n- `block_ads` — `Union[Unset, bool]`\n- `block_cookie_banners` — `Union[Unset, bool]`\n- `wait_until` — `Union[Unset, ScreenshotRequestWaitUntil]`\n- `wait_for_selector` — `Union[None, Unset, str]`\n- `delay_ms` — `Union[Unset, int]`\n- `scroll` — `Union[Unset, bool]`\n- `clip` — `Union['Clip', None, Unset]`\n- `dark_mode` — `Union[Unset, bool]`\n- `device_scale_factor` — `Union[None, ScreenshotRequestDeviceScaleFactorType1, ScreenshotRequestDeviceScaleFactorType2Type1, ScreenshotRequestDeviceScaleFactorType3Type1, Unset]`\n- `include_html` — `Union[Unset, bool]`\n- `country` — `Union[Unset, str]`\n- `language` — `Union[None, Unset, str]`\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nsync(client=client, body=body, async_=async_) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio(client=client, body=body, async_=async_) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\n```\n\n## Get Screenshot\n\nGet screenshot status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nsync(id=id, client=client) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\n```"
451
486
  },
452
487
  "sdk/python/search": {
453
488
  "title": "Search",
454
489
  "section": "SDK Reference",
455
- "body": "# Search\n\nFunctions for interacting with the `search` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Search\n\nSearch the web\n\nRuns a web search for `query` and returns ranked organic results with\ncontiguous `position` values from 1.\n\nUse `limit` (1–100, default 10) to request more results in a single\ncall. Results are fetched in pages of 10, so a call consumes\n`ceil(limit / 10)` credits (capped at 10) from the account's monthly\ncredits bucket — for example `limit=10` costs 1 credit and `limit=35`\ncosts 4. Credits are charged for every page fetched regardless of how\nmany results a page returns. The credit count is reported as\n`credits_used` in the response.\n\n**Parameters**\n\n- `body (CreateSearchBody)`\n- `query` — `str` — The search query.\n- `type_` — `Union[Unset, CreateSearchBodyType]` — Which search index to query. `web` (default) returns ranked organic results; `news` returns news articles in the same `results` array, additionally populating `source` and `image` on each item; `images` returns image results, populating `source`, `domain`, and a fuller `image` object (full- image dimensions plus a thumbnail URL and dimensions) while omitting `snippet` and `date`. Billing is identical for all three.\n- `limit` — `Union[Unset, int]` — Maximum number of organic results to return. Results are fetched in pages of 10, so the call costs `ceil(limit / 10)` credits (capped at 10).\n- `country` — `Union[Unset, str]` — Two-letter country code to localize results (e.g. `us`, `de`), normalized to lowercase. Defaults to `us`.\n- `language` — `Union[Unset, str]` — Two-letter ISO-639-1 language code for results (e.g. `en`, `fr`), normalized to lowercase. Defaults to `en`.\n- `date_range` — `Union[Unset, CreateSearchBodyDateRange]` — Restrict results to a recency window: `any` (default, no time filter), `hour` (past hour), `day` (past 24 hours), `week` (past week), `month` (past month), or `year` (past year). Applies identically to every `type`; billing is unchanged.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateSearchResponse200, CreateSearchResponse503, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateSearchResponse200, CreateSearchResponse503, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateSearchResponse200, CreateSearchResponse503, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateSearchResponse200, CreateSearchResponse503, Error]]\n```"
490
+ "body": "# Search\n\nFunctions for interacting with the `search` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Search\n\nSearch the web\n\nRuns a web search for `query` and returns ranked organic results with\ncontiguous `position` values from 1.\n\nUse `limit` (1–100, default 10) to request more results in a single\ncall. Results are fetched in pages of 10, so a call consumes\n`ceil(limit / 10)` credits (capped at 10) from the account's monthly\ncredits bucket — for example `limit=10` costs 1 credit and `limit=35`\ncosts 4. Credits are charged for every page fetched regardless of how\nmany results a page returns. The credit count is reported as\n`credits_used` in the response.\n\n**Parameters**\n\n- `body (CreateSearchBody)`\n- `query` — `str` — The search query, up to 2048 characters.\n- `type_` — `Union[Unset, CreateSearchBodyType]` — Which search index to query. `web` (default) returns ranked organic results; `news` returns news articles in the same `results` array, additionally populating `source` and `image` on each item; `images` returns image results, populating `source`, `domain`, and a fuller `image` object (full- image dimensions plus a thumbnail URL and dimensions) while omitting `snippet` and `date`. Billing is identical for all three.\n- `limit` — `Union[Unset, int]` — Maximum number of organic results to return. Results are fetched in pages of 10, so the call costs `ceil(limit / 10)` credits (capped at 10).\n- `country` — `Union[Unset, str]` — Two-letter country code to localize results (e.g. `us`, `de`), normalized to lowercase. Defaults to `us`.\n- `language` — `Union[Unset, str]` — Two-letter ISO-639-1 language code for results (e.g. `en`, `fr`), normalized to lowercase. Defaults to `en`.\n- `date_range` — `Union[Unset, CreateSearchBodyDateRange]` — Restrict results to a recency window: `any` (default, no time filter), `hour` (past hour), `day` (past 24 hours), `week` (past week), `month` (past month), or `year` (past year). Applies identically to every `type`; billing is unchanged.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateSearchResponse200, Error, Union['CreateSearchResponse503', 'Error']]]\nsync(client=client, body=body) -> Optional[Union[CreateSearchResponse200, Error, Union['CreateSearchResponse503', 'Error']]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateSearchResponse200, Error, Union['CreateSearchResponse503', 'Error']]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateSearchResponse200, Error, Union['CreateSearchResponse503', 'Error']]]\n```"
456
491
  },
457
492
  "sdk/python/sitemap": {
458
493
  "title": "Sitemap",
459
494
  "section": "SDK Reference",
460
- "body": "# Sitemap\n\nFunctions for interacting with the `sitemap` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Sitemap\n\nDiscover URLs on a domain\n\nCrawls a domain to build a sitemap. Returns cached results if available\nwithin cache_ttl. Results delivered via webhook and downloadable from results_url.\nWebhook deliveries include `X-ByteKit-Event: sitemap.completed` or\n`X-ByteKit-Event: sitemap.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (SitemapRequest)`\n- `url` — `str`\n- `strategy` — `Union[Unset, SitemapRequestStrategy]`\n- `max_depth` — `Union[Unset, int]`\n- `max_urls` — `Union[Unset, int]`\n- `process` — `Union['SitemapRequestProcessType0', None, Unset]`\n- `webhook_url` — `Union[Unset, str]` — Optional webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported). When omitted, no `sitemap.completed`/`sitemap.failed` webhook is delivered and the job is poll-only via `GET /v1/sitemap/\\{id\\}`. When present, delivery is unchanged. `webhook_secret` is ignored when `webhook_url` is absent.\n- `webhook_secret` — `Union[None, Unset, str]` — 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- `cache_ttl` — `Union[Unset, str]` — Max 90 days.\n- `compact` — `Union[Unset, bool]`\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[Error, SitemapResponse]]\nsync(client=client, body=body) -> Optional[Union[Error, SitemapResponse]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[Error, SitemapResponse]]\nawait asyncio(client=client, body=body) -> Optional[Union[Error, SitemapResponse]]\n```\n\n## Get Sitemap\n\nGet sitemap job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, SitemapResponse]]\nsync(id=id, client=client) -> Optional[Union[Error, SitemapResponse]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, SitemapResponse]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, SitemapResponse]]\n```"
495
+ "body": "# Sitemap\n\nFunctions for interacting with the `sitemap` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Sitemap\n\nDiscover 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**Parameters**\n\n- `body (SitemapRequest)`\n- `url` — `str` — The site to discover. Sitemap discovery is host-scoped (`robots.txt` and `/sitemap.xml` live at the host root), so 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. A bare host, or a host with just a trailing `/`, produces no warning.\n- `strategy` — `Union[Unset, SitemapRequestStrategy]` — How much discovery work the job does. - `quick` — reads `robots.txt` and the XML sitemaps only. Every result has `source: sitemap`. - `standard` — the `quick` sources, then fills any remaining `max_urls` budget with URLs from your account's completed scrapes of the host in the last 90 days (`source: known`). - `deep` — the `standard` sources, then crawls page links outward from the URLs found so far, up to `max_depth` levels, until `max_urls` is reached (`source: links`).\n- `max_depth` — `Union[Unset, int]`\n- `max_urls` — `Union[Unset, int]`\n- `process` — `Union['SitemapRequestProcessType0', None, Unset]` — Accepted, stored and echoed back on the job, but it has no effect: the worker logs that the trigger is not implemented and ignores it.\n- `webhook_url` — `Union[Unset, str]` — Optional webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported). When omitted, no `sitemap.completed`/`sitemap.failed` webhook is delivered and the job is poll-only via `GET /v1/sitemap/\\{id\\}`. When present, delivery is unchanged. `webhook_secret` is ignored when `webhook_url` is absent.\n- `webhook_secret` — `Union[None, Unset, str]` — 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- `cache_ttl` — `Union[Unset, str]` — Max 90 days.\n- `compact` — `Union[Unset, bool]`\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[Error, SitemapResponse]]\nsync(client=client, body=body) -> Optional[Union[Error, SitemapResponse]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[Error, SitemapResponse]]\nawait asyncio(client=client, body=body) -> Optional[Union[Error, SitemapResponse]]\n```\n\n## Get Sitemap\n\nGet sitemap job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, SitemapResponse]]\nsync(id=id, client=client) -> Optional[Union[Error, SitemapResponse]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, SitemapResponse]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, SitemapResponse]]\n```"
461
496
  },
462
497
  "sdk/python/usage": {
463
498
  "title": "Usage",
464
499
  "section": "SDK Reference",
465
- "body": "# Usage\n\nFunctions for interacting with the `usage` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Usage\n\nGet current billing period usage\n\n**Call styles**\n\n```python\nsync_detailed(client=client) -> Response[GetUsageResponse200]\nsync(client=client) -> Optional[GetUsageResponse200]\nawait asyncio_detailed(client=client) -> Response[GetUsageResponse200]\nawait asyncio(client=client) -> Optional[GetUsageResponse200]\n```\n\n## Get Usage By Endpoint\n\nGet per-endpoint bandwidth breakdown\n\nReturns bandwidth usage broken down by endpoint (screenshots, recordings, scrape, scrape_md, fetch,\nfetch_md, crawl, crawl_links, sitemap, monitors) for a date range. Each row carries raw bytes, the\nbilling multiplier, and billable bytes. Endpoints with zero raw bytes for the range are omitted from\n`rows`; `totals` is always present. Default range is the last 30 days; max 366 days.\n\n**Parameters**\n\n- `from_ (Union[Unset, datetime.date])`\n- `to (Union[Unset, datetime.date])`\n- `api_key (Union[Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[GetUsageByEndpointResponse200]\nsync(client=client, from_=from_, to=to, api_key=api_key) -> Optional[GetUsageByEndpointResponse200]\nawait asyncio_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[GetUsageByEndpointResponse200]\nawait asyncio(client=client, from_=from_, to=to, api_key=api_key) -> Optional[GetUsageByEndpointResponse200]\n```\n\n## Get Usage Daily\n\nGet daily usage breakdown\n\nDefault range is last 30 days. Max range is 366 days.\n\n**Parameters**\n\n- `from_ (Union[Unset, datetime.date])`\n- `to (Union[Unset, datetime.date])`\n- `api_key (Union[Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[GetUsageDailyResponse200]\nsync(client=client, from_=from_, to=to, api_key=api_key) -> Optional[GetUsageDailyResponse200]\nawait asyncio_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[GetUsageDailyResponse200]\nawait asyncio(client=client, from_=from_, to=to, api_key=api_key) -> Optional[GetUsageDailyResponse200]\n```"
500
+ "body": "# Usage\n\nFunctions for interacting with the `usage` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Usage\n\nGet current billing period usage\n\n**Call styles**\n\n```python\nsync_detailed(client=client) -> Response[Union[Error, GetUsageResponse200]]\nsync(client=client) -> Optional[Union[Error, GetUsageResponse200]]\nawait asyncio_detailed(client=client) -> Response[Union[Error, GetUsageResponse200]]\nawait asyncio(client=client) -> Optional[Union[Error, GetUsageResponse200]]\n```\n\n## Get Usage By Endpoint\n\nGet per-endpoint bandwidth breakdown\n\nReturns bandwidth usage broken down by endpoint (screenshots, recordings, scrape, scrape_md, fetch,\nfetch_md, crawl, crawl_links, sitemap, monitors) for a date range. Each row carries raw bytes, the\nbilling multiplier, and billable bytes. Endpoints with zero raw bytes for the range are omitted from\n`rows`; `totals` is always present. Default range is the last 30 days; max 366 days.\n\n**Parameters**\n\n- `from_ (Union[Unset, datetime.date])`\n- `to (Union[Unset, datetime.date])`\n- `api_key (Union[Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Union[Error, GetUsageByEndpointResponse200]]\nsync(client=client, from_=from_, to=to, api_key=api_key) -> Optional[Union[Error, GetUsageByEndpointResponse200]]\nawait asyncio_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Union[Error, GetUsageByEndpointResponse200]]\nawait asyncio(client=client, from_=from_, to=to, api_key=api_key) -> Optional[Union[Error, GetUsageByEndpointResponse200]]\n```\n\n## Get Usage Daily\n\nGet daily usage breakdown\n\nDefault range is last 30 days. Max range is 366 days.\n\n**Parameters**\n\n- `from_ (Union[Unset, datetime.date])`\n- `to (Union[Unset, datetime.date])`\n- `api_key (Union[Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Union[Error, GetUsageDailyResponse200]]\nsync(client=client, from_=from_, to=to, api_key=api_key) -> Optional[Union[Error, GetUsageDailyResponse200]]\nawait asyncio_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Union[Error, GetUsageDailyResponse200]]\nawait asyncio(client=client, from_=from_, to=to, api_key=api_key) -> Optional[Union[Error, GetUsageDailyResponse200]]\n```"
466
501
  },
467
502
  "sdk/python/webhooks": {
468
503
  "title": "Webhooks",
469
504
  "section": "SDK Reference",
470
- "body": "# Webhooks\n\nFunctions for interacting with the `webhooks` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## List Webhook Deliveries\n\nList webhook deliveries\n\n**Parameters**\n\n- `limit (Union[Unset, int])`\n- `cursor (Union[Unset, str])`\n- `status (Union[Unset, ListWebhookDeliveriesStatus])`\n- `since (Union[Unset, datetime.datetime])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Response[ListWebhookDeliveriesResponse200]\nsync(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Optional[ListWebhookDeliveriesResponse200]\nawait asyncio_detailed(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Response[ListWebhookDeliveriesResponse200]\nawait asyncio(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Optional[ListWebhookDeliveriesResponse200]\n```\n\n## Retry Webhook Delivery\n\nRetry a webhook delivery\n\nRequeues a failed or exhausted webhook delivery for another attempt.\n\n**Limits:** this endpoint takes no request body; any body sent is\ncapped at 64 KB. An oversized body returns a `400` with error code\n`request_too_large`.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, WebhookDeliveryResponse]]\nsync(id=id, client=client) -> Optional[Union[Error, WebhookDeliveryResponse]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, WebhookDeliveryResponse]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, WebhookDeliveryResponse]]\n```"
505
+ "body": "# Webhooks\n\nFunctions for interacting with the `webhooks` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## List Webhook Deliveries\n\nList webhook deliveries\n\n**Parameters**\n\n- `limit (Union[Unset, int])`\n- `cursor (Union[Unset, str])`\n- `status (Union[Unset, ListWebhookDeliveriesStatus])`\n- `since (Union[Unset, datetime.datetime])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Response[Union[Error, ListWebhookDeliveriesResponse200]]\nsync(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Optional[Union[Error, ListWebhookDeliveriesResponse200]]\nawait asyncio_detailed(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Response[Union[Error, ListWebhookDeliveriesResponse200]]\nawait asyncio(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Optional[Union[Error, ListWebhookDeliveriesResponse200]]\n```\n\n## Retry Webhook Delivery\n\nRetry a webhook delivery\n\nRequeues a failed or exhausted webhook delivery for another attempt.\n\n**Limits:** this endpoint takes no request body; any body sent is\ncapped at 64 KB. An oversized body returns a `400` with error code\n`request_too_large`.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, WebhookDeliveryResponse]]\nsync(id=id, client=client) -> Optional[Union[Error, WebhookDeliveryResponse]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, WebhookDeliveryResponse]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, WebhookDeliveryResponse]]\n```"
471
506
  },
472
507
  "sdk/typescript/account": {
473
508
  "title": "Account",
@@ -477,17 +512,17 @@
477
512
  "sdk/typescript/bulk": {
478
513
  "title": "Bulk",
479
514
  "section": "SDK Reference",
480
- "body": "# Bulk\n\nFan out many URLs in parallel with per-item webhooks. Accessed via `client.bulk`.\n\n## create\n\n```ts\nclient.bulk.create(opts: BulkCreateRequest, requestOptions?: RequestOptions): Promise<BulkCreateResponse>\n```\n\nPOST /v1/bulk — create a bulk screenshots job.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`; both override the constructor's `timeoutMs` default.\n\n## get\n\n```ts\nclient.bulk.get(id: BulkId, requestOptions?: RequestOptions): Promise<BulkGetResponse>\n```\n\nGET /v1/bulk/\\{id\\} — get a bulk job status\n\n## cancel\n\n```ts\nclient.bulk.cancel(id: BulkId, requestOptions?: RequestOptions): Promise<BulkCancelResponse>\n```\n\nDELETE /v1/bulk/\\{id\\} — cancel an in-flight bulk job\n\n## screenshots\n\n### list\n\n```ts\nclient.bulk.screenshots.list(id: BulkId, requestOptions?: RequestOptions): Promise<ListBulkScreenshotsResponse>\n```\n\nGET /v1/bulk/\\{id\\}/screenshots — list items in a mixed bulk job\n\n### list\n\n```ts\nclient.bulk.screenshots.list(id: BulkId, pageParams: BulkPageParams, requestOptions?: RequestOptions): Promise<ListBulkScreenshotsResponse>\n```\n\n### list\n\n```ts\nclient.bulk.screenshots.list(id: BulkId, pageParamsOrRequestOptions: BulkPageParams | RequestOptions = {}, requestOptions?: RequestOptions): Promise<ListBulkScreenshotsResponse>\n```"
515
+ "body": "# Bulk\n\nFan out many URLs in parallel and get one webhook when the job completes. Accessed via `client.bulk`.\n\n## create\n\n```ts\nclient.bulk.create(opts: BulkCreateRequest, requestOptions?: RequestOptions): Promise<BulkCreateResponse>\n```\n\nPOST /v1/bulk — create a bulk screenshots job.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`; both override the constructor's `timeoutMs` default.\n\n## get\n\n```ts\nclient.bulk.get(id: BulkId, requestOptions?: RequestOptions): Promise<BulkGetResponse>\n```\n\nGET /v1/bulk/\\{id\\} — get a bulk job status\n\n## cancel\n\n```ts\nclient.bulk.cancel(id: BulkId, requestOptions?: RequestOptions): Promise<BulkCancelResponse>\n```\n\nDELETE /v1/bulk/\\{id\\} — cancel an in-flight bulk job\n\n## screenshots\n\n### list\n\n```ts\nclient.bulk.screenshots.list(id: BulkId, requestOptions?: RequestOptions): Promise<ListBulkScreenshotsResponse>\n```\n\nGET /v1/bulk/\\{id\\}/screenshots — list items in a mixed bulk job\n\n### list\n\n```ts\nclient.bulk.screenshots.list(id: BulkId, pageParams: BulkPageParams, requestOptions?: RequestOptions): Promise<ListBulkScreenshotsResponse>\n```\n\n### list\n\n```ts\nclient.bulk.screenshots.list(id: BulkId, pageParamsOrRequestOptions: BulkPageParams | RequestOptions = {}, requestOptions?: RequestOptions): Promise<ListBulkScreenshotsResponse>\n```"
481
516
  },
482
517
  "sdk/typescript/client": {
483
518
  "title": "Client",
484
519
  "section": "SDK Reference",
485
- "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 with per-item webhooks.\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```"
520
+ "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```"
486
521
  },
487
522
  "sdk/typescript/fetch": {
488
523
  "title": "Fetch",
489
524
  "section": "SDK Reference",
490
- "body": "# Fetch\n\nLow-latency raw HTTP fetch with byte-for-byte upstream responses. Accessed via `client.fetch`.\n\n## create\n\n```ts\nclient.fetch.create(opts: FetchOpts, requestOptions?: RequestOptions): Promise<FetchResult>\n```\n\nPOST /v1/fetch — fetch URL content via POST body.\n\nResolves a `FetchResult` — the raw content body plus `X-Fetch-*` metadata.\nThe body is returned verbatim — a JSON-serving upstream comes back as the\nraw JSON string, not a parsed object.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`. It matters most here: ByteKit's own ceiling for a\nfetch is 60 s, so without a per-call budget a slow upstream holds the caller for\nthe constructor default (2 minutes) rather than a duration the caller chose.\n\n## get\n\n```ts\nclient.fetch.get(opts: FetchGetOpts, requestOptions?: RequestOptions): Promise<FetchResult>\n```\n\nGET /v1/fetch — fetch URL content via query params.\n\nResolves a `FetchResult` — the raw content body plus `X-Fetch-*` metadata.\n\nAccepts only the four params the spec declares for this endpoint. `custom`\nis a POST-body option with no GET query param; use `create()` for custom metadata.\n\nThe query string is built by iterating `FETCH_GET_QUERY_KEYS`, the same list\n`FetchGetOpts` is derived from, so every accepted option is necessarily\nserialized.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`. As on `create`, ByteKit's own ceiling for a fetch is\n60 s, so a per-call budget is what keeps a slow upstream from holding the caller\nfor the constructor default.\n\n## Options (`FetchOpts`)\n\n- `url` (required) — `string`\n- `country` — `string`\n- `timeout_ms` — `number`\n- `cache_ttl` — `string | 0` — How long a freshly fetched URL may be served from cache. Matches the\nOpenAPI `FetchRequest.cache_ttl` schema: a duration string (`\"48h\"`,\n`\"2d\"`, up to `168h` / `7d`) or the integer `0` to disable caching.\nDefaults to `\"48h\"` server-side when omitted.\n- `custom` — `Record<string, unknown>` — User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom`\nresponse header so callers can correlate the response to caller-side\nstate. Capped at 4096 UTF-8 bytes after JSON serialization. Does NOT\naffect cache-key inputs."
525
+ "body": "# Fetch\n\nLow-latency raw HTTP fetch with byte-for-byte upstream responses. Accessed via `client.fetch`.\n\n## create\n\n```ts\nclient.fetch.create(opts: FetchOpts, requestOptions?: RequestOptions): Promise<FetchResult>\n```\n\nPOST /v1/fetch — fetch URL content via POST body.\n\nResolves a `FetchResult` — the raw content body plus `X-Fetch-*` metadata.\nThe body is returned verbatim — a JSON-serving upstream comes back as the\nraw JSON string, not a parsed object.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`. It matters most here: ByteKit's own ceiling for a\nfetch is 60 s, so without a per-call budget a slow upstream holds the caller for\nthe constructor default (2 minutes) rather than a duration the caller chose.\n\n## get\n\n```ts\nclient.fetch.get(opts: FetchGetOpts, requestOptions?: RequestOptions): Promise<FetchResult>\n```\n\nGET /v1/fetch — fetch URL content via query params.\n\nResolves a `FetchResult` — the raw content body plus `X-Fetch-*` metadata.\n\nAccepts `url`, `country`, `timeout_ms` and `cache_ttl`. The spec also declares a `custom`\nquery param for this endpoint, which this method deliberately does not expose; use\n`create()` for custom metadata.\n\nThe query string is built by iterating `FETCH_GET_QUERY_KEYS`, the same list\n`FetchGetOpts` is derived from, so every accepted option is necessarily\nserialized.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`. As on `create`, ByteKit's own ceiling for a fetch is\n60 s, so a per-call budget is what keeps a slow upstream from holding the caller\nfor the constructor default.\n\n## Options (`FetchOpts`)\n\n- `url` (required) — `string`\n- `country` — `string`\n- `timeout_ms` — `number`\n- `cache_ttl` — `string | 0` — How long a freshly fetched URL may be served from cache. Matches the\nOpenAPI `FetchRequest.cache_ttl` schema: a duration string (`\"48h\"`,\n`\"2d\"`, up to `168h` / `7d`) or the integer `0` to disable caching.\nDefaults to `\"48h\"` server-side when omitted.\n- `custom` — `Record<string, unknown>` — User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom`\nresponse header so callers can correlate the response to caller-side\nstate. Capped at 4096 UTF-8 bytes after JSON serialization. Does NOT\naffect cache-key inputs."
491
526
  },
492
527
  "sdk/typescript/fetch-bulk": {
493
528
  "title": "Fetch Bulk",
@@ -512,7 +547,7 @@
512
547
  "sdk/typescript/screenshots": {
513
548
  "title": "Screenshots",
514
549
  "section": "SDK Reference",
515
- "body": "# Screenshots\n\nCapture full-page or viewport screenshots. Accessed via `client.screenshots`.\n\n## create\n\n```ts\nclient.screenshots.create(opts: ScreenshotCreateRequest, params?: { async?: boolean }, requestOptions?: RequestOptions): Promise<ScreenshotCreateResponse>\n```\n\nPOST /v1/screenshots — capture a screenshot.\n\n`params.async` maps to the `?async=true` query param (queued 202 capture). It is a QUERY\nparam on `createScreenshot`, distinct from scrape where `async` is a body field. `params` is\noptional and `async` omitted-when-absent: `create(opts)` with no second argument posts to the\nbare `/v1/screenshots` URL unchanged — existing single-arg callers are unaffected.\n\n`requestOptions` is the THIRD positional parameter (after `params`) so both existing call\nshapes stay unaffected. It carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`; both override the constructor's `timeoutMs` default.\n\n## get\n\n```ts\nclient.screenshots.get(id: ScreenshotId, requestOptions?: RequestOptions): Promise<ScreenshotGetResponse>\n```\n\nGET /v1/screenshots/\\{id\\} — poll a screenshot by ID.\n\nA terminal-`failed` screenshot returns the `Error` envelope on a 200,\nso narrow the result before reading `image_url`.\n\n## createWithResponse\n\n```ts\nclient.screenshots.createWithResponse(opts: ScreenshotCreateRequest, params?: { async?: boolean }, requestOptions?: RequestOptions): Promise<ApiResponse<ScreenshotCreateResponse>>\n```\n\nPOST /v1/screenshots, returning the header set alongside the body.\n\nSame request as `screenshots.create` — same method, path, body and\n`RequestOptions` precedence — and `data` is exactly what `create()` resolves to.\n`create()`'s own return type is UNCHANGED; this is an additive sibling.\n\nThe spec documents the `X-Screenshot-*` family (`ID`, `Status`, `URL`,\n`Credits-Charged`, `Duration-Ms`, `Created-At`, `Completed-At`, `Expires-At`,\n`Status-Code`, `Cache`, `Cache-Age`) plus `X-Raw-Bytes` / `X-Billable-Bytes` /\n`X-Billing-Multiplier`; every one of them is on `headers`.\n\n## getWithResponse\n\n```ts\nclient.screenshots.getWithResponse(id: ScreenshotId, requestOptions?: RequestOptions): Promise<ApiResponse<ScreenshotGetResponse>>\n```\n\nGET /v1/screenshots/\\{id\\}, returning the header set alongside the body.\n\nSame request as `screenshots.get`, and `data` is exactly what `get()`\nresolves to (including the failed-envelope arm). `get()`'s own return type is\nUNCHANGED; this is an additive sibling.\n\nCall it for the typed body, NOT for header metadata: the spec declares\n`GET /v1/screenshots/\\{id\\}` with NO `X-*` response headers, and a live GET returns\nnone, so `headers` carries only the transport's own entries (`Content-Type`, …).\nThe `X-Screenshot-*` / `X-Raw-Bytes` / `X-Billable-Bytes` / `X-Billing-Multiplier`\nfamily is emitted by `POST /v1/screenshots` — use `screenshots.createWithResponse`\nto read it. This matches `ByteKit.requestWithResponse` and the README,\nwhich are the truth for what this endpoint emits."
550
+ "body": "# Screenshots\n\nCapture full-page or viewport screenshots. Accessed via `client.screenshots`.\n\n## create\n\n```ts\nclient.screenshots.create(opts: ScreenshotCreateRequest, params?: { async?: boolean }, requestOptions?: RequestOptions): Promise<ScreenshotCreateResponse>\n```\n\nPOST /v1/screenshots — capture a screenshot.\n\n`params.async` maps to the `?async=true` query param (queued 202 capture). The API also\naccepts `async: true` in the request body, on screenshots and scrape alike; either one turns\nit on. `params` is optional and `async` omitted-when-absent: `create(opts)` with no second argument posts to the\nbare `/v1/screenshots` URL unchanged — existing single-arg callers are unaffected.\n\n`requestOptions` is the THIRD positional parameter (after `params`) so both existing call\nshapes stay unaffected. It carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`; both override the constructor's `timeoutMs` default.\n\n## get\n\n```ts\nclient.screenshots.get(id: ScreenshotId, requestOptions?: RequestOptions): Promise<ScreenshotGetResponse>\n```\n\nGET /v1/screenshots/\\{id\\} — poll a screenshot by ID.\n\nA terminal-`failed` screenshot returns the `Error` envelope on a 200,\nso narrow the result before reading `image_url`.\n\n## createWithResponse\n\n```ts\nclient.screenshots.createWithResponse(opts: ScreenshotCreateRequest, params?: { async?: boolean }, requestOptions?: RequestOptions): Promise<ApiResponse<ScreenshotCreateResponse>>\n```\n\nPOST /v1/screenshots, returning the header set alongside the body.\n\nSame request as `screenshots.create` — same method, path, body and\n`RequestOptions` precedence — and `data` is exactly what `create()` resolves to.\n`create()`'s own return type is UNCHANGED; this is an additive sibling.\n\nThe spec documents the `X-Screenshot-*` family (`ID`, `Status`, `URL`,\n`Credits-Charged`, `Duration-Ms`, `Created-At`, `Completed-At`, `Expires-At`,\n`Status-Code`, `Cache`, `Cache-Age`) plus `X-Raw-Bytes` / `X-Billable-Bytes` /\n`X-Billing-Multiplier`; every one of them is on `headers`.\n\n## getWithResponse\n\n```ts\nclient.screenshots.getWithResponse(id: ScreenshotId, requestOptions?: RequestOptions): Promise<ApiResponse<ScreenshotGetResponse>>\n```\n\nGET /v1/screenshots/\\{id\\}, returning the header set alongside the body.\n\nSame request as `screenshots.get`, and `data` is exactly what `get()`\nresolves to (including the failed-envelope arm). `get()`'s own return type is\nUNCHANGED; this is an additive sibling.\n\nCall it for the typed body, NOT for header metadata: the spec declares\n`GET /v1/screenshots/\\{id\\}` with NO `X-*` response headers, and a live GET returns\nnone, so `headers` carries only the transport's own entries (`Content-Type`, …).\nThe `X-Screenshot-*` / `X-Raw-Bytes` / `X-Billable-Bytes` / `X-Billing-Multiplier`\nfamily is emitted by `POST /v1/screenshots` — use `screenshots.createWithResponse`\nto read it. This matches `ByteKit.requestWithResponse` and the README,\nwhich are the truth for what this endpoint emits."
516
551
  },
517
552
  "sdk/typescript/search": {
518
553
  "title": "Search",