@hunt-labs/bytekit-mcp 0.3.20 → 0.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,39 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.3.22] - 2026-10-27
14
+
15
+ ### Added
16
+
17
+ - **`scrape_url` accepts the `outline` format (#5473).** `formats: ["outline"]` returns an indented
18
+ text accessibility tree of the browser-rendered page, shown under its own `--- format: outline ---`
19
+ delimiter. Experimental; it forces the browser path (so the call can come back queued with an `sc_`
20
+ ID for `get_result`) and adds no credits. The bundled documentation snapshot describes the new format.
21
+
22
+ ### Changed
23
+
24
+ - **`scrape_url`'s `solve_challenge` description now says the call may come back queued (#5541).**
25
+ Since #5532 a synchronous scrape with `solve_challenge: true` takes the held browser render, and a
26
+ solve that outlasts the gateway's hold returns a queued result with an `sc_` ID to redeem with
27
+ `get_result`. Description text only; no input schema change. The bundled documentation snapshot
28
+ carries the same wording.
29
+
30
+ ## [0.3.21] - 2026-10-24
31
+
32
+ ### Security
33
+
34
+ - Bumped `zod` from `^3.23.6` to `^4.6.7` and capped `scrape_url`'s `formats` list at 32 entries
35
+ (GHSA-mrhx-c7xc-m3w5). Zod records one error per bad list entry with no limit, so a long list of
36
+ bad entries could exhaust memory; a longer list is now rejected before any entry is checked. Only
37
+ four formats exist, so no valid call changes. Zod 4 rewords its own built-in validation messages.
38
+
39
+ ### Changed
40
+
41
+ - The bundled documentation snapshot's Python SDK reference now shows the type hints
42
+ `bytekit-sdk` 0.10.0 emits after its regeneration with `openapi-python-client` 0.29.1:
43
+ `str | Unset` and `X | None` replace `Union[Unset, str]` and `Optional[X]`. The `get_doc` and
44
+ `search_docs` tools serve the new text; no tool, schema or transport change.
45
+
13
46
  ## [0.3.20] - 2026-10-23
14
47
 
15
48
  ### Security
@@ -157,17 +157,17 @@
157
157
  "api/scrape-bulk/getscrapebulk": {
158
158
  "title": "Get scrape bulk job status",
159
159
  "section": "API Reference",
160
- "body": "# Get scrape bulk job status\n\nReturns the job envelope plus its rehydrated per-URL scrape envelopes.\n\n**Downloading item content.** A `raw` or `markdown` artifact within the\n10-MiB inline cap is returned inline. An oversized one is replaced by a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **86400 seconds (24 hours)**. The underlying objects are private, so an\nunsigned URL returns `401`: download the content inside that window, or\nre-poll this endpoint for a fresh signature. An artifact that was never\nstored, or whose object cannot be signed, is omitted from `formats` and\nreported as `artifact_unavailable` in `warnings`. The private unsigned\nstorage URL is never returned.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/{id}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/fetch/bulk` or `POST /v1/bulk` is found here too, not a `404`.\nThe items listed are the job's scrape rows: a fetch-bulk job's items appear, and a\n`POST /v1/bulk` job shows its scrape items but not its screenshots. An id from another\naccount answers `404`.\n\n**GET** `/v1/scrape/bulk/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n- `cursor` (query, string) — Opaque cursor returned by the preceding page. It is bound to this bulk id, this recovery route, and the exact status filter; cross-scope cursors return 422.\n- `limit` (query, integer) — Maximum result rows considered for this page; the 16-MiB response bound may stop sooner.\n- `status` (query, string) — Optional item-status filter. A cursor may be reused only with the same filter.\n\n## Responses\n\n### 200 — Bulk job status with rehydrated item envelopes. Each completed scrape\nresult entry echoes its `custom` payload (resolved per entry as\n`entry.custom ?? body.custom`) at the same position it occupies in the\n`/v1/scrape` success envelope. The key is omitted when no `custom` was\nsupplied for that entry.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `total_billed_bytes`\n- `estimated_credits`\n- `webhook_url`\n- `next_cursor`\n- `has_more`\n- `items`\n- `items.schema_version`\n- `items.status`\n- `items.id`\n- `items.url`\n- `items.final_url`\n- `items.content_type`\n- `items.content_length`\n- `items.status_code`\n- `items.retrieved_at`\n- `items.formats`\n- `items.formats.raw`\n- `items.formats.markdown`\n- `items.formats.links`\n- `items.formats.links.url`\n- `items.formats.links.text`\n- `items.formats.links.isInternal`\n- `items.formats.links.rel`\n- `items.formats.images`\n- `items.formats.images.url`\n- `items.formats.images.alt`\n- `items.formats.images.width`\n- `items.formats.images.height`\n- `items.formats.images.format`\n- `items.formats.images.score`\n- `items.formats.json`\n- `items.formats.json.data`\n- `items.formats.json.validated`\n- `items.formats.json.model`\n- `items.metadata`\n- `items.metadata.title`\n- `items.metadata.description`\n- `items.metadata.language`\n- `items.metadata.canonicalUrl`\n- `items.metadata.ogTitle`\n- `items.metadata.ogDescription`\n- `items.metadata.ogImage`\n- `items.metadata.ogUrl`\n- `items.metadata.ogSiteName`\n- `items.metadata.robots`\n- `items.metadata.byline`\n- `items.metadata.publishedAt`\n- `items.tables`\n- `items.tables.kind`\n- `items.tables.gfm`\n- `items.tables.rows`\n- `items.tables.cols`\n- `items.warnings`\n- `items.warnings.code`\n- `items.warnings.message`\n- `items.warnings.element`\n- `items.stats`\n- `items.stats.chars`\n- `items.stats.tokens`\n- `items.stats.blocks`\n- `items.markdown_tokens`\n- `items.markdown_tokens.kept`\n- `items.markdown_tokens.total`\n- `items.markdown_tokens.truncated`\n- `items.billing`\n- `items.billing.raw_bytes`\n- `items.billing.factors`\n- `items.billing.factors.name`\n- `items.billing.factors.value`\n- `items.billing.factors.reason`\n- `items.billing.multiplier`\n- `items.billing.billed_bytes`\n- `items.custom`\n- `items.cache`\n- `items.cache_age_s`\n- `items.error`\n- `items.error.code`\n- `items.error.message`\n- `items.error.http_status`\n- `items.error.retry_after_seconds`\n- `items.error.failed_at`\n- `items.status_url`\n- `items.queued_at`\n- `items.events`\n- `items.type`\n- `items.terminal_outcome`\n\n### 202 — Bulk job still processing. `routes/scrape-bulk.ts` ends the poll handler\nwith `status: isTerminal ? 200 : 202` over an identical body, so this is\nthe SAME envelope the 200 documents — only the status code and the\nreachable `status` values differ. Keep polling until you get a 200\n(issue #3533).\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `total_billed_bytes`\n- `estimated_credits`\n- `webhook_url`\n- `next_cursor`\n- `has_more`\n- `items`\n- `items.schema_version`\n- `items.status`\n- `items.id`\n- `items.url`\n- `items.final_url`\n- `items.content_type`\n- `items.content_length`\n- `items.status_code`\n- `items.retrieved_at`\n- `items.formats`\n- `items.formats.raw`\n- `items.formats.markdown`\n- `items.formats.links`\n- `items.formats.links.url`\n- `items.formats.links.text`\n- `items.formats.links.isInternal`\n- `items.formats.links.rel`\n- `items.formats.images`\n- `items.formats.images.url`\n- `items.formats.images.alt`\n- `items.formats.images.width`\n- `items.formats.images.height`\n- `items.formats.images.format`\n- `items.formats.images.score`\n- `items.formats.json`\n- `items.formats.json.data`\n- `items.formats.json.validated`\n- `items.formats.json.model`\n- `items.metadata`\n- `items.metadata.title`\n- `items.metadata.description`\n- `items.metadata.language`\n- `items.metadata.canonicalUrl`\n- `items.metadata.ogTitle`\n- `items.metadata.ogDescription`\n- `items.metadata.ogImage`\n- `items.metadata.ogUrl`\n- `items.metadata.ogSiteName`\n- `items.metadata.robots`\n- `items.metadata.byline`\n- `items.metadata.publishedAt`\n- `items.tables`\n- `items.tables.kind`\n- `items.tables.gfm`\n- `items.tables.rows`\n- `items.tables.cols`\n- `items.warnings`\n- `items.warnings.code`\n- `items.warnings.message`\n- `items.warnings.element`\n- `items.stats`\n- `items.stats.chars`\n- `items.stats.tokens`\n- `items.stats.blocks`\n- `items.markdown_tokens`\n- `items.markdown_tokens.kept`\n- `items.markdown_tokens.total`\n- `items.markdown_tokens.truncated`\n- `items.billing`\n- `items.billing.raw_bytes`\n- `items.billing.factors`\n- `items.billing.factors.name`\n- `items.billing.factors.value`\n- `items.billing.factors.reason`\n- `items.billing.multiplier`\n- `items.billing.billed_bytes`\n- `items.custom`\n- `items.cache`\n- `items.cache_age_s`\n- `items.error`\n- `items.error.code`\n- `items.error.message`\n- `items.error.http_status`\n- `items.error.retry_after_seconds`\n- `items.error.failed_at`\n- `items.status_url`\n- `items.queued_at`\n- `items.events`\n- `items.type`\n- `items.terminal_outcome`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 404 — Resource not found.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
160
+ "body": "# Get scrape bulk job status\n\nReturns the job envelope plus its rehydrated per-URL scrape envelopes.\n\n**Downloading item content.** A `raw` or `markdown` artifact within the\n10-MiB inline cap is returned inline. An oversized one is replaced by a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **86400 seconds (24 hours)**. The underlying objects are private, so an\nunsigned URL returns `401`: download the content inside that window, or\nre-poll this endpoint for a fresh signature. An artifact that was never\nstored, or whose object cannot be signed, is omitted from `formats` and\nreported as `artifact_unavailable` in `warnings`. The private unsigned\nstorage URL is never returned.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/{id}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/fetch/bulk` or `POST /v1/bulk` is found here too, not a `404`.\nThe items listed are the job's scrape rows: a fetch-bulk job's items appear, and a\n`POST /v1/bulk` job shows its scrape items but not its screenshots. An id from another\naccount answers `404`.\n\n**GET** `/v1/scrape/bulk/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n- `cursor` (query, string) — Opaque cursor returned by the preceding page. It is bound to this bulk id, this recovery route, and the exact status filter; cross-scope cursors return 422.\n- `limit` (query, integer) — Maximum result rows considered for this page; the 16-MiB response bound may stop sooner.\n- `status` (query, string) — Optional item-status filter. A cursor may be reused only with the same filter.\n\n## Responses\n\n### 200 — Bulk job status with rehydrated item envelopes. Each completed scrape\nresult entry echoes its `custom` payload (resolved per entry as\n`entry.custom ?? body.custom`) at the same position it occupies in the\n`/v1/scrape` success envelope. The key is omitted when no `custom` was\nsupplied for that entry.\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `total_billed_bytes`\n- `estimated_credits`\n- `webhook_url`\n- `next_cursor`\n- `has_more`\n- `items`\n- `items.schema_version`\n- `items.status`\n- `items.id`\n- `items.url`\n- `items.final_url`\n- `items.content_type`\n- `items.content_length`\n- `items.status_code`\n- `items.retrieved_at`\n- `items.formats`\n- `items.formats.raw`\n- `items.formats.markdown`\n- `items.formats.links`\n- `items.formats.links.url`\n- `items.formats.links.text`\n- `items.formats.links.isInternal`\n- `items.formats.links.rel`\n- `items.formats.images`\n- `items.formats.images.url`\n- `items.formats.images.alt`\n- `items.formats.images.width`\n- `items.formats.images.height`\n- `items.formats.images.format`\n- `items.formats.images.score`\n- `items.formats.json`\n- `items.formats.json.data`\n- `items.formats.json.validated`\n- `items.formats.json.model`\n- `items.formats.outline`\n- `items.metadata`\n- `items.metadata.title`\n- `items.metadata.description`\n- `items.metadata.language`\n- `items.metadata.canonicalUrl`\n- `items.metadata.ogTitle`\n- `items.metadata.ogDescription`\n- `items.metadata.ogImage`\n- `items.metadata.ogUrl`\n- `items.metadata.ogSiteName`\n- `items.metadata.robots`\n- `items.metadata.byline`\n- `items.metadata.publishedAt`\n- `items.tables`\n- `items.tables.kind`\n- `items.tables.gfm`\n- `items.tables.rows`\n- `items.tables.cols`\n- `items.warnings`\n- `items.warnings.code`\n- `items.warnings.message`\n- `items.warnings.element`\n- `items.stats`\n- `items.stats.chars`\n- `items.stats.tokens`\n- `items.stats.blocks`\n- `items.markdown_tokens`\n- `items.markdown_tokens.kept`\n- `items.markdown_tokens.total`\n- `items.markdown_tokens.truncated`\n- `items.billing`\n- `items.billing.raw_bytes`\n- `items.billing.factors`\n- `items.billing.factors.name`\n- `items.billing.factors.value`\n- `items.billing.factors.reason`\n- `items.billing.multiplier`\n- `items.billing.billed_bytes`\n- `items.custom`\n- `items.cache`\n- `items.cache_age_s`\n- `items.error`\n- `items.error.code`\n- `items.error.message`\n- `items.error.http_status`\n- `items.error.retry_after_seconds`\n- `items.error.failed_at`\n- `items.status_url`\n- `items.queued_at`\n- `items.events`\n- `items.type`\n- `items.terminal_outcome`\n\n### 202 — Bulk job still processing. `routes/scrape-bulk.ts` ends the poll handler\nwith `status: isTerminal ? 200 : 202` over an identical body, so this is\nthe SAME envelope the 200 documents — only the status code and the\nreachable `status` values differ. Keep polling until you get a 200\n(issue #3533).\n- `id`\n- `status`\n- `total`\n- `completed`\n- `failed`\n- `created_at`\n- `completed_at`\n- `total_credits_charged`\n- `total_billed_bytes`\n- `estimated_credits`\n- `webhook_url`\n- `next_cursor`\n- `has_more`\n- `items`\n- `items.schema_version`\n- `items.status`\n- `items.id`\n- `items.url`\n- `items.final_url`\n- `items.content_type`\n- `items.content_length`\n- `items.status_code`\n- `items.retrieved_at`\n- `items.formats`\n- `items.formats.raw`\n- `items.formats.markdown`\n- `items.formats.links`\n- `items.formats.links.url`\n- `items.formats.links.text`\n- `items.formats.links.isInternal`\n- `items.formats.links.rel`\n- `items.formats.images`\n- `items.formats.images.url`\n- `items.formats.images.alt`\n- `items.formats.images.width`\n- `items.formats.images.height`\n- `items.formats.images.format`\n- `items.formats.images.score`\n- `items.formats.json`\n- `items.formats.json.data`\n- `items.formats.json.validated`\n- `items.formats.json.model`\n- `items.formats.outline`\n- `items.metadata`\n- `items.metadata.title`\n- `items.metadata.description`\n- `items.metadata.language`\n- `items.metadata.canonicalUrl`\n- `items.metadata.ogTitle`\n- `items.metadata.ogDescription`\n- `items.metadata.ogImage`\n- `items.metadata.ogUrl`\n- `items.metadata.ogSiteName`\n- `items.metadata.robots`\n- `items.metadata.byline`\n- `items.metadata.publishedAt`\n- `items.tables`\n- `items.tables.kind`\n- `items.tables.gfm`\n- `items.tables.rows`\n- `items.tables.cols`\n- `items.warnings`\n- `items.warnings.code`\n- `items.warnings.message`\n- `items.warnings.element`\n- `items.stats`\n- `items.stats.chars`\n- `items.stats.tokens`\n- `items.stats.blocks`\n- `items.markdown_tokens`\n- `items.markdown_tokens.kept`\n- `items.markdown_tokens.total`\n- `items.markdown_tokens.truncated`\n- `items.billing`\n- `items.billing.raw_bytes`\n- `items.billing.factors`\n- `items.billing.factors.name`\n- `items.billing.factors.value`\n- `items.billing.factors.reason`\n- `items.billing.multiplier`\n- `items.billing.billed_bytes`\n- `items.custom`\n- `items.cache`\n- `items.cache_age_s`\n- `items.error`\n- `items.error.code`\n- `items.error.message`\n- `items.error.http_status`\n- `items.error.retry_after_seconds`\n- `items.error.failed_at`\n- `items.status_url`\n- `items.queued_at`\n- `items.events`\n- `items.type`\n- `items.terminal_outcome`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 404 — Resource not found.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
161
161
  },
162
162
  "api/scrape/createscrape": {
163
163
  "title": "Scrape a URL",
164
164
  "section": "API Reference",
165
- "body": "# Scrape a URL\n\nFetches and processes a URL, returning content in one or more formats wrapped in a ScrapeEnvelope.\n\n**The response shape is decided by your request, not by how we route it.** In precedence order:\n\n1. `async: true` in the body, or `?async=true` in the query string (either one is enough; `false` in one never cancels `true` in the other) → **202** with a `ScrapeQueuedEnvelope` receipt, returned immediately. Poll `GET /v1/scrape/{id}` for the result.\n2. Otherwise, a request that needs a full page render — today that is `delay_ms > 0` — is **held open** until the render reaches a terminal state, then returns **200** with the content envelope (`success` or `failed`). If the render is still running when the hold window expires (28 seconds by default), the request returns the **202** receipt instead and the job continues in the background.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content envelope, typically in under a second.\n\n**A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all come back on the same **200** as a `failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A failure the fast path decides inline is recorded as a failed job, so its envelope normally carries that job's `id` and `GET /v1/scrape/{id}` returns the same envelope; if recording the failed job itself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is nothing to poll. A failure a held render reaches carries that render's real `id`. Either way the request transfers no billable bytes and is charged nothing.\n\n**A target that rate-limits us is not ByteKit rate-limiting you.** The `failed` envelope's `error.code` is `target_rate_limited` when the target rate-limits the request. On the fast path that means our proxy attempts end on an HTTP 429 and no bot protection is identified on any attempt, even if the browser fallback then fails or reaches only an unidentified block page; the inline failure carries `error.retry_after_seconds` when the target sent a usable `Retry-After`. On a held render the browser's own answer decides: it observes a 429 on the page itself, or it fails outright after the proxy attempts ended on an HTTP 429. A bot-protection verdict on an earlier fetch attempt does not keep a held render `blocked` when the browser then observes the 429. A held render never carries `error.retry_after_seconds`. Retrying a `target_rate_limited` failure later is likely to work. A held render whose browser reaches an unidentified 403 or 503 page after a proxy 429 is `blocked`. A 429 that bot protection sends as a block stays `blocked` when it is the answer that decides the code: the fast path's proxy attempts, or the browser render on a held render. Your own per-key limit is a separate case: it answers HTTP 429 `rate_limited` with a `Retry-After` header (see the `429` response).\n\nSo a 202 means one of exactly two things: you asked for one with `async: true` or `?async=true`, or the hold window expired. `wait_for_selector` and `wait_until` are `ScreenshotRequest` options, not `ScrapeRequest` options — sending either to this endpoint returns `422 validation_error`, so neither can produce a 202 here.\n\n**POST** `/v1/scrape`\n\n## Parameters\n\n- `async` (query, boolean) — Query-string spelling of the body `async` field. `true` returns the 202 receipt immediately; any other value is ignored. Either spelling turns async on, and `false` in one never cancels `true` in the other.\n\n## Request Body\n\n- `url` (required)\n- `formats`\n- `formats.type`\n- `formats.schema`\n- `formats.model`\n- `formats.prompt`\n- `country`\n- `delay_ms`\n- `timeout_ms`\n- `async`\n- `webhook_url`\n- `events`\n- `markdown_mode`\n- `markdown_query`\n- `markdown_links`\n- `markdown_images`\n- `with_links_summary`\n- `with_images_summary`\n- `markdown_compact`\n- `markdown_filter_images`\n- `markdown_include_media`\n- `markdown_include_warnings`\n- `markdown_include_stats`\n- `token_budget`\n- `token_encoding`\n- `mobile`\n- `solve_challenge`\n- `remove_base64_images`\n- `include_tags`\n- `exclude_tags`\n- `cache_ttl`\n- `custom`\n- `clean_markdown`\n\n## Responses\n\n### 200 — Scrape reached a terminal state and the body is that terminal envelope: `success` carrying content, or `failed` carrying the error envelope. Returned by the fast HTTP path in one round trip, and by a browser-path request without `async: true` or `?async=true` once its render reaches a terminal state inside the hold window. A held render that ends in failure answers 200 with the same `failed` envelope `GET /v1/scrape/{id}` returns — narrow on `status` before reading the body. A definitive upstream outcome is a result, not a transport error: an unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all answer 200 with the `failed` envelope, never a 5xx. An inline failure is recorded as a failed job, so its envelope normally carries that job's `id` and polling it returns the same envelope; `id` is `null` only when recording the failed job itself failed. `error.http_status` is present only when a real upstream HTTP status is known.\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `final_url`\n- `content_type`\n- `content_length`\n- `status_code`\n- `retrieved_at`\n- `formats`\n- `formats.raw`\n- `formats.markdown`\n- `formats.links`\n- `formats.links.url`\n- `formats.links.text`\n- `formats.links.isInternal`\n- `formats.links.rel`\n- `formats.images`\n- `formats.images.url`\n- `formats.images.alt`\n- `formats.images.width`\n- `formats.images.height`\n- `formats.images.format`\n- `formats.images.score`\n- `formats.json`\n- `formats.json.data`\n- `formats.json.validated`\n- `formats.json.model`\n- `metadata`\n- `metadata.title`\n- `metadata.description`\n- `metadata.language`\n- `metadata.canonicalUrl`\n- `metadata.ogTitle`\n- `metadata.ogDescription`\n- `metadata.ogImage`\n- `metadata.ogUrl`\n- `metadata.ogSiteName`\n- `metadata.robots`\n- `metadata.byline`\n- `metadata.publishedAt`\n- `tables`\n- `tables.kind`\n- `tables.gfm`\n- `tables.rows`\n- `tables.cols`\n- `warnings`\n- `warnings.code`\n- `warnings.message`\n- `warnings.element`\n- `stats`\n- `stats.chars`\n- `stats.tokens`\n- `stats.blocks`\n- `markdown_tokens`\n- `markdown_tokens.kept`\n- `markdown_tokens.total`\n- `markdown_tokens.truncated`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `custom`\n- `cache`\n- `cache_age_s`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.retry_after_seconds`\n- `error.failed_at`\n\n### 202 — Scrape accepted for background processing; the body is a receipt, not content. Returned when `async: true` or `?async=true` was requested, or when a browser-path request's hold window expired before the render finished. Poll `GET /v1/scrape/{id}` for the result.\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `status_url`\n- `queued_at`\n- `events`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error. A `json` format entry whose `schema` the extractor cannot take is\nrefused with `schema_incompatible`, before anything is drawn.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 500 — Internal server error.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 503 — The request carried a `json` format entry and JSON extraction is unavailable on this\ndeployment (`provider_unavailable`). It is refused before anything is drawn. A\nterminal upstream failure is never a `503`: it is a `200` result, described above.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
165
+ "body": "# Scrape a URL\n\nFetches and processes a URL, returning content in one or more formats wrapped in a ScrapeEnvelope.\n\n**The response shape is decided by your request, not by how we route it.** In precedence order:\n\n1. `async: true` in the body, or `?async=true` in the query string (either one is enough; `false` in one never cancels `true` in the other) → **202** with a `ScrapeQueuedEnvelope` receipt, returned immediately. Poll `GET /v1/scrape/{id}` for the result.\n2. Otherwise, a request that needs a full page render — today that is any of `delay_ms > 0`, `solve_challenge: true`, or `outline` in `formats` — is **held open** until the render reaches a terminal state, then returns **200** with the content envelope (`success` or `failed`). If the render is still running when the hold window expires (28 seconds by default), the request returns the **202** receipt instead and the job continues in the background. A `solve_challenge` render can outlast the hold window, so expect the 202 receipt from such a request.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content envelope, typically in under a second.\n\n**A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all come back on the same **200** as a `failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A failure the fast path decides inline is recorded as a failed job, so its envelope normally carries that job's `id` and `GET /v1/scrape/{id}` returns the same envelope; if recording the failed job itself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is nothing to poll. A failure a held render reaches carries that render's real `id`. Either way the request transfers no billable bytes and is charged nothing.\n\n**A target that rate-limits us is not ByteKit rate-limiting you.** The `failed` envelope's `error.code` is `target_rate_limited` when the target rate-limits the request. On the fast path that means our proxy attempts end on an HTTP 429 and no bot protection is identified on any attempt, even if the browser fallback then fails or reaches only an unidentified block page; the inline failure carries `error.retry_after_seconds` when the target sent a usable `Retry-After`. On a held render the browser's own answer decides: it observes a 429 on the page itself, or it fails outright after the proxy attempts ended on an HTTP 429. A bot-protection verdict on an earlier fetch attempt does not keep a held render `blocked` when the browser then observes the 429. A held render never carries `error.retry_after_seconds`. Retrying a `target_rate_limited` failure later is likely to work. A held render whose browser reaches an unidentified 403 or 503 page after a proxy 429 is `blocked`. A 429 that bot protection sends as a block stays `blocked` when it is the answer that decides the code: the fast path's proxy attempts, or the browser render on a held render. Your own per-key limit is a separate case: it answers HTTP 429 `rate_limited` with a `Retry-After` header (see the `429` response).\n\nSo a 202 means one of exactly two things: you asked for one with `async: true` or `?async=true`, or the hold window expired. `wait_for_selector` and `wait_until` are `ScreenshotRequest` options, not `ScrapeRequest` options — sending either to this endpoint returns `422 validation_error`, so neither can produce a 202 here.\n\n**POST** `/v1/scrape`\n\n## Parameters\n\n- `async` (query, boolean) — Query-string spelling of the body `async` field. `true` returns the 202 receipt immediately; any other value is ignored. Either spelling turns async on, and `false` in one never cancels `true` in the other.\n\n## Request Body\n\n- `url` (required)\n- `formats`\n- `formats.type`\n- `formats.schema`\n- `formats.model`\n- `formats.prompt`\n- `country`\n- `delay_ms`\n- `timeout_ms`\n- `async`\n- `webhook_url`\n- `events`\n- `markdown_mode`\n- `markdown_query`\n- `markdown_links`\n- `markdown_images`\n- `with_links_summary`\n- `with_images_summary`\n- `markdown_compact`\n- `markdown_filter_images`\n- `markdown_include_media`\n- `markdown_include_warnings`\n- `markdown_include_stats`\n- `token_budget`\n- `token_encoding`\n- `mobile`\n- `solve_challenge`\n- `remove_base64_images`\n- `include_tags`\n- `exclude_tags`\n- `cache_ttl`\n- `custom`\n- `clean_markdown`\n\n## Responses\n\n### 200 — Scrape reached a terminal state and the body is that terminal envelope: `success` carrying content, or `failed` carrying the error envelope. Returned by the fast HTTP path in one round trip, and by a browser-path request without `async: true` or `?async=true` once its render reaches a terminal state inside the hold window. A held render that ends in failure answers 200 with the same `failed` envelope `GET /v1/scrape/{id}` returns — narrow on `status` before reading the body. A definitive upstream outcome is a result, not a transport error: an unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all answer 200 with the `failed` envelope, never a 5xx. An inline failure is recorded as a failed job, so its envelope normally carries that job's `id` and polling it returns the same envelope; `id` is `null` only when recording the failed job itself failed. `error.http_status` is present only when a real upstream HTTP status is known.\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `final_url`\n- `content_type`\n- `content_length`\n- `status_code`\n- `retrieved_at`\n- `formats`\n- `formats.raw`\n- `formats.markdown`\n- `formats.links`\n- `formats.links.url`\n- `formats.links.text`\n- `formats.links.isInternal`\n- `formats.links.rel`\n- `formats.images`\n- `formats.images.url`\n- `formats.images.alt`\n- `formats.images.width`\n- `formats.images.height`\n- `formats.images.format`\n- `formats.images.score`\n- `formats.json`\n- `formats.json.data`\n- `formats.json.validated`\n- `formats.json.model`\n- `formats.outline`\n- `metadata`\n- `metadata.title`\n- `metadata.description`\n- `metadata.language`\n- `metadata.canonicalUrl`\n- `metadata.ogTitle`\n- `metadata.ogDescription`\n- `metadata.ogImage`\n- `metadata.ogUrl`\n- `metadata.ogSiteName`\n- `metadata.robots`\n- `metadata.byline`\n- `metadata.publishedAt`\n- `tables`\n- `tables.kind`\n- `tables.gfm`\n- `tables.rows`\n- `tables.cols`\n- `warnings`\n- `warnings.code`\n- `warnings.message`\n- `warnings.element`\n- `stats`\n- `stats.chars`\n- `stats.tokens`\n- `stats.blocks`\n- `markdown_tokens`\n- `markdown_tokens.kept`\n- `markdown_tokens.total`\n- `markdown_tokens.truncated`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `custom`\n- `cache`\n- `cache_age_s`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.retry_after_seconds`\n- `error.failed_at`\n\n### 202 — Scrape accepted for background processing; the body is a receipt, not content. Returned when `async: true` or `?async=true` was requested, or when a browser-path request's hold window expired before the render finished. Poll `GET /v1/scrape/{id}` for the result.\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `status_url`\n- `queued_at`\n- `events`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error. A `json` format entry whose `schema` the extractor cannot take is\nrefused with `schema_incompatible`, before anything is drawn.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 500 — Internal server error.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 503 — The request carried a `json` format entry and JSON extraction is unavailable on this\ndeployment (`provider_unavailable`). It is refused before anything is drawn. A\nterminal upstream failure is never a `503`: it is a `200` result, described above.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
166
166
  },
167
167
  "api/scrape/getscrape": {
168
168
  "title": "Get scrape result",
169
169
  "section": "API Reference",
170
- "body": "# Get scrape result\n\nAlways returns 200. Check the `status` discriminator for the scrape state.\n\n**GET** `/v1/scrape/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Scrape state (queued, success, or failed).\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `final_url`\n- `content_type`\n- `content_length`\n- `status_code`\n- `retrieved_at`\n- `formats`\n- `formats.raw`\n- `formats.markdown`\n- `formats.links`\n- `formats.links.url`\n- `formats.links.text`\n- `formats.links.isInternal`\n- `formats.links.rel`\n- `formats.images`\n- `formats.images.url`\n- `formats.images.alt`\n- `formats.images.width`\n- `formats.images.height`\n- `formats.images.format`\n- `formats.images.score`\n- `formats.json`\n- `formats.json.data`\n- `formats.json.validated`\n- `formats.json.model`\n- `metadata`\n- `metadata.title`\n- `metadata.description`\n- `metadata.language`\n- `metadata.canonicalUrl`\n- `metadata.ogTitle`\n- `metadata.ogDescription`\n- `metadata.ogImage`\n- `metadata.ogUrl`\n- `metadata.ogSiteName`\n- `metadata.robots`\n- `metadata.byline`\n- `metadata.publishedAt`\n- `tables`\n- `tables.kind`\n- `tables.gfm`\n- `tables.rows`\n- `tables.cols`\n- `warnings`\n- `warnings.code`\n- `warnings.message`\n- `warnings.element`\n- `stats`\n- `stats.chars`\n- `stats.tokens`\n- `stats.blocks`\n- `markdown_tokens`\n- `markdown_tokens.kept`\n- `markdown_tokens.total`\n- `markdown_tokens.truncated`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `custom`\n- `cache`\n- `cache_age_s`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.retry_after_seconds`\n- `error.failed_at`\n- `status_url`\n- `queued_at`\n- `events`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 404 — Resource not found.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
170
+ "body": "# Get scrape result\n\nAlways returns 200. Check the `status` discriminator for the scrape state.\n\n**GET** `/v1/scrape/{id}`\n\n## Parameters\n\n- `id` (path, string, required)\n\n## Responses\n\n### 200 — Scrape state (queued, success, or failed).\n- `schema_version`\n- `status`\n- `id`\n- `url`\n- `final_url`\n- `content_type`\n- `content_length`\n- `status_code`\n- `retrieved_at`\n- `formats`\n- `formats.raw`\n- `formats.markdown`\n- `formats.links`\n- `formats.links.url`\n- `formats.links.text`\n- `formats.links.isInternal`\n- `formats.links.rel`\n- `formats.images`\n- `formats.images.url`\n- `formats.images.alt`\n- `formats.images.width`\n- `formats.images.height`\n- `formats.images.format`\n- `formats.images.score`\n- `formats.json`\n- `formats.json.data`\n- `formats.json.validated`\n- `formats.json.model`\n- `formats.outline`\n- `metadata`\n- `metadata.title`\n- `metadata.description`\n- `metadata.language`\n- `metadata.canonicalUrl`\n- `metadata.ogTitle`\n- `metadata.ogDescription`\n- `metadata.ogImage`\n- `metadata.ogUrl`\n- `metadata.ogSiteName`\n- `metadata.robots`\n- `metadata.byline`\n- `metadata.publishedAt`\n- `tables`\n- `tables.kind`\n- `tables.gfm`\n- `tables.rows`\n- `tables.cols`\n- `warnings`\n- `warnings.code`\n- `warnings.message`\n- `warnings.element`\n- `stats`\n- `stats.chars`\n- `stats.tokens`\n- `stats.blocks`\n- `markdown_tokens`\n- `markdown_tokens.kept`\n- `markdown_tokens.total`\n- `markdown_tokens.truncated`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `custom`\n- `cache`\n- `cache_age_s`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.retry_after_seconds`\n- `error.failed_at`\n- `status_url`\n- `queued_at`\n- `events`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 404 — Resource not found.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
171
171
  },
172
172
  "api/screenshots": {
173
173
  "title": "Screenshots",
@@ -377,7 +377,7 @@
377
377
  "guides/scraping": {
378
378
  "title": "Scraping",
379
379
  "section": "Guides",
380
- "body": "# Scraping\n\nScrape any URL as HTML, markdown, or structured content — formats, options, latency, and async polling.\n\n`POST /v1/scrape` fetches a URL and returns its content in the format you ask for. The same\nrequest shape works for every site; the options you pass determine the output and how long the\ncall takes.\n\n## Rendering & latency\n\nMost scrapes return in well under a second. Some options require ByteKit to fully render the page\nbefore it can return content, which takes longer — typically a few seconds. Pass these only when\nyou need them:\n\n| Option | When it adds latency |\n| ---------- | -------------------------------------------------------------- |\n| `delay_ms` | Greater than `0` |\n| `async` | `true` (the request is queued and processed in the background) |\n\nThe `country` option routes the request through a geo-located proxy. On its own it does not add\nrendering latency; it only does so when combined with one of the options above.\n\nLooking for `wait_for_selector` or `wait_until`? Those are not `ScrapeRequest` options — they\nbelong to the [Screenshot](https://bytekit.com/docs/api/screenshots/createscreenshot) endpoint. Sending them to\n`/v1/scrape` returns `422`.\n\n`cookies` and `headers` are no longer request options on any capture endpoint. Sending either\nreturns `400 validation_error`.\n\n```bash\n# A simple, low-latency scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n```bash\n# Slower: delay_ms forces a full render and waits before returning\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"delay_ms\": 2000\n }'\n```\n\n## Options\n\nEvery `POST /v1/scrape` option is listed here by the job it does. Only `url` is required. The\n[API reference](https://bytekit.com/docs/api/scrape/createscrape) carries the full request schema.\n\n### Output shaping\n\n- `url` — the page to scrape.\n- `formats` — what to return: any of `raw` (the default), `markdown`, `links` and `images`. The\n `formats` object in the response is keyed by what you asked for.\n- `markdown_mode` — how the page becomes markdown: `article` (the default) extracts the article\n content, `raw` applies minimal cleanup, and `llm` produces compact, LLM-optimised output.\n- `markdown_query` — a BM25 query string (up to 200 characters) that filters the markdown by\n relevance to it. Omit it or leave it empty to disable.\n- `include_tags` and `exclude_tags` — HTML element names (not CSS selectors). `include_tags` keeps\n only the content inside those elements in the `markdown` output; `exclude_tags` strips them from\n it. `include_tags` is applied first, then `exclude_tags`. Neither affects `raw`, which always\n returns the full page.\n- `clean_markdown` — when `true` and `markdown` is in `formats`, the converted markdown is sent to\n an LLM (Groq) to remove boilerplate and ads and improve formatting before it is returned. If that\n step fails for any reason (key unset, 4xx/5xx, timeout, empty response), you get the raw markdown\n unchanged plus a warning in the `warnings` array. Billing is 3× credits and bytes, applied only\n when cleaning succeeds.\n- `markdown_links` — how links are written in the markdown: `inline` (the default) keeps\n `[text](url)`, `text` keeps only the anchor text, `none` strips URLs and removes reference\n definitions, and `references` converts to numbered `[text][N]` references with a Links footer.\n- `markdown_images` — how images are written in the markdown: `inline` (the default) keeps\n `![alt](url)`, `text` keeps only the alt text, `none` removes images entirely, and `references`\n converts to numbered `![alt][N]` references with an Images footer. This is distinct from\n `markdown_filter_images`, which drops low-signal images before conversion.\n- `with_links_summary` and `with_images_summary` — append a `Links:` or `Images:` footer, a\n numbered list of the extracted URLs, to the markdown. `with_links_summary` is enabled\n automatically when `markdown_links` is `references`.\n- `markdown_compact` — collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — filter low-signal images out of the markdown output.\n- `markdown_include_media` — return `formats.links` and `formats.images` as rich scored objects\n instead of string arrays, and include a top-level `tables` array. Only effective when `markdown`\n is in `formats`.\n- `markdown_include_warnings` — enable markdown-pipeline and tag-filter warnings for requests that\n include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may\n appear independently of this flag.\n- `remove_base64_images` — base64-encoded `data:` image sources are stripped from the HTML before\n markdown conversion (the default, `true`). Set it to `false` to keep them. It does not affect\n `raw`, which always returns the original source unchanged.\n\n### Token control\n\n- `token_budget` — the maximum token count for the markdown output. When set and `markdown` is in\n `formats`, the output is truncated at the last paragraph, then sentence, then token boundary that\n keeps the estimated count under the limit. Leave it out for no truncation. Setting it adds a\n `markdown_tokens` field to the response.\n- `token_encoding` — the tokenizer hint for `token_budget`: `cl100k_base` (the default) matches\n GPT-4/4o and `o200k_base` matches GPT-4o-mini and the o-series. Both use the same 4-characters-\n per-token heuristic internally.\n- `markdown_include_stats` — include a top-level `stats` object (characters, tokens, blocks) in the\n response. Only effective when `markdown` is in `formats`.\n\n### Rendering and access\n\n- `delay_ms` — milliseconds to wait after page load before capturing, for content that renders\n late. See [Rendering & latency](#rendering--latency) above.\n- `country` — a two-letter uppercase country code (default `US`) that routes the request through a\n geo-located proxy.\n- `mobile` — emulate a mobile device: the request uses a mobile (Android) user agent and viewport\n so the upstream serves its mobile page. The default is `false` (desktop). The value is part of\n the cache key, so mobile and desktop responses are cached independently.\n- `solve_challenge` — attempts to clear a Cloudflare challenge. Success is not guaranteed, and it\n is billed as a normal browser render.\n- `timeout_ms` — the request timeout in milliseconds, from `1000` to `90000` (default `60000`).\n\n### Caching and delivery\n\n- `cache_ttl` — how long a freshly fetched URL may be served from cache. `0` (string or integer)\n skips the cache read, though cache-eligible results are still written. `Nh` or `Nd` sets a TTL,\n capped at 168 h / 7 d. The default is `48h`. Safety-classified WAF husks are returned live but\n never stored in the shared cache. It is honoured on both the synchronous and asynchronous paths.\n- `async` — queue the scrape and get a `202` receipt immediately; see\n [Async scrapes](#async-scrapes) below.\n- `webhook_url` — an HTTPS endpoint to notify. An `http://` URL is rejected with `400 invalid_url`\n (reason `scheme_unsupported`).\n- `events` — which webhook events to deliver when `webhook_url` is set: any of `queued`,\n `completed` and `failed`. All three are delivered by default; send a subset to receive fewer.\n- `custom` — a JSON object of your own, echoed back on the success envelope (sync, async and\n webhook). It is capped at 4096 UTF-8 bytes and does not affect the cache key, so two requests\n that differ only in `custom` resolve to the same cache entry.\n\n### Examples\n\nA markdown scrape trimmed to a token budget, with the response's token statistics:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"formats\": [\"markdown\"],\n \"markdown_mode\": \"llm\",\n \"token_budget\": 4000,\n \"token_encoding\": \"o200k_base\",\n \"markdown_include_stats\": true\n }'\n```\n\nA content-only scrape: keep the `article` and `main` elements, then strip navigation and footers\nfrom what is left.\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"formats\": [\"markdown\"],\n \"include_tags\": [\"article\", \"main\"],\n \"exclude_tags\": [\"nav\", \"footer\", \"aside\"]\n }'\n```\n\n## Response fields\n\nThe default format is `raw` — pass `formats` to request others (`markdown`, `links`,\n`images`). The `formats` object in the response is keyed by the format you requested.\n\nThe `scrape_url` tool in the [MCP server](https://bytekit.com/docs/mcp) differs: it returns markdown when `formats` is\nomitted. A request that includes `markdown` bills the 1.5× `scrape_md` endpoint factor; one that\ndoes not bills 1× (`scrape`). The API default stays `raw` so that omitting `formats` does not\nsilently raise a request's cost.\n\nEnvelope fields are `snake_case`; the keys inside `metadata` are the page's own metadata and\nstay `camelCase`.\n\n| Field | Description |\n| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `schema_version` | Response envelope version (currently `1`) |\n| `formats.raw` | Page content in the requested format (`raw` is the default when `formats` is omitted) |\n| `final_url` | URL the fetch landed on after redirects |\n| `content_type` | `Content-Type` reported by the origin |\n| `content_length` | Compressed wire bytes — the _basis_ for bandwidth billing, before the endpoint factor (see `billing`). A page served by a hosted browser reports the browser's full measured transfer |\n| `status_code` | HTTP status code of the origin page |\n| `retrieved_at` | ISO-8601 UTC timestamp of the fetch |\n| `cache` | `\"hit\"` or `\"miss\"` |\n| `cache_age_s` | Age of the cached entry in seconds — present only on a hit |\n| `billing` | What the request cost: `raw_bytes`, the `factors` applied, the resulting `multiplier`, and `billed_bytes` |\n| `metadata.title` | Page `<title>` element |\n\nThe `X-Scrape-*` response headers describe how each request was handled (cache status, timing,\nand the final URL) — useful for debugging.\n\n## Async scrapes\n\nFor long-running pages, pass `\"async\": true` to get a `202 Accepted` response with a scrape\n`id` prefixed `sc_`. Poll the result with `GET /v1/scrape/{id}`.\n\n```bash\n# Start async scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"async\": true}'\n\n# Poll for result\ncurl https://api.bytekit.com/v1/scrape/sc_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Webhook event header\n\nEvery outbound webhook POST includes an `X-ByteKit-Event` header with the event type:\n\n| Event type | Trigger |\n| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |\n| `bulk.completed` | A bulk job finishes (all items processed) |\n| `scrape.completed` | An async scrape succeeds, or a scrape monitor delivers a capture (`has_change` tells a change from a no-change capture) |\n| `scrape.failed` | An async scrape fails terminally |\n| `monitor.change_detected` | A screenshot monitor fires and detects a change |\n| `monitor.captured` | A screenshot monitor fires with no change detected (notify_on: every) |\n| `monitor.suspended` | A monitor is suspended because the account ran out of balance (reason `insufficient_balance`) |\n| `sitemap.completed` | A sitemap job finishes |\n| `sitemap.failed` | A sitemap job fails terminally |\n\nUse this header to dispatch events without inspecting the body shape:\n\n```python\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route(\"/webhooks/bytekit\", methods=[\"POST\"])\ndef handle():\n event = request.headers.get(\"X-ByteKit-Event\")\n if event == \"bulk.completed\":\n handle_bulk(request.json)\n elif event == \"scrape.completed\":\n handle_scrape(request.json)\n return \"\", 200\n```\n\n`X-ByteKit-Event` is a reserved header — you cannot supply it via `webhook_headers` in\nmonitor or bulk configuration. Attempts to do so will be rejected with a `422` at request\ntime.\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — usage counting and concurrency slots\n- [Errors](https://bytekit.com/docs/guides/errors) — how to interpret and retry error responses\n- [API Reference: Scrape](https://bytekit.com/docs/api/scrape/createscrape) — full request/response schema"
380
+ "body": "# Scraping\n\nScrape any URL as HTML, markdown, or structured content — formats, options, latency, and async polling.\n\n`POST /v1/scrape` fetches a URL and returns its content in the format you ask for. The same\nrequest shape works for every site; the options you pass determine the output and how long the\ncall takes.\n\n## Rendering & latency\n\nMost scrapes return in well under a second. Some options require ByteKit to fully render the page\nbefore it can return content, which takes longer — typically a few seconds. Pass these only when\nyou need them:\n\n| Option | When it adds latency |\n| ----------------- | -------------------------------------------------------------- |\n| `delay_ms` | Greater than `0` |\n| `solve_challenge` | `true` (can outlast the 28 s hold, so expect a `202` receipt) |\n| `formats` | Includes `outline` |\n| `async` | `true` (the request is queued and processed in the background) |\n\nThe `country` option routes the request through a geo-located proxy. On its own it does not add\nrendering latency; it only does so when combined with one of the options above.\n\nLooking for `wait_for_selector` or `wait_until`? Those are not `ScrapeRequest` options — they\nbelong to the [Screenshot](https://bytekit.com/docs/api/screenshots/createscreenshot) endpoint. Sending them to\n`/v1/scrape` returns `422`.\n\n`cookies` and `headers` are no longer request options on any capture endpoint. Sending either\nreturns `400 validation_error`.\n\n```bash\n# A simple, low-latency scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n```bash\n# Slower: delay_ms forces a full render and waits before returning\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"delay_ms\": 2000\n }'\n```\n\n## Options\n\nEvery `POST /v1/scrape` option is listed here by the job it does. Only `url` is required. The\n[API reference](https://bytekit.com/docs/api/scrape/createscrape) carries the full request schema.\n\n### Output shaping\n\n- `url` — the page to scrape.\n- `formats` — what to return: any of `raw` (the default), `markdown`, `links`, `images` and `outline`. The\n `formats` object in the response is keyed by what you asked for. `outline` is experimental: an\n indented text accessibility tree of the browser-rendered page. It forces the browser path, adds\n no credits, and is not accepted on monitors.\n- `markdown_mode` — how the page becomes markdown: `article` (the default) extracts the article\n content, `raw` applies minimal cleanup, and `llm` produces compact, LLM-optimised output.\n- `markdown_query` — a BM25 query string (up to 200 characters) that filters the markdown by\n relevance to it. Omit it or leave it empty to disable.\n- `include_tags` and `exclude_tags` — HTML element names (not CSS selectors). `include_tags` keeps\n only the content inside those elements in the `markdown` output; `exclude_tags` strips them from\n it. `include_tags` is applied first, then `exclude_tags`. Neither affects `raw`, which always\n returns the full page.\n- `clean_markdown` — when `true` and `markdown` is in `formats`, the converted markdown is sent to\n an LLM (Groq) to remove boilerplate and ads and improve formatting before it is returned. If that\n step fails for any reason (key unset, 4xx/5xx, timeout, empty response), you get the raw markdown\n unchanged plus a warning in the `warnings` array. Billing is 3× credits and bytes, applied only\n when cleaning succeeds.\n- `markdown_links` — how links are written in the markdown: `inline` (the default) keeps\n `[text](url)`, `text` keeps only the anchor text, `none` strips URLs and removes reference\n definitions, and `references` converts to numbered `[text][N]` references with a Links footer.\n- `markdown_images` — how images are written in the markdown: `inline` (the default) keeps\n `![alt](url)`, `text` keeps only the alt text, `none` removes images entirely, and `references`\n converts to numbered `![alt][N]` references with an Images footer. This is distinct from\n `markdown_filter_images`, which drops low-signal images before conversion.\n- `with_links_summary` and `with_images_summary` — append a `Links:` or `Images:` footer, a\n numbered list of the extracted URLs, to the markdown. `with_links_summary` is enabled\n automatically when `markdown_links` is `references`.\n- `markdown_compact` — collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — filter low-signal images out of the markdown output.\n- `markdown_include_media` — return `formats.links` and `formats.images` as rich scored objects\n instead of string arrays, and include a top-level `tables` array. Only effective when `markdown`\n is in `formats`.\n- `markdown_include_warnings` — enable markdown-pipeline and tag-filter warnings for requests that\n include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may\n appear independently of this flag.\n- `remove_base64_images` — base64-encoded `data:` image sources are stripped from the HTML before\n markdown conversion (the default, `true`). Set it to `false` to keep them. It does not affect\n `raw`, which always returns the original source unchanged.\n\n### Token control\n\n- `token_budget` — the maximum token count for the markdown output. When set and `markdown` is in\n `formats`, the output is truncated at the last paragraph, then sentence, then token boundary that\n keeps the estimated count under the limit. Leave it out for no truncation. Setting it adds a\n `markdown_tokens` field to the response.\n- `token_encoding` — the tokenizer hint for `token_budget`: `cl100k_base` (the default) matches\n GPT-4/4o and `o200k_base` matches GPT-4o-mini and the o-series. Both use the same 4-characters-\n per-token heuristic internally.\n- `markdown_include_stats` — include a top-level `stats` object (characters, tokens, blocks) in the\n response. Only effective when `markdown` is in `formats`.\n\n### Rendering and access\n\n- `delay_ms` — milliseconds to wait after page load before capturing, for content that renders\n late. See [Rendering & latency](#rendering--latency) above.\n- `country` — a two-letter uppercase country code (default `US`) that routes the request through a\n geo-located proxy.\n- `mobile` — emulate a mobile device: the request uses a mobile (Android) user agent and viewport\n so the upstream serves its mobile page. The default is `false` (desktop). The value is part of\n the cache key, so mobile and desktop responses are cached independently.\n- `solve_challenge` — attempts to clear a Cloudflare challenge. Success is not guaranteed, and it\n is billed as a normal browser render. A synchronous scrape with `solve_challenge: true` takes\n the held browser render; a solve can outlast the hold window (28 seconds by default), and the\n request then returns the `202` receipt while the job continues in the background. Poll\n `GET /v1/scrape/{id}` for the result.\n- `timeout_ms` — the request timeout in milliseconds, from `1000` to `90000` (default `60000`).\n\n### Caching and delivery\n\n- `cache_ttl` — how long a freshly fetched URL may be served from cache. `0` (string or integer)\n skips the cache read, though cache-eligible results are still written. `Nh` or `Nd` sets a TTL,\n capped at 168 h / 7 d. The default is `48h`. Safety-classified WAF husks are returned live but\n never stored in the shared cache. It is honoured on both the synchronous and asynchronous paths.\n- `async` — queue the scrape and get a `202` receipt immediately; see\n [Async scrapes](#async-scrapes) below.\n- `webhook_url` — an HTTPS endpoint to notify. An `http://` URL is rejected with `400 invalid_url`\n (reason `scheme_unsupported`).\n- `events` — which webhook events to deliver when `webhook_url` is set: any of `queued`,\n `completed` and `failed`. All three are delivered by default; send a subset to receive fewer.\n- `custom` — a JSON object of your own, echoed back on the success envelope (sync, async and\n webhook). It is capped at 4096 UTF-8 bytes and does not affect the cache key, so two requests\n that differ only in `custom` resolve to the same cache entry.\n\n### Examples\n\nA markdown scrape trimmed to a token budget, with the response's token statistics:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"formats\": [\"markdown\"],\n \"markdown_mode\": \"llm\",\n \"token_budget\": 4000,\n \"token_encoding\": \"o200k_base\",\n \"markdown_include_stats\": true\n }'\n```\n\nA content-only scrape: keep the `article` and `main` elements, then strip navigation and footers\nfrom what is left.\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"formats\": [\"markdown\"],\n \"include_tags\": [\"article\", \"main\"],\n \"exclude_tags\": [\"nav\", \"footer\", \"aside\"]\n }'\n```\n\n## Response fields\n\nThe default format is `raw` — pass `formats` to request others (`markdown`, `links`,\n`images`, `outline`). The `formats` object in the response is keyed by the format you requested.\n\nThe `scrape_url` tool in the [MCP server](https://bytekit.com/docs/mcp) differs: it returns markdown when `formats` is\nomitted. A request that includes `markdown` bills the 1.5× `scrape_md` endpoint factor; one that\ndoes not bills 1× (`scrape`). The API default stays `raw` so that omitting `formats` does not\nsilently raise a request's cost.\n\nEnvelope fields are `snake_case`; the keys inside `metadata` are the page's own metadata and\nstay `camelCase`.\n\n| Field | Description |\n| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `schema_version` | Response envelope version (currently `1`) |\n| `formats.raw` | Page content in the requested format (`raw` is the default when `formats` is omitted) |\n| `final_url` | URL the fetch landed on after redirects |\n| `content_type` | `Content-Type` reported by the origin |\n| `content_length` | Compressed wire bytes — the _basis_ for bandwidth billing, before the endpoint factor (see `billing`). A page served by a hosted browser reports the browser's full measured transfer |\n| `status_code` | HTTP status code of the origin page |\n| `retrieved_at` | ISO-8601 UTC timestamp of the fetch |\n| `cache` | `\"hit\"` or `\"miss\"` |\n| `cache_age_s` | Age of the cached entry in seconds — present only on a hit |\n| `billing` | What the request cost: `raw_bytes`, the `factors` applied, the resulting `multiplier`, and `billed_bytes` |\n| `metadata.title` | Page `<title>` element |\n\nThe `X-Scrape-*` response headers describe how each request was handled (cache status, timing,\nand the final URL) — useful for debugging.\n\n## Async scrapes\n\nFor long-running pages, pass `\"async\": true` to get a `202 Accepted` response with a scrape\n`id` prefixed `sc_`. Poll the result with `GET /v1/scrape/{id}`.\n\n```bash\n# Start async scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"async\": true}'\n\n# Poll for result\ncurl https://api.bytekit.com/v1/scrape/sc_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Webhook event header\n\nEvery outbound webhook POST includes an `X-ByteKit-Event` header with the event type:\n\n| Event type | Trigger |\n| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |\n| `bulk.completed` | A bulk job finishes (all items processed) |\n| `scrape.completed` | An async scrape succeeds, or a scrape monitor delivers a capture (`has_change` tells a change from a no-change capture) |\n| `scrape.failed` | An async scrape fails terminally |\n| `monitor.change_detected` | A screenshot monitor fires and detects a change |\n| `monitor.captured` | A screenshot monitor fires with no change detected (notify_on: every) |\n| `monitor.suspended` | A monitor is suspended because the account ran out of balance (reason `insufficient_balance`) |\n| `sitemap.completed` | A sitemap job finishes |\n| `sitemap.failed` | A sitemap job fails terminally |\n\nUse this header to dispatch events without inspecting the body shape:\n\n```python\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route(\"/webhooks/bytekit\", methods=[\"POST\"])\ndef handle():\n event = request.headers.get(\"X-ByteKit-Event\")\n if event == \"bulk.completed\":\n handle_bulk(request.json)\n elif event == \"scrape.completed\":\n handle_scrape(request.json)\n return \"\", 200\n```\n\n`X-ByteKit-Event` is a reserved header — you cannot supply it via `webhook_headers` in\nmonitor or bulk configuration. Attempts to do so will be rejected with a `422` at request\ntime.\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — usage counting and concurrency slots\n- [Errors](https://bytekit.com/docs/guides/errors) — how to interpret and retry error responses\n- [API Reference: Scrape](https://bytekit.com/docs/api/scrape/createscrape) — full request/response schema"
381
381
  },
382
382
  "guides/screenshots": {
383
383
  "title": "Screenshots",
@@ -432,7 +432,7 @@
432
432
  "mcp": {
433
433
  "title": "MCP Server",
434
434
  "section": "General",
435
- "body": "# MCP Server\n\nCall ByteKit web capture as a native tool from Claude, Cursor, and any MCP-compatible agent — hosted over HTTP or run locally over stdio.\n\nThe ByteKit **MCP server** exposes scraping, search, screenshots, and account\nlookups as [Model Context Protocol](https://modelcontextprotocol.io) tools. Your\nagent calls `scrape_url` or `screenshot_url` the same way it calls any other\ntool — no wrapper to write, no headless browser to manage.\n\nThere are two ways to connect: a **hosted HTTP endpoint** (nothing to install)\nand a **local stdio server** (`npx @hunt-labs/bytekit-mcp`).\n\n## Authentication\n\nBoth paths authenticate with a ByteKit API key. Sign up at\n[app.bytekit.com](https://app.bytekit.com) and create a key (prefixed\n`sk_live_`). The local server reads it from the `BYTEKIT_API_KEY` environment\nvariable (or the `--api-key` flag); the hosted endpoint takes it as a bearer\ntoken.\n\n## Option 1 — Hosted HTTP (no install)\n\nPoint any MCP client that speaks the Streamable HTTP transport at:\n\n```\nhttps://api.bytekit.com/mcp\n```\n\nSend your API key as a bearer token. Example client config for a host that\nspeaks Streamable HTTP directly (Cursor and most hosts accept this shape):\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"url\": \"https://api.bytekit.com/mcp\",\n \"headers\": {\n \"Authorization\": \"Bearer sk_live_xxx\"\n }\n }\n }\n}\n```\n\n**Paste your real key in place of `sk_live_xxx`.** A JSON config file is not a\nshell: most hosts read these values verbatim and do not substitute environment\nvariables inside `headers`, so writing `Bearer $BYTEKIT_API_KEY` here sends that\ntext to the API as the token, verbatim, and the API answers `401`.\n\n**Claude Desktop does not accept this shape.** `claude_desktop_config.json`\nonly launches local **stdio** subprocesses (`command`/`args`/`env`) — it has\nno native `url`-based remote-server entry, so pasting the config above into\nit will not connect. To reach the hosted endpoint from Claude Desktop, either:\n\n- add ByteKit as a [Connector](https://claude.com/connectors) (Settings →\n Connectors → Add custom connector), or\n- bridge it locally with [`mcp-remote`](https://www.npmjs.com/package/mcp-remote):\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"mcp-remote\",\n \"https://api.bytekit.com/mcp\",\n \"--header\",\n \"Authorization:${AUTH_HEADER}\"\n ],\n \"env\": {\n \"AUTH_HEADER\": \"Bearer sk_live_xxx\"\n }\n }\n }\n}\n```\n\nTwo details in that snippet are load-bearing, and both are documented by\n`mcp-remote` itself:\n\n- **`${AUTH_HEADER}`, not `$AUTH_HEADER`.** Claude Desktop launches\n `command`/`args` directly, with no shell in between, so it does not expand\n `$VAR` anywhere in the config. `mcp-remote` does its own substitution on\n `--header` values, but only of the braced `${VAR}` form, reading it from the\n process environment the `env` block supplies. A bare `$BYTEKIT_API_KEY` is\n passed through untouched and authenticates as that literal string — a\n guaranteed `401`.\n- **No space after the colon in `Authorization:${AUTH_HEADER}`.** The header\n value carries the space (`Bearer sk_live_xxx`) instead. `mcp-remote`'s README\n documents this as the workaround for a Cursor / Claude Desktop (Windows) bug\n where spaces inside `args` are not escaped when it invokes `npx`, mangling the\n value: `\"Authorization:${AUTH_HEADER}\" // note no spaces around ':'` with\n `\"AUTH_HEADER\": \"Bearer <auth-token>\" // spaces OK in env vars`.\n\nOr skip the hosted endpoint entirely and run the **local stdio server**\n(Option 2 below), which Claude Desktop supports natively.\n\n## Option 2 — Local stdio (`npx`)\n\nRun the server as a local subprocess over stdio. Nothing to install globally —\n`npx` fetches it on demand:\n\n```bash\nnpx @hunt-labs/bytekit-mcp --api-key $BYTEKIT_API_KEY\n```\n\nOr set the key in your environment and omit the flag:\n\n```bash\nexport BYTEKIT_API_KEY=sk_live_xxx\nnpx @hunt-labs/bytekit-mcp\n```\n\nClient config for a stdio server:\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@hunt-labs/bytekit-mcp\"],\n \"env\": {\n \"BYTEKIT_API_KEY\": \"sk_live_xxx\"\n }\n }\n }\n}\n```\n\n### API-key resolution order\n\nThe local server resolves the key in this order:\n\n1. `--api-key <key>` flag\n2. `BYTEKIT_API_KEY` environment variable\n\n## Tool inventory\n\n| Tool | What it does |\n| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `scrape_url` | Fetch a URL and return HTML, clean markdown, links, or images. Optional `solve_challenge` (boolean): Attempt to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render. |\n| `web_search` | Run a web search and return ranked organic results. |\n| `screenshot_url` | Capture a screenshot of a page (desktop/mobile, PNG/JPEG). |\n| `get_result` | Fetch a previously created screenshot by id. |\n| `get_account` | Return account details, plan, and current usage/quota. |\n| `list_docs` | List every page in the bundled ByteKit documentation. |\n| `search_docs` | Search the bundled documentation. |\n| `get_doc` | Fetch the full markdown of one documentation page. |\n\nWhen `formats` is omitted, `scrape_url` returns markdown, whereas `POST /v1/scrape` returns\nraw. Pass `formats` to choose the format explicitly on either. The\n[Scraping guide](https://bytekit.com/docs/guides/scraping#response-fields) covers how markdown changes the cost.\n\nThe server also exposes **resources** (`bytekit://account`,\n`bytekit://screenshot/{id}`) and **prompts** (`summarize_webpage`,\n`extract_structured_data`, `research_topic`) that MCP hosts can surface directly.\n\n## Limits\n\nThe hosted `POST /mcp` endpoint caps request bodies at **1 MB**. MCP tool\narguments are small (a URL plus a few options), so this comfortably covers\nevery tool and prompt in the matrix above — including `research_topic`, the\nlargest legitimate call, which carries a list of URLs. An oversized request\ngets a `413` with a JSON-RPC-shaped error body rather than a dropped\nconnection.\n\nBody-size limits for the REST API routes are listed under\n[Request size limits](https://bytekit.com/docs/guides/rate-limits#request-size-limits).\n\n## Next steps\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — make your first ByteKit API call.\n- [Authentication](https://bytekit.com/docs/guides/authentication) — key formats and management."
435
+ "body": "# MCP Server\n\nCall ByteKit web capture as a native tool from Claude, Cursor, and any MCP-compatible agent — hosted over HTTP or run locally over stdio.\n\nThe ByteKit **MCP server** exposes scraping, search, screenshots, and account\nlookups as [Model Context Protocol](https://modelcontextprotocol.io) tools. Your\nagent calls `scrape_url` or `screenshot_url` the same way it calls any other\ntool — no wrapper to write, no headless browser to manage.\n\nThere are two ways to connect: a **hosted HTTP endpoint** (nothing to install)\nand a **local stdio server** (`npx @hunt-labs/bytekit-mcp`).\n\n## Authentication\n\nBoth paths authenticate with a ByteKit API key. Sign up at\n[app.bytekit.com](https://app.bytekit.com) and create a key (prefixed\n`sk_live_`). The local server reads it from the `BYTEKIT_API_KEY` environment\nvariable (or the `--api-key` flag); the hosted endpoint takes it as a bearer\ntoken.\n\n## Option 1 — Hosted HTTP (no install)\n\nPoint any MCP client that speaks the Streamable HTTP transport at:\n\n```\nhttps://api.bytekit.com/mcp\n```\n\nSend your API key as a bearer token. Example client config for a host that\nspeaks Streamable HTTP directly (Cursor and most hosts accept this shape):\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"url\": \"https://api.bytekit.com/mcp\",\n \"headers\": {\n \"Authorization\": \"Bearer sk_live_xxx\"\n }\n }\n }\n}\n```\n\n**Paste your real key in place of `sk_live_xxx`.** A JSON config file is not a\nshell: most hosts read these values verbatim and do not substitute environment\nvariables inside `headers`, so writing `Bearer $BYTEKIT_API_KEY` here sends that\ntext to the API as the token, verbatim, and the API answers `401`.\n\n**Claude Desktop does not accept this shape.** `claude_desktop_config.json`\nonly launches local **stdio** subprocesses (`command`/`args`/`env`) — it has\nno native `url`-based remote-server entry, so pasting the config above into\nit will not connect. To reach the hosted endpoint from Claude Desktop, either:\n\n- add ByteKit as a [Connector](https://claude.com/connectors) (Settings →\n Connectors → Add custom connector), or\n- bridge it locally with [`mcp-remote`](https://www.npmjs.com/package/mcp-remote):\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"mcp-remote\",\n \"https://api.bytekit.com/mcp\",\n \"--header\",\n \"Authorization:${AUTH_HEADER}\"\n ],\n \"env\": {\n \"AUTH_HEADER\": \"Bearer sk_live_xxx\"\n }\n }\n }\n}\n```\n\nTwo details in that snippet are load-bearing, and both are documented by\n`mcp-remote` itself:\n\n- **`${AUTH_HEADER}`, not `$AUTH_HEADER`.** Claude Desktop launches\n `command`/`args` directly, with no shell in between, so it does not expand\n `$VAR` anywhere in the config. `mcp-remote` does its own substitution on\n `--header` values, but only of the braced `${VAR}` form, reading it from the\n process environment the `env` block supplies. A bare `$BYTEKIT_API_KEY` is\n passed through untouched and authenticates as that literal string — a\n guaranteed `401`.\n- **No space after the colon in `Authorization:${AUTH_HEADER}`.** The header\n value carries the space (`Bearer sk_live_xxx`) instead. `mcp-remote`'s README\n documents this as the workaround for a Cursor / Claude Desktop (Windows) bug\n where spaces inside `args` are not escaped when it invokes `npx`, mangling the\n value: `\"Authorization:${AUTH_HEADER}\" // note no spaces around ':'` with\n `\"AUTH_HEADER\": \"Bearer <auth-token>\" // spaces OK in env vars`.\n\nOr skip the hosted endpoint entirely and run the **local stdio server**\n(Option 2 below), which Claude Desktop supports natively.\n\n## Option 2 — Local stdio (`npx`)\n\nRun the server as a local subprocess over stdio. Nothing to install globally —\n`npx` fetches it on demand:\n\n```bash\nnpx @hunt-labs/bytekit-mcp --api-key $BYTEKIT_API_KEY\n```\n\nOr set the key in your environment and omit the flag:\n\n```bash\nexport BYTEKIT_API_KEY=sk_live_xxx\nnpx @hunt-labs/bytekit-mcp\n```\n\nClient config for a stdio server:\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@hunt-labs/bytekit-mcp\"],\n \"env\": {\n \"BYTEKIT_API_KEY\": \"sk_live_xxx\"\n }\n }\n }\n}\n```\n\n### API-key resolution order\n\nThe local server resolves the key in this order:\n\n1. `--api-key <key>` flag\n2. `BYTEKIT_API_KEY` environment variable\n\n## Tool inventory\n\n| Tool | What it does |\n| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `scrape_url` | Fetch a URL and return HTML, clean markdown, links, or images. Optional `solve_challenge` (boolean): Attempt to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render. It needs a browser render, so the call may instead return a queued result with an sc\\_ ID to redeem with get_result. |\n| `web_search` | Run a web search and return ranked organic results. |\n| `screenshot_url` | Capture a screenshot of a page (desktop/mobile, PNG/JPEG). |\n| `get_result` | Fetch a previously created screenshot by id. |\n| `get_account` | Return account details, plan, and current usage/quota. |\n| `list_docs` | List every page in the bundled ByteKit documentation. |\n| `search_docs` | Search the bundled documentation. |\n| `get_doc` | Fetch the full markdown of one documentation page. |\n\nWhen `formats` is omitted, `scrape_url` returns markdown, whereas `POST /v1/scrape` returns\nraw. Pass `formats` to choose the format explicitly on either. The\n[Scraping guide](https://bytekit.com/docs/guides/scraping#response-fields) covers how markdown changes the cost.\n\nThe server also exposes **resources** (`bytekit://account`,\n`bytekit://screenshot/{id}`) and **prompts** (`summarize_webpage`,\n`extract_structured_data`, `research_topic`) that MCP hosts can surface directly.\n\n## Limits\n\nThe hosted `POST /mcp` endpoint caps request bodies at **1 MB**. MCP tool\narguments are small (a URL plus a few options), so this comfortably covers\nevery tool and prompt in the matrix above — including `research_topic`, the\nlargest legitimate call, which carries a list of URLs. An oversized request\ngets a `413` with a JSON-RPC-shaped error body rather than a dropped\nconnection.\n\nBody-size limits for the REST API routes are listed under\n[Request size limits](https://bytekit.com/docs/guides/rate-limits#request-size-limits).\n\n## Next steps\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — make your first ByteKit API call.\n- [Authentication](https://bytekit.com/docs/guides/authentication) — key formats and management."
436
436
  },
437
437
  "quickstart": {
438
438
  "title": "Quickstart",
@@ -447,67 +447,67 @@
447
447
  "sdk/python/account": {
448
448
  "title": "Account",
449
449
  "section": "SDK Reference",
450
- "body": "# Account\n\nFunctions for interacting with the `account` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Account\n\nGet account details\n\nReturns account, plan, and current API key details, including the\n`api_key` and `subscription` fields.\n\n**Call styles**\n\n```python\nsync_detailed(client=client) -> Response[Union[Error, Union['AccountBearerResponse', 'AccountSessionResponse']]]\nsync(client=client) -> Optional[Union[Error, Union['AccountBearerResponse', 'AccountSessionResponse']]]\nawait asyncio_detailed(client=client) -> Response[Union[Error, Union['AccountBearerResponse', 'AccountSessionResponse']]]\nawait asyncio(client=client) -> Optional[Union[Error, Union['AccountBearerResponse', 'AccountSessionResponse']]]\n```"
450
+ "body": "# Account\n\nFunctions for interacting with the `account` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Account\n\nGet account details\n\nReturns account, plan, and current API key details, including the\n`api_key` and `subscription` fields.\n\n**Call styles**\n\n```python\nsync_detailed(client=client) -> Response[AccountBearerResponse | AccountSessionResponse | Error]\nsync(client=client) -> AccountBearerResponse | AccountSessionResponse | Error | None\nawait asyncio_detailed(client=client) -> Response[AccountBearerResponse | AccountSessionResponse | Error]\nawait asyncio(client=client) -> AccountBearerResponse | AccountSessionResponse | Error | None\n```"
451
451
  },
452
452
  "sdk/python/bulk": {
453
453
  "title": "Bulk",
454
454
  "section": "SDK Reference",
455
- "body": "# Bulk\n\nFunctions for interacting with the `bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Bulk\n\nCreate mixed bulk job\n\nEnqueues screenshots or scrapes in a single batch.\nProvide `urls` (simple list) or `items` (per-item config), not both.\nWebhook deliveries include `X-ByteKit-Event: bulk.completed` so\nreceivers can dispatch on the header without parsing the body shape.\nThe body follows `BulkCompletedWebhook`: at most 500 complete items and\n1 MiB, followed by cursor recovery through the existing mixed-item route\nwhenever `recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 4 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 32 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's richer per-item override\nbudget), which reaches 28.7 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 4 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (CreateBulkBody): Provide `urls` (simple list) OR `items` (per-item config), not`\n- `both. `type` selects the capture kind per entry — only`\n- ``screenshot` and `scrape` are accepted (`recording` is`\n- `deactivated). Behaviour fields may be set per item or via`\n- ``defaults`; a per-item value overrides the matching default.`\n- `This includes `type`: an entry with no `type` of its own`\n- `inherits `defaults.type`, falling back to `screenshot` only`\n- `when neither is set.`\n- `The top-level object, each `items[]` entry, and `defaults``\n- `each reject unrecognized keys with a 422 `validation_error``\n- `(the offending key name appears in the error's `details``\n- `message text) rather than silently discarding them.`\n- ``items[]` and `defaults` do not share one field set`\n- ``device_scale_factor` is accepted only under `defaults` (a`\n- `per-item value 422s), and `duration`/`scenario` are accepted`\n- `only per item (a `defaults` value 422s). `metadata` is`\n- `different from those three: it is valid both at the top`\n- `level of the body and per item, but rejected with a 422 if`\n- `placed under `defaults`. See the `422` response below.`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `urls` — `Union[Unset, list[str]]` — Simple URL list. Provide urls OR items, not both.\n- `items` — `Union[Unset, list['CreateBulkBodyItemsItem']]` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `Union[Unset, CreateBulkBodyDefaults]` — Default behaviour applied to every entry unless the item overrides it.\n- `webhook_secret` — `Union[Unset, str]` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, CreateBulkResponse403, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateBulkResponse202, CreateBulkResponse403, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, CreateBulkResponse403, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateBulkResponse202, CreateBulkResponse403, Error]]\n```\n\n## Delete Bulk\n\nCancel a bulk job\n\nCancels an in-flight bulk job: drains its still-queued (pending) child jobs and refunds the quota\nheld for exactly those drained children. Children already completed, failed, or in progress are\nuntouched and keep their charge. Idempotent — cancelling an already-terminal job (completed, failed,\nor cancelled) is a no-op that returns 200 with the job's real, unchanged status and refunds nothing.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[DeleteBulkResponse200, Error]]\nsync(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[DeleteBulkResponse200, Error]]\nawait asyncio(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\n```\n\n## Get Bulk\n\nGet bulk job status\n\nReturns the job envelope. Items are listed by `GET /v1/bulk/\\{id\\}/screenshots`.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/scrape/bulk` or `POST /v1/fetch/bulk` is found here too, not\na `404`, with that job's envelope. An id from another account answers `404`.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200, GetBulkResponse202]]\nsync(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200, GetBulkResponse202]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200, GetBulkResponse202]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200, GetBulkResponse202]]\n```\n\n## List Bulk Screenshots\n\nList bulk job items\n\nReturns the bulk job's items, discriminated by `type`.\n\n**Downloading item artifacts.** For a `completed` item with a storage key,\n`image_url` (`type: screenshot`) and both `content_url` and `markdown_url`\n(`type: scrape`) are **pre-signed** URLs, minted fresh on every read of\nthis endpoint and valid for **600 seconds (10 minutes)** —\nthe same signing lifetime as `content_url` on `GET /v1/fetch/bulk/\\{id\\}`.\nDownload inside that window, or re-poll this endpoint for a fresh\nsignature.\n\n**When no signature is minted.** Three cases mint none: an item that is not\n`completed`, a `completed` item with no storage key, and a `completed` item\nwhose object could not be signed — during an object-storage outage, for\ninstance. In all three the item's stored value is returned unchanged: `null`\nwhile nothing has been stored, and otherwise a **private, unsigned**\nobject-storage URL that answers `401`. These fields are neither nulled nor\nflagged in that case, so treat an artifact URL as usable only once you have\ndownloaded it, and re-poll for a fresh signature otherwise.\n`artifact_warnings` and its `artifact_unavailable` code describe the sibling\n`artifacts` object on `type: scrape` items only — they say nothing about\n`image_url`, `content_url`, or `markdown_url`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (Union[Unset, str])`\n- `limit (Union[Unset, int])`\n- `status (Union[Unset, ListBulkScreenshotsStatus])`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, ListBulkScreenshotsResponse200]]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, ListBulkScreenshotsResponse200]]\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, ListBulkScreenshotsResponse200]]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, ListBulkScreenshotsResponse200]]\n```"
455
+ "body": "# Bulk\n\nFunctions for interacting with the `bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Bulk\n\nCreate mixed bulk job\n\nEnqueues screenshots or scrapes in a single batch.\nProvide `urls` (simple list) or `items` (per-item config), not both.\nWebhook deliveries include `X-ByteKit-Event: bulk.completed` so\nreceivers can dispatch on the header without parsing the body shape.\nThe body follows `BulkCompletedWebhook`: at most 500 complete items and\n1 MiB, followed by cursor recovery through the existing mixed-item route\nwhenever `recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 4 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 32 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's richer per-item override\nbudget), which reaches 28.7 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 4 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (CreateBulkBody): Provide `urls` (simple list) OR `items` (per-item config), not`\n- `both. `type` selects the capture kind per entry — only`\n- ``screenshot` and `scrape` are accepted (`recording` is`\n- `deactivated). Behaviour fields may be set per item or via`\n- ``defaults`; a per-item value overrides the matching default.`\n- `This includes `type`: an entry with no `type` of its own`\n- `inherits `defaults.type`, falling back to `screenshot` only`\n- `when neither is set.`\n- `The top-level object, each `items[]` entry, and `defaults``\n- `each reject unrecognized keys with a 422 `validation_error``\n- `(the offending key name appears in the error's `details``\n- `message text) rather than silently discarding them.`\n- ``items[]` and `defaults` do not share one field set`\n- ``device_scale_factor` is accepted only under `defaults` (a`\n- `per-item value 422s), and `duration`/`scenario` are accepted`\n- `only per item (a `defaults` value 422s). `metadata` is`\n- `different from those three: it is valid both at the top`\n- `level of the body and per item, but rejected with a 422 if`\n- `placed under `defaults`. See the `422` response below.`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `urls` — `list[str] | Unset` — Simple URL list. Provide urls OR items, not both.\n- `items` — `list[CreateBulkBodyItemsItem] | Unset` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `CreateBulkBodyDefaults | Unset` — Default behaviour applied to every entry unless the item overrides it.\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateBulkResponse202 | CreateBulkResponse403 | Error]\nsync(client=client, body=body) -> CreateBulkResponse202 | CreateBulkResponse403 | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateBulkResponse202 | CreateBulkResponse403 | Error]\nawait asyncio(client=client, body=body) -> CreateBulkResponse202 | CreateBulkResponse403 | Error | None\n```\n\n## Delete Bulk\n\nCancel a bulk job\n\nCancels an in-flight bulk job: drains its still-queued (pending) child jobs and refunds the quota\nheld for exactly those drained children. Children already completed, failed, or in progress are\nuntouched and keep their charge. Idempotent — cancelling an already-terminal job (completed, failed,\nor cancelled) is a no-op that returns 200 with the job's real, unchanged status and refunds nothing.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[DeleteBulkResponse200 | Error]\nsync(id=id, client=client) -> DeleteBulkResponse200 | Error | None\nawait asyncio_detailed(id=id, client=client) -> Response[DeleteBulkResponse200 | Error]\nawait asyncio(id=id, client=client) -> DeleteBulkResponse200 | Error | None\n```\n\n## Get Bulk\n\nGet bulk job status\n\nReturns the job envelope. Items are listed by `GET /v1/bulk/\\{id\\}/screenshots`.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/scrape/bulk` or `POST /v1/fetch/bulk` is found here too, not\na `404`, with that job's envelope. An id from another account answers `404`.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | GetBulkResponse200 | GetBulkResponse202]\nsync(id=id, client=client) -> Error | GetBulkResponse200 | GetBulkResponse202 | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | GetBulkResponse200 | GetBulkResponse202]\nawait asyncio(id=id, client=client) -> Error | GetBulkResponse200 | GetBulkResponse202 | None\n```\n\n## List Bulk Screenshots\n\nList bulk job items\n\nReturns the bulk job's items, discriminated by `type`.\n\n**Downloading item artifacts.** For a `completed` item with a storage key,\n`image_url` (`type: screenshot`) and both `content_url` and `markdown_url`\n(`type: scrape`) are **pre-signed** URLs, minted fresh on every read of\nthis endpoint and valid for **600 seconds (10 minutes)** —\nthe same signing lifetime as `content_url` on `GET /v1/fetch/bulk/\\{id\\}`.\nDownload inside that window, or re-poll this endpoint for a fresh\nsignature.\n\n**When no signature is minted.** Three cases mint none: an item that is not\n`completed`, a `completed` item with no storage key, and a `completed` item\nwhose object could not be signed — during an object-storage outage, for\ninstance. In all three the item's stored value is returned unchanged: `null`\nwhile nothing has been stored, and otherwise a **private, unsigned**\nobject-storage URL that answers `401`. These fields are neither nulled nor\nflagged in that case, so treat an artifact URL as usable only once you have\ndownloaded it, and re-poll for a fresh signature otherwise.\n`artifact_warnings` and its `artifact_unavailable` code describe the sibling\n`artifacts` object on `type: scrape` items only — they say nothing about\n`image_url`, `content_url`, or `markdown_url`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (str | Unset)`\n- `limit (int | Unset)`\n- `status (ListBulkScreenshotsStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | ListBulkScreenshotsResponse200]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | ListBulkScreenshotsResponse200 | None\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | ListBulkScreenshotsResponse200]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | ListBulkScreenshotsResponse200 | None\n```"
456
456
  },
457
457
  "sdk/python/client": {
458
458
  "title": "Client",
459
459
  "section": "SDK Reference",
460
- "body": "# Client\n\nThe ByteKit Python SDK provides two client classes for making API requests.\n\nInstall the SDK, create a client, run a scrape and read the markdown:\n\n```python\n# pip install bytekit-sdk (import name: bytekit)\nimport os\n\nfrom bytekit import ByteKit\nfrom bytekit.models import ScrapeSuccessEnvelope\n\nclient = ByteKit(api_key=os.environ[\"BYTEKIT_API_KEY\"])\nresult = client.scrape.create(url=\"https://example.com\", formats=[\"markdown\"])\nif isinstance(result, ScrapeSuccessEnvelope):\n print(result.formats.markdown)\n```\n\n## Client\n\nA class for keeping track of data related to the API\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded. A connection that never gets established at\nall — DNS failure, refused connection, TLS handshake failure — raises its transport\nsibling httpx.ConnectError instead. Neither is caught by this SDK: both propagate to the\ncaller, on the generated operations and on ``AuthenticatedClient.search`` alike.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'Client'\n```\n\nGet a new client matching this one with a new timeout (in seconds)\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> 'Client'\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> 'Client'\n```\n\nManually the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set\n\n## AuthenticatedClient\n\nA Client which has been authenticated for use on secured endpoints\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded. A connection that never gets established at\nall — DNS failure, refused connection, TLS handshake failure — raises its transport\nsibling httpx.ConnectError instead. Neither is caught by this SDK: both propagate to the\ncaller, on the generated operations and on ``AuthenticatedClient.search`` alike.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\ntoken: The token to use for authentication. KEYWORD-ONLY.\nprefix: The prefix to use for the Authorization header. KEYWORD-ONLY.\nauth_header_name: The name of the Authorization header. KEYWORD-ONLY.\nAll three are keyword-only so that the pre-0.3.0 positional call\n``AuthenticatedClient(base_url, token)`` raises TypeError instead of\nsilently binding the base URL to ``token`` and the API key to ``prefix``.\n\n### search\n\n```python\nsearch(query: str, type: Optional[Union['CreateSearchBodyType', Literal['web', 'news', 'images']]] = None, limit: Optional[int] = None, country: Optional[str] = None, language: Optional[str] = None, date_range: Optional[Union['CreateSearchBodyDateRange', Literal['any', 'hour', 'day', 'week', 'month', 'year']]] = None) -> 'CreateSearchResponse200'\n```\n\nRun a web search and return ranked organic results.\n\nThin, statically-declared delegate to the hand-written ``_search`` appended at the\nbottom of this module; the full contract (argument semantics, the\n``errors.UnexpectedStatus`` guarantee) is documented there.\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with a new timeout (in seconds)\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> 'AuthenticatedClient'\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> 'AuthenticatedClient'\n```\n\nManually the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set"
460
+ "body": "# Client\n\nThe ByteKit Python SDK provides two client classes for making API requests.\n\nInstall the SDK, create a client, run a scrape and read the markdown:\n\n```python\n# pip install bytekit-sdk (import name: bytekit)\nimport os\n\nfrom bytekit import ByteKit\nfrom bytekit.models import ScrapeSuccessEnvelope\n\nclient = ByteKit(api_key=os.environ[\"BYTEKIT_API_KEY\"])\nresult = client.scrape.create(url=\"https://example.com\", formats=[\"markdown\"])\nif isinstance(result, ScrapeSuccessEnvelope):\n print(result.formats.markdown)\n```\n\n## Client\n\nA class for keeping track of data related to the API\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded. A connection that never gets established at\nall — DNS failure, refused connection, TLS handshake failure — raises its transport\nsibling httpx.ConnectError instead. Neither is caught by this SDK: both propagate to the\ncaller, on the generated operations and on ``AuthenticatedClient.search`` alike.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'Client'\n```\n\nGet a new client matching this one with a new timeout configuration\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> Self\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> Self\n```\n\nManually set the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set\n\n## AuthenticatedClient\n\nA Client which has been authenticated for use on secured endpoints\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded. A connection that never gets established at\nall — DNS failure, refused connection, TLS handshake failure — raises its transport\nsibling httpx.ConnectError instead. Neither is caught by this SDK: both propagate to the\ncaller, on the generated operations and on ``AuthenticatedClient.search`` alike.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\ntoken: The token to use for authentication. KEYWORD-ONLY.\nprefix: The prefix to use for the Authorization header. KEYWORD-ONLY.\nauth_header_name: The name of the Authorization header. KEYWORD-ONLY.\nAll three are keyword-only so that the pre-0.3.0 positional call\n``AuthenticatedClient(base_url, token)`` raises TypeError instead of\nsilently binding the base URL to ``token`` and the API key to ``prefix``.\n\n### search\n\n```python\nsearch(query: str, type: Optional[Union['CreateSearchBodyType', Literal['web', 'news', 'images']]] = None, limit: Optional[int] = None, country: Optional[str] = None, language: Optional[str] = None, date_range: Optional[Union['CreateSearchBodyDateRange', Literal['any', 'hour', 'day', 'week', 'month', 'year']]] = None) -> 'CreateSearchResponse200'\n```\n\nRun a web search and return ranked organic results.\n\nThin, statically-declared delegate to the hand-written ``_search`` appended at the\nbottom of this module; the full contract (argument semantics, the\n``errors.UnexpectedStatus`` guarantee) is documented there.\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with a new timeout configuration\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> Self\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> Self\n```\n\nManually set the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set"
461
461
  },
462
462
  "sdk/python/fetch": {
463
463
  "title": "Fetch",
464
464
  "section": "SDK Reference",
465
- "body": "# Fetch\n\nFunctions for interacting with the `fetch` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Fetch\n\nFetch a URL (GET)\n\nDirect HTTP fetch. Metadata is returned in X-Fetch-* headers. What the body holds\ndepends on `X-Fetch-Fast-Path`. When it is `true`, a successful response returns the\nupstream response bytes verbatim. When it is `false` the request fell back to a browser\nrender, and the body is the rendered page rather than the bytes the target sent;\n`X-Fetch-Content-Length` is then the compressed size of that page. Non-2xx upstream\nresponses use the `upstream_error` JSON envelope with the upstream HTTP status.\n\n**Parameters**\n\n- `url_query (str)`\n- `country (Union[Unset, str])`\n- `timeout_ms (Union[Unset, int])`\n- `cache_ttl (Union[GetFetchCacheTtlType1, Unset, str])`\n- `custom (Union[Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Response[Union[Error, str]]\nsync(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Optional[Union[Error, str]]\nawait asyncio_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Response[Union[Error, str]]\nawait asyncio(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Optional[Union[Error, str]]\n```\n\n## Post Fetch\n\nFetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body. The response is the same, including\nthe `X-Fetch-Fast-Path` rule for what the body holds: the upstream bytes verbatim when\nit is `true`, the rendered page when it is `false`.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (FetchRequest)`\n- `url` — `str`\n- `country` — `Union[Unset, str]` — Two-letter country code. Either case is accepted; the value is upper-cased.\n- `timeout_ms` — `Union[Unset, int]`\n- `cache_ttl` — `Union[FetchRequestCacheTtlType1, Unset, str]` — How long a freshly fetched URL may be served from cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts `Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values receive a 422 validation_error with an actionable message.\n- `custom` — `Union[Unset, FetchRequestCustom]` — User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom` response header so callers can correlate the response back to caller-side state (job IDs, batch metadata, etc.). Capped at 4096 UTF-8 bytes after JSON serialization. Does NOT affect cache-key inputs — two requests differing only in `custom` share the same cache slot.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[Error, str]]\nsync(client=client, body=body) -> Optional[Union[Error, str]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[Error, str]]\nawait asyncio(client=client, body=body) -> Optional[Union[Error, str]]\n```"
465
+ "body": "# Fetch\n\nFunctions for interacting with the `fetch` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Fetch\n\nFetch a URL (GET)\n\nDirect HTTP fetch. Metadata is returned in X-Fetch-* headers. What the body holds\ndepends on `X-Fetch-Fast-Path`. When it is `true`, a successful response returns the\nupstream response bytes verbatim. When it is `false` the request fell back to a browser\nrender, and the body is the rendered page rather than the bytes the target sent;\n`X-Fetch-Content-Length` is then the compressed size of that page. Non-2xx upstream\nresponses use the `upstream_error` JSON envelope with the upstream HTTP status.\n\n**Parameters**\n\n- `url_query (str)`\n- `country (str | Unset)`\n- `timeout_ms (int | Unset)`\n- `cache_ttl (GetFetchCacheTtlType1 | str | Unset)`\n- `custom (str | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Response[Error | str]\nsync(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Error | str | None\nawait asyncio_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Response[Error | str]\nawait asyncio(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Error | str | None\n```\n\n## Post Fetch\n\nFetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body. The response is the same, including\nthe `X-Fetch-Fast-Path` rule for what the body holds: the upstream bytes verbatim when\nit is `true`, the rendered page when it is `false`.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (FetchRequest)`\n- `url` — `str`\n- `country` — `str | Unset` — Two-letter country code. Either case is accepted; the value is upper-cased.\n- `timeout_ms` — `int | Unset`\n- `cache_ttl` — `FetchRequestCacheTtlType1 | str | Unset` — How long a freshly fetched URL may be served from cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts `Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values receive a 422 validation_error with an actionable message.\n- `custom` — `FetchRequestCustom | Unset` — User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom` response header so callers can correlate the response back to caller-side state (job IDs, batch metadata, etc.). Capped at 4096 UTF-8 bytes after JSON serialization. Does NOT affect cache-key inputs — two requests differing only in `custom` share the same cache slot.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Error | str]\nsync(client=client, body=body) -> Error | str | None\nawait asyncio_detailed(client=client, body=body) -> Response[Error | str]\nawait asyncio(client=client, body=body) -> Error | str | None\n```"
466
466
  },
467
467
  "sdk/python/fetch-bulk": {
468
468
  "title": "Fetch Bulk",
469
469
  "section": "SDK Reference",
470
- "body": "# Fetch Bulk\n\nFunctions for interacting with the `fetch_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Fetch Bulk\n\nBulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (wait_for_selector, etc.).\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/fetch/bulk/\\{id\\}` whenever\n`recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 2 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 20 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's per-item override budget),\nwhich reaches 16.8 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 2 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (CreateFetchBulkBody)`\n- `urls` — `list[Union['CreateFetchBulkBodyUrlsItemType1', str]]`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `defaults` — `Union[Unset, CreateFetchBulkBodyDefaults]`\n- `webhook_secret` — `Union[Unset, str]` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, CreateFetchBulkResponse403, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, CreateFetchBulkResponse403, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, CreateFetchBulkResponse403, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, CreateFetchBulkResponse403, Error]]\n```\n\n## Get Fetch Bulk\n\nGet fetch bulk job status\n\nReturns the job envelope plus its per-URL items.\n\n**Downloading item content.** Each completed item's `content_url` is a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **600 seconds (10 minutes)** — the same signing lifetime as the\n`image_url` returned by `GET /v1/bulk/\\{id\\}/screenshots`. The underlying\nobjects are private, so an unsigned URL returns `401`: download the\ncontent inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, or completed items whose object cannot be signed, carry\n`null`; the latter report `artifact_unavailable`. The private unsigned\nstorage URL is never returned.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/scrape/bulk` or `POST /v1/bulk` is found here too, not a\n`404`, with the job envelope and `items: []`: only items fetched through\n`POST /v1/fetch/bulk` are listed. An id from another account answers `404`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (Union[Unset, str])`\n- `limit (Union[Unset, int])`\n- `status (Union[Unset, GetFetchBulkStatus])`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\n```"
470
+ "body": "# Fetch Bulk\n\nFunctions for interacting with the `fetch_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Fetch Bulk\n\nBulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (wait_for_selector, etc.).\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/fetch/bulk/\\{id\\}` whenever\n`recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 2 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 20 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's per-item override budget),\nwhich reaches 16.8 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 2 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (CreateFetchBulkBody)`\n- `urls` — `list[CreateFetchBulkBodyUrlsItemType1 | str]`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `defaults` — `CreateFetchBulkBodyDefaults | Unset`\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error]\nsync(client=client, body=body) -> CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error]\nawait asyncio(client=client, body=body) -> CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error | None\n```\n\n## Get Fetch Bulk\n\nGet fetch bulk job status\n\nReturns the job envelope plus its per-URL items.\n\n**Downloading item content.** Each completed item's `content_url` is a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **600 seconds (10 minutes)** — the same signing lifetime as the\n`image_url` returned by `GET /v1/bulk/\\{id\\}/screenshots`. The underlying\nobjects are private, so an unsigned URL returns `401`: download the\ncontent inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, or completed items whose object cannot be signed, carry\n`null`; the latter report `artifact_unavailable`. The private unsigned\nstorage URL is never returned.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/scrape/bulk` or `POST /v1/bulk` is found here too, not a\n`404`, with the job envelope and `items: []`: only items fetched through\n`POST /v1/fetch/bulk` are listed. An id from another account answers `404`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (str | Unset)`\n- `limit (int | Unset)`\n- `status (GetFetchBulkStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetFetchBulkResponse200 | GetFetchBulkResponse202]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetFetchBulkResponse200 | GetFetchBulkResponse202 | None\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetFetchBulkResponse200 | GetFetchBulkResponse202]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetFetchBulkResponse200 | GetFetchBulkResponse202 | None\n```"
471
471
  },
472
472
  "sdk/python/monitors": {
473
473
  "title": "Monitors",
474
474
  "section": "SDK Reference",
475
- "body": "# Monitors\n\nFunctions for interacting with the `monitors` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\nFirst-capture behavior is the same for both monitor types: the first capture is a silent baseline (`has_change=False`, `change_pct=None`) with no `change_detected` webhook, whether the monitor is `scrape` or `screenshot`. From the second capture onward both types diff against the previous capture.\n\n## Create Monitor\n\nCreate a change-detection monitor\n\nCreates a recurring change-detection monitor for a URL, delivering results via webhook.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (MonitorCreateRequest)`\n- `url` — `str`\n- `interval_type` — `MonitorCreateRequestIntervalType`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `type_` — `Union[Unset, MonitorCreateRequestType]`\n- `cron_expression` — `Union[Unset, str]` — 5-field cron expression. Required when interval_type is \"cron\".\n- `change_threshold` — `Union[Unset, float]`\n- `notify_on` — `Union[Unset, MonitorCreateRequestNotifyOn]`\n- `webhook_secret` — `Union[Unset, str]` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `webhook_headers` — `Union[Unset, MonitorCreateRequestWebhookHeaders]` — Max 20 headers. Keys must match /^[A-Za-z0-9-]+$/ and not be reserved.\n- `options` — `Union[Unset, MonitorCreateRequestOptions]` — Screenshot monitor options (device, viewport, format, etc.).\n- `scrape_options` — `Union[Unset, MonitorCreateRequestScrapeOptions]` — Scrape monitor options (formats, country, wait_for_selector, wait_until, delay_ms). Only for type=scrape.\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[Error, MonitorCreateResponse]]\nsync(client=client, body=body) -> Optional[Union[Error, MonitorCreateResponse]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[Error, MonitorCreateResponse]]\nawait asyncio(client=client, body=body) -> Optional[Union[Error, MonitorCreateResponse]]\n```\n\n## Delete Monitor\n\nCancel monitor\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Any, Error]]\nsync(id=id, client=client) -> Optional[Union[Any, Error]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Any, Error]]\nawait asyncio(id=id, client=client) -> Optional[Union[Any, Error]]\n```\n\n## Get Monitor\n\nGet monitor\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, MonitorResponse]]\nsync(id=id, client=client) -> Optional[Union[Error, MonitorResponse]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, MonitorResponse]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, MonitorResponse]]\n```\n\n## List Monitor Captures\n\nList monitor captures\n\n**Parameters**\n\n- `id (str)`\n- `limit (Union[Unset, int])`\n- `cursor (Union[Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, limit=limit, cursor=cursor) -> Response[Union[Error, ListMonitorCapturesResponse200]]\nsync(id=id, client=client, limit=limit, cursor=cursor) -> Optional[Union[Error, ListMonitorCapturesResponse200]]\nawait asyncio_detailed(id=id, client=client, limit=limit, cursor=cursor) -> Response[Union[Error, ListMonitorCapturesResponse200]]\nawait asyncio(id=id, client=client, limit=limit, cursor=cursor) -> Optional[Union[Error, ListMonitorCapturesResponse200]]\n```\n\n## List Monitors\n\nList monitors\n\n**Parameters**\n\n- `limit (Union[Unset, int])`\n- `cursor (Union[Unset, str])`\n- `status (Union[Unset, ListMonitorsStatus])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, limit=limit, cursor=cursor, status=status) -> Response[Union[Error, ListMonitorsResponse200]]\nsync(client=client, limit=limit, cursor=cursor, status=status) -> Optional[Union[Error, ListMonitorsResponse200]]\nawait asyncio_detailed(client=client, limit=limit, cursor=cursor, status=status) -> Response[Union[Error, ListMonitorsResponse200]]\nawait asyncio(client=client, limit=limit, cursor=cursor, status=status) -> Optional[Union[Error, ListMonitorsResponse200]]\n```\n\n## Update Monitor\n\nUpdate monitor\n\n**Parameters**\n\n- `id (str)`\n- `body (MonitorUpdateRequest)`\n- `url` — `Union[Unset, str]`\n- `interval_type` — `Union[Unset, MonitorUpdateRequestIntervalType]`\n- `cron_expression` — `Union[Unset, str]`\n- `change_threshold` — `Union[Unset, float]`\n- `notify_on` — `Union[Unset, MonitorUpdateRequestNotifyOn]`\n- `webhook_url` — `Union[Unset, str]` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `webhook_secret` — `Union[Unset, str]` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `webhook_headers` — `Union[Unset, MonitorUpdateRequestWebhookHeaders]`\n- `status` — `Union[Unset, MonitorUpdateRequestStatus]`\n- `options` — `Union[Unset, MonitorUpdateRequestOptions]`\n- `scrape_options` — `Union[Unset, MonitorUpdateRequestScrapeOptions]`\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, body=body) -> Response[Union[Error, MonitorResponse]]\nsync(id=id, client=client, body=body) -> Optional[Union[Error, MonitorResponse]]\nawait asyncio_detailed(id=id, client=client, body=body) -> Response[Union[Error, MonitorResponse]]\nawait asyncio(id=id, client=client, body=body) -> Optional[Union[Error, MonitorResponse]]\n```"
475
+ "body": "# Monitors\n\nFunctions for interacting with the `monitors` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\nFirst-capture behavior is the same for both monitor types: the first capture is a silent baseline (`has_change=False`, `change_pct=None`) with no `change_detected` webhook, whether the monitor is `scrape` or `screenshot`. From the second capture onward both types diff against the previous capture.\n\n## Create Monitor\n\nCreate a change-detection monitor\n\nCreates a recurring change-detection monitor for a URL, delivering results via webhook.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (MonitorCreateRequest)`\n- `url` — `str`\n- `interval_type` — `MonitorCreateRequestIntervalType`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `type_` — `MonitorCreateRequestType | Unset`\n- `cron_expression` — `str | Unset` — 5-field cron expression. Required when interval_type is \"cron\".\n- `change_threshold` — `float | Unset`\n- `notify_on` — `MonitorCreateRequestNotifyOn | Unset`\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `webhook_headers` — `MonitorCreateRequestWebhookHeaders | Unset` — Max 20 headers. Keys must match /^[A-Za-z0-9-]+$/ and not be reserved.\n- `options` — `MonitorCreateRequestOptions | Unset` — Screenshot monitor options (device, viewport, format, etc.).\n- `scrape_options` — `MonitorCreateRequestScrapeOptions | Unset` — Scrape monitor options (formats, country, wait_for_selector, wait_until, delay_ms). Only for type=scrape.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Error | MonitorCreateResponse]\nsync(client=client, body=body) -> Error | MonitorCreateResponse | None\nawait asyncio_detailed(client=client, body=body) -> Response[Error | MonitorCreateResponse]\nawait asyncio(client=client, body=body) -> Error | MonitorCreateResponse | None\n```\n\n## Delete Monitor\n\nCancel monitor\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Any | Error]\nsync(id=id, client=client) -> Any | Error | None\nawait asyncio_detailed(id=id, client=client) -> Response[Any | Error]\nawait asyncio(id=id, client=client) -> Any | Error | None\n```\n\n## Get Monitor\n\nGet monitor\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | MonitorResponse]\nsync(id=id, client=client) -> Error | MonitorResponse | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | MonitorResponse]\nawait asyncio(id=id, client=client) -> Error | MonitorResponse | None\n```\n\n## List Monitor Captures\n\nList monitor captures\n\n**Parameters**\n\n- `id (str)`\n- `limit (int | Unset)`\n- `cursor (str | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, limit=limit, cursor=cursor) -> Response[Error | ListMonitorCapturesResponse200]\nsync(id=id, client=client, limit=limit, cursor=cursor) -> Error | ListMonitorCapturesResponse200 | None\nawait asyncio_detailed(id=id, client=client, limit=limit, cursor=cursor) -> Response[Error | ListMonitorCapturesResponse200]\nawait asyncio(id=id, client=client, limit=limit, cursor=cursor) -> Error | ListMonitorCapturesResponse200 | None\n```\n\n## List Monitors\n\nList monitors\n\n**Parameters**\n\n- `limit (int | Unset)`\n- `cursor (str | Unset)`\n- `status (ListMonitorsStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, limit=limit, cursor=cursor, status=status) -> Response[Error | ListMonitorsResponse200]\nsync(client=client, limit=limit, cursor=cursor, status=status) -> Error | ListMonitorsResponse200 | None\nawait asyncio_detailed(client=client, limit=limit, cursor=cursor, status=status) -> Response[Error | ListMonitorsResponse200]\nawait asyncio(client=client, limit=limit, cursor=cursor, status=status) -> Error | ListMonitorsResponse200 | None\n```\n\n## Update Monitor\n\nUpdate monitor\n\n**Parameters**\n\n- `id (str)`\n- `body (MonitorUpdateRequest)`\n- `url` — `str | Unset`\n- `interval_type` — `MonitorUpdateRequestIntervalType | Unset`\n- `cron_expression` — `str | Unset`\n- `change_threshold` — `float | Unset`\n- `notify_on` — `MonitorUpdateRequestNotifyOn | Unset`\n- `webhook_url` — `str | Unset` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `webhook_headers` — `MonitorUpdateRequestWebhookHeaders | Unset`\n- `status` — `MonitorUpdateRequestStatus | Unset`\n- `options` — `MonitorUpdateRequestOptions | Unset`\n- `scrape_options` — `MonitorUpdateRequestScrapeOptions | Unset`\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, body=body) -> Response[Error | MonitorResponse]\nsync(id=id, client=client, body=body) -> Error | MonitorResponse | None\nawait asyncio_detailed(id=id, client=client, body=body) -> Response[Error | MonitorResponse]\nawait asyncio(id=id, client=client, body=body) -> Error | MonitorResponse | None\n```"
476
476
  },
477
477
  "sdk/python/scrape": {
478
478
  "title": "Scrape",
479
479
  "section": "SDK Reference",
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 `![alt](url)` as-is. 'text' strips the URL, keeping only alt text. 'none' removes images entirely. 'references' converts to numbered `![alt][N]` refs with an Images footer. Distinct from markdown_filter_images (which drops low-signal images before conversion).\n- `with_links_summary` — `Union[Unset, bool]` — When true, appends a 'Links:\\n[1]: url\\n...' footer to the markdown output, built from the extracted link list. Automatically enabled when markdown_links is 'references'.\n- `with_images_summary` — `Union[Unset, bool]` — When true, appends an 'Images:\\n[1]: url\\n...' footer to the markdown output, built from the extracted image list.\n- `markdown_compact` — `Union[Unset, bool]` — Collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — `Union[Unset, bool]` — Filter low-signal images from the markdown output.\n- `markdown_include_media` — `Union[Unset, bool]` — When true, `formats.links` and `formats.images` return `ScrapeScoredLink[]` / `ScrapeScoredImage[]` (rich objects) instead of `string[]`, and a top-level `tables` array is included. Only effective when `markdown` is in `formats`.\n- `markdown_include_warnings` — `Union[Unset, bool]` — When true, enables markdown-pipeline and tag-filter warnings for requests that include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may appear independently of this flag.\n- `markdown_include_stats` — `Union[Unset, bool]` — When true, the response includes a top-level `stats` object with `ScrapeStats` (chars, tokens, blocks). Only effective when `markdown` is in `formats`.\n- `token_budget` — `Union[Unset, int]` — Maximum token count for the markdown output. When set and `markdown` is in `formats`, the output is truncated at the last paragraph → sentence → token boundary that keeps the estimated count under this limit. Absent → no truncation. Triggers a `markdown_tokens` field in the response.\n- `token_encoding` — `Union[Unset, ScrapeRequestTokenEncoding]` — Tokenizer encoding hint for `token_budget`. `cl100k_base` (default) matches GPT-4/4o; `o200k_base` matches GPT-4o-mini / o-series. Both use the same 4-char/token heuristic internally.\n- `mobile` — `Union[Unset, bool]` — When true, emulate a mobile device — the request uses a mobile (Android) user agent and a mobile viewport, so the upstream serves the mobile version of the page. Default false (desktop). The value is part of the cache key, so mobile and desktop responses are cached independently.\n- `solve_challenge` — `Union[Unset, bool]` — Attempts to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render.\n- `remove_base64_images` — `Union[Unset, bool]` — When true (default), base64-encoded `data:` image sources are stripped from the HTML before markdown conversion. Set to false to preserve base64 images in the pipeline output. Does not affect `raw`, which always returns the original source unchanged.\n- `include_tags` — `Union[Unset, list[str]]` — HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in the `markdown` output. Applied before `exclude_tags`. Does not affect `raw`, which always returns the full page.\n- `exclude_tags` — `Union[Unset, list[str]]` — HTML element names (not CSS selectors) to strip from the `markdown` output. Applied after `include_tags` when both are present. Does not affect `raw`, which always returns the full page.\n- `cache_ttl` — `Union[ScrapeRequestCacheTtlType1, Unset, str]` — How long a freshly fetched URL may be served from cache. `0` (string or integer) skips the cache read; cache-eligible results are still written. `Nh`/`Nd` set a TTL (capped at 168 h / 7 d). Safety-classified WAF husks are returned live but never stored in the shared cache. Honoured on both the synchronous and asynchronous paths; the async success envelope reports the lookup outcome via the `cache` field.\n- `custom` — `Union[Unset, ScrapeRequestCustom]` — User-supplied JSON payload, echoed back on the success envelope (sync, async, webhook). Capped at 4096 UTF-8 bytes (`Buffer.byteLength`). Distinct from the system-owned `metadata` column. Does NOT affect cache-key inputs — two requests differing only in `custom` resolve to the same cache entry.\n- `clean_markdown` — `Union[Unset, bool]` — When `true` and `markdown` is in `formats`, the converted markdown is sent to Groq LLM for cleaning (boilerplate removal, ad stripping, formatting improvement) before being returned. Graceful degradation: any Groq failure (key unset, 4xx/5xx, timeout, empty response) returns the raw markdown unchanged plus a warning in the `warnings` array. Billing: 3× credits and bytes applied only when cleaning succeeds.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\nsync(client=client, body=body, async_=async_) -> Optional[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio(client=client, body=body, async_=async_) -> Optional[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\n```\n\n## Get Scrape\n\nGet scrape result\n\nAlways returns 200. Check the `status` discriminator for the scrape state.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\nsync(id=id, client=client) -> Optional[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\n```"
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 any of `delay_ms > 0`,\n`solve_challenge: true`, or `outline` in `formats` — is **held open** until the render reaches a\nterminal state, then returns **200** with the content envelope (`success` or `failed`). If the\nrender is still running when the hold window expires (28 seconds by default), the request returns\nthe **202** receipt instead and the job continues in the background. A `solve_challenge` render can\noutlast the hold window, so expect the 202 receipt from such a request.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content\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_ (bool | Unset)`\n- `body (ScrapeRequest)`\n- `url` — `str`\n- `formats` — `list[ScrapeRequestFormatsItem | ScrapeRequestJsonFormat] | Unset` — 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` — `str | Unset`\n- `delay_ms` — `int | Unset` — 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` — `int | Unset`\n- `async_` — `bool | Unset` — 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` — `str | Unset` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `events` — `list[ScrapeRequestEventsItem] | Unset` — 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` — `ScrapeRequestMarkdownMode | Unset` — Markdown processing mode. article=article extraction (default), raw=minimal cleanup, llm=compact LLM-optimised output.\n- `markdown_query` — `str | Unset` — BM25 query string for relevance-ranked content filtering. Omit or leave empty to disable.\n- `markdown_links` — `ScrapeRequestMarkdownLinks | Unset` — 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` — `ScrapeRequestMarkdownImages | Unset` — Image retention mode in the markdown output. 'inline' (default) keeps `![alt](url)` as-is. 'text' strips the URL, keeping only alt text. 'none' removes images entirely. 'references' converts to numbered `![alt][N]` refs with an Images footer. Distinct from markdown_filter_images (which drops low-signal images before conversion).\n- `with_links_summary` — `bool | Unset` — 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` — `bool | Unset` — When true, appends an 'Images:\\n[1]: url\\n...' footer to the markdown output, built from the extracted image list.\n- `markdown_compact` — `bool | Unset` — Collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — `bool | Unset` — Filter low-signal images from the markdown output.\n- `markdown_include_media` — `bool | Unset` — 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` — `bool | Unset` — 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` — `bool | Unset` — 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` — `int | Unset` — 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` — `ScrapeRequestTokenEncoding | Unset` — 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` — `bool | Unset` — 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` — `bool | Unset` — Attempts to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render. On a synchronous `POST /v1/scrape` this routes the request to the held browser render; a solve can outlast the hold window (28 seconds by default), and the request then returns the 202 receipt while the job continues in the background. With `async: true` the 202 receipt is returned immediately.\n- `remove_base64_images` — `bool | Unset` — 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` — `list[str] | Unset` — 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` — `list[str] | Unset` — 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` — `ScrapeRequestCacheTtlType1 | str | Unset` — 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` — `ScrapeRequestCustom | Unset` — 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` — `bool | Unset` — 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[Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope]\nsync(client=client, body=body, async_=async_) -> Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope | None\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope]\nawait asyncio(client=client, body=body, async_=async_) -> Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope | None\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[Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope]\nsync(id=id, client=client) -> Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope]\nawait asyncio(id=id, client=client) -> Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope | None\n```"
481
481
  },
482
482
  "sdk/python/scrape-bulk": {
483
483
  "title": "Scrape Bulk",
484
484
  "section": "SDK Reference",
485
- "body": "# Scrape Bulk\n\nFunctions for interacting with the `scrape_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Scrape Bulk\n\nBulk scrape URLs\n\nEnqueues multiple URLs for scraping. Results delivered via webhook.\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/scrape/bulk/\\{id\\}` whenever\n`recovery_required` is true.\n\n**Unknown keys.** An unknown key on an `items[]` entry, or at the top level of\nthe body, is rejected with `422 validation_error`. An unknown key inside\n`defaults` is not: it is dropped without a warning and the request is accepted\nwith `202`. The exception is `cookies` and `headers`, on an item or in `defaults`: they\nanswer `400 validation_error`.\n\n**Parameters**\n\n- `body (CreateScrapeBulkBody)`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `urls` — `Union[Unset, list[str]]` — Simple URL list. Provide urls OR items, not both.\n- `items` — `Union[Unset, list['CreateScrapeBulkBodyItemsItem']]` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `Union[Unset, CreateScrapeBulkBodyDefaults]`\n- `webhook_secret` — `Union[Unset, str]` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n- `custom` — `Union[Unset, CreateScrapeBulkBodyCustom]` — Top-level user-supplied JSON payload, capped at 4096 UTF-8 bytes. Applied to every scrape-type entry that does not provide its own per-entry `custom` (the per-entry value wins). Echoed on each entry's success envelope in the bulk results response (the key is omitted when no `custom` was supplied at either level). Distinct from the system-owned `metadata` column and never used as a cache-key input.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateScrapeBulkResponse202, CreateScrapeBulkResponse403, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateScrapeBulkResponse202, CreateScrapeBulkResponse403, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateScrapeBulkResponse202, CreateScrapeBulkResponse403, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateScrapeBulkResponse202, CreateScrapeBulkResponse403, Error]]\n```\n\n## Get Scrape Bulk\n\nGet scrape bulk job status\n\nReturns the job envelope plus its rehydrated per-URL scrape envelopes.\n\n**Downloading item content.** A `raw` or `markdown` artifact within the\n10-MiB inline cap is returned inline. An oversized one is replaced by a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **86400 seconds (24 hours)**. The underlying objects are private, so an\nunsigned URL returns `401`: download the content inside that window, or\nre-poll this endpoint for a fresh signature. An artifact that was never\nstored, or whose object cannot be signed, is omitted from `formats` and\nreported as `artifact_unavailable` in `warnings`. The private unsigned\nstorage URL is never returned.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/fetch/bulk` or `POST /v1/bulk` is found here too, not a `404`.\nThe items listed are the job's scrape rows: a fetch-bulk job's items appear, and a\n`POST /v1/bulk` job shows its scrape items but not its screenshots. An id from another\naccount answers `404`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (Union[Unset, str])`\n- `limit (Union[Unset, int])`\n- `status (Union[Unset, GetScrapeBulkStatus])`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Optional[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\n```"
485
+ "body": "# Scrape Bulk\n\nFunctions for interacting with the `scrape_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Scrape Bulk\n\nBulk scrape URLs\n\nEnqueues multiple URLs for scraping. Results delivered via webhook.\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/scrape/bulk/\\{id\\}` whenever\n`recovery_required` is true.\n\n**Unknown keys.** An unknown key on an `items[]` entry, or at the top level of\nthe body, is rejected with `422 validation_error`. An unknown key inside\n`defaults` is not: it is dropped without a warning and the request is accepted\nwith `202`. The exception is `cookies` and `headers`, on an item or in `defaults`: they\nanswer `400 validation_error`.\n\n**Parameters**\n\n- `body (CreateScrapeBulkBody)`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `urls` — `list[str] | Unset` — Simple URL list. Provide urls OR items, not both.\n- `items` — `list[CreateScrapeBulkBodyItemsItem] | Unset` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `CreateScrapeBulkBodyDefaults | Unset`\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n- `custom` — `CreateScrapeBulkBodyCustom | Unset` — Top-level user-supplied JSON payload, capped at 4096 UTF-8 bytes. Applied to every scrape-type entry that does not provide its own per-entry `custom` (the per-entry value wins). Echoed on each entry's success envelope in the bulk results response (the key is omitted when no `custom` was supplied at either level). Distinct from the system-owned `metadata` column and never used as a cache-key input.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error]\nsync(client=client, body=body) -> CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error]\nawait asyncio(client=client, body=body) -> CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error | None\n```\n\n## Get Scrape Bulk\n\nGet scrape bulk job status\n\nReturns the job envelope plus its rehydrated per-URL scrape envelopes.\n\n**Downloading item content.** A `raw` or `markdown` artifact within the\n10-MiB inline cap is returned inline. An oversized one is replaced by a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **86400 seconds (24 hours)**. The underlying objects are private, so an\nunsigned URL returns `401`: download the content inside that window, or\nre-poll this endpoint for a fresh signature. An artifact that was never\nstored, or whose object cannot be signed, is omitted from `formats` and\nreported as `artifact_unavailable` in `warnings`. The private unsigned\nstorage URL is never returned.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/fetch/bulk` or `POST /v1/bulk` is found here too, not a `404`.\nThe items listed are the job's scrape rows: a fetch-bulk job's items appear, and a\n`POST /v1/bulk` job shows its scrape items but not its screenshots. An id from another\naccount answers `404`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (str | Unset)`\n- `limit (int | Unset)`\n- `status (GetScrapeBulkStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202 | None\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202 | None\n```"
486
486
  },
487
487
  "sdk/python/screenshots": {
488
488
  "title": "Screenshots",
489
489
  "section": "SDK Reference",
490
- "body": "# Screenshots\n\nFunctions for interacting with the `screenshots` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Screenshot\n\nCapture a screenshot\n\nSync by default (holds up to 28s). Pass `async: true` in the body or `?async=true` in the\nquery string to return 202 immediately; either one is enough, and `false` in one never\ncancels `true` in the other.\nPoll via GET /v1/screenshots/\\{id\\}.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `async_ (Union[Unset, bool])`\n- `body (ScreenshotRequest)`\n- `url` — `str`\n- `device` — `Union[Unset, ScreenshotRequestDevice]`\n- `viewport` — `Union['Viewport', None, Unset]`\n- `async_` — `Union[Unset, bool]` — When true, the request returns 202 immediately and the screenshot is captured in the background; poll `GET /v1/screenshots/\\{id\\}`. The `?async=true` query parameter is a second spelling of this field: the request is async when either one says true, and `false` in one never cancels `true` in the other.\n- `full_page` — `Union[Unset, bool]`\n- `format_` — `Union[Unset, ScreenshotRequestFormat]`\n- `quality` — `Union[Unset, int]`\n- `block_ads` — `Union[Unset, bool]`\n- `block_cookie_banners` — `Union[Unset, bool]`\n- `wait_until` — `Union[Unset, ScreenshotRequestWaitUntil]`\n- `wait_for_selector` — `Union[None, Unset, str]`\n- `delay_ms` — `Union[Unset, int]`\n- `scroll` — `Union[Unset, bool]`\n- `clip` — `Union['Clip', None, Unset]`\n- `dark_mode` — `Union[Unset, bool]`\n- `device_scale_factor` — `Union[None, ScreenshotRequestDeviceScaleFactorType1, ScreenshotRequestDeviceScaleFactorType2Type1, ScreenshotRequestDeviceScaleFactorType3Type1, Unset]`\n- `include_html` — `Union[Unset, bool]`\n- `country` — `Union[Unset, str]`\n- `language` — `Union[None, Unset, str]`\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nsync(client=client, body=body, async_=async_) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio(client=client, body=body, async_=async_) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\n```\n\n## Get Screenshot\n\nGet screenshot status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nsync(id=id, client=client) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\n```"
490
+ "body": "# Screenshots\n\nFunctions for interacting with the `screenshots` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Screenshot\n\nCapture a screenshot\n\nSync by default (holds up to 28s). Pass `async: true` in the body or `?async=true` in the\nquery string to return 202 immediately; either one is enough, and `false` in one never\ncancels `true` in the other.\nPoll via GET /v1/screenshots/\\{id\\}.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `async_ (bool | Unset)`\n- `body (ScreenshotRequest)`\n- `url` — `str`\n- `device` — `ScreenshotRequestDevice | Unset`\n- `viewport` — `None | Unset | Viewport`\n- `async_` — `bool | Unset` — When true, the request returns 202 immediately and the screenshot is captured in the background; poll `GET /v1/screenshots/\\{id\\}`. The `?async=true` query parameter is a second spelling of this field: the request is async when either one says true, and `false` in one never cancels `true` in the other.\n- `full_page` — `bool | Unset`\n- `format_` — `ScreenshotRequestFormat | Unset`\n- `quality` — `int | Unset`\n- `block_ads` — `bool | Unset`\n- `block_cookie_banners` — `bool | Unset`\n- `wait_until` — `ScreenshotRequestWaitUntil | Unset`\n- `wait_for_selector` — `None | str | Unset`\n- `delay_ms` — `int | Unset`\n- `scroll` — `bool | Unset`\n- `clip` — `Clip | None | Unset`\n- `dark_mode` — `bool | Unset`\n- `device_scale_factor` — `None | ScreenshotRequestDeviceScaleFactorType1 | ScreenshotRequestDeviceScaleFactorType2Type1 | ScreenshotRequestDeviceScaleFactorType3Type1 | Unset`\n- `include_html` — `bool | Unset`\n- `country` — `str | Unset`\n- `language` — `None | str | Unset`\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Error | Error | ScreenshotResponse | ScreenshotResponse]\nsync(client=client, body=body, async_=async_) -> Error | Error | ScreenshotResponse | ScreenshotResponse | None\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Error | Error | ScreenshotResponse | ScreenshotResponse]\nawait asyncio(client=client, body=body, async_=async_) -> Error | Error | ScreenshotResponse | ScreenshotResponse | None\n```\n\n## Get Screenshot\n\nGet screenshot status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | Error | ScreenshotResponse | ScreenshotResponse]\nsync(id=id, client=client) -> Error | Error | ScreenshotResponse | ScreenshotResponse | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | Error | ScreenshotResponse | ScreenshotResponse]\nawait asyncio(id=id, client=client) -> Error | Error | ScreenshotResponse | ScreenshotResponse | None\n```"
491
491
  },
492
492
  "sdk/python/search": {
493
493
  "title": "Search",
494
494
  "section": "SDK Reference",
495
- "body": "# Search\n\nFunctions for interacting with the `search` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Search\n\nSearch the web\n\nRuns a web search for `query` and returns ranked organic results with\ncontiguous `position` values from 1.\n\nUse `limit` (1–100, default 10) to request more results in a single\ncall. Results are fetched in pages of 10, so a call consumes\n`ceil(limit / 10)` credits (capped at 10) from the account's monthly\ncredits bucket — for example `limit=10` costs 1 credit and `limit=35`\ncosts 4. Credits are charged for every page fetched regardless of how\nmany results a page returns. The credit count is reported as\n`credits_used` in the response.\n\n**Parameters**\n\n- `body (CreateSearchBody)`\n- `query` — `str` — The search query, up to 2048 characters.\n- `type_` — `Union[Unset, CreateSearchBodyType]` — Which search index to query. `web` (default) returns ranked organic results; `news` returns news articles in the same `results` array, additionally populating `source` and `image` on each item; `images` returns image results, populating `source`, `domain`, and a fuller `image` object (full- image dimensions plus a thumbnail URL and dimensions) while omitting `snippet` and `date`. Billing is identical for all three.\n- `limit` — `Union[Unset, int]` — Maximum number of organic results to return. Results are fetched in pages of 10, so the call costs `ceil(limit / 10)` credits (capped at 10).\n- `country` — `Union[Unset, str]` — Two-letter country code to localize results (e.g. `us`, `de`), normalized to lowercase. Defaults to `us`.\n- `language` — `Union[Unset, str]` — Two-letter ISO-639-1 language code for results (e.g. `en`, `fr`), normalized to lowercase. Defaults to `en`.\n- `date_range` — `Union[Unset, CreateSearchBodyDateRange]` — Restrict results to a recency window: `any` (default, no time filter), `hour` (past hour), `day` (past 24 hours), `week` (past week), `month` (past month), or `year` (past year). Applies identically to every `type`; billing is unchanged.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateSearchResponse200, Error, Union['CreateSearchResponse503', 'Error']]]\nsync(client=client, body=body) -> Optional[Union[CreateSearchResponse200, Error, Union['CreateSearchResponse503', 'Error']]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateSearchResponse200, Error, Union['CreateSearchResponse503', 'Error']]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateSearchResponse200, Error, Union['CreateSearchResponse503', 'Error']]]\n```"
495
+ "body": "# Search\n\nFunctions for interacting with the `search` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Search\n\nSearch the web\n\nRuns a web search for `query` and returns ranked organic results with\ncontiguous `position` values from 1.\n\nUse `limit` (1–100, default 10) to request more results in a single\ncall. Results are fetched in pages of 10, so a call consumes\n`ceil(limit / 10)` credits (capped at 10) from the account's monthly\ncredits bucket — for example `limit=10` costs 1 credit and `limit=35`\ncosts 4. Credits are charged for every page fetched regardless of how\nmany results a page returns. The credit count is reported as\n`credits_used` in the response.\n\n**Parameters**\n\n- `body (CreateSearchBody)`\n- `query` — `str` — The search query, up to 2048 characters.\n- `type_` — `CreateSearchBodyType | Unset` — Which search index to query. `web` (default) returns ranked organic results; `news` returns news articles in the same `results` array, additionally populating `source` and `image` on each item; `images` returns image results, populating `source`, `domain`, and a fuller `image` object (full- image dimensions plus a thumbnail URL and dimensions) while omitting `snippet` and `date`. Billing is identical for all three.\n- `limit` — `int | Unset` — Maximum number of organic results to return. Results are fetched in pages of 10, so the call costs `ceil(limit / 10)` credits (capped at 10).\n- `country` — `str | Unset` — Two-letter country code to localize results (e.g. `us`, `de`), normalized to lowercase. Defaults to `us`.\n- `language` — `str | Unset` — Two-letter ISO-639-1 language code for results (e.g. `en`, `fr`), normalized to lowercase. Defaults to `en`.\n- `date_range` — `CreateSearchBodyDateRange | Unset` — Restrict results to a recency window: `any` (default, no time filter), `hour` (past hour), `day` (past 24 hours), `week` (past week), `month` (past month), or `year` (past year). Applies identically to every `type`; billing is unchanged.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateSearchResponse200 | CreateSearchResponse503 | Error | Error]\nsync(client=client, body=body) -> CreateSearchResponse200 | CreateSearchResponse503 | Error | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateSearchResponse200 | CreateSearchResponse503 | Error | Error]\nawait asyncio(client=client, body=body) -> CreateSearchResponse200 | CreateSearchResponse503 | Error | Error | None\n```"
496
496
  },
497
497
  "sdk/python/sitemap": {
498
498
  "title": "Sitemap",
499
499
  "section": "SDK Reference",
500
- "body": "# Sitemap\n\nFunctions for interacting with the `sitemap` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Sitemap\n\nDiscover URLs on a domain\n\nCrawls a domain to build a sitemap. Returns cached results if available\nwithin cache_ttl. Results delivered via webhook and downloadable from results_url.\nWebhook deliveries include `X-ByteKit-Event: sitemap.completed` or\n`X-ByteKit-Event: sitemap.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\nThe webhook body is `\\{ event, data \\}`. For a job the worker ran, `data` is not a\n`SitemapResponse`:\n\n- `sitemap.completed` `data` carries `id`, `url`, `strategy`, `status`,\n`total_urls`, `sources`, `total_bytes`, `results_url`, `warnings`,\n`metadata`, `compact` and `billing`.\n- `sitemap.failed` `data` carries `id`, `url`, `strategy`, `status`,\n`error_code`, `error_message`, `warnings` and `metadata`.\n\nIn both, `url` is the host as `scheme://host`, and `warnings` is the\nworker's own warnings or `null`. When the request is answered from a cached job\n(`cache: hit`), the `sitemap.completed` `data` is instead the full job object, the\nsame fields as a `SitemapResponse`.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (SitemapRequest)`\n- `url` — `str` — The site to discover. Sitemap discovery is host-scoped (`robots.txt` and `/sitemap.xml` live at the host root), so only the scheme and host are used: a path, query string or fragment is accepted but ignored, and the `202` response carries a `warnings` entry saying so. A bare host, or a host with just a trailing `/`, produces no warning.\n- `strategy` — `Union[Unset, SitemapRequestStrategy]` — How much discovery work the job does. - `quick` — reads `robots.txt` and the XML sitemaps only. Every result has `source: sitemap`. - `standard` — the `quick` sources, then fills any remaining `max_urls` budget with URLs from your account's completed scrapes of the host in the last 90 days (`source: known`). - `deep` — the `standard` sources, then crawls page links outward from the URLs found so far, up to `max_depth` levels, until `max_urls` is reached (`source: links`).\n- `max_depth` — `Union[Unset, int]`\n- `max_urls` — `Union[Unset, int]`\n- `process` — `Union['SitemapRequestProcessType0', None, Unset]` — Accepted, stored and echoed back on the job, but it has no effect: the worker logs that the trigger is not implemented and ignores it.\n- `webhook_url` — `Union[Unset, str]` — Optional webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported). When omitted, no `sitemap.completed`/`sitemap.failed` webhook is delivered and the job is poll-only via `GET /v1/sitemap/\\{id\\}`. When present, delivery is unchanged. `webhook_secret` is ignored when `webhook_url` is absent.\n- `webhook_secret` — `Union[None, Unset, str]` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `cache_ttl` — `Union[Unset, str]` — Max 90 days.\n- `compact` — `Union[Unset, bool]`\n- `metadata` — `Union[Unset, Metadata]` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[Error, SitemapResponse]]\nsync(client=client, body=body) -> Optional[Union[Error, SitemapResponse]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[Error, SitemapResponse]]\nawait asyncio(client=client, body=body) -> Optional[Union[Error, SitemapResponse]]\n```\n\n## Get Sitemap\n\nGet sitemap job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, SitemapResponse]]\nsync(id=id, client=client) -> Optional[Union[Error, SitemapResponse]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, SitemapResponse]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, SitemapResponse]]\n```"
500
+ "body": "# Sitemap\n\nFunctions for interacting with the `sitemap` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Sitemap\n\nDiscover URLs on a domain\n\nCrawls a domain to build a sitemap. Returns cached results if available\nwithin cache_ttl. Results delivered via webhook and downloadable from results_url.\nWebhook deliveries include `X-ByteKit-Event: sitemap.completed` or\n`X-ByteKit-Event: sitemap.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\nThe webhook body is `\\{ event, data \\}`. For a job the worker ran, `data` is not a\n`SitemapResponse`:\n\n- `sitemap.completed` `data` carries `id`, `url`, `strategy`, `status`,\n`total_urls`, `sources`, `total_bytes`, `results_url`, `warnings`,\n`metadata`, `compact` and `billing`.\n- `sitemap.failed` `data` carries `id`, `url`, `strategy`, `status`,\n`error_code`, `error_message`, `warnings` and `metadata`.\n\nIn both, `url` is the host as `scheme://host`, and `warnings` is the\nworker's own warnings or `null`. When the request is answered from a cached job\n(`cache: hit`), the `sitemap.completed` `data` is instead the full job object, the\nsame fields as a `SitemapResponse`.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (SitemapRequest)`\n- `url` — `str` — The site to discover. Sitemap discovery is host-scoped (`robots.txt` and `/sitemap.xml` live at the host root), so only the scheme and host are used: a path, query string or fragment is accepted but ignored, and the `202` response carries a `warnings` entry saying so. A bare host, or a host with just a trailing `/`, produces no warning.\n- `strategy` — `SitemapRequestStrategy | Unset` — How much discovery work the job does. - `quick` — reads `robots.txt` and the XML sitemaps only. Every result has `source: sitemap`. - `standard` — the `quick` sources, then fills any remaining `max_urls` budget with URLs from your account's completed scrapes of the host in the last 90 days (`source: known`). - `deep` — the `standard` sources, then crawls page links outward from the URLs found so far, up to `max_depth` levels, until `max_urls` is reached (`source: links`).\n- `max_depth` — `int | Unset`\n- `max_urls` — `int | Unset`\n- `process` — `None | SitemapRequestProcessType0 | Unset` — Accepted, stored and echoed back on the job, but it has no effect: the worker logs that the trigger is not implemented and ignores it.\n- `webhook_url` — `str | Unset` — Optional webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported). When omitted, no `sitemap.completed`/`sitemap.failed` webhook is delivered and the job is poll-only via `GET /v1/sitemap/\\{id\\}`. When present, delivery is unchanged. `webhook_secret` is ignored when `webhook_url` is absent.\n- `webhook_secret` — `None | str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `cache_ttl` — `str | Unset` — Max 90 days.\n- `compact` — `bool | Unset`\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Error | SitemapResponse]\nsync(client=client, body=body) -> Error | SitemapResponse | None\nawait asyncio_detailed(client=client, body=body) -> Response[Error | SitemapResponse]\nawait asyncio(client=client, body=body) -> Error | SitemapResponse | None\n```\n\n## Get Sitemap\n\nGet sitemap job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | SitemapResponse]\nsync(id=id, client=client) -> Error | SitemapResponse | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | SitemapResponse]\nawait asyncio(id=id, client=client) -> Error | SitemapResponse | None\n```"
501
501
  },
502
502
  "sdk/python/usage": {
503
503
  "title": "Usage",
504
504
  "section": "SDK Reference",
505
- "body": "# Usage\n\nFunctions for interacting with the `usage` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Usage\n\nGet current billing period usage\n\n**Call styles**\n\n```python\nsync_detailed(client=client) -> Response[Union[Error, GetUsageResponse200]]\nsync(client=client) -> Optional[Union[Error, GetUsageResponse200]]\nawait asyncio_detailed(client=client) -> Response[Union[Error, GetUsageResponse200]]\nawait asyncio(client=client) -> Optional[Union[Error, GetUsageResponse200]]\n```\n\n## Get Usage By Endpoint\n\nGet per-endpoint bandwidth breakdown\n\nReturns bandwidth usage broken down by endpoint (screenshots, recordings, scrape, scrape_md, fetch,\nfetch_md, crawl, crawl_links, sitemap, monitors) for a date range. Each row carries raw bytes, the\nbilling multiplier, and billable bytes. Endpoints with zero raw bytes for the range are omitted from\n`rows`; `totals` is always present. Default range is the last 30 days; max 366 days.\n\n**Parameters**\n\n- `from_ (Union[Unset, datetime.date])`\n- `to (Union[Unset, datetime.date])`\n- `api_key (Union[Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Union[Error, GetUsageByEndpointResponse200]]\nsync(client=client, from_=from_, to=to, api_key=api_key) -> Optional[Union[Error, GetUsageByEndpointResponse200]]\nawait asyncio_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Union[Error, GetUsageByEndpointResponse200]]\nawait asyncio(client=client, from_=from_, to=to, api_key=api_key) -> Optional[Union[Error, GetUsageByEndpointResponse200]]\n```\n\n## Get Usage Daily\n\nGet daily usage breakdown\n\nDefault range is last 30 days. Max range is 366 days.\n\n**Parameters**\n\n- `from_ (Union[Unset, datetime.date])`\n- `to (Union[Unset, datetime.date])`\n- `api_key (Union[Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Union[Error, GetUsageDailyResponse200]]\nsync(client=client, from_=from_, to=to, api_key=api_key) -> Optional[Union[Error, GetUsageDailyResponse200]]\nawait asyncio_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Union[Error, GetUsageDailyResponse200]]\nawait asyncio(client=client, from_=from_, to=to, api_key=api_key) -> Optional[Union[Error, GetUsageDailyResponse200]]\n```"
505
+ "body": "# Usage\n\nFunctions for interacting with the `usage` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Usage\n\nGet current billing period usage\n\n**Call styles**\n\n```python\nsync_detailed(client=client) -> Response[Error | GetUsageResponse200]\nsync(client=client) -> Error | GetUsageResponse200 | None\nawait asyncio_detailed(client=client) -> Response[Error | GetUsageResponse200]\nawait asyncio(client=client) -> Error | GetUsageResponse200 | None\n```\n\n## Get Usage By Endpoint\n\nGet per-endpoint bandwidth breakdown\n\nReturns bandwidth usage broken down by endpoint (screenshots, recordings, scrape, scrape_md, fetch,\nfetch_md, crawl, crawl_links, sitemap, monitors) for a date range. Each row carries raw bytes, the\nbilling multiplier, and billable bytes. Endpoints with zero raw bytes for the range are omitted from\n`rows`; `totals` is always present. Default range is the last 30 days; max 366 days.\n\n**Parameters**\n\n- `from_ (datetime.date | Unset)`\n- `to (datetime.date | Unset)`\n- `api_key (str | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Error | GetUsageByEndpointResponse200]\nsync(client=client, from_=from_, to=to, api_key=api_key) -> Error | GetUsageByEndpointResponse200 | None\nawait asyncio_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Error | GetUsageByEndpointResponse200]\nawait asyncio(client=client, from_=from_, to=to, api_key=api_key) -> Error | GetUsageByEndpointResponse200 | None\n```\n\n## Get Usage Daily\n\nGet daily usage breakdown\n\nDefault range is last 30 days. Max range is 366 days.\n\n**Parameters**\n\n- `from_ (datetime.date | Unset)`\n- `to (datetime.date | Unset)`\n- `api_key (str | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Error | GetUsageDailyResponse200]\nsync(client=client, from_=from_, to=to, api_key=api_key) -> Error | GetUsageDailyResponse200 | None\nawait asyncio_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Error | GetUsageDailyResponse200]\nawait asyncio(client=client, from_=from_, to=to, api_key=api_key) -> Error | GetUsageDailyResponse200 | None\n```"
506
506
  },
507
507
  "sdk/python/webhooks": {
508
508
  "title": "Webhooks",
509
509
  "section": "SDK Reference",
510
- "body": "# Webhooks\n\nFunctions for interacting with the `webhooks` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## List Webhook Deliveries\n\nList webhook deliveries\n\n**Parameters**\n\n- `limit (Union[Unset, int])`\n- `cursor (Union[Unset, str])`\n- `status (Union[Unset, ListWebhookDeliveriesStatus])`\n- `since (Union[Unset, datetime.datetime])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Response[Union[Error, ListWebhookDeliveriesResponse200]]\nsync(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Optional[Union[Error, ListWebhookDeliveriesResponse200]]\nawait asyncio_detailed(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Response[Union[Error, ListWebhookDeliveriesResponse200]]\nawait asyncio(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Optional[Union[Error, ListWebhookDeliveriesResponse200]]\n```\n\n## Retry Webhook Delivery\n\nRetry a webhook delivery\n\nRequeues a failed or exhausted webhook delivery for another attempt.\n\n**Limits:** this endpoint takes no request body; any body sent is\ncapped at 64 KB. An oversized body returns a `400` with error code\n`request_too_large`.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, WebhookDeliveryResponse]]\nsync(id=id, client=client) -> Optional[Union[Error, WebhookDeliveryResponse]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, WebhookDeliveryResponse]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, WebhookDeliveryResponse]]\n```"
510
+ "body": "# Webhooks\n\nFunctions for interacting with the `webhooks` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## List Webhook Deliveries\n\nList webhook deliveries\n\n**Parameters**\n\n- `limit (int | Unset)`\n- `cursor (str | Unset)`\n- `status (ListWebhookDeliveriesStatus | Unset)`\n- `since (datetime.datetime | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Response[Error | ListWebhookDeliveriesResponse200]\nsync(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Error | ListWebhookDeliveriesResponse200 | None\nawait asyncio_detailed(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Response[Error | ListWebhookDeliveriesResponse200]\nawait asyncio(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Error | ListWebhookDeliveriesResponse200 | None\n```\n\n## Retry Webhook Delivery\n\nRetry a webhook delivery\n\nRequeues a failed or exhausted webhook delivery for another attempt.\n\n**Limits:** this endpoint takes no request body; any body sent is\ncapped at 64 KB. An oversized body returns a `400` with error code\n`request_too_large`.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | WebhookDeliveryResponse]\nsync(id=id, client=client) -> Error | WebhookDeliveryResponse | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | WebhookDeliveryResponse]\nawait asyncio(id=id, client=client) -> Error | WebhookDeliveryResponse | None\n```"
511
511
  },
512
512
  "sdk/typescript/account": {
513
513
  "title": "Account",
@@ -542,7 +542,7 @@
542
542
  "sdk/typescript/scrape": {
543
543
  "title": "Scrape",
544
544
  "section": "SDK Reference",
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."
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' | 'outline' | 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. On a synchronous scrape this routes the request to the held browser render; a solve can outlast the hold window (28 seconds by default), and the request then returns the 202 receipt while the job continues in the background. With `async: true` the 202 receipt is returned immediately.\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."
546
546
  },
547
547
  "sdk/typescript/scrape-bulk": {
548
548
  "title": "Scrape Bulk",
@@ -40,7 +40,7 @@ function presentWarnings(envelope) {
40
40
  // Textual formats in canonical render order. The first one present in the envelope is
41
41
  // the unlabeled primary (today's position); every other one present follows under its
42
42
  // own delimiter. Module-local: nothing outside this file needs it (issue #2589).
43
- const TEXTUAL_FORMATS = ['markdown', 'raw'];
43
+ const TEXTUAL_FORMATS = ['markdown', 'raw', 'outline'];
44
44
  // Full delimiter templates for every possible secondary textual format, used only to
45
45
  // detect and strip a DANGLING partial delimiter left by a byte-boundary truncation
46
46
  // cut (issue #2589 cr-8) — never to detect a complete, legitimately-rendered one.
@@ -16,7 +16,7 @@
16
16
  * (issue #2588 failure mode E2).
17
17
  */
18
18
  /** Every format value the public spec enumerates. This is what goes on the wire. */
19
- export declare const PUBLIC_SCRAPE_FORMATS: readonly ["raw", "markdown", "links", "images"];
19
+ export declare const PUBLIC_SCRAPE_FORMATS: readonly ["raw", "markdown", "links", "images", "outline"];
20
20
  export type PublicScrapeFormat = (typeof PUBLIC_SCRAPE_FORMATS)[number];
21
21
  /**
22
22
  * Every value the tool's `formats` enum accepts — the public set, and nothing else.
@@ -16,7 +16,7 @@
16
16
  * (issue #2588 failure mode E2).
17
17
  */
18
18
  /** Every format value the public spec enumerates. This is what goes on the wire. */
19
- export const PUBLIC_SCRAPE_FORMATS = ['raw', 'markdown', 'links', 'images'];
19
+ export const PUBLIC_SCRAPE_FORMATS = ['raw', 'markdown', 'links', 'images', 'outline'];
20
20
  /**
21
21
  * Every value the tool's `formats` enum accepts — the public set, and nothing else.
22
22
  *
@@ -1,4 +1,4 @@
1
- export type Format = 'raw' | 'markdown' | 'links' | 'images';
1
+ export type Format = 'raw' | 'markdown' | 'links' | 'images' | 'outline';
2
2
  /**
3
3
  * Contract generation emitted by every newly produced scrape envelope.
4
4
  *
@@ -51,6 +51,8 @@ export interface ScrapeFormats {
51
51
  links?: string[] | ScrapeScoredLink[];
52
52
  images?: string[] | ScrapeScoredImage[];
53
53
  json?: ScrapeJsonResult;
54
+ /** Indented text accessibility tree of the browser-rendered page (#5473). */
55
+ outline?: string;
54
56
  }
55
57
  /** The `json` format's result (issue #5130). `data` is null whenever `validated` is false. */
56
58
  export interface ScrapeJsonResult {
@@ -31,13 +31,13 @@ import { ACCEPTED_SCRAPE_FORMATS } from '../lib/scrape-formats.js';
31
31
  */
32
32
  export function scrapeUrlTool(server, client) {
33
33
  server.tool('scrape_url',
34
- // Deliberately keeps the description capability-derived (#2589 E3): this input
35
- // schema exposes none of the fields packages/gateway/src/scrape-core/can-fast-path.ts
36
- // gates on, nor a `body.async` field, so an async/202 slow-path outcome is not
37
- // advertised here — it would be unreachable from this tool. Add a queue-reaching
38
- // field (e.g. `delay_ms`) or `async` to the schema below and update this
39
- // description to match (pinned by scrape-url-description-reachability.test.ts).
40
- 'Scrape a webpage and return its content. Returns markdown by default. Use the formats parameter to request additional representations (raw, links, images); the raw format — the untouched upstream source, whether that is HTML, JSON, XML or plain text — is included under its own delimiter when it is not the primary, and links/images are appended under their own labeled sections. The rendered content (the requested formats plus any links/images) is capped at 100KB — on very large pages a requested format may be truncated or, in extreme cases, omitted to stay within that cap. A few header lines (id, URL, status, page title) are added on top and are not counted against it. Problems the API reports about the capture come back as warnings, rendered under a `Warnings (N):` section as one `code: message (element)` line each; `artifact_unavailable` there means a format you requested and were billed for is missing from this response, which is a different answer from the page having none of it.', {
34
+ // Deliberately keeps the description capability-derived (#2589 E3): the queued/202
35
+ // outcome is advertised iff this input schema exposes a field that can reach it, as
36
+ // derived from packages/gateway/src/scrape-core/can-fast-path.ts by
37
+ // scrape-url-description-reachability.test.ts. `formats: ['outline']` (#5473) and
38
+ // `solve_challenge: true` (#5532) are such fields: each forces a browser render, and a
39
+ // render that outlives the gateway's hold returns the queued receipt.
40
+ 'Scrape a webpage and return its content. Returns markdown by default. Use the formats parameter to request additional representations (raw, links, images, outline); the raw format — the untouched upstream source, whether that is HTML, JSON, XML or plain text — is included under its own delimiter when it is not the primary, and links/images are appended under their own labeled sections. The experimental outline format is an indented text accessibility tree of the browser-rendered page (headings, landmarks, links, buttons, form fields; no element IDs); it needs a browser render, so the call may instead return a queued result with an sc_ ID to redeem with get_result. The rendered content (the requested formats plus any links/images) is capped at 100KB — on very large pages a requested format may be truncated or, in extreme cases, omitted to stay within that cap. A few header lines (id, URL, status, page title) are added on top and are not counted against it. Problems the API reports about the capture come back as warnings, rendered under a `Warnings (N):` section as one `code: message (element)` line each; `artifact_unavailable` there means a format you requested and were billed for is missing from this response, which is a different answer from the page having none of it.', {
41
41
  url: z.string().url().describe('The URL to scrape'),
42
42
  // `.min(1)` mirrors docs/api/openapi.yaml ScrapeRequest.formats (`minItems: 1`)
43
43
  // exactly (issue #2687 item 3). Before it, `params.formats ?? ['markdown']` only
@@ -49,13 +49,16 @@ export function scrapeUrlTool(server, client) {
49
49
  formats: z
50
50
  .array(z.enum(ACCEPTED_SCRAPE_FORMATS))
51
51
  .min(1, 'formats must list at least one format; omit it entirely for the markdown default')
52
+ // GHSA-mrhx-c7xc-m3w5: Zod records one issue per failing element, so the list is
53
+ // bounded; 32 is far above the four formats it can usefully name.
54
+ .max(32)
52
55
  .optional()
53
- .describe('Content formats to return. Default: ["markdown"]. Options: markdown, raw, links, images. Omit the parameter for the default; an empty array is rejected.'),
56
+ .describe('Content formats to return. Default: ["markdown"]. Options: markdown, raw, links, images, outline. Omit the parameter for the default; an empty array is rejected.'),
54
57
  country: z.string().optional().describe('Two-letter country code for geo-targeted scraping'),
55
58
  solve_challenge: z
56
59
  .boolean()
57
60
  .optional()
58
- .describe('Attempt to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render.'),
61
+ .describe('Attempt to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render. It needs a browser render, so the call may instead return a queued result with an sc_ ID to redeem with get_result.'),
59
62
  }, async (params) => {
60
63
  try {
61
64
  const formats = params.formats ?? ['markdown'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunt-labs/bytekit-mcp",
3
- "version": "0.3.20",
3
+ "version": "0.3.22",
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",
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "@modelcontextprotocol/sdk": "1.32.1",
58
- "zod": "^3.23.6"
58
+ "zod": "^4.6.7"
59
59
  },
60
60
  "scripts": {
61
61
  "prebuild": "pnpm check:scrape-contract",