@hunt-labs/bytekit-mcp 0.3.18 → 0.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/docs-bundle/docs-bundle.json +14 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,15 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.3.19] - 2026-10-15
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- The bundled documentation snapshot's `guides/schema-extraction` page now documents the
|
|
18
|
+
`422 content_too_large` error (#5399): its Errors table, the Errors intro and the Cost table's
|
|
19
|
+
"page was fetched, but extraction failed" row. The `get_doc` and `search_docs` tools serve the
|
|
20
|
+
new text; no tool, schema or transport change.
|
|
21
|
+
|
|
13
22
|
## [0.3.18] - 2026-10-02
|
|
14
23
|
|
|
15
24
|
### Changed
|
|
@@ -161,6 +170,16 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
|
|
|
161
170
|
that `change_pct` is `null` on a monitor's first capture, instead of promising a number from 0 to
|
|
162
171
|
100 (#5422). The `get_doc` and `search_docs` tools serve the new text; no tool, schema or
|
|
163
172
|
transport change.
|
|
173
|
+
- The bundled documentation snapshot's `guides/monitors` page now says a scrape monitor's
|
|
174
|
+
`change_pct` is `100` when the content hash changed, `0` when it did not (including a preflight
|
|
175
|
+
capture) and `null` on a first capture, instead of calling it a percentage from 0 to 100 (#5432).
|
|
176
|
+
The `get_doc` and `search_docs` tools serve the new text; no tool, schema or transport change.
|
|
177
|
+
- The bundled documentation snapshot's `guides/fetch` page now gives `cookies`, `headers`,
|
|
178
|
+
`wait_for_selector`, `wait_until` and `delay_ms` on `POST /v1/fetch` the message the server
|
|
179
|
+
returns instead of sending all of them to `/v1/scrape`, and its `guides/bulk` page says
|
|
180
|
+
`POST /v1/fetch/bulk` answers `headers` with the same `400 validation_error` removal message as
|
|
181
|
+
`cookies` (#5434). The `get_doc` and `search_docs` tools serve the new text; no tool, schema or
|
|
182
|
+
transport change.
|
|
164
183
|
|
|
165
184
|
## [0.3.17] - 2026-10-02
|
|
166
185
|
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"api/bulk/createbulk": {
|
|
23
23
|
"title": "Create mixed bulk job",
|
|
24
24
|
"section": "API Reference",
|
|
25
|
-
"body": "# Create mixed bulk job\n\nEnqueues screenshots or scrapes in a single batch.\nProvide `urls` (simple list) or `items` (per-item config), not both.\nWebhook deliveries include `X-ByteKit-Event: bulk.completed` so\nreceivers can dispatch on the header without parsing the body shape.\nThe body follows `BulkCompletedWebhook`: at most 500 complete items and\n1 MiB, followed by cursor recovery through the existing mixed-item route\nwhenever `recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 4 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 32 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's richer per-item override\nbudget), which reaches 28.7 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 4 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**POST** `/v1/bulk`\n\n## Request Body\n\n- `urls`\n- `items`\n- `items.url`\n- `items.type`\n- `items.device`\n- `items.format`\n- `items.quality`\n- `items.full_page`\n- `items.block_ads`\n- `items.block_cookie_banners`\n- `items.scroll`\n- `items.include_html`\n- `items.country`\n- `items.language`\n- `items.dark_mode`\n- `items.formats`\n- `items.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`"
|
|
25
|
+
"body": "# Create mixed bulk job\n\nEnqueues screenshots or scrapes in a single batch.\nProvide `urls` (simple list) or `items` (per-item config), not both.\nWebhook deliveries include `X-ByteKit-Event: bulk.completed` so\nreceivers can dispatch on the header without parsing the body shape.\nThe body follows `BulkCompletedWebhook`: at most 500 complete items and\n1 MiB, followed by cursor recovery through the existing mixed-item route\nwhenever `recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 4 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 32 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's richer per-item override\nbudget), which reaches 28.7 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 4 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**POST** `/v1/bulk`\n\n## Request Body\n\n- `urls`\n- `items`\n- `items.url`\n- `items.type`\n- `items.device`\n- `items.format`\n- `items.quality`\n- `items.full_page`\n- `items.block_ads`\n- `items.block_cookie_banners`\n- `items.scroll`\n- `items.include_html`\n- `items.country`\n- `items.language`\n- `items.dark_mode`\n- `items.formats`\n- `items.formats.type`\n- `items.formats.schema`\n- `items.formats.model`\n- `items.formats.prompt`\n- `items.wait_until`\n- `items.wait_for_selector`\n- `items.delay_ms`\n- `items.viewport`\n- `items.viewport.width`\n- `items.viewport.height`\n- `items.duration`\n- `items.scenario`\n- `items.metadata`\n- `defaults`\n- `defaults.type`\n- `defaults.device`\n- `defaults.format`\n- `defaults.quality`\n- `defaults.full_page`\n- `defaults.block_ads`\n- `defaults.block_cookie_banners`\n- `defaults.scroll`\n- `defaults.include_html`\n- `defaults.country`\n- `defaults.language`\n- `defaults.dark_mode`\n- `defaults.formats`\n- `defaults.formats.type`\n- `defaults.formats.schema`\n- `defaults.formats.model`\n- `defaults.formats.prompt`\n- `defaults.wait_until`\n- `defaults.wait_for_selector`\n- `defaults.delay_ms`\n- `defaults.viewport`\n- `defaults.viewport.width`\n- `defaults.viewport.height`\n- `defaults.device_scale_factor`\n- `webhook_url` (required)\n- `webhook_secret`\n- `metadata`\n\n## Responses\n\n### 202 — Bulk job accepted.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `total_billed_bytes`\n- `estimated_credits`\n- `webhook_url`\n\n### 400 — Bad request. When a `url` (or item URL) fails strict validation the\nerror code is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — One or more URLs in the request are on ByteKit's blocklist. The whole request is\nrejected before anything is queued or billed. This body is NOT the unified `Error`\nenvelope: it carries no `status`, `http_status` or `failed_at`. `blocked` lists every\noffending URL with the rule that matched (`domain`, `tld`, `port` or `path`) and the\ncode that rule maps to (`host_forbidden` for the first three, `path_forbidden` for\n`path`).\n- `error`\n- `error.code`\n- `error.message`\n- `blocked`\n- `blocked.url`\n- `blocked.rule_type`\n- `blocked.error_code`\n\n### 422 — Validation error. `bulk_too_large` is returned when the item count\nexceeds the account plan's `max_bulk_size` cap (also surfaced as\n`max_bulk_size` on `GET /v1/account`). `validation_error` is\nreturned when the request body contains an unrecognized key\nanywhere in the top-level object, an `items[]` entry, or\n`defaults` — all three reject unknown keys with a 422\n`validation_error` whose `details` message names the offending\nkey, instead of silently discarding it. The two nested objects\ndo not accept the same field set: `device_scale_factor` is\n`defaults`-only (rejected per item), and `duration`/`scenario`\nare `items[]`-only (rejected under `defaults`). `metadata` is\nvalid both at the top level of the body and per item, but is\nrejected with this same 422 if placed under `defaults`.\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",
|
|
@@ -42,7 +42,7 @@
|
|
|
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- `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`"
|
|
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.json`\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",
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"api/scrape-bulk/createscrapebulk": {
|
|
153
153
|
"title": "Bulk scrape URLs",
|
|
154
154
|
"section": "API Reference",
|
|
155
|
-
"body": "# Bulk scrape URLs\n\nEnqueues multiple URLs for scraping. Results delivered via webhook.\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/scrape/bulk/{id}` whenever\n`recovery_required` is true.\n\n**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`"
|
|
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.formats.type`\n- `items.formats.schema`\n- `items.formats.model`\n- `items.formats.prompt`\n- `items.country`\n- `items.delay_ms`\n- `items.timeout_ms`\n- `items.metadata`\n- `items.clean_markdown`\n- `items.custom`\n- `defaults`\n- `defaults.formats`\n- `defaults.formats.type`\n- `defaults.formats.schema`\n- `defaults.formats.model`\n- `defaults.formats.prompt`\n- `defaults.country`\n- `defaults.delay_ms`\n- `defaults.timeout_ms`\n- `defaults.clean_markdown`\n- `webhook_url` (required)\n- `webhook_secret`\n- `metadata`\n- `custom`\n\n## Responses\n\n### 202 — Bulk scrape job accepted.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `total_billed_bytes`\n- `estimated_credits`\n- `webhook_url`\n\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",
|
|
@@ -342,7 +342,7 @@
|
|
|
342
342
|
"guides/bulk": {
|
|
343
343
|
"title": "Bulk",
|
|
344
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]"
|
|
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` or `headers` field in its body, in `defaults`, or in a `urls` object returns\n`400 validation_error` with the message `cookies is no longer accepted: caller-supplied cookies and headers were removed from the capture API. Every capture presents ByteKit's own identity to the target site.` (the message for `headers` is the same with `headers` in place of the leading `cookies`; for a `urls` object it starts with `Item 0: `, using the object's position). No bulk route accepts `cookies` or `headers`, so there is no other route to send them to. A `wait_for_selector`, `delay_ms` or `wait_until` field in the same three places returns `400 validation_error` with the message `Use /v1/bulk for browser-backed options.`, with the same `Item 0: ` prefix, because `/v1/bulk` accepts all three. Naming a scrape format such as `markdown` as `format` is also a `400`. For\nMarkdown, links or images from a batch, use `/v1/scrape/bulk`.\n\n## Submit a job\n\nAll three create routes require `webhook_url`, an `https://` URL. An `http://` URL is rejected with\n`400 invalid_url` and the reason `scheme_unsupported`. Set `webhook_secret` to have the deliveries signed;\nsee the [Webhooks guide](https://bytekit.com/docs/guides/webhooks) for verification.\n\n### Mixed screenshots and scrapes\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/bulk \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"items\": [\n {\"url\": \"https://example.com/?page=bulk-guide-1\", \"type\": \"screenshot\"},\n {\"url\": \"https://example.com/?page=bulk-guide-1\", \"type\": \"scrape\", \"formats\": [\"markdown\"]}\n ],\n \"webhook_url\": \"https://hooks.example.com/bytekit\"\n }'\n```\n\n```json\n{\n \"id\": \"bulk_01a125a61d9777909cff22879e7d0165\",\n \"status\": \"processing\",\n \"total\": 2,\n \"completed\": 0,\n \"failed\": 0,\n \"total_credits_charged\": 0,\n \"total_billed_bytes\": null,\n \"estimated_credits\": 2.5,\n \"webhook_url\": \"https://hooks.example.com/bytekit\",\n \"created_at\": \"2026-10-10T11:50:05.984Z\",\n \"completed_at\": null\n}\n```\n\n> This request was run for real and returned `202`.\n\nKeep the `id`: it is how you read and cancel the job. `total_billed_bytes` is `null` here because nothing has completed yet.\n\n### Scrapes only\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/scrape/bulk \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"urls\": [\"https://example.com/?page=bulk-guide-2\"],\n \"defaults\": {\"formats\": [\"markdown\"]},\n \"webhook_url\": \"https://hooks.example.com/bytekit\"\n }'\n```\n\n> This request was run for real and returned `202`, with the same job envelope as above.\n\n### Raw fetches\n\n```bash\ncurl -i -X POST https://api.bytekit.com/v1/fetch/bulk \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"urls\": [\"https://example.com/?page=bulk-guide-3\"],\n \"webhook_url\": \"https://hooks.example.com/bytekit\"\n }'\n```\n\n> This request was run for real and returned `202`, with the same job envelope as above.\n\n### `urls` or `items`\n\nOn `/v1/bulk` and `/v1/scrape/bulk`, send `urls` or `items`, not both. A request with both returns\n`422 validation_error` (`Provide either urls or items, not both.`), and a request with neither returns\n`422 validation_error` (`Either urls or items must be provided.`).\n\n- `urls` is a plain list of URLs. Each one takes the values in `defaults`.\n- `items` is a list of objects, each with a `url` and its own options. An option on an item wins over the\n same option in `defaults`.\n- On `/v1/bulk`, an entry that names no `type` is a screenshot unless `defaults.type` says `scrape`. A bare\n `urls` list on `/v1/bulk` therefore produces screenshots, and with `\"defaults\": {\"type\": \"scrape\"}` it\n produces scrapes. Both were run for real.\n- `/v1/fetch/bulk` has no `items`. It takes `urls`, as strings or as objects with `url`, `country` and\n `cache_ttl`, and a body with `items` and no `urls` returns `422 validation_error`.\n\n## Get the results\n\n### By webhook\n\nWhen the job reaches `completed`, ByteKit sends a `POST` to your `webhook_url` with the header `X-ByteKit-Event: bulk.completed`, so you can dispatch on the header without reading the body. A job that ends `cancelled` or `failed` gets no webhook, so poll it. The\n[Scraping guide](https://bytekit.com/docs/guides/scraping#webhook-event-header) lists the other event types.\n\nThe body is bounded: it carries at most 500 complete items and 1 MiB of JSON. These are its fields, from\nthe API Reference (this page shows no captured delivery):\n\n| Field | Meaning |\n| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `bulk_id` | The job id |\n| `status` | `completed` |\n| `total`, `completed`, `failed` | Counts for the whole job |\n| `total_billed_bytes` | Bandwidth billed for the job, in bytes, or `null` when it cannot be reported in full |\n| `total_credits_charged` | Deprecated: read `total_billed_bytes` instead |\n| `webhook_url` | The `webhook_url` the job was created with |\n| `items` | Complete item records, up to 500. Each has an `id`, a `type` and a `status` (`success`, `completed`, `failed` or `cancelled`), and may carry `error_code` and `error_message` |\n| `recovery_api` | `fetch`, `scrape` or `mixed`: which API created the job |\n| `recovery_url` | The path to read the rest of the results from |\n| `manifest_item_count` | How many items this body carries |\n| `manifest_items_complete` | `true` when every item that reached a final status is in `items` |\n| `manifest_artifacts_complete` | `true` when every included completed item has a usable result reference |\n| `manifest_complete` | `true` when both of the above are `true` |\n| `recovery_required` | The inverse of `manifest_complete` |\n\nWhen `recovery_required` is `true`, the body does not hold the whole job. Read the rest from\n`recovery_url` with cursors: request it, then repeat the request with `?cursor=` set to the `next_cursor`\nyou were given, until `has_more` is `false`. `recovery_url` depends on the API that created the job:\n\n| Created with | `recovery_url` |\n| ---------------------- | --------------------------- |\n| `POST /v1/bulk` | `/v1/bulk/{id}/screenshots` |\n| `POST /v1/scrape/bulk` | `/v1/scrape/bulk/{id}` |\n| `POST /v1/fetch/bulk` | `/v1/fetch/bulk/{id}` |\n\nA delivery can arrive more than once or late. Use `bulk_id` together with each item `id` to process an item\nonce.\n\n### By polling\n\nEach API has `GET` routes for its own jobs. The job routes (`GET /v1/bulk/{id}`,\n`GET /v1/scrape/bulk/{id}` and `GET /v1/fetch/bulk/{id}`) answer `202` while the job is `processing` and `200` once it is `completed`, `failed` or `cancelled`. `GET /v1/bulk/{id}/screenshots` answers `200` whatever the job's status; an item that\nhas not completed shows `null` in `billing`.\n\n| Created with | Job status | Items |\n| ---------------------- | -------------------------- | --------------------------------------------------------- |\n| `POST /v1/bulk` | `GET /v1/bulk/{id}` | `GET /v1/bulk/{id}/screenshots`, whatever the item `type` |\n| `POST /v1/scrape/bulk` | `GET /v1/scrape/bulk/{id}` | the same response, in `items` |\n| `POST /v1/fetch/bulk` | `GET /v1/fetch/bulk/{id}` | the same response, in `items` |\n\n`GET /v1/bulk/{id}/screenshots` lists the items of a mixed job and is not limited to screenshots; each item\nhas a `type` of `screenshot` or `scrape`. Unless the job is cancelled, its `status` is `processing` until every item has completed or failed, and `completed` after. A `completed` job can have a non-zero `failed`; read `failed` to tell. The other values are `failed` and `cancelled`.\n\n```bash\ncurl -i https://api.bytekit.com/v1/bulk/bulk_01a125a61d9777909cff22879e7d0165 \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n```json\n{\n \"id\": \"bulk_01a125a61d9777909cff22879e7d0165\",\n \"status\": \"completed\",\n \"total\": 2,\n \"completed\": 2,\n \"failed\": 0,\n \"total_credits_charged\": 0,\n \"total_billed_bytes\": 1002,\n \"estimated_credits\": null,\n \"webhook_url\": \"https://hooks.example.com/bytekit\",\n \"created_at\": \"2026-10-10T11:50:05.951Z\",\n \"completed_at\": \"2026-10-10T11:50:16.313Z\"\n}\n```\n\n> This request was run for real and returned `200`. Called while the job was still running, it returned `202`.\n\nThe items of that job:\n\n```bash\ncurl -i https://api.bytekit.com/v1/bulk/bulk_01a125a61d9777909cff22879e7d0165/screenshots \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n```json\n{\n \"bulk_id\": \"bulk_01a125a61d9777909cff22879e7d0165\",\n \"items\": [\n {\n \"type\": \"screenshot\",\n \"id\": \"ss_01a125a61d9d744299721fb4b915b626\",\n \"status\": \"completed\",\n \"url\": \"https://example.com/?page=bulk-guide-1\",\n \"image_url\": \"https://…\",\n \"billing\": { \"raw_bytes\": 334, \"multiplier\": 1.5, \"billed_bytes\": 501 },\n \"error_code\": null\n },\n {\n \"type\": \"scrape\",\n \"id\": \"sc_01a125a61d9973569644148e9697b8ba\",\n \"status\": \"completed\",\n \"url\": \"https://example.com/?page=bulk-guide-1\",\n \"content_url\": \"https://…\",\n \"markdown_url\": \"https://…\",\n \"billing\": { \"raw_bytes\": 334, \"multiplier\": 1.5, \"billed_bytes\": 501 },\n \"error_code\": null\n }\n ],\n \"total\": 2,\n \"next_cursor\": null,\n \"has_more\": false,\n \"job_counters\": { \"total\": 2, \"completed\": 2, \"failed\": 0 }\n}\n```\n\n> This request was run for real and returned `200`. Links are shortened, and other fields, such as\n> `page_title`, `artifacts` and `created_at`, are left out.\n\nThe item routes take `limit`, `cursor` and `status` (`pending`, `processing`, `completed`, `failed` or\n`cancelled`). `limit` runs from 1 to 500; its default is 100 on `/v1/bulk/{id}/screenshots` and 500 on the\nother two. Pass the `next_cursor` of one page as `cursor` of the next while `has_more` is `true`, and reuse\nthe same `status` filter for the whole walk.\n\nDownload links in the item lists are signed and expire. `content_url`, `markdown_url` and `image_url` on\n`/v1/bulk/{id}/screenshots` and `content_url` on `/v1/fetch/bulk/{id}` are valid for 600 seconds; read the\njob again for a fresh link. On `/v1/scrape/bulk/{id}`, a `raw` or `markdown` result up to 10 MiB is returned\ninline, and a larger one is replaced by a signed link valid for 24 hours.\n\nRead a job through the routes of the API that created it. Another API's routes can answer `200` with\nsomething else: in a run for real, `GET /v1/fetch/bulk/{id}` on a `POST /v1/bulk` job returned `200` with an\nempty `items` list.\n\n### Listing jobs\n\n`GET /v1/bulk` lists your bulk jobs, most recent first, whichever API created them. It takes `status`\n(`processing`, `completed`, `failed` or `cancelled`), `limit` (1 to 100, default 25) and `cursor`. Follow\n`next_cursor` while `has_more` is `true`. Each entry is the job envelope without `items`.\n\n```bash\ncurl -i \"https://api.bytekit.com/v1/bulk?limit=2\" \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n> This request was run for real and returned `200` with `data`, `next_cursor` and `has_more`.\n\n## 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\n---\n[Truncated to the 16384-byte per-page limit — this page is 22315 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
346
|
},
|
|
347
347
|
"guides/choosing-an-endpoint": {
|
|
348
348
|
"title": "Choosing an endpoint",
|
|
@@ -357,12 +357,12 @@
|
|
|
357
357
|
"guides/fetch": {
|
|
358
358
|
"title": "Fetch",
|
|
359
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]"
|
|
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` or `headers` in the `POST` body | `400 validation_error`, message `cookies is no longer accepted: caller-supplied cookies and headers were removed from the capture API. Every capture presents ByteKit's own identity to the target site.` (`headers` in place of `cookies` for that field) |\n| `wait_for_selector` or `wait_until` in the `POST` body | `400 validation_error`, message `wait_for_selector is not accepted by /v1/fetch.` (`wait_until` in place of `wait_for_selector` for that field) |\n| `delay_ms` in the `POST` body | `400 validation_error`, message `Use /v1/scrape for browser-backed options.` |\n| A `format` value that `/v1/fetch` has no name for, or a field it does not know | `422 validation_error`; `error.details` names the unrecognized key |\n\nThe retired spellings that get that `400` include `rawHtml`, `raw_html`\nand `html`.\n\nEach of those five fields gets its own message, because they have different destinations. Only\n`delay_ms` is a `/v1/scrape` option, so only its message points there (see the [Scraping guide](https://bytekit.com/docs/guides/scraping)).\n`wait_for_selector` and `wait_until` belong to `/v1/screenshots` and are not accepted by `/v1/scrape`, so\ntheir message names no other endpoint. No capture endpoint accepts `cookies` or `headers`, so theirs names none either.\n\nThe `400` checks run before field validation, so a body that carries both a rejected option and an\ninvalid field gets the `400`. On `GET`, `/v1/fetch` reads `url`, `country`, `timeout_ms`, `cache_ttl`,\n`custom` and `format`. A `delay_ms` in the query string is not rejected\nthere: `GET /v1/fetch?url=…&delay_ms=500` returned `200`, where the same field in a `POST` body gets the\n`400` above.\n\n## Cost\n\n`/v1/fetch` is billed on bandwidth: the bytes counted in `X-Raw-Bytes` (the bytes the target sent, or\nthe compressed size of the rendered page when `X-Fetch-Fast-Path` is `false`), at a factor of 1\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 23398 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/fetch]"
|
|
361
361
|
},
|
|
362
362
|
"guides/monitors": {
|
|
363
363
|
"title": "Monitors",
|
|
364
364
|
"section": "Guides",
|
|
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"
|
|
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` | `100` when the content hash changed, `0` when it did not (including a `was_preflight: true` capture), 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"
|
|
366
366
|
},
|
|
367
367
|
"guides/rate-limits": {
|
|
368
368
|
"title": "Rate Limits",
|
|
@@ -372,7 +372,7 @@
|
|
|
372
372
|
"guides/schema-extraction": {
|
|
373
373
|
"title": "Schema extraction",
|
|
374
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]"
|
|
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`, `content_too_large`, or `schema_incompatible` raised after the fetch) | Refunded | Kept: the page was downloaded |\n| The page was fetched and the call returned `200` with `validated: false` | Not charged | Kept: the page was downloaded |\n| A successful extraction | Charged | Charged |\n\n[Credit billing](https://bytekit.com/docs/billing/credits) covers the two charges and a failure before the fetch, and\n[Rate Limits](https://bytekit.com/docs/guides/rate-limits) covers a failed extraction after it. On real requests,\n`credits_scrape` on `GET /v1/usage` rose by 10 after a successful extraction and did not move after\nthe `validated: false` call or a request for a host that does not exist.\n\n> The credits for this endpoint appear in `credits_scrape` on `GET /v1/usage`.\n\n## Not in the SDKs\n\n`/v1/schema` is not available in the TypeScript SDK, the Python SDK or the CLI: none of 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`, `content_too_large`,\n`scrape_failed` or the `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 24026 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]"
|
|
376
376
|
},
|
|
377
377
|
"guides/scraping": {
|
|
378
378
|
"title": "Scraping",
|
|
@@ -394,6 +394,11 @@
|
|
|
394
394
|
"section": "Guides",
|
|
395
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]"
|
|
396
396
|
},
|
|
397
|
+
"guides/structured-extraction": {
|
|
398
|
+
"title": "Structured extraction",
|
|
399
|
+
"section": "Guides",
|
|
400
|
+
"body": "# Structured extraction\n\nAdd a json format to a scrape to get a page back as an object that follows your JSON Schema, on a single scrape or on a bulk job.\n\nThe `json` format turns a scraped page into data shaped by a [JSON Schema](https://json-schema.org/)\nyou provide. Put one `json` entry in the `formats` list of a scrape, next to the string formats\nsuch as `markdown`, and the response carries the extracted object under `formats.json`. The page\nis fetched once, so you get the content and the structured data from the same request.\n\nIt works on three endpoints:\n\n- `POST /v1/scrape`, in `formats`\n- `POST /v1/scrape/bulk`, in `defaults.formats` and in each `items[].formats`\n- `POST /v1/bulk`, in the same fields of scrape entries\n\n## Request a json format\n\nThe string formats are the four names `raw`, `markdown`, `links` and `images`. The `json` format\nis an object, not a string: the list `[\"markdown\", \"json\"]` is rejected. A list holds at most one\n`json` entry.\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://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html\",\n \"formats\": [\n \"markdown\",\n {\n \"type\": \"json\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"price\": { \"type\": \"number\" }\n }\n },\n \"prompt\": \"Extract the book title and its price as a number.\"\n }\n ]\n }'\n```\n\nThe entry takes these fields:\n\n| Field | Required | Description |\n| -------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `type` | yes | Always `\"json\"` |\n| `schema` | yes | The JSON Schema describing the output. The limits and the supported keywords are the ones in [Writing the schema](https://bytekit.com/docs/guides/schema-extraction#writing-the-schema) |\n| `prompt` | no | A hint in plain language about what to extract, up to 2000 characters |\n| `model` | no | `openai/gpt-oss-20b` (the default) or `openai/gpt-oss-120b`, the larger model. Any other value is rejected |\n\nA request with only the `json` entry also fetches the page's `raw` source, so `formats.raw` is\nin the response as well.\n\n### In the SDKs\n\nBoth SDKs take the entry as a plain object beside the string formats.\n\n```ts\nimport { ByteKit } from '@hunt-labs/bytekit-sdk';\n\nconst client = new ByteKit({ apiKey: process.env.BYTEKIT_API_KEY! });\n\nconst result = await client.scrape.create({\n url: 'https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html',\n formats: [\n 'markdown',\n {\n type: 'json',\n schema: {\n type: 'object',\n properties: { title: { type: 'string' }, price: { type: 'number' } },\n },\n },\n ],\n});\n```\n\n```python\nfrom bytekit import ByteKit\n\nclient = ByteKit(api_key=\"sk_live_YOUR_KEY_HERE\")\n\nresult = client.scrape.create(\n url=\"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html\",\n formats=[\n \"markdown\",\n {\n \"type\": \"json\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\"title\": {\"type\": \"string\"}, \"price\": {\"type\": \"number\"}},\n },\n },\n ],\n)\n```\n\n## Read the result\n\nThe result is `formats.json`, with three fields:\n\n```json\n{\n \"formats\": {\n \"markdown\": \"# A Light in the Attic\\n...\",\n \"json\": {\n \"data\": { \"title\": \"A Light in the Attic\", \"price\": 51.77 },\n \"validated\": true,\n \"model\": \"openai/gpt-oss-20b\"\n }\n }\n}\n```\n\n> This response is illustrative: it shows the shape, and the values depend on the page.\n\n| Field | Description |\n| ----------- | ---------------------------------------------------------------------------------- |\n| `data` | The extracted object, shaped by your schema, or `null` when `validated` is `false` |\n| `validated` | `true` when the output matched your schema |\n| `model` | The model that ran |\n\nThe key is present on every outcome of a request that carried a `json` entry. Check `validated`\nbefore you use `data`.\n\n### When validated is false\n\nA failed extraction never fails the scrape. The page was fetched, so the other formats you asked\nfor are returned as usual and the response is still a `200`. The `json` result is\n`{ \"data\": null, \"validated\": false, \"model\": ... }`. This happens when the model refused, when\nits retries ran out before it produced output that matched your schema, or when the page held\nnone of the fields you asked for.\n\nThe reason is in the response's top-level `warnings` array, not inside `json`. An extraction\nwarning has `element: null` and one of these codes:\n\n| Code | Meaning |\n| --------------------------- | ----------------------------------------------------------------------------- |\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 held none of the requested fields |\n| `content_truncated` | The page was trimmed to fit the model, so the result may be incomplete |\n\n`content_truncated` can appear on a result that is `validated: true`; the others come with\n`validated: false`.\n\nTwo failures are refused before the page is fetched, so they are errors instead of a\n`validated: false` result. A `schema` the extractor cannot take returns `422 schema_incompatible`,\nand a deployment with no extraction provider returns `503 provider_unavailable`. See the\n[Errors guide](https://bytekit.com/docs/guides/errors) for the envelope.\n\n## Bulk jobs\n\nOn `POST /v1/scrape/bulk` and `POST /v1/bulk` the entry goes in `defaults.formats` to apply to\nevery scrape, or in an item's own `formats`. An item's own `json` entry replaces the one in\n`defaults`.\n\n```json\n{\n \"items\": [\n { \"url\": \"https://example.com/a\", \"formats\": [\"markdown\"] },\n {\n \"url\": \"https://example.com/b\",\n \"formats\": [\"markdown\", { \"type\": \"json\", \"schema\": { \"type\": \"object\" } }]\n }\n ],\n \"webhook_url\": \"https://example.com/hooks/bytekit\"\n}\n```\n\nEach scrape item carries its own `formats.json`, read the way you read any other bulk item (see\nthe [Bulk guide](https://bytekit.com/docs/guides/bulk)). On `GET /v1/bulk/{id}/screenshots` a scrape item holds it at\n`artifacts.json`, a key that is present only on an item that asked for a `json` format. When an\nitem is too large for the page it is returned in a bounded form; there the `json` result is kept\nonly while it serializes to at most 8,192 characters.\n\n## Cost\n\nA `json` format is billed in two parts, on top of the scrape's own charge:\n\n- **The page's bandwidth**, as for any scrape.\n- **A flat per-extraction credit charge**, the same whatever the page or the schema, charged only\n when the extraction validates.\n\nA `validated: false` result charges no extraction credits, and the page's bandwidth is kept\nbecause the page was downloaded. The credits are held when the request is admitted and given back\nif the extraction does not validate, so an account needs enough balance to cover them at the\nstart. For the current amount, see [Credit billing](https://bytekit.com/docs/billing/credits).\n\n## json or POST /v1/schema\n\nUse the `json` format when you also want the page's content, or when you are scraping a list of\nURLs in bulk: one request fetches the page and extracts from it.\n\nUse [`POST /v1/schema`](https://bytekit.com/docs/guides/schema-extraction) when you only want the extracted object. It\ntakes one `url` and a `schema`, answers synchronously with the object, and reports extraction\ntimings in its response."
|
|
401
|
+
},
|
|
397
402
|
"guides/webhooks": {
|
|
398
403
|
"title": "Webhooks",
|
|
399
404
|
"section": "Guides",
|
|
@@ -472,7 +477,7 @@
|
|
|
472
477
|
"sdk/python/scrape": {
|
|
473
478
|
"title": "Scrape",
|
|
474
479
|
"section": "SDK Reference",
|
|
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 `` 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```"
|
|
480
|
+
"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 is accepted on `POST /v1/scrape`, `POST /v1/scrape/bulk` and `POST /v1/bulk` (scrape entries); monitor `formats` accept the string formats alone. Its result is `formats.json` on the response, and its charge 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 `` 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```"
|
|
476
481
|
},
|
|
477
482
|
"sdk/python/scrape-bulk": {
|
|
478
483
|
"title": "Scrape Bulk",
|
|
@@ -537,7 +542,7 @@
|
|
|
537
542
|
"sdk/typescript/scrape": {
|
|
538
543
|
"title": "Scrape",
|
|
539
544
|
"section": "SDK Reference",
|
|
540
|
-
"body": "# Scrape\n\nFetch a URL as raw HTML, clean markdown, or structured content. Accessed via `client.scrape`.\n\n## create\n\n```ts\nclient.scrape.create(opts: ScrapeOpts, requestOptions?: RequestOptions): Promise<ScrapeCreateResponse>\n```\n\nPOST /v1/scrape — create a scrape job.\n\nResolves to the 200 `success` content envelope or the 202 queued receipt;\nnarrow on `status` to tell them apart. A TERMINAL FAILURE THROWS: the server\ndelivers it as a `failed` envelope on HTTP 200 (a definitive upstream outcome\nis a result, not a transport error), and this method converts it into the\n`ByteKitError` you already catch — `err.code`, `err.message`, and `err.status`\n200. `scrape.get(id)` is unchanged and still returns `failed` as data.\n\nSee `ScrapeCreateResponse` for the full precedence: `async: true` receipts\nimmediately, a browser-path request without it is held open until the render\nreaches a terminal state (200) or the server's hold window expires (202 — a\nreceipt you did not ask for), and everything else takes the fast path (200).\n\nA held request therefore occupies the connection for as long as the render\ntakes, up to the server's hold window (28 s by default) — well inside this\nSDK's 120 s default `timeoutMs`, but worth raising `requestTimeoutMs` if you\nlowered it.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`; both override the constructor's `timeoutMs` default. They\nare a different axis from `opts.timeout_ms`, which is the SERVER-side scrape budget.\n\n## get\n\n```ts\nclient.scrape.get(id: ScrapeId, requestOptions?: RequestOptions): Promise<ScrapeGetResponse>\n```\n\nGET /v1/scrape/\\{id\\} — poll a scrape by ID\n\n## Options (`ScrapeOpts`)\n\n- `url` (required) — `string`\n- `formats` — `Array<'raw' | 'markdown' | 'links' | 'images'
|
|
545
|
+
"body": "# Scrape\n\nFetch a URL as raw HTML, clean markdown, or structured content. Accessed via `client.scrape`.\n\n## create\n\n```ts\nclient.scrape.create(opts: ScrapeOpts, requestOptions?: RequestOptions): Promise<ScrapeCreateResponse>\n```\n\nPOST /v1/scrape — create a scrape job.\n\nResolves to the 200 `success` content envelope or the 202 queued receipt;\nnarrow on `status` to tell them apart. A TERMINAL FAILURE THROWS: the server\ndelivers it as a `failed` envelope on HTTP 200 (a definitive upstream outcome\nis a result, not a transport error), and this method converts it into the\n`ByteKitError` you already catch — `err.code`, `err.message`, and `err.status`\n200. `scrape.get(id)` is unchanged and still returns `failed` as data.\n\nSee `ScrapeCreateResponse` for the full precedence: `async: true` receipts\nimmediately, a browser-path request without it is held open until the render\nreaches a terminal state (200) or the server's hold window expires (202 — a\nreceipt you did not ask for), and everything else takes the fast path (200).\n\nA held request therefore occupies the connection for as long as the render\ntakes, up to the server's hold window (28 s by default) — well inside this\nSDK's 120 s default `timeoutMs`, but worth raising `requestTimeoutMs` if you\nlowered it.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`; both override the constructor's `timeoutMs` default. They\nare a different axis from `opts.timeout_ms`, which is the SERVER-side scrape budget.\n\n## get\n\n```ts\nclient.scrape.get(id: ScrapeId, requestOptions?: RequestOptions): Promise<ScrapeGetResponse>\n```\n\nGET /v1/scrape/\\{id\\} — poll a scrape by ID\n\n## Options (`ScrapeOpts`)\n\n- `url` (required) — `string`\n- `formats` — `Array<'raw' | 'markdown' | 'links' | 'images' | ScrapeJsonFormat>` — String formats, plus at most one `\\{ type: 'json', schema \\}` entry for structured extraction (the entry's result is `formats.json`).\n- `country` — `string`\n- `delay_ms` — `number`\n- `timeout_ms` — `number` — SERVER-side scrape budget in ms — how long the server may spend on the scrape itself. For the CLIENT-side abort budget (when this SDK gives up on the wire), see `RequestOptions.requestTimeoutMs`.\n- `async` — `boolean`\n- `webhook_url` — `string`\n- `events` — `Array<'queued' | 'completed' | 'failed'>`\n- `markdown_mode` — `MarkdownMode` — Markdown processing mode. article=article extraction (default), raw=minimal cleanup, llm=compact LLM-optimised output.\n- `markdown_query` — `string` — BM25 query string for relevance-ranked content filtering. Omit or leave empty to disable.\n- `markdown_links` — `MarkdownLinks` — Link rendering style in the markdown output.\n- `markdown_images` — `MarkdownImages` — Image retention mode in the markdown output. Distinct from `markdown_filter_images` (which drops low-signal images before conversion).\n- `with_links_summary` — `boolean` — When true, appends a `Links:` footer to the markdown output. Automatically enabled when `markdown_links` is `'references'`.\n- `with_images_summary` — `boolean` — When true, appends an `Images:` footer to the markdown output.\n- `markdown_compact` — `boolean` — Collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — `boolean` — Filter low-signal images from the markdown output.\n- `markdown_include_media` — `boolean` — 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` — `boolean` — When true, the response includes markdown-pipeline and tag-filter warnings. `artifact_unavailable` may appear independently when a requested persisted format cannot be rehydrated.\n- `markdown_include_stats` — `boolean` — 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` — `number` — Maximum token count for the markdown output. Truncates at the last paragraph → sentence → token boundary under the limit. Absent → no truncation.\n- `token_encoding` — `TokenEncoding` — Tokenizer encoding hint for `token_budget`. `cl100k_base` (default) matches GPT-4/4o; `o200k_base` matches GPT-4o-mini / o-series.\n- `solve_challenge` — `boolean` — Attempts to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render.\n- `mobile` — `boolean` — When true, emulate a mobile device (mobile UA + viewport). Default false (desktop). Part of the cache key, so mobile and desktop responses cache independently.\n- `remove_base64_images` — `boolean` — When true (default), base64-encoded `data:` image sources are stripped before markdown conversion. Set false to preserve them. Does not affect `raw`.\n- `include_tags` — `string[]` — HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in `markdown` output. Applied before `exclude_tags`. Does not affect `raw`.\n- `exclude_tags` — `string[]` — HTML element names (not CSS selectors) to strip from `markdown` output. Applied after `include_tags`. Does not affect `raw`.\n- `clean_markdown` — `boolean` — When true and `markdown` is in `formats`, the converted markdown is sent to Groq for cleaning before return. Graceful degradation on any Groq failure. Billing: 3× credits and bytes applied only when cleaning succeeds.\n- `cache_ttl` — `string | 0` — How long a freshly fetched URL may be served from cache. `'0'`/`0` skips the\ncache read (the result is still written), `'Nh'`/`'Nd'` set a TTL (capped at\n168h / 7d). Default `'48h'`. Honoured on both the synchronous and asynchronous\npaths; the async success envelope reports the outcome via the `cache` field.\n- `custom` — `Record<string, unknown>` — User-supplied JSON payload, echoed back on the success envelope so callers\ncan correlate the response to caller-side state (job IDs, batch metadata).\nCapped at 4096 UTF-8 bytes after JSON serialization. Does NOT affect\ncache-key inputs — two requests differing only in `custom` share the same\ncache slot."
|
|
541
546
|
},
|
|
542
547
|
"sdk/typescript/scrape-bulk": {
|
|
543
548
|
"title": "Scrape Bulk",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hunt-labs/bytekit-mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
4
4
|
"description": "ByteKit MCP server — exposes ByteKit web-data tools (scrape, screenshot, search, docs) to AI agents over the Model Context Protocol, hosted or as a local stdio server.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|