@hunt-labs/bytekit-mcp 0.2.8 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  "api": {
3
3
  "title": "API Reference",
4
4
  "section": "API Reference",
5
- "body": "# API Reference\n\nEvery ByteKit endpoint, request, and response.\n\nThe ByteKit REST API is organized by capability. Every endpoint shares one base\nURL and Bearer authentication — start with the [Quickstart](https://bytekit.com/docs/quickstart) and\n[Authentication](https://bytekit.com/docs/guides/authentication) guides.\n\n- [Scrape](https://bytekit.com/docs/api/scrape/createscrape) — Fetch any URL as raw HTML, clean markdown, or structured content.\n- [Screenshots](https://bytekit.com/docs/api/screenshots/createscreenshot) — Capture full-page or viewport PNG/JPEG.\n- [Bulk](https://bytekit.com/docs/api/bulk/createbulk) — Fan out many URLs in parallel with per-item webhooks.\n- [Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — Watch a URL on a schedule and webhook on change.\n- [Sitemap](https://bytekit.com/docs/api/sitemap/createsitemap) — Discover URLs from a domain's sitemap or by crawling.\n- [Fetch](https://bytekit.com/docs/api/fetch/postfetch) — Low-latency raw HTTP fetch with optional conversion."
5
+ "body": "# API Reference\n\nEvery ByteKit endpoint, request, and response.\n\nThe ByteKit REST API is organized by capability. Every endpoint shares one base\nURL and Bearer authentication — start with the [Quickstart](https://bytekit.com/docs/quickstart) and\n[Authentication](https://bytekit.com/docs/guides/authentication) guides.\n\n- [Scrape](https://bytekit.com/docs/api/scrape/createscrape) — Fetch any URL as raw HTML, clean markdown, or structured content.\n- [Screenshots](https://bytekit.com/docs/api/screenshots/createscreenshot) — Capture full-page or viewport PNG/JPEG.\n- [Bulk](https://bytekit.com/docs/api/bulk/createbulk) — Fan out many URLs in parallel with per-item webhooks.\n- [Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — Watch a URL on a schedule and webhook on change.\n- [Sitemap](https://bytekit.com/docs/api/sitemap/createsitemap) — Discover URLs from a domain's sitemap or by crawling.\n- [Fetch](https://bytekit.com/docs/api/fetch/postfetch) — Low-latency raw HTTP fetch with byte-for-byte upstream responses."
6
6
  },
7
7
  "api/account": {
8
8
  "title": "Account",
@@ -57,7 +57,7 @@
57
57
  "api/fetch-bulk/createfetchbulk": {
58
58
  "title": "Bulk fetch URLs",
59
59
  "section": "API Reference",
60
- "body": "# Bulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (cookies, wait_for_selector, etc.).\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"
60
+ "body": "# Bulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (wait_for_selector, etc.).\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"
61
61
  },
62
62
  "api/fetch-bulk/getfetchbulk": {
63
63
  "title": "Get fetch bulk job status",
@@ -67,7 +67,7 @@
67
67
  "api/fetch/getfetch": {
68
68
  "title": "Fetch a URL (GET)",
69
69
  "section": "API Reference",
70
- "body": "# Fetch a URL (GET)\n\nDirect HTTP fetch. The response body IS the content; metadata is returned in X-Fetch-* headers.\nOmit `format` for raw passthrough. Use `format=markdown` or `format=html` for conversion.\n"
70
+ "body": "# Fetch a URL (GET)\n\nDirect HTTP fetch. Successful responses return the upstream response bytes verbatim;\nmetadata is returned in X-Fetch-* headers. Non-2xx upstream responses use the\n`upstream_error` JSON envelope with the upstream HTTP status.\n"
71
71
  },
72
72
  "api/fetch/postfetch": {
73
73
  "title": "Fetch a URL (POST)",
@@ -137,7 +137,7 @@
137
137
  "api/schema/createschemaextraction": {
138
138
  "title": "Schema-driven structured extraction",
139
139
  "section": "API Reference",
140
- "body": "# Schema-driven structured extraction\n\nFetches `url` and extracts structured JSON conforming to the supplied\nJSON Schema (draft 2020-12) using an LLM. Fast-path only — slow-path\nrendering options (`wait_until=networkidle`, `cookies`, `delay_ms`,\ncustom `headers`, `wait_for_selector`) cause a `400 unsupported_url`.\n\nDual-axis billing: a fixed per-request credit charge **plus** the\nunderlying page's bandwidth, billed exactly like `/v1/scrape`. The\nbandwidth is still billed when the scrape succeeds but extraction later\nfails; both axes are refunded only when the scrape itself never runs.\n\nAvailability is gated by a server-side feature flag; when disabled the\nendpoint returns `404`.\n"
140
+ "body": "# Schema-driven structured extraction\n\nFetches `url` and extracts structured JSON conforming to the supplied\nJSON Schema (draft 2020-12) using an LLM. Fast-path only — slow-path\nrendering options (`wait_until=networkidle`, `delay_ms`,\n`wait_for_selector`) cause a `400 unsupported_url`.\n\nDual-axis billing: a fixed per-request credit charge **plus** the\nunderlying page's bandwidth, billed exactly like `/v1/scrape`. The\nbandwidth is still billed when the scrape succeeds but extraction later\nfails; both axes are refunded only when the scrape itself never runs.\n\nAvailability is gated by a server-side feature flag; when disabled the\nendpoint returns `404`.\n"
141
141
  },
142
142
  "api/scrape": {
143
143
  "title": "Scrape",
@@ -244,35 +244,40 @@
244
244
  "section": "API Reference",
245
245
  "body": "# Retry a webhook delivery\n\nRequeues a failed or exhausted webhook delivery for another attempt.\n\n**Limits:** this endpoint takes no request body; any body sent is\ncapped at 64 KB. An oversized body returns a `400` with error code\n`request_too_large`.\n"
246
246
  },
247
+ "billing": {
248
+ "title": "Billing",
249
+ "section": "General",
250
+ "body": "# Billing\n\nHow ByteKit prices bandwidth and credits, and how balances, top-ups, and spending controls behave.\n\nByteKit meters two separate things: **bandwidth**, which pays for the capture endpoints, and\n**credits**, which pay for search and schema extraction. The relevant balance is checked before\nany billable work is admitted, so a request either runs against a balance or is rejected — it\nnever continues as unpriced usage.\n\n- [Balance and exhausted quota](https://bytekit.com/docs/billing/balance) — What happens when a ByteKit bandwidth or credit balance reaches zero.\n- [Bandwidth billing](https://bytekit.com/docs/billing/bandwidth) — How ByteKit measures billed bandwidth for capture and sitemap endpoints.\n- [Credit billing](https://bytekit.com/docs/billing/credits) — How search and schema extraction consume credits.\n- [Top-ups and rollover](https://bytekit.com/docs/billing/top-ups) — How purchased bandwidth and credits expire, carry across periods, and are consumed.\n- [Spending controls](https://bytekit.com/docs/billing/spending) — How spending caps and automatic bandwidth top-ups behave."
251
+ },
247
252
  "billing/balance": {
248
253
  "title": "Balance and exhausted quota",
249
254
  "section": "General",
250
- "body": "# Balance and exhausted quota\n\nWhat happens when a ByteKit bandwidth or credit balance reaches zero.\n\nByteKit checks the relevant balance before admitting billable work. Capture endpoints use the bandwidth balance; search uses the credit balance; schema extraction requires both.\n\nWhen a request would exceed an enforced balance, ByteKit returns **HTTP 402** with the error code `quota_exceeded`. The request does not continue as unpriced usage.\n\nThere is no automatic overage: availability is an explicit plan setting. The plan schema defaults `has_overage` to false, while some seeded subscription plans explicitly enable it. For credit-metered requests on an overage-enabled plan, a configured spending cap can permit or reject additional usage. Capture endpoints still enforce their bandwidth budget.\n\nTo continue after a hard balance stop, purchase a top-up or move to a plan with more included usage. Auto-top-up can purchase bandwidth before the configured threshold is crossed, but it must be enabled and configured in advance; reaching zero does not silently enable it.\n\nSee **Dashboard → Settings → Billing** for included usage, purchased and rollover balances, and auto-top-up status."
255
+ "body": "# Balance and exhausted quota\n\nWhat happens when a ByteKit bandwidth or credit balance reaches zero.\n\nByteKit checks the relevant balance before admitting billable work. Capture endpoints use the bandwidth balance; search uses the credit balance; schema extraction requires both.\n\nWhen a request would exceed an enforced balance, ByteKit returns **HTTP 402** with the error code `quota_exceeded`. The request does not continue as unpriced usage.\n\nThere is no automatic overage: availability is an explicit plan setting, and no standard plan enables it. Starter, Growth and Scale carry `has_overage = false`, so a credit-metered request past the included allowance is refused with 402 `quota_exceeded` rather than admitted as billable overage. Only a custom plan arranged with ByteKit can enable overage; on such a plan a configured spending cap can permit or reject additional usage, returning 402 `spending_cap_reached` when the cap is crossed. Capture endpoints still enforce their bandwidth budget.\n\nTo continue after a hard balance stop, purchase a top-up or move to a plan with more included usage. Auto-top-up can purchase bandwidth before the configured threshold is crossed, but it must be enabled and configured in advance; reaching zero does not silently enable it.\n\nSee **Dashboard → Settings → Billing** for included usage, purchased and rollover balances, and auto-top-up status."
251
256
  },
252
257
  "billing/bandwidth": {
253
258
  "title": "Bandwidth billing",
254
259
  "section": "General",
255
- "body": "# Bandwidth billing\n\nHow ByteKit measures billed bandwidth for capture and sitemap endpoints.\n\nByteKit bills most capture endpoints from bytes transferred over the upstream wire, not from the size of the final JSON, Markdown, image, or recording artifact. Sitemap jobs use the generated results artifact instead, as described below.\n\n## Upstream wire-byte endpoints\n\nFor scrape, fetch, crawl, and monitor requests, ByteKit applies one calculation and rounds once:\n\n```\nbilled bytes = round(upstream wire bytes × endpoint factor × cache factor × clean-Markdown factor)\n```\n\nThe endpoint factor depends on the work performed:\n\n| Endpoint | Factor |\n| --- | ---: |\n| Scrape | 1× |\n| Scrape with Markdown output | 1.5× |\n| Fetch | 1× |\n| Fetch with Markdown output | 1.5× |\n| Crawl | 1.5× |\n| Crawl links | 1× |\n| Monitor run | 1× |\n\nA cache hit contributes a **0.5×** factor. Successful clean-Markdown processing contributes a separate **3×** factor. These factors compose with the endpoint factor; they are not alternative rates.\n\n## Sitemap\n\nSitemap billing uses the byte length of the **gzip-compressed generated results CSV**. The worker builds the results CSV, compresses it, and uses that compressed length for the job's billed bytes and sitemap usage record.\n\nDiscovery fetch bytes are not accumulated into the sitemap charge. The charged byte count is the compressed results artifact, not the upstream bytes transferred while discovering URLs.\n\n## Other capture artifacts\n\nScreenshots and recordings use a separate capture basis: `phase1WireBytes × 1.5`, rounded to whole bytes. The 1.5× combines the upstream Phase 1 fetch with rendering overhead. If Phase 1 has no positive wire-byte measurement, that capture contributes zero billable bytes.\n\nYour current allowance, purchased bandwidth, rollover bandwidth, and remaining balance are shown under **Dashboard → Settings → Billing**."
260
+ "body": "# Bandwidth billing\n\nHow ByteKit measures billed bandwidth for capture and sitemap endpoints.\n\nByteKit bills most capture endpoints from bytes transferred over the upstream wire, not from the size of the final JSON, Markdown, image, or recording artifact. Sitemap jobs use the generated results artifact instead, as described below.\n\n## Upstream wire-byte endpoints\n\nFor scrape, fetch, crawl, and monitor requests, the amount taken from your balance is calculated once, at settlement, and rounded once:\n\n```\nbalance deduction = round(upstream wire bytes × cache factor × clean-Markdown factor)\n```\n\nA cache hit contributes a **0.5×** factor. Successful clean-Markdown processing contributes a separate **3×** factor. The two compose; they are not alternative rates.\n\n### Endpoint factors in your usage report\n\n`GET /v1/usage/by-endpoint` and the per-endpoint table under **Dashboard → Usage** additionally weight each endpoint's bucket by the work that endpoint performs:\n\n| Endpoint | Factor |\n| --- | ---: |\n| Scrape | 1× |\n| Scrape with Markdown output | 1.5× |\n| Fetch | 1× |\n| Crawl | 1.5× |\n| Crawl links | 1× |\n| Monitor run | 1× |\n\nThis factor is a reporting weight, not a charge. It is applied when the report is built, never at settlement, so a Markdown scrape or a crawl draws from your balance at the deduction above and the report's billable-byte figure for those endpoints is higher than the amount your balance actually lost. Screenshot captures are the exception — their 1.5× is part of the settled amount, and is described under [Other capture artifacts](#other-capture-artifacts).\n\n## Sitemap\n\nSitemap billing uses the byte length of the **gzip-compressed generated results CSV**. The worker builds the results CSV, compresses it, and uses that compressed length for the job's billed bytes and sitemap usage record.\n\nDiscovery fetch bytes are not accumulated into the sitemap charge. The charged byte count is the compressed results artifact, not the upstream bytes transferred while discovering URLs.\n\n## Other capture artifacts\n\nScreenshots and recordings use a separate capture basis: `phase1WireBytes × 1.5`, rounded to whole bytes. The 1.5× combines the upstream Phase 1 fetch with rendering overhead. If Phase 1 has no positive wire-byte measurement, that capture contributes zero billable bytes.\n\nYour current allowance, purchased bandwidth, rollover bandwidth, and remaining balance are shown under **Dashboard → Settings → Billing**."
256
261
  },
257
262
  "billing/credits": {
258
263
  "title": "Credit billing",
259
264
  "section": "General",
260
- "body": "# Credit billing\n\nHow search and schema extraction consume credits.\n\nCredits pay for operations with a per-request or per-upstream-page cost. They are tracked separately from bandwidth.\n\n## Search\n\nSearch costs one credit for every upstream results page requested:\n\n```\npages = min(ceil(limit / 10), 10)\ncredits = pages\n```\n\nFor example, a limit of 10 costs one credit, a limit of 11 costs two credits, and limits up to 100 are capped at ten upstream pages and ten credits. The charge follows the requested limit even if an upstream page returns fewer results.\n\n## Schema extraction\n\nSchema extraction is dual-axis billing. Each request has a fixed **10-credit** extraction charge and also consumes bandwidth for its source-page fetch. ByteKit pre-charges an estimated 100 KiB for that fetch, then reconciles the bandwidth charge to the actual upstream wire bytes.\n\nIf the request fails before the source page is fetched, ByteKit compensates the credit and bandwidth pre-charges. Failures after the fetch may retain the source-page bandwidth charge because that upstream work was completed.\n\nYour effective credit budget includes plan credits, purchased credits, and any live rollover credits."
265
+ "body": "# Credit billing\n\nHow search and schema extraction consume credits.\n\nCredits pay for operations with a per-request or per-upstream-page cost. They are tracked separately from bandwidth.\n\nOnly the two surfaces below are credit-billed. Scrape, fetch, screenshot, sitemap, and monitor-run requests are billed on bandwidth instead — see [Bandwidth billing](https://bytekit.com/docs/billing/bandwidth) for what those endpoints charge.\n\n## Search\n\nSearch costs one credit for every upstream results page requested:\n\n```\npages = min(ceil(limit / 10), 10)\ncredits = pages\n```\n\nFor example, a limit of 10 costs one credit, a limit of 11 costs two credits, and limits up to 100 are capped at ten upstream pages and ten credits. The charge follows the requested limit even if an upstream page returns fewer results.\n\n## Schema extraction\n\nSchema extraction is dual-axis billing. Each request has a fixed **10-credit** extraction charge and also consumes bandwidth for its source-page fetch. ByteKit pre-charges an estimated 100 KiB for that fetch, then reconciles the bandwidth charge to the actual upstream wire bytes.\n\nIf the request fails before the source page is fetched, ByteKit compensates the credit and bandwidth pre-charges. Failures after the fetch may retain the source-page bandwidth charge because that upstream work was completed.\n\nYour effective credit budget includes plan credits and purchased credits. Credits do not roll over — they reset every billing period."
261
266
  },
262
267
  "billing/spending": {
263
268
  "title": "Spending controls",
264
269
  "section": "General",
265
- "body": "# Spending controls\n\nHow spending caps and automatic bandwidth top-ups behave.\n\nByteKit has two distinct spending controls: a credit-overage cap and automatic bandwidth top-ups.\n\n## Credit-overage spending cap\n\nFor a credit-metered request on an overage-enabled plan, ByteKit compares the calculated overage cost with the account's `max_overage_spend_cents`. When the request would cross that limit, the API returns **HTTP 402** with `spending_cap_reached`.\n\nThe current billing page does not expose a self-service control for this account-level overage cap. Contact support if it must be changed.\n\n## Automatic bandwidth top-ups\n\nThe billing page lets an account administrator enable or disable auto-top-up and configure:\n\n- the remaining-bandwidth threshold that triggers a purchase;\n- the amount of bandwidth to purchase; and\n- an optional monthly top-up spending cap.\n\nThe trigger requires auto-top-up to be enabled and the account to have a Stripe customer. When remaining included bandwidth falls below the configured threshold, ByteKit queues a top-up. A stored monthly cap of zero means no cap; the API and dashboard present that state as no configured cap.\n\nThese controls do not configure purchased-balance expiration. See [Top-ups](https://bytekit.com/docs/billing/top-ups) for the expiry and rollover rules enforced by the billing ledger."
270
+ "body": "# Spending controls\n\nHow spending caps and automatic bandwidth top-ups behave.\n\nByteKit has two distinct spending controls: a credit-overage cap and automatic bandwidth top-ups.\n\n## Credit-overage spending cap\n\nNo standard plan is overage-enabled: Starter, Growth and Scale stop at the included credit allowance with 402 `quota_exceeded`, so this cap never applies to them. It applies only to a custom plan arranged with ByteKit that carries an overage agreement.\n\nFor a credit-metered request on such a plan, ByteKit compares the calculated overage cost with the account's `max_overage_spend_cents`. When the request would cross that limit, the API returns **HTTP 402** with `spending_cap_reached`.\n\nThe current billing page does not expose a self-service control for this account-level overage cap. Contact support if it must be changed.\n\n## Automatic bandwidth top-ups\n\nThe billing page lets an account administrator enable or disable auto-top-up and configure:\n\n- the remaining-bandwidth threshold that triggers a purchase;\n- the amount of bandwidth to purchase; and\n- an optional monthly top-up spending cap.\n\nThe trigger requires auto-top-up to be enabled and the account to have a Stripe customer. When remaining included bandwidth falls below the configured threshold, ByteKit queues a top-up. A stored monthly cap of zero means no cap; the API and dashboard present that state as no configured cap.\n\nThese controls do not configure purchased-balance expiration. See [Top-ups](https://bytekit.com/docs/billing/top-ups) for the expiry and rollover rules enforced by the billing ledger."
266
271
  },
267
272
  "billing/top-ups": {
268
273
  "title": "Top-ups and rollover",
269
274
  "section": "General",
270
- "body": "# Top-ups and rollover\n\nHow purchased bandwidth and credits expire, carry across periods, and are consumed.\n\nTop-ups add bandwidth or credits without changing your plan's included allowance. The billing ledger records each purchase as its own lot and consumes eligible lots as billable work exceeds included and rollover allowances.\n\n## Expiration\n\nPurchased top-up lots expire **180 days after the payment provider object was created**. This expiry is fixed by the billing service; it is not configurable in the dashboard. Expired lots are removed from the active purchased balance and cannot fund new usage.\n\nThat source-backed rule supersedes older wording that described top-ups as never expiring or said their expiration could be configured.\n\n## Billing-period rollover\n\nMonthly plan allowances reset with the billing period. Purchased value is maintained in the billing ledger rather than being limited to the `account_usage_periods` row where the purchase first appeared; the current period's `topup_bytes` and `topup_credits` fields are projections of eligible, unexpired lot balances.\n\nCredit rollover is also live: credits present in the current period's `rollover_credits` field are included in the enforced credit budget together with included and purchased credits. Rollover is consumed before a top-up lot is charged. The presence of this budget field does not make top-up expiry configurable and does not extend a purchased lot beyond its 180-day expiry.\n\nYour current purchased and rollover balances appear under **Dashboard → Settings → Billing**."
275
+ "body": "# Top-ups and rollover\n\nHow purchased bandwidth and credits expire, carry across periods, and are consumed.\n\nTop-ups add bandwidth or credits without changing your plan's included allowance. The billing ledger records each purchase as its own lot and consumes eligible lots as billable work exceeds included and rollover allowances.\n\n## Expiration\n\nPurchased top-up lots expire **180 days after the payment provider object was created**. A cancellation or downgrade freezes the lot and **resets that deadline to 90 days from the freeze**. The reset runs in both directions: a lot with five months left loses that time, and a lot that was about to expire gains a little. The window is set by the billing service; it is not configurable in the dashboard. Expired lots are removed from the active purchased balance and cannot fund new usage. If your subscription is cancelled or lapses, any purchased balance above the pay-as-you-go tier is held (not spent, not forfeited) until you resubscribe at the same tier or higher. Restoring the balance does not restore the original deadline — a released lot keeps the date the freeze assigned it. A second freeze restamps from that second freeze, because the rule is keyed to the event, not to the lot.\n\nThat source-backed rule supersedes older wording that described top-ups as never expiring or said their expiration could be configured.\n\n## Billing-period rollover\n\nUnused bandwidth from your monthly plan allowance rolls over to the next billing period with no cap, for as long as the subscription stays on its plan or moves to a higher one. A downgrade or cancellation freezes it: the frozen balance stops being spendable, and resubscribing at the same tier or higher within 90 days restores it in full — after that it is permanently lost. Purchased value is maintained separately in the billing ledger rather than being limited to the `account_usage_periods` row where the purchase first appeared; the current period's `topup_bytes` and `topup_credits` fields are projections of eligible, unexpired lot balances.\n\nCredits do not roll over — they reset every billing period. The `rollover_credits` field exists on the usage-period row and is read when computing the enforced credit budget, but it is never written non-zero today, so it has no effect in practice. This does not affect top-up expiry, which follows the rule above and is not configurable.\n\nYour current purchased and rollover balances appear under **Dashboard → Settings → Billing**."
271
276
  },
272
277
  "changelog": {
273
278
  "title": "Changelog",
274
279
  "section": "General",
275
- "body": "# Changelog\n\nRelease history for the ByteKit SDKs, CLI, and MCP server\n\nEach section below is the `CHANGELOG.md` kept alongside that client’s source in the ByteKit\nrepository. Entries record what a release changed, including names and options it retired.\n\n## @hunt-labs/bytekit-sdk\n\nTypeScript SDK, published on npm.\n\n### [Unreleased]\n\n### [0.8.0] - 2026-08-19\n\n#### Removed\n\n- **BREAKING: `billing_multiplier` and `billed_bytes` are gone from the scrape success\n envelope** (#3143). Read `billing` instead — a `BillingNode` that names every factor\n applied to the charge, the multiplier they compose to, and the resulting billed bytes:\n\n ```ts\n // before\n const spend = res.billed_bytes; // flat, base-endpoint only\n // after\n const spend = res.billing?.billed_bytes;\n const why = res.billing?.factors; // [{ name: 'endpoint', value: 1.5, reason: 'scrape_md' }, …]\n ```\n\n This is a correction, not a rename: the two surfaces reported **different numbers for the\n same charge**. The flat pair carried the BASE-endpoint composition, so a markdown cache hit\n read `0.5` / `400` while the real charge — and the `X-Billing-Multiplier` header — was\n `0.75` / `600`; an html-only miss read the per-format credits estimate `1.5` / `150` against\n an endpoint factor of `1.0` / `100`. The flat pair also never carried the `clean_markdown`\n ×3 surcharge, so on a successful clean it under-reported the amount billed by two thirds.\n `billing.multiplier` composes every applied factor behind exactly one rounding, so it is the\n number that predicts your invoice.\n\n `billing` is optional and is **absent** on resources that completed before the billing node\n existed. A pre-node row omits the field rather than reporting a zero node, because a zero\n node would assert that a real past charge was zero. Test the node for presence\n (`res.billing !== undefined`, or equivalently a plain truthiness check — `billing` is an\n object or `undefined`, and an object is always truthy, so the two are the same test here).\n The hazard is a condition that reaches _into_ the node: `if (res.billing?.billed_bytes)`\n silently skips a genuine zero-byte charge, because `0` is falsy. Check that the node is\n present, then read `billed_bytes` from it.\n\n ```ts\n // wrong — a real 0-byte charge is falsy and disappears\n if (res.billing?.billed_bytes) record(res.billing.billed_bytes);\n // right — presence first, value second\n if (res.billing) record(res.billing.billed_bytes); // 0 is a charge, not an absence\n ```\n\n Two endpoints deliberately carry no node: `/v1/search` is billed per credit and reports\n `credits_used`, and a single `/v1/fetch` reports its charge through response headers only.\n The `/v1/logs` row field named `billing_multiplier` is a **different field** and is not the\n envelope field this release removed. It carries the BASE settled `credits_charged` factor,\n not the composed real-endpoint value the `X-Billing-Multiplier` header reports — a markdown\n cache hit reads `0.5` on the logs row and `0.75` on the header.\n\n#### Changed\n\n- Generated `ScrapeErrorEnvelope` types now describe terminal asynchronous `scrape.failed`\n webhook delivery (#1856). No runtime SDK behavior or API shape changed.\n\n#### Fixed\n\n- **`GET /v1/logs` entries now carry `billing_multiplier`, as a JSON number** (#3022). The\n gateway had been serializing that value under an undeclared key `credits`, and as the raw\n Postgres `NUMERIC(10,2)` string (`\"1.50\"`), while the OpenAPI spec — and therefore the\n generated types in `src/generated/api.d.ts` — declared `billing_multiplier?: number | null`.\n Anything typed against this package read `undefined` for the field.\n\n **Breaking at the wire level:** the undeclared `credits` key is gone from every `/v1/logs`\n entry. Code that reached past the generated types to read `credits` must read\n `billing_multiplier`. No SDK method exposes this endpoint, so the only change inside this\n package is the regenerated type description.\n\n- **`change_threshold` (on `monitors.create`/`monitors.list`/`monitors.get`/\n `monitors.update` responses) and `change_pct` (on `monitors.captures.list` entries)\n now serialize as JSON numbers, not strings** (#3021). Both are Postgres `NUMERIC(5,2)`\n columns; the gateway passed the raw driver string through unconverted (`\"5.00\"` /\n `\"7.25\"`) while the OpenAPI spec's _request_ schemas already declared `number` — only\n the _response_ schemas had been (incorrectly) edited to match the buggy string output.\n This release fixes the gateway serializer and corrects the two response schemas to\n `number` / `number | null`, so spec and runtime now agree.\n\n **Breaking at the wire level:** `client.monitors.create()`, `client.monitors.list()`,\n `client.monitors.get()`, and `client.monitors.update()` now return a JS number for\n `change_threshold` instead of a string (screenshot-type monitors only); the create\n response's `MonitorCreateResponse` and every other monitor route serialize through the\n same `MonitorResponse` schema, so all four are affected identically.\n `client.monitors.captures.list()` now returns a JS number for `change_pct` instead of a\n string. Code doing `parseFloat(monitor.change_threshold)` or template-literal\n interpolation keeps working; strict `typeof x === 'string'` checks or string methods\n (`.trim()`, `.padStart()`) will now throw. `change_pct` is `null` (not `0`) when there is\n no prior capture to diff against, unchanged from before. No SDK method-level shape\n changed otherwise — the only change inside this package is the regenerated type\n description.\n\n### [0.7.4] - 2026-08-19\n\n#### Changed\n\n- **`gen:version` no longer runs as part of `build`** (#3144). `scripts/gen-version.ts` writes\n `src/version.ts`, a _tracked_ source file, and it was chained into the `build` script. That made\n a build silently rewrite committed source whenever the file disagreed with the manifest: local\n runs went green on a tree CI could fail, the resulting ` M src/version.ts` was indistinguishable\n from routine build noise, and in CI the outcome depended on whether Turbo's build cache hit\n (restoring `dist/**` without re-running the generator) or missed. `build` now starts at\n `rm -rf dist ...`, so building this package touches nothing tracked. This changes `prepack` /\n `prepublishOnly` behavior too: both call `build`, so the publish path now reads the committed\n `src/version.ts` rather than regenerating it, and the committed value is what ships.\n- **New `gen:version-check` script**, `pnpm gen:version && git diff --exit-code src/version.ts`,\n mirroring the existing `gen:types-check` in the same manifest. It runs in `.woodpecker/ci.yaml`'s\n `types-drift` step, so a manifest bump without the matching `src/version.ts` regeneration now\n fails a named PR check instead of reaching `staging`. `src/__tests__/version-parity.test.ts`\n stays in place as the in-suite assertion; the gate is what makes its failure reachable before\n merge rather than after.\n\nNo runtime or type changes. `SDK_VERSION` and the `X-ByteKit-Client: sdk_ts/<version>` affix\nbehave exactly as before.\n\n### [0.7.3] - 2026-08-18\n\n#### Changed\n\n- **`XFetchContentLength`'s description no longer calls the header a wire-byte count** (#3133).\n `X-Fetch-Content-Length` is the byte length of the response body actually served: on a\n passthrough `/v1/fetch` (no `format`) that is the relayed upstream payload, so it does equal\n the upstream wire bytes — but with `format=html` or `format=markdown` the gateway overwrites\n it with the transformed document's length, which is typically far smaller than what is billed.\n The old description therefore read as a billing discrepancy on every transform request. Billing\n is unchanged and has always used the upstream compressed wire bytes reported by `X-Raw-Bytes` /\n `X-Billable-Bytes`. Generated-type comments only; no type or runtime behavior changes.\n\n### [0.7.2] - 2026-08-17\n\n#### Changed\n\n- **`ScrapeResponses.202`'s headers no longer advertise `X-Raw-Bytes`, `X-Billable-Bytes`, or\n `X-Billing-Multiplier`** (#3068). The gateway's async `/v1/scrape` path only ever emitted\n `X-Scrape-ID` and `X-Scrape-Status: queued` on a 202 — a queued scrape has no finalized byte\n charge yet — but `docs/api/openapi.yaml` documented the billing-transparency trio there too,\n so `src/generated/api.d.ts` typed three response headers the runtime never sends. This corrects\n the generated type to match the gateway's actual behavior; it does not change any runtime\n behavior. The synchronous `200` response, and `/v1/screenshots`' `202` (which does finalize a\n charge before responding), are unaffected.\n\n### [0.7.1] - 2026-08-11\n\n#### Changed\n\n- **Generated types follow the spec's corrected error and format vocabularies** (#2959). Two\n vocabulary corrections in `docs/api/openapi.yaml` flow through `src/generated/api.d.ts`:\n - `ScrapeErrorEnvelope.error.code` no longer lists `quota_exhausted`. The API has emitted\n `quota_exceeded` since #1539 and there is no throw site for `quota_exhausted` anywhere in\n the gateway, so this removes a code that has never been sent — not one that stops being\n sent. A consumer switching on it was matching a branch that could not be reached; the\n live code for an exceeded quota is `quota_exceeded`. `invalid_url`, which the API does\n emit, is unchanged and still listed.\n - `createBulk`'s `formats` now spells the raw-HTML value `raw_html`, matching `ScrapeRequest`\n and `createScrapeBulk`. `/v1/bulk` previously accepted only the internal `rawHtml`\n spelling and the spec documented that; it now accepts both, so the one endpoint that\n disagreed with the rest of the surface no longer does. `rawHtml` keeps working.\n\n#### Added\n\n- **`ByteKitError.headers` — the failing response's headers, so you can write your own backoff**\n (#2957). This SDK performs exactly one `fetch` per call and never retries, deliberately, so that\n retry policy stays the caller's. But the policy was unwritable: `ByteKitError` carried no\n headers and `requestWithResponse` returns headers only on 2xx — which a rate-limited request\n never reaches — so `Retry-After` and the `X-RateLimit-*` family were unreachable through the SDK\n at every entry point. `err.headers` closes that:\n\n ```ts\n if (err instanceof ByteKitError && err.status === 429) {\n const waitMs = Number(err.headers?.get('Retry-After') ?? 1) * 1000;\n }\n ```\n\n It is the runtime's own `Headers` object rather than a snapshot, so `get()` stays\n case-insensitive whatever casing the wire used. **Strictly additive**: it is optional and last\n on the constructor, follows the same `declare` discipline `details` uses, and an error\n constructed without one carries no `headers` key at all — `'headers' in err`, spreads and\n `JSON.stringify` are unchanged for every pre-existing construction, as are `status`, `code`,\n `message`, `details` and both 2xx return shapes. Only **response** headers are exposed;\n `Authorization` rides on the request and is never reachable through it.\n `ByteKitConnectionError` is unchanged — no response, no headers to carry.\n\n#### Fixed\n\n- **`screenshots.getWithResponse`'s docstring no longer promises headers that endpoint never\n emits** (#2957). The JSDoc — the one an IDE surfaces on hover, and the one the published SDK\n reference is generated from — claimed the documented `X-Screenshot-*` / `X-Raw-Bytes` /\n `X-Billable-Bytes` / `X-Billing-Multiplier` headers \"are on `headers`\". They are not:\n `GET /v1/screenshots/{id}` is declared with **no** `X-*` response headers, which is what\n `ByteKit.requestWithResponse`'s own doc comment and the README have said all along, and what a\n live GET confirms. Documentation only — no signature, return type or runtime behavior changed.\n `screenshots.createWithResponse` (`POST /v1/screenshots`) really does emit that family, and its\n docstring still says so.\n\n- **README documents the `signal`-vs-`timeoutMs` precedence and the `requestTimeoutMs` escape\n hatch** (#2957). Passing your own `AbortSignal` silently disables the constructor's `timeoutMs`\n — the signal becomes the request's only abort source, so a client built with `timeoutMs: 200`\n waits indefinitely if the signal never fires. That precedence was documented on\n `RequestOptions.signal` in the types, where only a reader already inspecting the option would\n meet it, and nowhere in the README. A new \"Timeouts and cancellation\" section states it with the\n full four-row precedence table and shows `requestTimeoutMs` composed alongside a caller signal\n (the request then aborts on whichever fires first). No behavior changed — the precedence is what\n it always was.\n\n- **`ScrapeWarning.code` now carries all 12 codes the server can emit** (#2948). The generated\n union in `src/generated/api.d.ts` listed 10. `low_quality_extraction` and\n `fragment_menu_stripped` — added to the server-side emitter union by #1701 — never reached\n `docs/api/openapi.yaml`, so every regeneration since faithfully reproduced the gap and the\n exported type was non-exhaustive: a `switch` over `warning.code` that TypeScript proved\n exhaustive would silently fall through on a warning the API really returns. Widening the spec\n and regenerating fixes the type; no runtime code changed. The other 10 codes are unaffected.\n\n- **Gateway wire-type correction: `billing_multiplier` is a JSON number on `scrape.get()` again**\n (#2954). `GET /v1/scrape/{id}` (and `GET /v1/scrape/bulk/{id}` items) were serializing\n `billing_multiplier` as a JSON string (e.g. `\"0.50\"`) instead of a number — the pg driver\n returns the underlying `NUMERIC(10,2)` column as a string, and the gateway's GET serializer\n passed it through unconverted, while `POST /v1/scrape`'s create-path value (computed in JS) was\n already correct. Fixed upstream in the gateway; this SDK required no code change, only removal\n of the `KNOWN DRIFT (#2426)` JSDoc on `ScrapeResource.get()` that documented the workaround —\n the static `number` type this SDK has shipped all along is accurate again. A caller that was\n defensively coercing with `Number(...)` per the old note does not need to change anything; a\n caller relying on the exact string form `\"0.50\"` (rather than doing arithmetic) will now see\n `0.5`.\n\n#### Changed\n\n- **Alignment release — no consumer-visible change _in the alignment itself_** (the `#2948` type\n widening above is a separate, deliberate change under this same version). `0.7.0` published to npm at\n `2026-08-11T21:17:42.790Z`. Two doc comments, in `src/client.ts` and `src/version.ts`, were\n reworded **after** the commit that introduced the `0.7.0` version string — they had re-spelled\n the `X-ByteKit-Client` header name in prose, which issue #2905's pre-merge gate 1 counts. No\n exported function, type, or runtime behavior differs from `0.7.0`.\n\n This release exists because `check-release-drift` (#2680) is version-gated and anchors on the\n commit that introduced a version, not on the commit whose tree was actually published. Once\n `0.7.0` reached npm, any shipped-file change after that anchor reads as post-release drift.\n Bumping moves the anchor past those comments. The published `0.7.0` artifact is **not** stale in\n any way a consumer can observe — the divergence is comment text only.\n\n- **Corrected a false legacy-name claim carried since the rename (#2950).** The `0.7.0`-era note\n below said the prior `rapidcrawl`/`@rapidcrawl/sdk` name \"remains installable at its last\n version but is deprecated.\" Verified 2026-08-13: both `rapidcrawl` and `@rapidcrawl/sdk` return\n npm `404` (\"is not in this registry\"), and `npm deprecate` against either fails with the same\n `404` — there is no published version left for a deprecation notice to attach to, so the claim\n never held. No registry stub or deprecation was possible to publish; root `CLAUDE.md` carried\n the same false claim and is corrected alongside this entry. Users of the old names should\n install `@hunt-labs/bytekit-sdk` directly. No exported function, type, or runtime behavior\n changes.\n\n### [0.7.0] - 2026-08-11\n\n#### Added\n\n- **Every outbound request now carries `X-ByteKit-Client: sdk_ts/<version>`.** The SDK identifies\n itself with the sanctioned `client_surface` marker (issue #2905, slice 2 of #2701), so requests\n made through `@hunt-labs/bytekit-sdk` are distinguishable from raw API calls in ByteKit's own\n analytics instead of all resolving to `api_direct`. `sdk_ts` is a member of the closed\n `client_surface` vocabulary declared in issue #2904; the version affix is this package's own\n version, baked in at build time from `package.json`.\n\n Set at exactly ONE place — the header literal inside the private transport every request funnels\n through — so it rides on the JSON path, the raw `/v1/fetch` path and every resource method\n alike. **Nothing else about a request changed:** same `Authorization` and `Content-Type`, same\n body bytes, same client-side abort budget, same error taxonomy, same return shapes. The marker\n carries no caller data and cannot be set, overridden or read by callers — there is no\n `headers` option on `ByteKitOptions` or `RequestOptions`.\n\n Minor rather than patch because the wire format of every request changes, even though no\n documented API does. A gateway that does not yet recognize the header ignores it.\n\n- `SDK_VERSION` — an internal, build-time-generated constant (`src/version.ts`, written by\n `pnpm gen:version` from `package.json` and gated by `src/__tests__/version-parity.test.ts`).\n It backs the marker's version affix. **Not part of the public export surface**;\n `package.json`'s `version` field remains the only version consumers should read.\n\n#### Unchanged\n\n- **Still ZERO runtime dependencies.** The `client_surface` vocabulary lives in an internal,\n unpublished workspace package, so the emitted value is a string literal here and the binding to\n that registry is a test-only import. `dependencies` stays empty, asserted by\n `src/__tests__/package-manifest.test.ts`.\n\n### [0.6.2] - 2026-08-11 [NEVER PUBLISHED]\n\n**This version was cut but NEVER PUBLISHED — npm `latest` went from 0.6.1 straight to 0.7.0.**\nThe two documentation/regeneration changes below reached consumers in the **0.7.0** artifact,\nwhich contains all of them. Nothing under this heading is missing from 0.7.0, and nothing is\ninstallable at 0.6.2: `npm i @hunt-labs/bytekit-sdk@0.6.2` fails.\n\nWhy it was stranded: 0.6.2 was cut for two `src/generated/api.d.ts` regenerations, and the next\nchange (issue #2905's new outbound request header) altered the wire format of every request —\nadditive behavior that belongs at a MINOR, not a patch. Folding it into the still-unpublished\n0.6.2 would have shipped a new request header to consumers pinning `^0.6.1` unannounced, so 0.7.0\nwas cut instead and this heading annotated per `ci/scripts/check-release-drift.sh`'s\nreconciliation form (#2680).\n\n#### Documentation\n\n- **`AccountSessionResponse.has_activity` now documents what it actually means.** The generated\n type's JSDoc previously said the flag was true once the account had \"ever recorded billable\n activity\", which read as \"ever made a request\". It is true only once a request has\n **successfully completed and been charged credits** — a request that failed does not flip it,\n even when its bandwidth was billed (issue #2890). The doc comment also now states the\n all-time (never windowed) scope and the up-to-one-rollup lag, so a caller polling it after a\n first request knows `false` can mean \"not visible yet\" rather than \"never made a request\".\n Regenerated from `docs/api/openapi.yaml`; the emitted TYPE is unchanged\n (`has_activity: boolean`), so this release is source-compatible in both directions.\n\n#### Changed\n\n- Regenerated `src/generated/api.d.ts` from `docs/api/openapi.yaml` after issue #2904 declared the\n optional `X-ByteKit-Client` request header as `components.parameters.ClientSurfaceMarker`. The\n regeneration is ADDITIVE and touches no method signature: one entry appears under\n `components[\"parameters\"]`, because the parameter is deliberately `$ref`-ed from no operation.\n **No consumer-visible change** — no exported function, type or runtime behavior differs from\n 0.6.1. The entry exists because `check-release-drift` (#2680) requires a version bump for any\n post-release change to a shipped file, and the publish pipeline is version-gated.\n\n Documented under 0.6.2 alongside the #2890 regeneration above, rather than under a 0.6.3 of its\n own, because 0.6.2 has been CUT BUT NOT PUBLISHED (npm `latest` is 0.6.1). Both regenerations\n therefore ship in the same single artifact. Numbering this 0.6.3 would leave 0.6.2 documented and\n unpublishable — the version-gated pipeline would publish 0.6.3 and skip it — which is precisely\n the phantom-version class #2680 exists to kill, and `check-release-drift` rejects it by name.\n\n### [0.6.1] - 2026-08-10\n\n#### Changed\n\n- Version-alignment release after the 2026-08-10 publish rescue: the published 0.6.0 artifact was built from the `main` promotion HEAD, which already contained every change documented under the 0.6.0 heading — but that commit postdates the one that introduced the 0.6.0 version string, so the `check-release-drift` gate (#2680) correctly reported shipped drift on every subsequent CI run (#2829). 0.6.1 realigns manifest ↔ registry ↔ version-introducing commit. **No consumer-visible change relative to the published 0.6.0.**\n\n### [0.6.0] - 2026-08-07\n\n#### Added\n\n- **`ByteKitError.details`** — the API error envelope's structured rejection reason is now\n reachable from the thrown error. A `422 validation_error` carries\n `{ formErrors, fieldErrors }`, so a caller can finally read WHICH request field was\n rejected rather than only that the request was invalid; a `400 invalid_url` carries a flat\n `{ url, field, reason }`. Typed as `ByteKitErrorDetails | undefined` where\n `ByteKitErrorDetails = Record<string, unknown>` (also exported), deliberately loose because\n the contents vary by error code — narrow the member you read. Strictly ADDITIVE: `details`\n is an optional FOURTH constructor argument, so existing three-argument\n `new ByteKitError(status, code, message)` construction is unchanged, and `status` / `code` /\n `message` are byte-identical. Populated only from the canonical `{ error: { … } }`\n envelope — a flat vendor-masked body (`/v1/search` `502 {\"error\":\"search_provider_error\"}`)\n carries no structured detail and grows none. `http_status` and `failed_at` are deliberately\n NOT exposed: `http_status` would duplicate the existing `status` property, and a duplicated\n field that can disagree with its twin is a bug surface. (#2685)\n\n- A `tsc --noEmit`-checked parity pin in `src/types.ts` ties the hand-authored search types\n (`SearchOpts`, `SearchResult`, `SearchResultImage`, `SearchResponse` — the SDK's only\n hand-authored request/response types) to the generated `operations['createSearch']`\n request and `200` response. It asserts key-set and optionality parity in both directions\n and assignability in each meaningful direction, so a future spec change that search's\n types do not follow fails the build instead of shipping. Value types are erased before the\n parity comparison, so a deliberate hand-authored refinement (a branded id, a narrowed\n union) cannot trip it. Type-level only — the assertions erase at emit and add nothing to\n `dist/`. (#2678)\n\n#### Fixed\n\n- **README: the `fetch` sample's `res.cache` type is corrected to include `null`.** The\n documented type read `\"hit\" | \"miss\" | \"bypass\"`, but `FetchResult.cache` is\n `FetchCacheStatus | null` (null when the response carried no recognizable `X-Fetch-Cache`\n header) — the one strict-`tsc` error a real consumption file copied from the README ever\n produced. The line is now a TYPED ASSIGNMENT rather than a comment, so the README compile\n guard (`src/__tests__/readme-compiles.test.ts`) typechecks it: comment-vs-type drift on\n this field now fails the build instead of shipping. Documentation only — no runtime or type\n change. (#2685)\n\n- **CHANGELOG: the `[0.1.0]` heading's malformed `- 2026` date is now `- 2026-04-24`**, the\n commit date of `caf17e56b`, which introduced `packages/sdk-typescript/package.json` at\n version `0.1.0`. Every other heading in this file already carried a full ISO date; this one\n broke the Keep a Changelog `## [x.y.z] - YYYY-MM-DD` form. (#2685)\n\n- **Test-only: nine SDK test files mocked wire bodies the API can never send.** A\n `monitors.create` 200 (the operation declares 201 as its only success arm), a scrape 200\n carrying `data: { markdown }` (the envelope has no `data` member — content lives under\n `formats`), a `screenshots.getWithResponse` mock asserting `X-Screenshot-*` headers that\n `GET /v1/screenshots/{id}` declares on no arm, error bodies omitting the `Error` schema's\n required `status: 'failed'` / `http_status` / `failed_at`, and twelve `402`/`429` arms on\n operations that declare neither status. Each is rewritten to a spec-valid shape with a\n comment naming the arm it now matches, and every test keeps its original assertion target.\n No shipped code changed. (#2685)\n\n- **`SearchResult.snippet` is now optional (`snippet?: string`) — BREAKING AT COMPILE TIME.**\n `type: 'images'` search results omit `snippet` entirely (the spec has always declared a\n result's `required` set as `[position, title, url]`), but the SDK typed it as a required\n `string`. `hit.snippet.length` therefore compiled under strict TypeScript and threw\n `TypeError: Cannot read properties of undefined` on every images hit — the TypeScript twin\n of the Python SDK's #2579 images `KeyError`. **Consumers reading `.snippet` unguarded now\n see `string | undefined`** and must narrow it (`if (typeof hit.snippet === 'string')` or\n `hit.snippet ?? ''`), exactly as they already do for `date`. No runtime behavior and no\n wire bytes change: the field was already absent from those payloads. `web`/`news` results\n are unaffected — they still carry `snippet`, and a narrowed read yields the same string.\n (#2678)\n\n- **Path parameters are now percent-encoded.** Every id-bearing method built its request path\n with a raw template literal, so a crafted or interpolated id silently retargeted the\n request: `scrape.get('sc_/../../account')` addressed `GET /v1/account` once WHATWG URL\n parsing collapsed the `../` segments, and `monitors.get('mon_x?admin=1#frag')` turned the id\n into a real query string plus fragment. The branded id types constrain only the PREFIX of an\n id, never its tail, so they were never a defence. An id now travels as one percent-encoded\n path segment — a malformed one 404s server-side instead of reaching a different resource.\n Ports the Python SDK's #2593 fix. (#2677)\n\n#### Changed\n\n- Request paths are assembled by a single internal `buildPath()` helper in `client.ts` rather\n than by per-resource template literals. It encodes SEGMENTS only — every fixed segment and\n every `/` separator stays literal — and encodes each value exactly once, so an id that\n already contains a `%` is not double-encoded. **A well-formed id (`sc_<hex>`, `mon_<hex>`, …)\n produces a byte-identical URL to before**, on every id-bearing method: encoding is a no-op\n for those characters, so no existing call changes on the wire. (#2677)\n\n- Four of the guards shipped above could not fail on the change they appeared to protect, and\n now can. `buildPath()`'s two `TypeError` throws — the fail-loud that replaced the\n compile-time checking a template literal used to give — each survived its own removal with\n the whole suite green, and are now pinned by tests separated by input shape rather than by\n message text. The in-suite path-helper gate read its directory non-recursively while the\n shell grep it reproduces is `-r`, so an offender one directory down was invisible to it; it\n now walks the whole of `src/`, a strict superset of the shell gate's set. The `images`\n search-result literal's key ABSENCE (no `snippet`, no `date`) was held only by a\n one-directional subtype check, which an extra key cannot break; it is now pinned by explicit\n key-absence assertions plus an exact key-set assertion. And the spec's `error.details` —\n read at one site in `client.ts` off a hand-written inline type — is now tied to the\n generated schema by a PRESENCE pin, so dropping the field from `docs/api/openapi.yaml` fails\n the build. Every pin is key-level, never value-level, so a deliberate hand-authored value\n refinement still cannot trip it. Test- and type-level only: no runtime behavior, no exported\n type, and nothing in `dist/` changes. (#2793)\n\n### [0.5.0] - 2026-07-29\n\n#### Added\n\n- `src/generated/api.d.ts` now models the `400` responses that the gateway's new\n request-body-size guards can return. `operations['stripeWebhook']['responses']` gains a\n `400` with this route's bespoke `{ error?: string }` body, and\n `operations['retryWebhookDelivery']['responses']` gains a `400` carrying the unified\n `components['schemas']['Error']` envelope. Both are purely additive — no existing member\n changed shape — so every current call site still compiles. (#2640)\n\n#### Changed\n\n- Regenerated `src/generated/api.d.ts` against the merged spec. Beyond the two added `400`\n members above, the delta is JSDoc only: every guarded endpoint's description now carries a\n `**Limits:**` block stating its byte ceiling and the `request_too_large` error code\n (#2640), and `POST /v1/bulk`'s description documents `defaults.type` inheritance and the\n 422 on unrecognized keys (#2643). No runtime code changed. (#2640, #2643)\n\n### [0.4.0] - 2026-07-24\n\n#### Added\n\n- `RequestOptions` (per-call `requestTimeoutMs` + caller `signal`) is now accepted by\n **every** resource method, not just `scrape.create` / `scrape.get`. It is always a\n trailing optional parameter — on `screenshots.create` it is the third positional, after\n `params` — so every existing call site compiles and serializes byte-identically. Per-call\n options continue to beat the constructor's `timeoutMs` default; omitting them leaves the\n constructor default in force exactly as before. (#2547)\n- `ApiResponse<T>` (`{ data, headers, status }`), a generic `client.requestWithResponse<T>()`\n transport, and three typed siblings — `sitemap.getWithResponse`,\n `screenshots.createWithResponse`, `screenshots.getWithResponse` — make the documented\n `X-Raw-Bytes`, `X-Billable-Bytes`, `X-Billing-Multiplier` and `X-Screenshot-*` response\n headers reachable. This surface is purely **additive**: it issues the identical request\n with the identical options as the base method, and no existing return type changes.\n (#2547)\n- `MonitorStatus` and `ScrapeCookie` are exported from the package entrypoint. (#2547)\n\n#### Changed (**BREAKING** at compile time)\n\n- `ScrapeOpts.cookies` is now `ScrapeCookie[]`, derived from the spec's `Cookie` schema\n (`name` and `value` required; `domain`, `path`, `secure`, `httpOnly` optional), instead of\n an open bag of untyped records. A cookie missing `name` used to compile and fail as a 422\n on the wire; it is a compile error now. Serialization is unchanged. (#2547)\n- `ListMonitorsParams.status` is now the spec enum\n (`'active' | 'processing' | 'paused' | 'cancelled' | 'suspended'`), derived from the\n generated `listMonitors` query type, instead of `string`. A typo like `'activee'` used to\n compile and 422; it is a compile error now. The serialized query string is unchanged.\n (#2547)\n\n#### Fixed\n\n- `timeoutMs` / `requestTimeoutMs` (and a caller-supplied `signal`) now cover the\n **response body read**, not just the time to first byte of headers. The abort budget was\n armed for `fetch` and cleared the moment headers arrived, after which `request()`'s\n `response.text()`, `requestRaw()`'s `response.arrayBuffer()`, and the error-body\n `response.json()` on a non-2xx all read the body unbounded — so a server that answered\n with headers and then stalled its body hung the caller forever. A mid-body abort now\n surfaces as `ByteKitConnectionError` with `code: 'timeout'` (budget) or `'aborted'`\n (caller signal) instead of a bare `TypeError: terminated`.\n\n The default is **unchanged at 120 s**, and the precedence table for\n `signal` / `requestTimeoutMs` / `timeoutMs` is untouched. One consequence worth planning\n for: a legitimately large body (a multi-MB `/v1/fetch` document) now counts against that\n same budget, where previously only the wait for headers did. (#2546)\n\n- The README's webhook-retry sample used an invalid delivery id prefix (`whd_`) that its own\n branded type rejects. The sample is corrected, and a new test compiles every TypeScript\n sample in the README against the SDK's sources so a non-compiling sample can no longer\n ship. (#2547)\n\n#### Fixed (**BREAKING** at compile time)\n\n- `fetch.get` no longer accepts the eleven markdown-tuning options (`markdown_mode`,\n `markdown_query`, `markdown_links`, `markdown_images`, `with_links_summary`,\n `with_images_summary`, `markdown_compact`, `markdown_filter_images`,\n `markdown_include_media`, `markdown_include_warnings`, `markdown_include_stats`).\n The spec's `GET /v1/fetch` declares only `url`, `format`, `country`, `timeout_ms`\n and `cache_ttl`, so those options were silently dropped by the query builder — a\n caller asking for `markdown_mode: 'llm'` compiled and received default article-mode\n markdown. They are now compile errors instead of silent no-ops; use `fetch.create`\n (POST), which accepts and serializes all of them unchanged. `FetchGetOpts` is now\n derived from the generated `getFetch` query type, so future spec drift fails\n `tsc --noEmit` rather than reaching production. (#2539)\n\n### [0.3.0] - 2026-07-21\n\n#### Removed (**BREAKING**)\n\n- The deprecated `RapidCrawl`, `RapidCrawlError`, and `RapidCrawlConnectionError`\n exports and the `RapidCrawlOptions` type alias (kept as a one-minor-version\n bridge in #2421) are removed. Import the `ByteKit*` names instead. (#2473)\n- The `RecordingId` type export is removed. Recordings are deactivated\n (`/v1/recordings` returns 410), so the branded id had no reachable use.\n Breaking in theory only — unused in practice. (#2481)\n\n#### Fixed\n\n- `fetch.create` / `fetch.get` no longer throw a bare `SyntaxError` on every\n non-JSON body. `/v1/fetch` returns the fetched content AS the response body\n (metadata in `X-Fetch-*` headers), but both methods routed through the\n JSON-parsing transport. They now use a raw-capable transport and resolve to a\n typed `FetchResult` — raw `body`, byte-exact `bytes`, plus `id`,\n `creditsCharged`, `cache`, `custom`, `contentType`, and `headers` parsed from\n the `X-Fetch-*` metadata. (#2466)\n- A trailing slash on the constructor `baseUrl` (e.g. `\"https://api.bytekit.com/\"`)\n no longer produces double-slash request URLs — it is normalized once, preserving\n a path-carrying baseUrl. (#2481)\n- `SearchResult.date` is now optional (`string | null | undefined`): `images`\n search results omit the field entirely. (#2481)\n\n#### Added\n\n- New `usage` resource (`get`, `daily`, `byEndpoint` — `GET /v1/usage`,\n `/v1/usage/daily`, `/v1/usage/by-endpoint`) and `webhooks` resource (`list`,\n `retry` — `GET /v1/webhook-deliveries`, `POST /v1/webhook-deliveries/{id}/retry`),\n with their request/response types exported. (#2471)\n- `ScrapeOpts` and `FetchOpts` now cover the full documented request field set\n (10 previously missing `ScrapeRequest` fields; 11 markdown-tuning\n `FetchRequest` fields), plus the `'text'` markdown-links mode. A compile-time\n drift guard keeps them aligned with the generated OpenAPI schema. (#2475)\n- `monitors`, `sitemap`, `bulk`, and `fetch.bulk` methods are now fully typed from\n the generated OpenAPI `operations` (previously `Record<string, unknown>` in /\n `Promise<unknown>` out); their request/response types are re-exported. (#2481)\n- `monitors.list` accepts typed query params and returns a typed response\n (`ListMonitorsParams` / `ListMonitorsResponse`, both exported). (#2480)\n\n#### Changed (**BREAKING**)\n\n- `fetch.get` now rejects a `custom` option at compile time: `GET /v1/fetch` has\n no `custom` query param, so the value was silently dropped before. Use\n `fetch.create` (POST) to echo a `custom` payload. (#2481)\n- `FetchOpts.format` is narrowed from `string` to the spec union\n `'markdown' | 'html'`; off-spec values now fail to compile. (#2475)\n\n### [0.2.2] - 2026-07-16\n\n#### Changed\n\n- Re-release of 0.2.1. The 0.2.1 artifacts never reached npm — the prod publish's\n `publish-sdk` step failed on a CI test-isolation flake (`cjs-require.test.ts`\n rebuilding the shared `dist`), which is now fixed. No consumer-facing changes\n beyond 0.2.1.\n\n### [0.2.1] - 2026-07-16 [NEVER PUBLISHED]\n\n> **Never published to npm.** This version was cut in-tree but no `@hunt-labs/bytekit-sdk@0.2.1`\n> tarball exists — `npm i @hunt-labs/bytekit-sdk@0.2.1` fails. Everything below shipped to users in\n> **0.2.2**, which is the first published release containing it. Reconciled by issue #2680; the\n> `release-drift` CI gate now blocks a new phantom heading from being introduced.\n\n#### Changed\n\n- Primary exports renamed `RapidCrawl`→`ByteKit`, `RapidCrawlError`→`ByteKitError`,\n `RapidCrawlOptions`→`ByteKitOptions`. The old names remain as deprecated,\n identity-preserving aliases (`RapidCrawl === ByteKit`), so existing imports keep\n working. (#2421)\n\n#### Fixed\n\n- `request()` now returns `undefined` on `204 No Content` / empty-body responses\n instead of throwing a JSON-parse error — `account.apiKeys.revoke()` now resolves\n as its `Promise<void>` contract declares. (#2450)\n\n#### Removed\n\n- `client.recordings` (the `/v1/recordings` endpoint is permanently `410`\n deactivated). (#2421)\n\n### [0.2.0] - 2026-07-15\n\nThis is a breaking release. Four runtime behavior changes affect code written\nagainst 0.1.0 — read each one before upgrading.\n\n#### Changed (breaking)\n\n- **Default client-side timeout (120s).** Requests now abort after 120000 ms by\n default (`DEFAULT_TIMEOUT_MS` in `src/client.ts`); 0.1.0 had no client-side\n timeout and would hang indefinitely. A slow request now rejects with\n `RapidCrawlConnectionError` carrying `code: 'timeout'`. Override per client via\n `new RapidCrawl({ apiKey, timeoutMs })`.\n- **Network failures throw `RapidCrawlConnectionError`.** Every `fetch()` rejection\n is now wrapped by `toConnectionError()` and re-thrown as `RapidCrawlConnectionError`.\n 0.1.0 surfaced undici's bare `TypeError: fetch failed`. Code that matched on a bare\n `TypeError` to detect a network failure will no longer match — catch\n `RapidCrawlConnectionError` instead.\n- **Constructor throws on an empty `apiKey`.** `new RapidCrawl({ apiKey: '' })` (or a\n missing key) now throws a `TypeError` immediately instead of silently sending\n `Authorization: Bearer undefined`. Ensure `apiKey` is populated (e.g. from\n `process.env.BYTEKIT_API_KEY`) before constructing the client.\n- **Request-body types narrowed to the OpenAPI schema.** Request payloads are now\n typed from spec-derived types generated from the OpenAPI schema\n (`src/generated/api.d.ts`) rather than `Record<string, unknown>`. Payloads that\n previously compiled by virtue of the loose index type may now be rejected by the\n type checker; align them with the documented request shape.\n\n#### Changed\n\n- Package renamed to `@hunt-labs/bytekit-sdk` (the `@bytekit` npm scope was\n unobtainable). ~~The prior `rapidcrawl`/`@rapidcrawl/sdk` name remains installable at\n its last version but is deprecated.~~ **Corrected in 0.7.1 (see above): that claim\n does not hold — both names 404 on npm and there is no published version left to\n deprecate.**\n- Generated API types (`dist/generated/api.d.ts`) are now shipped in the tarball so\n consumers get the typed request/response surface without regenerating from the spec.\n\n#### Added\n\n- Publish-ready packaging metadata: types-first `exports`, `engines`, `keywords`,\n `homepage`, `bugs`, `README.md`, `LICENSE`, and an MIT `license` field.\n\n### [0.1.0] - 2026-04-24\n\n#### Added\n\n- Initial release of the ByteKit TypeScript SDK — a typed client for the ByteKit API\n (scrape, screenshot, search, and related endpoints), published under the original\n `@rapidcrawl/sdk` name.\n\n## bytekit-sdk\n\nPython SDK, published on PyPI. Import name: `bytekit`.\n\n### Unreleased\n\n### 0.4.0\n\n_Release cut 2026-08-19._\n\n#### Removed\n\n- **BREAKING: `billing_multiplier` and `billed_bytes` are gone from\n `ScrapeSuccessEnvelope`** (#3143). Read `billing` instead — a `BillingNode` that names every\n factor applied to the charge, the multiplier they compose to, and the resulting billed bytes:\n\n ```python\n # before\n spend = res.billed_bytes # flat, base-endpoint only\n # after\n spend = res.billing.billed_bytes # guard on isinstance(res.billing, BillingNode)\n why = res.billing.factors # [BillingFactor(name=\"endpoint\", value=1.5, reason=\"scrape_md\"), ...]\n ```\n\n This is a correction, not a rename: the two surfaces reported **different numbers for the\n same charge**. The flat pair carried the BASE-endpoint composition, so a markdown cache hit\n read `0.5` / `400` while the real charge — and the `X-Billing-Multiplier` header — was\n `0.75` / `600`; an html-only miss read the per-format credits estimate `1.5` / `150` against\n an endpoint factor of `1.0` / `100`. The flat pair also never carried the `clean_markdown`\n x3 surcharge, so on a successful clean it under-reported the amount billed by two thirds.\n `billing.multiplier` composes every applied factor behind exactly one rounding, so it is the\n number that predicts your invoice.\n\n `billing` is `UNSET` on resources that completed before the billing node existed. A pre-node\n row omits the field rather than reporting a zero node, because a zero node would assert that\n a real past charge was zero. Test with `isinstance(res.billing, BillingNode)`, never with a\n truthiness check — a legitimate zero-byte charge is a value, not an absence.\n\n Two endpoints deliberately carry no node: `/v1/search` is billed per credit and reports\n `credits_used`, and a single `/v1/fetch` reports its charge through response headers only.\n The `/v1/logs` row field named `billing_multiplier` is a **different field** and is not the\n envelope field this release removed. It carries the BASE settled `credits_charged` factor,\n not the composed real-endpoint value the `X-Billing-Multiplier` header reports — a markdown\n cache hit reads `0.5` on the logs row and `0.75` on the header.\n\n#### Changed\n\n- Generated `ScrapeErrorEnvelope` documentation now describes terminal asynchronous\n `scrape.failed` webhook delivery (#1856). No runtime SDK behavior or API shape changed.\n\n#### Fixed\n\n- **`GET /v1/logs` entries now carry `billing_multiplier`, as a JSON number** (#3022). The\n gateway had been serializing that value under an undeclared key `credits`, and as the raw\n Postgres `NUMERIC(10,2)` string (`\"1.50\"`), while the OpenAPI spec declared\n `billing_multiplier` as a number.\n\n **Breaking at the wire level:** the undeclared `credits` key is gone from every `/v1/logs`\n entry. Code reading `credits` off a logs response must read `billing_multiplier`. No SDK\n method exposes this endpoint, so nothing inside this package changed.\n\n- **`change_threshold` on `MonitorResponse`/`MonitorCreateResponse` and `change_pct` on\n `CaptureResponse` are now typed `float`, not `str`** (#3021). Both are Postgres\n `NUMERIC(5,2)` columns; the gateway passed the raw driver string through unconverted\n (`\"5.00\"` / `\"7.25\"`) while the OpenAPI spec's request schemas already declared `number`\n — only the response schemas had been (incorrectly) edited to match the buggy string\n output. This release fixes the gateway serializer and corrects the two response schemas,\n so spec and runtime now agree.\n\n **Breaking at the wire level:** `bytekit.api.monitors.create_monitor`,\n `bytekit.api.monitors.get_monitor`, `bytekit.api.monitors.list_monitors`, and\n `bytekit.api.monitors.update_monitor` now return `float` for `change_threshold` instead\n of `str` (screenshot-type monitors only, `create_monitor`/`update_monitor` included since\n both also serialize through the same `MonitorCreateResponse`/`MonitorResponse` schemas);\n `bytekit.api.monitors.list_monitor_captures` now returns `float` for `change_pct` instead\n of `str`. `change_pct` is `None` (not `0.0`) when there is no prior capture to diff\n against, unchanged from before. Only the generated model description changed inside this\n package.\n\n### 0.3.9\n\n_Release cut 2026-08-11._\n\n\n\n#### Changed\n\n- **The declared `httpx` floor is raised from `>=0.24.0` to `>=0.28.0`** (#2998). The SDK's own\n tests assert the exact request and response bytes it puts on the wire, and those bytes changed\n in httpx 0.28.0, which switched to compact JSON separators (`b'{\"a\":\"b\"}'`; every release up to\n and including 0.27.2 emits `b'{\"a\": \"b\"}'`). The old floor therefore promised an install the\n suite cannot run green: on httpx 0.24–0.27 the dependency resolves, and 12 assertions then fail\n with a message naming neither httpx nor a version. Raising the floor was chosen over loosening\n the assertions, because the compact form is the wire format the SDK actually emits and pinning\n it is the reason those tests exist. **No runtime behaviour of this package changes** — only what\n `pip` will resolve. httpx 0.28.0 declares `requires-python >=3.8`, so this excludes no Python\n version the SDK supports (`requires-python = \">=3.10\"`).\n\n- **Generated vocabularies follow the spec's corrected error and format enums** (#2959).\n `ScrapeErrorEnvelopeErrorCode` no longer carries `QUOTA_EXHAUSTED`: the API has emitted\n `quota_exceeded` since #1539 and no gateway throw site produces `quota_exhausted`, so this\n removes a member that has never arrived over the wire — not one that stops arriving. Code\n matching on it was matching a branch that could not be reached; the live code for an exceeded\n quota is `quota_exceeded`. `INVALID_URL`, which the API does emit, is unchanged.\n\n `CreateBulkBodyDefaultsFormatsItem` and `CreateBulkBodyItemsItemFormatsItem` rename\n `RAWHTML = \"rawHtml\"` to `RAW_HTML = \"raw_html\"`, matching `ScrapeRequest` and\n `/v1/scrape/bulk`. `/v1/bulk` accepted only the internal spelling and the spec documented\n that; it now accepts both, so the one endpoint that disagreed with the rest of the surface no\n longer does. `rawHtml` keeps working on the wire.\n\n#### Fixed\n\n- **An invalid `type` or `date_range` passed to `client.search(...)` now raises an error you can\n act on** (#2958). `search(type=\"bogus\")` raised a bare `ValueError: 'bogus' is not a valid\nCreateSearchBodyType` straight out of a generated enum constructor — it named a class you never\n imported, it did not say which values would have worked, and the method's `Raises:` section\n listed only `UnexpectedStatus`, so the error was undocumented as well as unhelpful. The message\n now names the parameter, the value it rejected and every value it accepts, and it is raised\n before any request is sent, so a typo can never be billed.\n\n The type hints for both arguments narrowed from `Optional[str]` to a `Literal` union with the\n generated enum class, which makes a wrong CONSTANT a type error at the call site rather than a\n runtime surprise. **This is hints-only: any `str` is still accepted at runtime**, so code that\n computes the value — from argv, a config file, a database column — keeps working unchanged.\n Enum members (`CreateSearchBodyType.IMAGES`) type-check as before.\n\n- **A successful 200 carrying an extraction-quality warning no longer fails to parse** (#2948).\n `ScrapeWarningCode` was generated from a spec enum that listed 10 of the 12 codes the server\n emits; `low_quality_extraction` and `fragment_menu_stripped` (added server-side by #1701) were\n missing. `ScrapeWarning.from_dict` builds the code with `ScrapeWarningCode(...)`, which raises\n `ValueError` on an unknown member, and #2684's `bytekit_parse` guard then turned that into the\n two-tier contract — so a **successful, billed 200** reached the caller as\n `errors.UnexpectedStatus` under the default `raise_on_unexpected_status=True`, and as\n `response.parsed is None` under the opt-out. Both codes are now in the spec and the enum, so\n such a response parses normally. Callers who added a defensive `except UnexpectedStatus` around\n scrape calls for this reason can drop it. The other 10 codes are unaffected.\n\n#### Changed\n\n- **Connection failures are documented.** Every `Raises:` section named `httpx.TimeoutException`\n and stopped there, and the README's error-handling section did the same. Its transport sibling\n `httpx.ConnectError` — DNS failure, connection refused, TLS handshake failure — is just as\n reachable and is caught nowhere, so `except (UnexpectedStatus, httpx.TimeoutException)` written\n from the documented surface left an uncaught exception waiting for the first flaky network.\n Both client-class docstrings, `search()`'s `Raises:` section and a new README\n **Transport errors** table now name both. No behavior changed: neither exception was ever\n caught, and neither is now.\n\n- **README: two first-use traps.** `get_fetch` takes `url_query=`, not `url=` (it travels as the\n `url` query parameter), and `AuthenticatedClient.search(...)` is synchronous — calling it\n inside a coroutine blocks the event loop, with `create_search.asyncio` as the async\n alternative. Both are now documented with runnable examples.\n\n- **The sdist no longer ships a legacy-brand name.** `bytekit-sdk==0.3.8` carried one occurrence\n of the pre-cutover project name — inside a `.gitignore` this package does not own and its build\n configuration does not list. hatchling force-includes the nearest ignore file into an sdist,\n which here means the repository's, so the string reached PyPI while a search of the package\n itself came back clean. The line is corrected, and the BUILT tarball is now grepped on every\n test run rather than the source tree. Nothing you install changes; the artifact simply stops\n advertising a name and a command that no longer exist.\n\n- **A release can no longer be published while its own changelog denies it exists.** The `0.3.8`\n sdist shipped with its `## 0.3.8` section still carrying the cut-time placeholder that denies\n publication: it was written when the release was cut, was never updated when the release\n actually happened, and nothing existed to notice. The publish step now refuses to upload a\n version whose section still carries that placeholder. This entry documents the fix for readers\n of the artifact; the guard itself lives in the repository. (The placeholder's own wording is\n deliberately not quoted here — the guard reads this section, and quoting it would trip the very\n check being described.)\n\n- **Alignment release — the published `0.3.8` artifact already carries this content.** `0.3.8`\n published to PyPI at `2026-08-11T21:18:32.641Z` (sdist `bytekit_sdk-0.3.8.tar.gz`), built from\n the promotion HEAD, so it contains every change documented under `0.3.8` — including the two\n review fix-ups to the injected `client_surface` converter (non-mapping `headers=` values, and\n case-insensitive override precedence). Verified by downloading the published sdist and reading\n `src/bytekit/client.py`. **Nothing about the installed package changes _through this alignment_**\n — the `#2948` enum fix above is a separate, deliberate change riding the same unpublished version.\n\n This release exists because `check-release-drift` (#2680) is version-gated and anchors on the\n commit that introduced a version, not on the commit whose tree was actually published. Those two\n fix-ups landed **after** the commit that introduced `0.3.8`, so once `0.3.8` reached PyPI the\n gate read them as post-release drift. Bumping moves the anchor past them. This mirrors the\n `0.3.6` version-alignment release cut after the 2026-08-10 publish rescue.\n\n### 0.3.8\n\n_Published to PyPI 2026-08-11 (`21:18:32.641Z`)._\n\n#### Added\n\n- **Every request now carries an `X-ByteKit-Client` header identifying this SDK and its\n version** — `X-ByteKit-Client: sdk_python/<version>`, sent by default from both `Client` and\n `AuthenticatedClient`, on the synchronous and the asynchronous httpx client alike. It lets\n ByteKit tell traffic that came through the Python SDK apart from direct API calls; before\n this release those were indistinguishable. The version half resolves from the installed\n distribution's metadata (the same source as `bytekit.__version__`), so it can never drift\n from `pyproject.toml`.\n\n **A caller-supplied header of the same name wins**, whether it is passed to the constructor\n (`Client(headers={\"X-ByteKit-Client\": \"…\"})`) or merged in later\n (`client.with_headers({\"X-ByteKit-Client\": \"…\"})`) — the marker is a telemetry dimension, not\n an authentication or authorization control, and ByteKit treats an unrecognized value exactly\n as it treats a missing one. Unrelated caller headers leave the marker intact.\n\n The override is matched **case-insensitively**, as HTTP header names are, so\n `x-bytekit-client` and `X-BYTEKIT-CLIENT` override just as `X-ByteKit-Client` does — including\n through `httpx.Headers`, which lowercases every key it is given. Exactly one\n `X-ByteKit-Client` header goes on the wire either way; you will never see your override and\n the default sent together.\n\n Nothing else about request construction changed: `AuthenticatedClient` still stamps its auth\n header, `with_headers` still merges caller keys over defaults, the cookies, timeout, verify\n and redirect settings of both clients are untouched, and `headers=` still accepts everything\n it accepted before — a dict, `None`, a list or tuple of pairs, an `httpx.Headers`.\n\n#### Fixed\n\n- **A `headers` dict you pass to a client is no longer written into by the SDK.** Previously the\n client kept your mapping by reference and stamped `Authorization: Bearer <your token>` into it\n when it built its httpx client, so a dict you still held — and might log, reuse for a second\n client, or share across threads — silently acquired your API key. The client now copies what\n you pass, so your object is left exactly as you gave it and two clients built from one dict\n can no longer contaminate each other's credentials. Nothing about the headers the client\n _sends_ changed.\n\n### 0.3.7 [NEVER PUBLISHED]\n\n> **Never published to PyPI.** This version was cut in-tree but no `bytekit-sdk` 0.3.7 artifact\n> exists — `pip install bytekit-sdk==0.3.7` fails. Everything below shipped to users in **0.3.8**,\n> which is the first published release containing it.\n\n#### Documentation\n\n- **`AccountSessionResponse.has_activity` now documents what it actually means.** The generated\n model's attribute docstring previously said the flag was true once the account had \"ever\n recorded billable activity\", which read as \"ever made a request\". It is true only once a\n request has **successfully completed and been charged credits** — a request that failed does\n not flip it, even when its bandwidth was billed (issue #2890). The docstring also now states\n the all-time (never windowed) scope and the up-to-one-rollup lag, so a caller polling it\n after a first request knows `False` can mean \"not visible yet\" rather than \"never made a\n request\". Regenerated from `docs/api/openapi.yaml`; the attribute's TYPE is unchanged\n (`has_activity: bool`), so this release is source-compatible in both directions.\n\n### 0.3.6\n\n#### Documentation\n\n- No README change ships in 0.3.6. The README's Error handling documentation reached PyPI\n inside the published 0.3.5 artifact (2026-08-10 publish rescue) and stays documented under\n the 0.3.5 heading, which is the version whose wheel actually carries it.\n\n#### Changed\n\n- Version-alignment release after the 2026-08-10 publish rescue: the published 0.3.5 artifact was built from the `main` promotion HEAD, which already contained every change documented under the 0.3.5 heading — but that commit postdates the one that introduced the 0.3.5 version string, so the `check-release-drift` gate (#2680) correctly reported shipped drift on every subsequent CI run (#2829). 0.3.6 realigns manifest ↔ registry ↔ version-introducing commit. **No consumer-visible change relative to the published 0.3.5.**\n\n### 0.3.5\n\n#### Breaking\n\n- **`AuthenticatedClient` takes no positional arguments.** `token`, `prefix` and\n `auth_header_name` are now keyword-only, joining `base_url`, `timeout`,\n `raise_on_unexpected_status` and the rest — so `AuthenticatedClient(...)` accepts keywords\n only. Before 0.3.0 the first positional argument was `base_url`, which made\n `AuthenticatedClient(\"https://api-stg.bytekit.com\", \"sk_live_…\")` a documented call. When\n 0.3.0 made `base_url` a defaulted keyword argument, that call stopped meaning what it said\n and started **binding the URL to `token` and the API key to `prefix`** — sending\n `Authorization: sk_live_… https://api-stg.bytekit.com` to the _default_ host,\n `https://api.bytekit.com`, with nothing raised and nothing warned. It now raises\n `TypeError`. Migration is mechanical:\n `AuthenticatedClient(base_url=\"https://api-stg.bytekit.com\", token=\"sk_live_…\")`. Keyword\n construction — the form the README, the docs site and every example already use — is\n entirely unchanged, including `prefix=`/`auth_header_name=` overrides and the\n `with_headers`/`with_cookies`/`with_timeout` helpers. The unauthenticated `Client` was\n already keyword-only and is unaffected.\n\n#### Fixed\n\n- **A schema-drifted response body no longer crashes with a bare `KeyError`.** A generated\n model's `from_dict` trusts the `required` keys the OpenAPI spec declared when the client\n was generated, so a server that renamed, dropped or retyped a field leaked the generator's\n own internal exception straight to the caller — `KeyError: 'schema_version'` from\n `create_scrape`, `KeyError: 'period_start'` from `get_usage`, `KeyError: 'data'` from\n `list_monitors`, plus `TypeError`/`ValueError` for non-object and nested-drift bodies. It\n happened on a **documented** status (a `200`/`202`), in **both** raise modes, and no row of\n the documented error table covered it, so a caller who handled that table faithfully still\n had no branch for it. Schema drift now takes exactly the same two arms as a non-JSON body:\n `errors.UnexpectedStatus` (carrying `.status_code` and the raw `.content`, with the\n original parse failure attached as `__cause__`) in the default mode, and `None` under\n `raise_on_unexpected_status=False`. Deliberately **no new exception type** — a new class\n would be one every existing `except errors.UnexpectedStatus` silently fails to catch, i.e.\n the same untyped crash in a different costume. Bodies that match the documented schema\n parse exactly as before, and a genuinely optional key that is absent still yields `UNSET`.\n- **`client.search()` never returns a silent `None`.** Its 200 body is parsed through the\n same shared guard the generated operations use, which honors\n `raise_on_unexpected_status` — so an opt-out client got `None` handed back from a non-JSON\n 200 or a schema-drifted one, contradicting both the method's non-`Optional` return\n annotation and its own docstring. `search()` now raises `errors.UnexpectedStatus` in\n **both** raise modes. `raise_on_unexpected_status` configures the generated two-tier\n contract, whose signatures are `Optional[...]`; `search()` was never part of it — it\n already raises on documented error statuses that the generated `create_search` returns as\n a typed `Error` model. A well-formed 200 still returns the parsed\n `CreateSearchResponse200` in either mode.\n- **A non-IANA HTTP status no longer crashes every operation with a bare `ValueError`.**\n Each generated operation built its `Response` with\n `status_code=HTTPStatus(response.status_code)` evaluated _before_ the response was\n parsed, so any status outside Python's `http.HTTPStatus` — Cloudflare's `520`–`530`\n family, nginx's `499` — raised `ValueError: 520 is not a valid HTTPStatus` from inside\n the SDK. This happened in **both** raise modes: the default\n `raise_on_unexpected_status=True` never got to raise its `errors.UnexpectedStatus`, and\n `raise_on_unexpected_status=False`, which promises `None`, raised the `ValueError` too.\n `api.bytekit.com` is served through Cloudflare, so this was exactly the edge/CDN failure\n class the typed-error contract exists for. All 29 operations now behave as documented:\n `errors.UnexpectedStatus` (carrying `.status_code` and the raw `.content`) in the default\n mode, a `Response` with `.parsed is None` in the opt-out mode. The hand-written\n `client.search()` wrapper was never affected and is unchanged.\n\n#### Changed\n\n- **`Response.status_code` is a plain `int` for a status `http.HTTPStatus` does not know.**\n This is the contract decision behind the fix above, recorded here because it is the one\n observable difference in the typed surface. Concretely:\n - Every status the stdlib enum **does** know — documented by the API or not, `200` as\n much as `503` — still comes back as a real `http.HTTPStatus` member, so\n `response.status_code.phrase`, `.name`, and identity comparisons such as\n `response.status_code is HTTPStatus.OK` keep working exactly as before.\n - A status the enum does **not** know (`499`, `520`, `521`, `522`, `530`, …) comes back\n as the plain `int` the wire carried. `int` comparisons (`response.status_code == 520`,\n `>= 500`) work; enum-only attributes (`.phrase`, `.name`) do not exist on it. The\n alternatives were rejected deliberately: a synthetic `IntEnum` member would invent a\n `.phrase`/`.name` no registry backs, and raising before the `Response` is constructed\n is the bug itself — it is precisely what `raise_on_unexpected_status=False` promises\n not to do.\n - The **declared** annotation on `Response.status_code` is unchanged (`HTTPStatus`), so\n this release adds no type errors to existing consumer code; widening it to\n `Union[HTTPStatus, int]` would make `.phrase`/`.name` a type error on _every_ response,\n including the IANA ones, which is a far larger break than the residual it would close.\n Reach for `.phrase`/`.name` only after an `isinstance(..., HTTPStatus)` check if you\n handle edge statuses off a non-raising client.\n\n In the default (raising) mode this is largely invisible: a non-IANA status raises\n `errors.UnexpectedStatus` before any `Response` is returned, and\n `UnexpectedStatus.status_code` has always been a plain `int`.\n\n#### Documentation\n\n- The \"Error handling\" example in the README now requests `formats=[…MARKDOWN]` explicitly.\n Run literally, its success arm printed `<bytekit.types.Unset object at 0x…>`: the snippet\n built `ScrapeRequest(url=...)` with no `formats`, so the server applied its `raw_html`\n default and `result.formats.markdown` was legitimately unset. The same class of defect\n 0.3.3 fixed in the quick start, in the block directly beneath it. The README's error table\n gains the schema-drift row, a note that `search()` is outside the two-tier contract, and a\n migration note for the keyword-only constructor.\n\n### 0.3.4\n\n#### Breaking\n\n- **`CreateBulkBody`, `CreateBulkBodyDefaults`, `CreateBulkBodyItemsItem`, and\n `CreateFetchBulkBodyUrlsItemType1` lost their additional-properties mapping API.**\n `docs/api/openapi.yaml`'s `/v1/bulk` request schema declares `additionalProperties: false`\n on the top-level body, `items[]`, and `defaults` (issue #2641), and `/v1/fetch/bulk`'s\n per-item override schema inside `urls[]` declares the same (issue #2648), matching the\n gateway's own `.strict()` validators. The code generator responds to\n `additionalProperties: false` by omitting the catch-all mapping it otherwise attaches to\n every generated model, so these four models no longer expose `additional_properties`, the\n `additional_keys` property, `__getitem__`, `__setitem__`, `__delitem__`, or `__contains__`.\n Code that did `body[\"some_key\"] = value`, `\"some_key\" in body`, or read\n `body.additional_keys` on any of these four models will now raise\n `AttributeError`/`TypeError` instead. Use the model's declared `attrs` fields directly\n instead (e.g. `CreateBulkBodyItemsItem(url=..., type=...)`,\n `CreateFetchBulkBodyUrlsItemType1(url=..., format_=...)`); the server itself now rejects\n unrecognized keys on these endpoints with `422 validation_error`, so the removed escape\n hatch could never have reached the API successfully anyway. This is scoped to the four\n `create_bulk_body*` / `create_fetch_bulk_body_urls_item_type_1` models — no other generated\n model is affected.\n\n- If you are upgrading from 0.3.2 or earlier, note that **0.3.3 also carried a breaking model\n removal** that went undocumented at the time — see the \"Breaking\" entry under 0.3.3 below\n (`CreateFetchBulkBodyMetadata` and `CreateScrapeBulkBodyItemsItemMetadata`).\n\n### 0.3.3 [NEVER PUBLISHED]\n\n> **Never published to PyPI.** This version was cut in-tree but no `bytekit-sdk` 0.3.3 artifact\n> exists — `pip install bytekit-sdk==0.3.3` fails. Everything below shipped to users in **0.3.4**,\n> which is the first published release containing it. Reconciled by issue #2680; the\n> `release-drift` CI gate now blocks a new phantom heading from being introduced.\n\n#### Breaking\n\n- **`CreateFetchBulkBodyMetadata` and `CreateScrapeBulkBodyItemsItemMetadata` were removed;\n both fields now use the shared `Metadata` model.** This landed with the default-stripping\n traversal fix listed under \"Fixed\" below (issue #2592) and was not recorded at the time.\n Once server defaults stopped being materialized into the request-direction schemas, the two\n per-body `metadata` objects became structurally identical to the shared `Metadata`\n component, and the code generator emits one model per distinct schema — so\n `bytekit.models.create_fetch_bulk_body_metadata` and\n `bytekit.models.create_scrape_bulk_body_items_item_metadata` no longer exist and importing\n either raises `ModuleNotFoundError`. `CreateFetchBulkBody.metadata` and\n `CreateScrapeBulkBodyItemsItem.metadata` are now typed `Union[Unset, Metadata]`. The wire\n format is **unchanged** — the same JSON object is sent either way — so the migration is\n purely at the import site: `from bytekit.models.metadata import Metadata`, then\n `Metadata(...)` (or `Metadata.from_dict({...})`) wherever you constructed one of the two\n removed classes.\n\n#### Security\n\n- **Path parameters are now percent-encoded.** All 13 operations that interpolate an id into\n their URL (`get_scrape`, `get_screenshot`, `get_bulk`, `delete_bulk`,\n `list_bulk_screenshots`, `get_scrape_bulk`, `get_fetch_bulk`, `get_monitor`,\n `update_monitor`, `delete_monitor`, `list_monitor_captures`, `get_sitemap`,\n `retry_webhook_delivery`) previously interpolated the value raw, so an id containing `/`,\n `?`, `#` or traversal segments could retarget the request to a **different path on the same\n authenticated host** — e.g. a `DELETE /v1/bulk/{id}` becoming a delete against another\n resource. Values are now encoded with `quote(str(value), safe=\"\")`. This is **not** a\n breaking change for any id the API issues: hex and `sc_`/`ss_`/`mon_`/`sm_`/`bulk_`-prefixed\n ids contain no reserved characters, so the resulting URL is byte-identical to before.\n No id-format validation was added — the client does not reject id shapes.\n\n#### Fixed\n\n- **Reusing one client across several `asyncio.run(...)` calls no longer raises\n `RuntimeError: Event loop is closed`.** An `httpx.AsyncClient`'s connection pool belongs to\n the event loop that created it, and the SDK cached its internal async client\n unconditionally. It now tracks which loop that client was built on and transparently\n rebuilds it when the running loop changes, re-applying `base_url`, headers, timeout,\n `httpx_args` and authentication. Behavior is unchanged when no loop is running, and a client\n you supply via `set_async_httpx_client(...)` is **never** rebuilt or closed — it stays yours\n to manage. See the README's new \"Clients and event loops\" section.\n- **The README quick start now prints markdown instead of an `Unset` placeholder.** It\n requested no `formats`, so the server applied its `raw_html` default and\n `result.formats.markdown` was legitimately unset. It now asks for\n `formats=[ScrapeRequestFormatsItem.MARKDOWN]` — note `formats` takes enum members, not plain\n strings.\n- **`client.search(type=\"images\")` no longer crashes with a bare `KeyError: 'snippet'`.**\n The OpenAPI spec's search result-item schema declared `snippet` as `required` while its\n own description said the key is omitted for `images` results — a self-contradiction the\n code generator trusted literally, so `CreateSearchResponse200ResultsItem.from_dict`\n unconditionally did `d.pop(\"snippet\")`. `snippet` (like `date`) is now `Union[Unset, str]`,\n matching the real gateway behavior (`web`/`news` results still always carry `snippet`;\n `images` results omit it entirely) — fixed at the spec level (`docs/api/openapi.yaml`) and\n regenerated, not patched in the generated model. (Issue #2579.)\n- **Server defaults are no longer materialized into request wire bodies/query strings\n for inline request bodies and `$ref`'d parameters.** `scripts/filter-spec.ts`'s\n default-stripping traversal previously only followed `$ref`'d request-body component\n schemas, so `ScrapeRequest`/`FetchRequest` were clean but every other request-direction\n shape kept baking in server defaults: `/v1/search`'s fully-inline body (`type`,\n `limit`, `country`, `language`, `date_range`), all three bulk endpoints' bodies and\n their nested `Defaults`/`ItemsItem` models, and `$ref`'d query parameters\n (`GET /v1/fetch`'s `country`/`timeout_ms`/`cache_ttl`, `list_monitors`'\n `limit`/`status`, `list_webhook_deliveries`'/`list_monitor_captures`' `limit`,\n `create_screenshot`'s `async`). The traversal now walks inline request bodies AND\n parameters (both operation-level and shared path-item-level, `$ref`'d or inline)\n before generation, so an omitted optional field always serializes to nothing and\n the server's own default applies — caller-supplied values are unaffected and still\n serialize exactly as given (issue #2592).\n- `tests/test_no_materialized_defaults.py` rewritten to enumerate every\n request-direction model and operation parameter programmatically (walking the\n generated `bytekit.api`/`bytekit.models` trees) instead of sampling two known-clean\n models, so a newly introduced leaker is caught automatically.\n\n#### Changed\n\n- **The source distribution no longer ships `tests/`.** The bundled suite could not be\n collected from an unpacked sdist: 12 of its 27 modules require the repository's codegen\n scripts or the canonical OpenAPI spec, neither of which belongs in a published\n distribution, and three of them build distributions of the package itself. Nothing\n importable was removed — the **wheel is unchanged**, `py.typed` included, so\n `pip install bytekit-sdk` is unaffected.\n\n#### Internal\n\n- CI now proves the committed client is reproducible from the canonical OpenAPI spec, and that\n the generation chain is deterministic (generating twice yields byte-identical output). This\n closes the gap where a spec change could land with a TypeScript-only regeneration and leave\n the Python client silently stranded on an older spec.\n- `ruff` is now pinned to an exact version alongside the code generator. The generator runs\n `ruff` over everything it emits, so it — not the generator alone — determines the committed\n bytes; the generator itself accepts any `ruff<0.13`, which meant a fresh install could\n reformat the whole tree. Bumping the pin is a deliberate, reviewed reformat.\n- The PEP 561 `py.typed` marker is now emitted by the post-generation injector rather than\n hand-maintained inside the generated tree (the generator omits it under `--meta none`).\n\n### 0.3.2\n\n#### Added\n\n- **`bytekit.__version__`** reports the installed distribution version, resolved at import\n time from `importlib.metadata` (so it can never drift from `pyproject.toml`'s\n `[project].version`). When the package is imported from a source tree with no installed\n distribution it reads `0.0.0.dev0` rather than raising. The dead version override in\n `sdk-python-config.yaml` — inert under `--meta none` and contradicting the real\n version — has been removed, leaving one authoritative version.\n\n#### Fixed\n\n- **`AuthenticatedClient.search()` is now visible to type checkers.** It was attached to the\n class after creation, so despite the package shipping a `py.typed` marker, `mypy` and\n `pyright` reported `\"AuthenticatedClient\" has no attribute \"search\"`. It is now declared as a\n real method in the class body that delegates to the same implementation: **runtime behavior,\n arguments, return type and raised errors are unchanged** — only the static surface is fixed.\n\n### 0.3.1 [NEVER PUBLISHED]\n\n> **Never published to PyPI.** This version was cut in-tree but no `bytekit-sdk` 0.3.1 artifact\n> exists — `pip install bytekit-sdk==0.3.1` fails. Everything below shipped to users in **0.3.2**,\n> which is the first published release containing it. Reconciled by issue #2680; the\n> `release-drift` CI gate now blocks a new phantom heading from being introduced.\n\n#### Fixed\n\n- **The \"never a bare `json.JSONDecodeError`\" guarantee is now package-wide across all\n generated operations**, not only the `AuthenticatedClient.search()` wrapper. Every\n generated operation previously called `response.json()` unconditionally on a\n DOCUMENTED status, so a `500`/`502` serving an HTML load-balancer page raised a bare\n `json.JSONDecodeError` from inside the SDK. All operations now parse documented\n statuses through a shared guard: a non-JSON body raises the typed\n `errors.UnexpectedStatus` (or returns `None` when\n `raise_on_unexpected_status=False`), carrying the status code and the raw body.\n- **`errors.UnexpectedStatus.code` / `.message` are now populated for generated\n operations too**, from the documented `Error` envelope — previously they were always\n `None` outside `search()`. A string-valued `error` (the masked search-provider `502`)\n still never enriches, so the upstream provider's identity is never surfaced.\n- Behavior on JSON bodies is unchanged: JSON success bodies still parse into their typed\n success models, documented JSON error bodies are still **returned** as typed `Error`\n models rather than raised, and `raise_on_unexpected_status` semantics are untouched.\n The documented non-JSON success paths — `get_fetch`/`post_fetch`'s raw-text `200` and\n `delete_monitor`'s empty `204` — are likewise unaffected.\n- **README error documentation corrected.** The quick-start example wrapped a call in\n `try/except UnexpectedStatus` and then read `response.formats.markdown`, but a\n documented `4xx` _returns_ a typed `Error` model without raising — so the documented\n example failed with `AttributeError: 'Error' object has no attribute 'formats'`. The\n README now documents the real two-tier contract, and the snippet is executed by\n `tests/test_readme_examples.py` so it cannot silently drift again.\n\n#### Documentation\n\n- Removed the contributor-only `Publishing`, `Regenerating`, and `Development` sections\n from the published README (the PyPI long description) — they described internal CI\n mechanics and a monorepo-contributor workflow that do not belong on a public package\n index. The regeneration/development knowledge is preserved in-repo in\n `packages/sdk-python/CLAUDE.md` (not shipped in the distribution).\n- Added a `## License` section and a `LICENSE` file, matching the npm sibling packages.\n\n### 0.3.0\n\n#### Breaking\n\n- **PyPI distribution renamed `bytekit` -> `bytekit-sdk`.** PyPI administratively\n denylists the bare name `bytekit`, so the package installs as\n `pip install bytekit-sdk`. The **import name is unchanged** — `import bytekit`\n still works, and no module path moved. Nothing was ever published under the old\n distribution name, so there is no migration for existing installs.\n- **`raise_on_unexpected_status` now defaults to `True`.** Undocumented response\n statuses now raise `errors.UnexpectedStatus` instead of silently returning `None`.\n Callers that relied on the old `None`-return behavior must pass\n `raise_on_unexpected_status=False` explicitly to opt out.\n- **`base_url` is now a keyword-only argument.** It gained a default\n (`https://api.bytekit.com`), and to satisfy attrs field ordering it became\n keyword-only. Any caller passing `base_url` positionally must switch to the\n `base_url=` keyword form. (`base_url=` was already the documented usage.)\n\n#### Added\n\n- `AuthenticatedClient(token=...)` now works out of the box against production:\n `base_url` defaults to `https://api.bytekit.com`.\n- Finite default request timeout of `120s` (`httpx.Timeout(120.0)`) — requests no\n longer hang indefinitely. Override with `timeout=`.\n- `errors.UnexpectedStatus` now carries optional `.code` / `.message` attributes.\n The `AuthenticatedClient.search()` wrapper populates them from the documented\n `Error` envelope, and safely raises a typed error (never a bare\n `json.JSONDecodeError`) on a non-JSON documented-status body such as an HTML 502.\n\n## @hunt-labs/bytekit-cli\n\nCommand-line client, published on npm. Binary: `bytekit`.\n\n### [Unreleased]\n\n### [0.8.1] - 2026-08-13\n\n#### Fixed\n\n- **`bytekit search` explains a malformed `200` instead of leaking a `TypeError`.** A server\n answering `200 {\"ok\":true}` — a proxy, a stub, a future envelope change — drove the human-mode\n renderer into `Error: response.results is not iterable`, which named an internal expression\n rather than the field the body was missing. It now reports, on one line and with no stack trace,\n `search: the response carries no \"results\" array — the server returned an unexpected 200 body. Re-run with --json to inspect it.`\n and exits `1`. A `results` value that is present but not an array is caught by the same gate: a\n **string** was previously iterated CHARACTER BY CHARACTER, printing one garbled row per character\n and exiting `0`. Unchanged: an empty `results: []` is still a successful zero-hit search that\n prints nothing and exits `0`; valid responses render byte-identically; and `--json` never reaches\n the renderer, so it keeps dumping the raw body at exit `0` — which is how you inspect an\n unexpected body.\n\n#### Added\n\n- **`screenshots … -o <file>` now says so when the filename contradicts the captured format.**\n `--format` is omitted far more often than not and the server default is **jpeg**, so\n `bytekit screenshots create --url … -o shot.png` wrote JPEG bytes into a `.png`-named file\n silently, at exit `0`; `screenshots get` has no `--format` flag at all, so it could not even be\n told what it was downloading. Both now print one advisory line to **stderr** —\n `Note: the screenshot was captured as jpeg, but shot.png names .png. The file holds jpeg bytes — pass --format png to capture it as png.`\n The captured format is read from the artifact URL's own path, which is the only place the CLI can\n observe it. **Advisory, not enforcement:** the bytes written and the exit code are unchanged, and\n the note goes to stderr, so `-o -` pipelines and stdout redirects stay byte-identical. It stays\n silent unless both the destination and the artifact name a recognized image format and the two\n differ — `.jpg` and `.jpeg` are the same format, and an extension-less destination, a non-image\n extension, `-o -`, or an artifact URL with no usable extension all make no claim to contradict. A\n not-ready poll is untouched: it still prints its bare id and poll note at exit `2`.\n\n#### Changed\n\n- **The README now documents the whole flag surface, and says which reference wins.** Every flag\n worked and every flag appeared in `--help`; the README simply framed subsets as exhaustive, so\n `bulk create`'s `--webhook-secret` / `--defaults` / `--metadata`, `scrape bulk create`'s\n `--custom`, `sitemap create`'s `--webhook-url` / `--webhook-secret` / `--cache-ttl` /\n `--compact` / `--process` / `--metadata`, `monitors create` and `monitors update`'s `--cron`\n (required with `--interval-type cron`) and `--metadata` plus the rest of `update`'s surface,\n `fetch create`'s ten markdown flags and `--custom`, and `screenshots create`'s `--headers` /\n `--cookies` / `--metadata` were all undocumented. All of them are documented now, and a note at\n the top of the README states that `--help` is the authoritative flag reference. **Required flags\n are marked as such** — `--file` and `--webhook-url` on all three bulk creators, `--url` /\n `--interval-type` / `--webhook-url` on `monitors create`, and `--url` on `scrape create`,\n `screenshots create`, `sitemap create` and both `fetch` verbs — so no reader mistakes one for\n optional. Note in particular that a **bulk job has no poll-only mode**: `--webhook-url` is\n mandatory there, unlike on `sitemap create` where omitting it really does mean poll-only. A test\n asserts the parity in the direction that matters — every flag the parser accepts must appear in\n the README — so this cannot drift again silently. No command, flag or behavior changed.\n\n- **Alignment-release note, carried forward from this version's original cut.** `0.8.0` published\n to npm at `2026-08-11T21:18:01.304Z`. Doc comments in `src/client.ts` and\n `src/package-version.ts` were reworded **after** the commit that introduced the `0.8.0` version\n string — they had re-spelled the `X-ByteKit-Client` header name in prose, which issue #2906's\n pre-merge gate 1 counts. No command, flag, exit code, or runtime behavior differs from `0.8.0`\n on account of _those_ comments.\n\n `0.8.1` was cut for that reason because `check-release-drift` (#2680) is version-gated and\n anchors on the commit that introduced a version, not on the commit whose tree was actually\n published. Once `0.8.0` reached npm, any shipped-file change after that anchor reads as\n post-release drift. Bumping moves the anchor past those comments. `0.8.1` had not yet reached\n npm when the entries above landed, so they ride this same pending release rather than stranding\n it as a never-published version.\n\n- **Corrected a false legacy-name claim carried since the rename (#2950).** The `0.8.0`-era note\n below said the prior `rapidcrawl-cli` name \"remains installable at its last version but is\n deprecated.\" Verified 2026-08-13: `rapidcrawl-cli` returns npm `404` (\"is not in this\n registry\"), and `npm deprecate rapidcrawl-cli@'*'` fails with the same `404` — there is no\n published version left for a deprecation notice to attach to, so the claim never held. No\n registry stub or deprecation was possible to publish (npm has nothing to act on); root\n `CLAUDE.md` carried the same false claim and is corrected alongside this entry. Users of the old\n name should install `@hunt-labs/bytekit-cli` directly. No command, flag, or runtime behavior\n changes.\n\n### [0.8.0] - 2026-08-11\n\n#### Added\n\n- **Every outgoing request now carries `X-ByteKit-Client: cli/<version>`.** The CLI identifies\n itself with the sanctioned `client_surface` marker (issue #2906, slice 3 of #2701), so `bytekit`\n usage is distinguishable in ByteKit's own analytics from both raw API calls (`api_direct`) and\n programmatic `@hunt-labs/bytekit-sdk` usage (`sdk_ts`) instead of being counted as one of them.\n `cli` is a member of the closed `client_surface` vocabulary declared in issue #2904; the version\n affix is this package's own version, resolved from `package.json` at runtime — the same value\n `bytekit --version` prints.\n\n Set at exactly ONE place — the header literal inside the private transport core all three CLI\n transports funnel through — so it rides on every command, on the JSON path, on the raw\n `/v1/fetch` path, and on the 429 retry attempt alike. **Nothing else about a request changed:**\n same `Authorization` and `Content-Type`, same body bytes, same per-attempt abort budget, same\n single-retry 429 behavior, same error taxonomy, same exit codes and output shapes. The marker\n carries no user data and cannot be set, overridden or read from the command line — `--headers`\n is a _scrape_ option that travels in the request body to the captured site, and never touches\n the CLI's own request headers.\n\n Minor rather than patch because the wire format of every request changes, even though no\n documented command behavior does. A gateway that does not yet recognize the header ignores it.\n\n### [0.7.1] - 2026-08-10\n\n#### Changed\n\n- Version-alignment release after the 2026-08-10 publish rescue: the published 0.7.0 artifact was built from the `main` promotion HEAD, which already contained every change documented under the 0.7.0 heading — but that commit postdates the one that introduced the 0.7.0 version string, so the `check-release-drift` gate (#2680) correctly reported shipped drift on every subsequent CI run (#2829). 0.7.1 realigns manifest ↔ registry ↔ version-introducing commit. **No consumer-visible change relative to the published 0.7.0.**\n\n### [0.7.0] - 2026-08-07\n\n#### Breaking\n\n- **A not-ready `screenshots get -o` / `screenshots create -o` now exits `2` and prints the bare\n `ss_` id, instead of exiting `1` with `not ready yet: screenshot is pending`.** The two poll\n commands disagreed: `scrape get --raw` on a still-queued scrape already wrote the bare `sc_` id\n to stdout and exited `2` — a distinct, scriptable \"accepted but not ready\" signal — while the\n screenshots side reported the same state as a failure and threw the handle away, so a polling\n script could branch on \"queued\" for one command and not the other. The screenshots branch now\n mirrors scrape exactly: bare `ss_` id on stdout, a poll note on stderr, exit `2`, and (as before)\n no file written. A script that treated any non-zero exit as \"this screenshot failed\" now sees `2`\n for a job that is merely still running — branch on the code (`2` = poll again, `1` = failed)\n rather than on non-zero. Three states deliberately do **not** move: a terminally `failed`\n screenshot stays exit `1` with its error surfaced (it will never complete, so a \"poll again\"\n signal would loop a script forever), an envelope carrying no `ss_` id stays exit `1` (there is no\n handle to hand back), and `--json` keeps the envelope at exit `0`.\n- **`--json` on a `fetch` command now emits `X-Fetch-ID` and `X-Fetch-URL`, not `X-Fetch-Id` and\n `X-Fetch-Url`.** The metadata keys were derived by a generic segment-wise Title-Caser, which\n lowercases every non-initial character of a segment — so the two acronym-bearing headers came out\n in a spelling the API reference never uses, and a `jq '.\"X-Fetch-ID\"'` filter written from the\n docs returned `null`. All 16 `X-Fetch-*` keys now match the spec names byte-for-byte. The\n **values** are unchanged, the non-`X-Fetch-*` headers stay filtered out, and every other key\n (`X-Fetch-Waf-Vendor`, `X-Fetch-Duration-Ms`, `X-Fetch-Fast-Path`, …) is spelled exactly as\n before. A consumer reading `.[\"X-Fetch-Id\"]` must switch to `.[\"X-Fetch-ID\"]`.\n\n#### Fixed\n\n- **A `screenshots get -o` / `screenshots create -o` poll only says \"poll again\" for a `pending` or\n `processing` screenshot.** The not-ready predicate decided from the presence of an `image_url`,\n an `id` and a nested error alone — `status` was read only to phrase the message — so a\n `completed` screenshot whose `image_url` never materialized, a status outside the closed enum,\n and the flat `error_code`/`error_message` failed shape all received exit `2` and \"no image\n artifact is available yet. Poll it with: …\" for a job that would never complete. Those states now\n exit `1`: a terminal failure prints `screenshot failed: …`, and any other artifact-less state\n prints `no image artifact available: screenshot is <status>`. Genuine `pending` / `processing`\n polls keep the bare `ss_` id, the poll note and exit `2` exactly as before — **including** a\n poll whose envelope carries an `error_code` from an attempt that failed and is being retried,\n since the status, not the error, decides whether polling can still help. `--json` still prints\n the envelope at exit `0`.\n- **A terminally failed screenshot reported through the spec's flat `error_code`/`error_message`\n fields now reaches stderr.** Only the nested `{error:{code,message}}` envelope was read, so the\n shape `ScreenshotResponse` actually declares surfaced neither code nor message. It now prints\n `screenshot failed: <message> (<code>)` — the formatting `scrape get --raw` already uses for a\n failed scrape. The nested envelope's own message is unchanged.\n- **`scrape get --raw` on a terminally failed scrape now reports why it failed.** It printed\n `--raw: response contains no formats` — technically true of a `ScrapeErrorEnvelope`, and the one\n diagnostic that cannot explain anything — while the envelope's own `error.code` and\n `error.message` never reached the caller. Both now go to stderr (exit `1`, unchanged). The\n failure is reported ahead of the format diagnostics, so an envelope carrying both a failure and\n an empty `formats: {}` still says why it failed rather than pointing at a `--format` choice that\n cannot help.\n- **An empty-formats success now names the warning that explains it.** A completed scrape whose\n persisted artifact could not be rehydrated comes back with `formats: {}` and an\n `artifact_unavailable` warning; `--raw` rendered that as `--raw requires --format when the\nresponse contains multiple formats`, which is false on both counts. It now names the warning's\n code and message, or says plainly that the formats map is empty when no warning explains it.\n- **Error paths no longer risk losing their own diagnostic.** `handleError` and the missing-API-key\n path each wrote to stderr and then immediately hard-`process.exit(1)`. Node's stderr is\n asynchronous when it points at a pipe, and `process.exit` discards whatever is still queued — so\n the one line a script greps was the line most at risk of being thrown away, which is exactly the\n defect this package's flush policy exists to prevent. Both now set `process.exitCode` and let the\n process end naturally once stderr has drained. The exit codes and the rendered messages are\n byte-identical.\n- `--headers`, `--custom` and `--metadata` said `must be valid JSON (a object)` on a malformed\n value; the article now agrees — `an object` / `an array`.\n- The `[0.6.0]` link reference, missing from the bottom of this file, is restored.\n\n### [0.6.0] - 2026-07-29\n\n#### Breaking\n\n- **`screenshots create --async` now exits `2` in human mode instead of `0`.** The queued 202 is\n not a completed capture — there is no artifact yet — and every other queued path in the CLI\n already signalled that with exit code `2` (`scrape create --async`). A script that relied on\n exit `0` to mean \"the screenshot is ready\" was reading a false success; under `set -e` such a\n script now stops at the queue step, which is the intended correction. The envelope itself is\n unchanged and still printed. Two carve-outs: **`--json` keeps exit `0`** (the envelope is a\n complete machine-readable payload — identical to `scrape create --async --json`), and\n `--async -o <file>` also exits `2` while still writing no file (it prints the queued envelope\n and skips the download, as before). Poll with `bytekit screenshots get <id>`.\n- **A `--file` per-item key outside a bulk endpoint's own strict schema now fails the whole\n create with a `422`** instead of silently succeeding with that key ignored. In 0.5.x, `--file`\n never read anything but `url` from a JSON line — every other key was dropped client-side\n before the request was ever built. As of 0.6.0 those keys ride to the server (`items` on\n `bulk create` / `scrape bulk create`; inside `urls` on `fetch bulk create`), and `/v1/bulk` /\n `/v1/scrape/bulk` reject any key their `.strict()` per-item schema doesn't recognize. A file\n that worked in 0.5.x purely because its extra keys were quietly discarded may now `422` — see\n each command's `--file` help for the keys actually honored on that endpoint.\n- **`fetch bulk create --file` per-item keys outside `url`/`format`/`country`/`cache_ttl` now\n fail the whole create with a `422`** instead of silently succeeding with that key ignored.\n `/v1/fetch/bulk`'s per-item override schema (inside `urls[]`) is now `.strict()` on the\n gateway (issue #2648), matching the `/v1/bulk` / `/v1/scrape/bulk` posture above. The\n `--file` help text for `fetch bulk create` is now uniform with `bulk create` /\n `scrape bulk create` and no longer enumerates keys — this entry is where the honored set\n (`url`, `format`, `country`, `cache_ttl`) is documented instead.\n\n#### Added\n\n- **Per-item bulk configuration on all three bulk creates** (`bulk create`, `scrape bulk create`,\n `fetch bulk create`). A `--file` line may now be a JSON object carrying `url` plus per-item\n fields instead of only a bare URL; such a file is sent as `items` on `/v1/bulk` and\n `/v1/scrape/bulk`, and as a heterogeneous `urls` array on `/v1/fetch/bulk` (which has no\n `items` property). A line whose only key is `url` still normalizes to a bare URL string, so a\n file of url-only lines produces a byte-identical request to before. A JSON line with a missing\n or non-string `url` is now rejected locally with a usage error (exit `1`) instead of being sent\n to the server as a URL. (See Breaking, above, for the per-item strict-schema behavior change\n this enables.)\n- `--defaults`, `--webhook-secret` and `--metadata` on all three bulk creates, plus `--custom` on\n `scrape bulk create` only (`/v1/bulk` and `/v1/fetch/bulk` have no top-level `custom`, so the\n flag would be rejected or stripped there). `--defaults` is forwarded verbatim; the server owns\n precedence and unknown-key handling.\n- The full markdown-tuning surface on `fetch create`: `--markdown-query`, `--markdown-links`,\n `--markdown-images`, `--with-links-summary`, `--with-images-summary`, `--markdown-compact`,\n `--markdown-filter-images`, `--markdown-include-media`, `--markdown-include-warnings`,\n `--markdown-include-stats`, and `--custom`.\n- Webhook delivery and processing flags on `sitemap create`: `--webhook-url`, `--webhook-secret`,\n `--cache-ttl`, `--compact`, `--process`, `--metadata`. Webhook-driven sitemap crawls were\n previously unreachable from the shell.\n- `--headers`, `--cookies` and `--metadata` on `screenshots create`.\n- `--metadata` on `monitors create`, and `--metadata` + `--url` on `monitors update`. `--type`\n remains deliberately absent from `update` — it is immutable server-side.\n\n### [0.5.1] - 2026-07-28 [NEVER PUBLISHED]\n\n> **Never published to npm.** This version was cut in-tree but no `@hunt-labs/bytekit-cli@0.5.1`\n> tarball exists — `npm i @hunt-labs/bytekit-cli@0.5.1` fails. Everything below shipped to users in\n> **0.6.0**, which is the first published release containing it. Reconciled by issue #2680; the\n> `release-drift` CI gate now blocks a new phantom heading from being introduced.\n\n#### Fixed\n\n- **Corrects the scope of the 0.5.0 \"stalled body\" fix claim.** `screenshots create`/`get -o`\n downloads the `image_url` artifact bytes with a bare `globalThis.fetch` call\n (`lib/download-artifact.ts`) that sat entirely outside the transport seam `sendWithRetry` owns —\n no abort signal, no connection-error taxonomy. The 0.5.0 entry below (\"The per-attempt request\n timeout now covers the response body read... a server that answered with headers and then\n stalled its body... hung the CLI forever\", #2546) reads as if it covered every response body; it\n only ever covered API-call bodies read through the JSON/raw transports. A stalled artifact host\n (headers, then a body that never completes) still hung the CLI indefinitely until now. The\n download path now shares the same per-attempt abort budget and `ByteKitConnectionError` timeout\n taxonomy as the API transport (`createAttemptBudget` / `toConnectionError`, exported from\n `client.ts` — no second timeout implementation), with the same 120 s per-attempt default and no\n retry (artifact GETs are not the API's 429 domain). Partial-file policy: the response is\n buffered fully in memory before any write, so an aborted download never leaves a\n partial/truncated file at the `-o` destination. **User-visible consequence:** a legitimately\n slow (but not stalled) large artifact download now hard-fails after 120 s instead of waiting\n indefinitely, and there is currently no CLI flag to raise that budget for a single command.\n (#2587)\n- While in the file: the 429-retry path left its (unread) response body undrained before sleeping\n and retrying — undici cannot reclaim the underlying socket for connection-pool reuse until a body\n is fully read. The body is now drained with `response.text()` on that path, bounded by its own\n short (2 s) cap independent of the 120 s per-attempt budget, so a 429 whose body stalls can no\n longer delay the retry by anywhere near the full attempt budget (or, with the budget disabled,\n forever). **Correction to an intermediate `Unreleased` draft of this same fix:** that draft's cap\n only bounded how long the _retry_ waited — it resolved on schedule but never touched the\n abandoned `response.text()` call itself, which kept reading against a live socket indefinitely.\n Because every CLI success path exits via a soft `process.exitCode` (#2544) rather than\n `process.exit()`, that orphaned read kept the whole process alive forever — strictly worse than\n having no drain at all, and on the exact class of hang this ticket exists to eliminate. The cap\n now also **aborts** the request when it fires, so the abandoned read is actually torn down, not\n merely ignored; this holds even when the per-attempt timeout itself is disabled\n (`timeoutMs <= 0`). **User-visible consequence:** a 429 with a stalled body still costs the retry\n at most ~2 s, exactly as before, but the CLI process now reliably exits afterward instead of\n hanging forever regardless of that visible latency. The same discard-drain on the\n artifact-download's non-2xx path is removed outright rather than capped: that path throws\n straight into `process.exit(1)`, so there is no subsequent request in the process for a reclaimed\n socket to serve, and the drain there bought nothing. (#2587)\n\n### [0.5.0] - 2026-07-24\n\n#### Note\n\n- The `0.3.1` and `0.4.0` versions below document real, tagged changes but were\n never published to npm — the registry's version history jumps straight from\n `0.3.0` to `0.5.0`. Don't go looking for those tarballs; the changes they\n describe ship for the first time in this release.\n\n#### Added\n\n- Surface parity round 2 (#2545): every `x-sdk-scope: v0.1` endpoint the SDK\n exposes now has a CLI command, and the high-value request fields are reachable\n by flags. Each new flag follows the omit-when-absent rule — absent → the key is\n left out of the request, so a server default is never materialized.\n - **New command groups:** `usage get | daily | by-endpoint` (billing-period\n usage reporting), `webhook-deliveries list | retry <id>` (inspect and requeue\n deliveries), and `bulk cancel <id>` (stop an in-flight bulk job).\n - **Monitor pause/resume:** `monitors update --status paused` / `--status active`.\n `monitors create`/`update` also gain `--change-threshold` (float), `--notify-on`,\n `--webhook-secret`, and the JSON-object flags `--webhook-headers`, `--options`,\n `--scrape-options`. `--type` is **create-only** (a monitor's type is immutable).\n - **`scrape create` multi-format `--format`:** repeatable AND comma-separated —\n `--format raw_html --format markdown` and `--format raw_html,markdown` both send\n `formats: [\"raw_html\",\"markdown\"]`. Raw output (`--raw`/`-o`) requires exactly one\n format. New scrape flags: `--cache-ttl`, `--markdown-query`, `--cookies`,\n `--headers`, `--delay-ms`, `--events`, `--token-encoding`, `--custom`,\n `--remove-base64-images` / `--no-remove-base64-images` (tri-state), and the\n `--markdown-*` / `--with-*-summary` family.\n - **`scrape get --raw` / `-o` / `--format`:** retrieve a completed queued scrape's\n body from the shell (a still-queued job prints the id and exits `2`).\n - **`screenshots create`:** `--block-ads`/`--no-block-ads`,\n `--block-cookie-banners`/`--no-block-cookie-banners`, `--scroll`/`--no-scroll`\n (tri-state pairs), `--wait-for-selector`, `--delay-ms`, `--dark-mode`,\n `--device-scale-factor`, `--include-html`, `--country`, `--language`.\n - **`fetch create` / `fetch get`:** `--country`, `--timeout-ms`, `--cache-ttl`\n (both verbs); `--markdown-mode` (create only).\n - **`sitemap create`:** `--strategy`, `--max-depth`, `--max-urls`.\n\n#### Fixed\n\n- `--json` no longer emits the literal text `undefined` — which is not valid JSON —\n for a response with no body. `JSON.stringify(undefined)` returns the _value_\n `undefined`, so `bytekit monitors delete <id> --json | jq .` failed with a parse\n error on every delete, and `--json -o <file>` on the same response crashed with\n `ERR_INVALID_ARG_TYPE` instead of writing anything. Every `--json` code path now\n serializes through one helper. (#2544)\n- `scrape create --async --raw` (and the bare `-o` form) no longer risks losing the\n `sc_` id it writes. The id went to stdout immediately followed by a hard\n `process.exit(2)`; Node documents `process.stdout` as **asynchronous** when it\n points at a pipe, so anything still queued at that moment is discarded — exactly\n the `sc_id=$(bytekit scrape create … --async --raw)` capture the flag exists for.\n The queued signal is now a soft `process.exitCode`, so the process ends naturally\n once stdout has drained. The exit code is unchanged. (#2544)\n- The per-attempt request timeout now covers the **response body read**, not just the\n time to first byte of headers. The abort budget was armed for `fetch` and cleared the\n moment headers arrived, after which reading the body was unbounded — so a server that\n answered with headers and then stalled its body (including a non-2xx whose error body\n never finished) hung the CLI forever. The budget now spans headers **and** body on both\n transports (`request` and the `/v1/fetch` raw path), and a mid-body abort surfaces as\n the usual `ByteKitConnectionError` with `code: 'timeout'`.\n\n The default is **unchanged at 120 s**, and the budget is still **per attempt** — the\n single 429 retry and its backoff sleep still get a fresh full budget. One consequence\n worth planning for: a legitimately large body (a multi-MB `/v1/fetch` document) now\n counts against that same 120 s, where previously only the wait for headers did. (#2546)\n\n#### Documented\n\n- **Output contract:** with `--json`, a `204 No Content` response (e.g.\n `monitors delete`) renders as JSON `null`. Human mode still prints nothing for\n the same response. (#2544)\n- **Exit codes** now have their own README section. In particular exit code `2` —\n \"accepted but still queued\", emitted by `scrape create --async` in raw and human\n modes — was previously documented nowhere despite being observable since 0.3.0.\n It is deliberately neither `0` (a content-body success) nor `1` (an error). (#2544)\n- Corrected two false README claims about `scrape` output: a bare `-o` implies\n `--raw` and writes the requested format's **body** (it does not write \"the same\n text rendering the terminal would show\"), and `--async --raw` prints the **bare\n `sc_` id** on stdout with a note on stderr (it does not print the queued job\n envelope). (#2544)\n\n### [0.4.0] - 2026-07-23 [NEVER PUBLISHED]\n\n> **Never published to npm.** This version was cut in-tree but no `@hunt-labs/bytekit-cli@0.4.0`\n> tarball exists — `npm i @hunt-labs/bytekit-cli@0.4.0` fails. Everything below shipped to users in\n> **0.5.0**, which is the first published release containing it. Reconciled by issue #2680; the\n> `release-drift` CI gate now blocks a new phantom heading from being introduced.\n\n#### Removed (**BREAKING**)\n\n- The entire `bytekit account api-keys` command group — `create`, `list`, `get`,\n `update`, `reveal`, and `revoke`. Every one of these subcommands was\n structurally unreachable: they target `/v1/account/api-keys*`, which the API\n mounts behind a **Clerk dashboard session** and marks `x-internal` in the\n OpenAPI spec. The CLI's only credential is a bearer `sk_` API key, which can\n never satisfy a session verifier, so all six returned `401 unauthorized` in\n every published version. Running one now exits `1` with\n `error: unknown command 'api-keys'`.\n\n Key management was deliberately NOT moved onto bearer auth. The reveal\n operation returns the **live plaintext** of any key on the account, and there\n is no per-key scope or permission model, so accepting API-key auth there would\n turn any leaked key into a self-perpetuating credential factory.\n\n **Replacement:** manage API keys from the dashboard at\n [app.bytekit.com](https://app.bytekit.com). (#2536)\n\n### [0.3.1] - 2026-07-22 [NEVER PUBLISHED]\n\n> **Never published to npm.** This version was cut in-tree but no `@hunt-labs/bytekit-cli@0.3.1`\n> tarball exists — `npm i @hunt-labs/bytekit-cli@0.3.1` fails. Everything below shipped to users in\n> **0.5.0**, which is the first published release containing it (0.4.0 was never published either —\n> see its heading above). Reconciled by issue #2680; the `release-drift` CI gate now blocks a new\n> phantom heading from being introduced.\n\n#### Fixed\n\n- `bytekit fetch get` / `fetch create` print the fetched content again. **0.3.0's\n claim that fetch \"prints the raw body by default, or the `X-Fetch-*` metadata\n as JSON with `--json`\" was not true of the shipped artifact**: the CLI replaced\n only `client.request`, but SDK 0.3.0 moved `/v1/fetch` onto `client.requestRaw`,\n so the CLI's raw-body branch was unreachable and every fetch fell through to the\n generic key/value printer — emitting `body: …`, a JSON map of every byte under\n `bytes:`, and `headers: {}`. The CLI now overrides BOTH transport seams and\n renders the SDK's real `FetchResult`. Binary content is byte-exact in every\n mode. (#2535)\n- Fetch commands honor the CLI's single 429 retry again. Riding the\n un-overridden SDK transport also bypassed the retry, the per-attempt 120 s\n timeout, and the connection-error taxonomy; all three now apply to fetch\n exactly as they do to the JSON commands. (#2535)\n\n#### Added\n\n- `-o, --output <file>` on `fetch get` / `fetch create`: writes the fetched body\n bytes to a file, byte-for-byte (with `--json`, writes the `X-Fetch-*` metadata\n object instead). (#2535)\n\n### [0.3.0] - 2026-07-21\n\n#### Removed (**BREAKING**)\n\n- The legacy `RAPIDCRAWL_API_KEY` and `RAPIDCRAWL_BASE_URL` environment-variable\n fallbacks (kept as a one-minor-version bridge in #2421) are removed. Use\n `BYTEKIT_API_KEY` and `BYTEKIT_BASE_URL` (or the `--key` / `--base-url` flags).\n (#2473)\n\n#### Fixed\n\n- `bytekit fetch get` / `fetch create` no longer crash on non-JSON bodies. The\n transport JSON-parsed every 2xx response, but `/v1/fetch` returns the fetched\n content AS the body. The fetch command now prints the raw body by default, or\n the `X-Fetch-*` metadata as JSON with `--json`; `fetch bulk` and every other\n command still parse JSON. (#2467)\n- `204 No Content` / empty-body responses (e.g. `monitors delete`,\n `account api-keys revoke`) no longer throw a JSON-parse error, including after\n a 429 retry. (#2467, #2468)\n- `search --type images` no longer prints an `undefined` snippet line for\n results that omit the field. (#2479)\n\n#### Added\n\n- `scrape create` accepts the full `ScrapeRequest` surface: `--country`,\n `--timeout-ms`, `--markdown-mode`, `--async`, `--webhook-url`,\n `--token-budget`, `--clean-markdown`, `--include-tags`, `--exclude-tags`,\n `--mobile`. Each flag is omitted from the request when absent. (#2480)\n- `screenshots create` accepts `--device`, `--viewport WxH`, `--format`,\n `--quality`, `--wait-until`, `--clip x,y,w,h`, and `--async`; `-o <file>`\n on `screenshots create`/`get` downloads the captured image bytes (`-o -` for\n stdout). `-o` cannot be combined with `--json` on screenshots. (#2480)\n- `monitors list` accepts `--limit`, `--cursor`, and `--status` query\n filters. (#2480)\n- `account api-keys reveal <ak_id>`: prints the key masked by default\n (`sk_live_…2345`); pass `--show` for the full plaintext. (#2480)\n- Per-attempt transport timeout (120s, mirroring the SDK default): a hung\n request now fails with `code: 'timeout'` instead of hanging forever. Network\n failures are mapped onto the SDK's connection-error taxonomy\n (`timeout` / `aborted` / `connection`), and error output renders the API or\n connection error code. (#2479)\n- A queued async job (HTTP 202) under `--raw` prints the job envelope with its\n `sc_` id instead of an empty body. (#2479)\n\n#### Changed (**BREAKING**)\n\n- `fetch --format` is validated locally against the spec union\n `'markdown' | 'html'`; off-spec values are rejected with a clear error before\n a request is sent (previously forwarded as-is). (#2475)\n\n### [0.2.2] - 2026-07-16\n\n#### Changed\n\n- Re-release of 0.2.1. The 0.2.1 artifacts never reached npm — the prod publish's\n `publish-sdk` step failed on a CI test-isolation flake (`cjs-require.test.ts`\n rebuilding the shared `dist`), which is now fixed. No consumer-facing changes\n beyond 0.2.1.\n\n### [0.2.1] - 2026-07-16 [NEVER PUBLISHED]\n\n> **Never published to npm.** This version was cut in-tree but no `@hunt-labs/bytekit-cli@0.2.1`\n> tarball exists — `npm i @hunt-labs/bytekit-cli@0.2.1` fails. Everything below shipped to users in\n> **0.2.2**, which is the first published release containing it. Reconciled by issue #2680; the\n> `release-drift` CI gate now blocks a new phantom heading from being introduced.\n\n#### Changed\n\n- `BYTEKIT_API_KEY` / `BYTEKIT_BASE_URL` are now the primary environment\n variables (precedence: flag > `BYTEKIT_*` > legacy `RAPIDCRAWL_*`).\n `RAPIDCRAWL_API_KEY` / `RAPIDCRAWL_BASE_URL` continue to work as silent\n fallbacks. `--help` text, the missing-key error, and the README now reference\n `BYTEKIT_*`. (#2421)\n\n#### Removed\n\n- The `recordings` command (the endpoint is permanently `410` deactivated). (#2421)\n\n### [0.2.0] - 2026-07-15\n\nAdditive, lower-risk release — no breaking changes to existing commands.\n\n#### Added\n\n- `scrape create --raw` / `-o, --output <file>`: write the raw response body to\n stdout or a file (#2425).\n- Local `search --limit` validation via a commander `argParser`, so an invalid limit\n is rejected before a request is sent (#2425).\n- One automatic retry on HTTP 429, honoring a clamped `Retry-After` header, in the\n CLI transport (#2425).\n\n#### Fixed\n\n- Entrypoint guard canonicalized so the `bytekit` bin runs correctly when invoked\n through an npm/npx symlink (#2418).\n\n#### Changed\n\n- Package renamed to `@hunt-labs/bytekit-cli` (the `@bytekit` npm scope was\n unobtainable); the `bin` name stays `bytekit`. ~~The prior `rapidcrawl-cli` name\n remains installable at its last version but is deprecated.~~ **Corrected in\n 0.8.1 (see below): that claim does not hold — `rapidcrawl-cli` 404s on npm and\n there is no published version left to deprecate.**\n- Consumer call sites propagate the SDK's narrowed, spec-derived request types (#2426).\n- Publish-ready packaging metadata: dropped `main`, unpinned the SDK dependency to\n `workspace:^`, added `engines`, `keywords`, `homepage`, `bugs`, `README.md`,\n `LICENSE`, and an MIT `license` field.\n\n### [0.1.0] - 2026-07-13\n\n#### Added\n\n- Initial release of the ByteKit CLI, wrapping the ByteKit SDK as shell\n subcommands, published under the original `rapidcrawl-cli` name.\n\n## @hunt-labs/bytekit-mcp\n\nMCP server, published on npm.\n\n### [Unreleased]\n\n### [0.2.8] - 2026-08-19\n\n#### Changed\n\n- **The generated scrape contract's billing factor vocabulary gained `phase1_render`** (#3141).\n `BillingFactorName` is a closed union copied verbatim into `src/scrape-contract.generated.ts`,\n and screenshots and recordings bill on a basis the byte-scrape factors cannot name — Phase 1\n proxy wire bytes times a 1.5 render-overhead multiplier. A capture's billing node carries that\n one factor and none of the byte-scrape names; the two vocabularies never mix on a single node.\n This release is a regeneration of the checked-in contract only, with no behavior change in the\n server itself: the MCP tools do not call the capture endpoints whose responses now carry the\n node.\n\n### [0.2.7] - 2026-08-18\n\n#### Changed\n\n- **The generated scrape contract now carries the `billing` node** (#3139). `ScrapeSuccessEnvelope`\n gained an optional `billing` object with `raw_bytes`, an ordered `factors` list of\n `name`/`value`/`reason` entries, `multiplier` and `billed_bytes`. The factor list explains\n exactly how a scrape's charge was composed — endpoint factor, cache-hit discount, clean-markdown\n surcharge — and multiplies out to the `X-Billing-Multiplier` on the same response. The existing\n flat `billing_multiplier` / `billed_bytes` pair is unchanged and still emitted beside it; this\n release is a regeneration of the checked-in contract only, with no behavior change in the server\n itself.\n\n### [0.2.6] - 2026-08-12\n\n#### Changed\n\n- **`scrape_url` now sends the public `raw_html` format spelling on the wire** (#2959). It\n previously translated the `raw_html` an agent asks for into the gateway's internal `rawHtml`\n before calling the API. That request only succeeded because the gateway happens to accept both\n spellings — nothing in the published API contract promised it, so this server depended on an\n undocumented leniency it could not see. It now sends what the spec documents.\n\n **No change to what the tool accepts:** `raw_html` and the legacy `rawHtml` are both still\n valid `formats` values, and results are rendered identically. The bundled `libraries/typescript`\n doc page also gained the `search`, `usage` and `webhooks` resources it had been omitting.\n\n#### Added\n\n- The published docs bundle now includes the five billing guides linked from the pricing page:\n balance, bandwidth, credits, spending, and top-ups. The guides describe the source-backed\n charging, expiry, rollover, and quota behavior. (#2960)\n\n#### Fixed\n\n- A validation failure from the API now reaches the agent as `validation_error: <message>` from\n every tool, instead of a bare `Invalid request body. ({\"formErrors\":[],\"fieldErrors\":{…}})`\n with the error code stripped off. `scrape_url` and `screenshot_url` are the two tools\n affected: the client's 422 handling rendered a screenshot's failed-capture body as\n `code: message` but passed a validation envelope's message through verbatim, so which\n spelling an agent saw depended on the HTTP status the endpoint happened to pick — the same\n vocabulary already rendered `validation_error: …` on a 400. The field details are unchanged,\n and so are `web_search`'s render, the concurrency-limit advice, and the 401/402 guidance\n messages. (#2955)\n- The hosted `/mcp` endpoint now rejects a missing or invalid API key with a JSON-RPC error body\n (`{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32000,…},\"id\":null}`, HTTP 401) rather than the REST\n capture envelope, so an MCP host that parses `/mcp` responses as JSON-RPC can read the failure\n it is most likely to hit. Every other transport-level failure on that endpoint already spoke\n JSON-RPC (405 on GET/DELETE, `-32700` on a malformed body, 406 on `Accept`). The ByteKit code\n (`invalid_api_key`) is preserved on JSON-RPC's `data` member, and the capture endpoints' 401\n envelope is untouched. (#2955)\n- The 26 SDK reference pages in the docs bundle (`sdk/python/*`, `sdk/typescript/*`) no longer\n open with their title and description twice, so `get_doc` and `search_docs` stop spending\n tokens on a duplicated preamble and search snippets stop reading doubled. The docs site's\n LLM markdown composer prepended a synthesized `# <title>` + description block\n unconditionally, on top of the generator-authored SDK bodies that already carry their own\n H1 and intro paragraph; it now yields the title block to a body that leads with an H1. The\n other 77 bundled pages are byte-identical. `sdk/python/client`'s body heading was also\n aligned to its page title (`# Client Reference` → `# Client`), the one SDK page where the\n two disagreed. (#2953)\n- The screenshot render's signed-URL note no longer presents the plan's artifact-retention\n date (`expires_at`, ~30 days out) as the signed image URL's expiry. The URL is a B2-signed\n link that dies ~10 minutes after issue (`X-Amz-Expires=600`) regardless of retention; the\n note now always states that ~600s signature expiry, so an agent following it no longer\n stashes a link that reads as good for weeks and is already dead. `expires_at` itself is\n untouched — it remains correct for plan retention everywhere else. (#2947)\n- An unknown flag (e.g. `--bogus-flag`) or the space-form `--timeout-ms -5` (which\n `node:util`'s `parseArgs` itself rejects as an ambiguous option value, before it ever\n reaches the existing `--timeout-ms` validation) no longer crashes with a raw\n `node:internal/util/parse_args` stack trace. Both now render the same one-line\n `Error: ...` message the binary already used for `--help`, a missing API key, and the\n equals-form/non-numeric `--timeout-ms` cases — parse-layer failures and value-validation\n failures render through one error path. `--help`, the missing-key message, and the\n existing `--timeout-ms abc` / `--timeout-ms=-5` errors are unchanged. (#2952)\n\n### [0.2.5] - 2026-08-11\n\n#### Added\n\n- Every outbound request now carries `X-ByteKit-Client: mcp/<package version>`, the\n `client_surface` attribution marker defined by the Track A analytics contract (#2904),\n so requests made by the published `@hunt-labs/bytekit-mcp` server can be told apart\n from `api_direct` and the other published clients. Set once, unconditionally, at the\n client's single header-construction site — it does not ride along with `Authorization`\n and is not affected by the in-process gateway dispatch path (issue #1182). (#2907)\n\n### [0.2.4] - 2026-08-10\n\n#### Changed\n\n- Version-alignment release after the 2026-08-10 publish rescue: the published 0.2.3 artifact was built from the `main` promotion HEAD, which already contained every change documented under the 0.2.3 heading — but that commit postdates the one that introduced the 0.2.3 version string, so the `check-release-drift` gate (#2680) correctly reported shipped drift on every subsequent CI run (#2829). 0.2.4 realigns manifest ↔ registry ↔ version-introducing commit. **No consumer-visible change relative to the published 0.2.3.**\n\n### [0.2.3] - 2026-08-07\n\n#### Added\n\n- `scrape_url` / `get_result` render a zero-count `Links (0):` / `Images (0):` header for\n a format you requested that came back empty, so \"the page has none\" is no longer\n indistinguishable from \"the format was not returned\". A format you did not request\n still renders nothing at all. (#2687)\n- The queued-scrape render carries the spec-required `events` array, and the success\n render carries `content_length` — the compressed upstream wire-byte count that is the\n billing basis for the call, which nothing else in the output surfaced. (#2687)\n- Screenshot renders carry `page_title` (a spec field the tool description already\n promised as \"metadata\") and a note that `image_url` is a signed link with a short\n lifetime, using the concrete `expires_at` instant when the API supplies one. (#2687)\n- A queued scrape now gets the same \"Use `get_result` with this ID to check when it\n completes.\" guidance a pending screenshot got in 0.2.2. (#2687)\n- `screenshot_url` exposes `quality`, `dark_mode`, `country` and `language`. None of them\n can reach the queued outcome; `quality` and `dark_mode` are additionally cost-neutral (a\n screenshot bills on the phase-1 fetch's wire bytes, never the artifact size), while\n `country`/`language` change which page the origin serves and so can change that figure.\n `token_budget`, `clean_markdown` and `cache_ttl` stay unexposed on `scrape_url`, each\n for a reason recorded in `src/tools/scrape-url.ts`. (#2687)\n- **New output contract.** `scrape_url` / `get_result` render the envelope's `warnings`\n under a `Warnings (N):` section, one `code: message (element)` line per warning, on both\n the success and the terminal-failure render. The `(element)` suffix is omitted for the\n whole-extraction codes that carry no element. Nothing rendered them before, so an\n `artifact_unavailable` — a format you requested and were billed for is missing from the\n response — was indistinguishable from a page that simply had none of it. The block is\n budgeted inside the same 100KB cap as the content, ahead of the links/images sections, so\n a long links list cannot crowd a failure signal out. A `warnings` array that is empty or\n absent renders nothing, exactly as before. (#2679)\n\n#### Fixed\n\n- **Compile-time breaking for TypeScript consumers that read `SearchResult.snippet` or\n `SearchResult.date` unguarded.** Both were declared required on the exported\n `SearchResult` type, but `POST /v1/search` omits both keys for `type: 'images'`\n results — `docs/api/openapi.yaml` declares `required: [position, title, url]` and\n nothing else for a search result. Reading `result.snippet.length` therefore compiled\n under strict TypeScript and threw at runtime on any images result. They are now\n `snippet?: string` and `date?: string | null`. Runtime behaviour is unchanged — the\n server has always passed the API's JSON through verbatim, and no MCP tool output\n moved; what changes is that `tsc` now requires a guard (`result.snippet?.length`, or\n an `if (result.snippet !== undefined)` narrowing) at every read site. `web`/`news`\n results still carry both fields and `date` is still nullable there, so `null`\n (the provider reported no date) stays distinguishable from absent (the index carries\n no such field at all). (#2781)\n- The hosted `/mcp` transport and a local `npx` install now render invalid-argument errors\n identically. They had diverged — hosted returned the raw Zod issue-array JSON where\n stdio returned the flattened `Required at url` — and the cause was neither a stale\n deploy nor a difference in ByteKit source: both transports share one server factory, and\n the text is produced inside `@modelcontextprotocol/sdk`. What differed was the SDK\n version each side resolved. `@modelcontextprotocol/sdk` 1.30.0 rewrote\n `getParseErrorMessage` to format Zod issues as `<message> at <path>`, where 1.29.0 fell\n through to `ZodError.message` (the raw JSON array). The hosted image builds with a frozen\n lockfile, which still pinned 1.29.0, while the unpinned `^1.12.1` range let an `npx`\n consumer resolve 1.30.0. The lockfile is now bumped to 1.30.0 so both sides run the same\n SDK; the declared range is deliberately left at `^1.12.1` so upstream fixes keep\n arriving. (#2682)\n- A truncated links or images list is cut between whole entries instead of mid-URL, and\n each affected section is annotated with `[Links truncated: N of M entries shown]`, so\n the section header's count stays reconcilable with what was actually returned. The\n markers are spent from the same 100KB budget, not appended on top of it. (#2687)\n- `web_search` no longer prints the API error code twice\n (`validation_error: … (validation_error)`); the code is appended only when the message\n does not already carry it. (#2687)\n- `scrape_url` rejects `formats: []` at the schema boundary — matching the API's own\n `minItems: 1` — instead of forwarding it and returning a server 422. Omitting the\n parameter still yields the `[\"markdown\"]` default. (#2687)\n- `--timeout-ms` with a non-numeric value is rejected with an error instead of being\n silently ignored, which had left the client running on its default budget while the\n operator believed one was set. (#2687)\n- Reading `bytekit://account` issues its two sub-requests serially, matching the\n `get_account` tool — concurrent sub-requests could rate-limit a 1-rps plan against\n itself. (#2687)\n- `list_docs` with a `section` outside the documentation taxonomy returns an error naming\n the valid set, rather than a silent empty list that a correctly-spelled but empty\n section would also produce. (#2687)\n- The Claude Desktop / `mcp-remote` bridge config in README.md now authenticates as\n written. It previously passed `\"Authorization: Bearer $BYTEKIT_API_KEY\"` in `args`;\n an MCP host launches `command`/`args` with no shell, and `mcp-remote` interpolates\n only the braced `${VAR}` form, so the literal text was sent as the bearer token and\n the endpoint answered `401`. The snippet now uses `\"Authorization:${AUTH_HEADER}\"`\n with a matching `env` block, and the hosted-HTTP snippet carries the same\n no-shell-expansion caveat. (#2688)\n- The bundled documentation no longer teaches the deactivated `/v1/recordings` endpoint\n or links its removed reference pages. (#2688)\n- A 429 caused by the account's **concurrency** cap now says so and fails fast, instead of\n being reported as a rate limit. HTTP 429 carries two conditions (`rate_limited` and\n `concurrency_limit`), and the client read neither the body nor the code: every 429 got\n one `Retry-After` retry and then `Rate limited. Try again in a moment.` with the error\n code hardcoded to `rate_limited`. The concurrency variant does not clear on that\n back-off — the API spec calls its `Retry-After` \"a fixed small back-off\" while the slots\n free only when the in-flight jobs finish — so the retry was spent on a condition a\n second cannot clear, and the error object named the wrong cause. A `concurrency_limit`\n 429 now throws immediately with the real wait scale and `errorCode: 'concurrency_limit'`,\n at both 429 sites. `rate_limited` 429s, and any 429 whose body is empty, non-JSON or\n carries no recognizable code, keep the single honored-header retry and the exact message\n and code they had. (#2681)\n- A screenshot that fails inside the API's sync hold now surfaces its REAL failure code\n (`blocked`, `timeout`, …) and message. `POST /v1/screenshots` answers that case with HTTP\n 422 carrying the flat screenshot resource, not the unified error envelope, and the client\n parsed neither — so every such failure read as the literal `Validation error.`. The\n `(Screenshot ID: ss_…)` handle line is unchanged, and a genuine request-validation 422\n still renders exactly as it did. (#2679)\n\n### [0.2.2] - 2026-07-29\n\n#### Fixed\n\n- `scrape_url` / `get_result` render every returned textual format\n (`markdown`/`html`/`raw_html`), not just the first present — a multi-format call\n previously dropped every secondary format silently despite it being billed. Secondary\n formats are rendered under a `--- format: <name> ---` delimiter, in canonical order\n after the unlabeled primary. (#2589)\n- The 100KB output truncation budget now covers the links/images blocks too — they were\n previously appended AFTER truncation, so a combined output could exceed the budget.\n The whole assembled payload is now truncated exactly once, with the links/images\n block reserved its own share of the budget so it is never dropped in full just\n because the textual formats alone already fill the budget. (#2589)\n- `scrape_url` / `get_result` descriptions no longer advertise a queued `sc_` outcome\n that the MCP input schema (`url`/`formats`/`country`) cannot produce — that outcome\n was only reachable via `body.async` or fields `can-fast-path.ts` gates on, none of\n which this tool's schema exposes. (#2589)\n- `web_search` now renders `credits_used` and `related_searches`, both spec-required\n fields that were previously dropped silently. (#2591)\n- A sync-failed screenshot's `ss_` handle — absent from the 422 error body — is now\n read from the `X-Screenshot-ID` response header and included in the error text, so\n it can still be redeemed via `get_result`. Degrades gracefully when the header is\n absent. (#2591)\n- The 402 message on `/v1/screenshots` no longer says \"Bandwidth quota exhausted\"\n (screenshot quotas are credit/count-based) and no longer points at `get_account`,\n which is rate-limit-fragile immediately after a quota failure. Every other endpoint's\n 402 wording is unchanged. (#2591)\n- `get_result`'s invalid-id-prefix message no longer truncates the offending id to 3\n characters. (#2591)\n- `get_result` now gives the same \"poll with get_result\" guidance `screenshot_url`'s\n queued branch gives when a screenshot is still `pending`/`processing`. (#2591)\n- `get_account` no longer renders a duplicate email (`Account: foo@bar.com\n(foo@bar.com)`) when the account has no name. (#2591)\n- `search_docs` snippets no longer duplicate the page title when the match falls near\n the body's own leading `# <Title>` heading. (#2591)\n- `ScrapeErrorEnvelope.id` is now modeled as nullable, matching\n `docs/api/openapi.yaml` (`id` is null when a scrape was never queued, e.g. a\n validation failure) — `get_result`/`scrape_url` render `ID: —` instead of the\n literal `ID: null`. (#2591)\n\n#### Changed\n\n- `get_account` now issues its `getAccount`/`getUsage` requests serially instead of\n via `Promise.all`, so it no longer doubles the concurrent request rate against\n 1-rps plans. (#2591)\n- Regenerated the bundled `src/docs-bundle/docs-bundle.json` against the current\n `packages/docs/content` tree. Every guarded endpoint's docs page now states its\n request-body byte ceiling and the `request_too_large` error code (#2640), and the\n `/v1/bulk` pages document `defaults.type` inheritance plus the 422 on unrecognized\n keys (#2643). Content only — no tool surface, schema, or runtime behavior changed.\n (#2640, #2643)\n\n### [0.2.1] - 2026-07-24\n\n#### Fixed\n\n- The spec'd flat `/v1/search` 502 error body (`{\"error\":\"search_provider_error\"}`)\n now surfaces its code in the tool error text instead of collapsing to a generic\n \"ByteKit API error (HTTP 502)\". Flat `{error: \"<string>\"}` bodies on any status\n parse the same way; envelope-shaped bodies keep winning when both shapes are\n present. (#2541)\n\n#### Added\n\n- `BytekitClient` accepts a `timeoutMs` constructor option — a per-request budget in\n milliseconds, defaulting to `120000`. Set `0` to disable it entirely. Values that are\n negative or non-finite normalize to disabled rather than throwing. Previously a hung\n upstream hung a stdio MCP tool call forever. (#2568)\n- The budget covers an **entire** `request()` call rather than each await separately:\n the initial fetch, the 429 `Retry-After` sleep, the retry fetch, **and both** the\n success and error body reads (`response.json()` in `request()` and in\n `parseErrorEnvelope`). Two of those previously swallowed an abort outright — the\n `Retry-After` sleep observed no signal, and a failed error-body read was downgraded to\n \"no envelope\", surfacing a misleading status-line message instead of the timeout.\n Exhausting the budget now produces a `BytekitApiError` with\n `errorCode: 'timeout'`, distinct from `'network_error'`. (#2568)\n- Note the semantics are **client-side only**: aborting does not cancel or refund\n server-side work already in progress, so an account may still be billed for a result\n the caller never reads. The `120000` default is deliberately well above the server-side\n screenshot ceiling so it never truncates a legitimate billable operation. (#2568)\n\n### [0.2.0] - 2026-07-21\n\n#### Removed (**BREAKING**)\n\n- The legacy `RAPIDCRAWL_API_KEY` environment-variable fallback (kept as a\n one-minor-version bridge in #2421) is removed. Use `BYTEKIT_API_KEY` (or the\n `--api-key` flag). (#2473)\n\n#### Fixed\n\n- Tool-surface drift against the live API (#2477):\n - `screenshot_url`'s `device` enum is now `desktop` / `mobile` — `tablet` was\n 422-rejected by the API.\n - Screenshot results render the spec field names (`image_width`,\n `image_height`, `file_size_bytes`); the removed `format` field is gone.\n - `get_result` renders a failed job's envelope (`Status: failed` +\n `error.code`/`error.message`) instead of `undefined` lines, and omits\n `Credits: null` for pending rows.\n - `get_account` no longer renders `Account: null` when the account has no\n name.\n - `get_doc`'s description example uses a real bundle key.\n- Server errors now surface diagnostics instead of a generic failure: any\n non-2xx with a parseable API envelope renders its `code` + `message`\n (e.g. 503 `blocked`, 400 `invalid_url`), 422 includes `error.details`, and\n `Retry-After` (including HTTP-date or garbage values) is parsed to a bounded\n retry delay instead of `setTimeout(NaN)`. Specific 401/402/429 mappings still\n win. (#2478)\n\n#### Changed\n\n- The bundled offline docs (`get_doc`/`list_docs`/`search_docs`) are\n regenerated: 96 pages, now including the TypeScript SDK `usage` and\n `webhooks` reference pages and dropping removed content. (#2469)\n\n### [0.1.3] - 2026-07-16\n\n#### Changed (**BREAKING**)\n\n- The MCP tool `web-search` is renamed to `web_search` (snake_case, consistent\n with every other tool). MCP clients bound to the old `web-search` name must\n update. (#2421)\n\n#### Changed\n\n- The 401 error message now references `BYTEKIT_API_KEY`; `--base-url` now falls\n back to the `BYTEKIT_BASE_URL` environment variable when no flag is passed. (#2421)\n\n#### Fixed\n\n- The bundled offline docs (`get_doc`/`list_docs`/`search_docs`) now teach the\n correct `@hunt-labs/bytekit-sdk` install/import name instead of the dead\n `@bytekit/sdk` scope. (#2449)\n\n### [0.1.2] - 2026-07-15\n\n#### Fixed\n\n- `scrape_url` now reads the snake_case envelope fields the API actually returns\n (`id`, `final_url`, `status_code`); the published 0.1.1 tarball read the old\n camelCase fields (`scrapeId`, `finalUrl`, `statusCode`), so every metadata line\n rendered `undefined` (#2419).\n- The MCP handshake `serverInfo.version` is now derived from `package.json` instead\n of a hardcoded literal, so it can never drift from the published version (#2419).\n\n#### Changed\n\n- Compiled test code and fixtures are excluded from the published tarball — only\n runtime `dist/**` (plus `README.md`, `LICENSE`, and now `CHANGELOG.md`) ships (#2419).\n\n### [0.1.1] - 2026-07 [DEPRECATED]\n\n#### Note\n\n- Superseded by 0.1.2. This release shipped stale `scrape_url` metadata rendering\n (camelCase fields the API no longer returned) and included compiled test code in\n the tarball. Upgrade to 0.1.2 or later.\n\n### [0.1.0] - 2026-07\n\n#### Added\n\n- Initial release of the ByteKit MCP server, exposing ByteKit web-data tools\n (scrape, screenshot, search, docs) to AI agents over the Model Context Protocol,\n as a local stdio server or hosted."
280
+ "body": "# Changelog\n\nRelease history for the ByteKit SDKs, CLI, and MCP server\n\nEach section below is the `CHANGELOG.md` kept alongside that client’s source in the ByteKit\nrepository. Entries record what a release changed, including names and options it retired.\n\n## @hunt-labs/bytekit-sdk\n\nTypeScript SDK, published on npm.\n\n### [Unreleased]\n\n### [0.9.1] - 2026-08-25\n\n#### Fixed\n\n- The generated `paths` type for the `200` of `GET /v1/scrape/bulk/{id}` now declares `items`\n (#3632). The route builds one body and varies only the status code, so the terminal `200`\n has always carried the per-URL scrape envelopes — but only the `202` documented them, so\n `scrape.bulk.get()` typed the results away at exactly the poll that has them. Types only:\n the field was already on the wire, and server behavior is unchanged.\n\n- The generated `paths` types now describe the `202` that `GET /v1/scrape/bulk/{id}`,\n `GET /v1/fetch/bulk/{id}` and `GET /v1/bulk/{id}` already serve while a bulk job is\n non-terminal (#3533). Each of the three returns 202 with the job envelope until the job is\n terminal and 200 afterwards, but only the 200 was declared, so anything typed off the spec\n had no shape for the response the very first poll receives. Types only: `scrape.bulk.get()`,\n `fetch.bulk.get()` and `bulk.get()` already resolved the body on any 2xx, and server behavior\n is unchanged.\n\n#### Changed\n\n- The generated `topup_balance_bytes` description on `GET /v1/usage` now states that the value is\n the remaining purchased top-up bytes, already net of any overage consumed against them (#3459).\n Types only: the field's name, type and wire format are unchanged. The server previously\n subtracted the consumed overage a second time when computing this value, so the number a client\n reads is larger than before for accounts that ran past their included allowance.\n\n### [0.9.0] - 2026-08-20\n\n#### Removed\n\n- **BREAKING: the `cookies` and `headers` request-body fields are gone from every capture\n endpoint** (#3242) — `/v1/scrape`, `/v1/scrape/bulk`, `/v1/screenshots`, `/v1/recordings` and\n `/v1/schema`. A request that carries either field is rejected with `400 validation_error`; it\n is not ignored, and there is no deprecation window, feature flag, or compatibility header.\n `ScrapeOpts.cookies`, `ScrapeOpts.headers` and the exported `ScrapeCookie` type are removed\n from the SDK surface, so a call that still passes them no longer compiles.\n\n ```ts\n // before — compiled, and the values were forwarded to the target site\n await client.scrape.create({ url, cookies: [{ name: 'session', value: 'abc' }] });\n // after — does not compile; the same body over raw HTTP is a 400 validation_error\n await client.scrape.create({ url });\n ```\n\n ByteKit continues to manage its own cookie jar and request headers internally; what was removed\n is the caller's ability to inject or override them.\n\n#### Changed\n\n- **The generated types now declare the `503` response of `GET`/`POST /v1/fetch`** (#3372).\n `/v1/fetch` answers `503` on two conditions and both carry the ordinary `Error` envelope, so\n a typed consumer reading `operations['getFetch']['responses']` / `['postFetch']` can handle it\n instead of meeting an undeclared status at runtime. Read `error.code` to tell the two apart,\n because they disagree about `error.http_status`:\n - `upstream_error` — the target returned HTTP `502`, relayed at `503` because Cloudflare\n replaces a clean origin 502 with its own error page. `error.http_status` stays `502`, the\n **true upstream status**, and is the only surviving record of what the target answered.\n - `internal_error` (`Fetch service unavailable.`) — the fetch service was unreachable. There\n is no upstream, so `error.http_status` reports `503`, matching what was served.\n\n No runtime behaviour changes, and every other documented `/v1/fetch` status is unaffected.\n\n### [0.8.0] - 2026-08-19\n\n#### Removed\n\n- **BREAKING: `billing_multiplier` and `billed_bytes` are gone from the scrape success\n envelope** (#3143). Read `billing` instead — a `BillingNode` that names every factor\n applied to the charge, the multiplier they compose to, and the resulting billed bytes:\n\n ```ts\n // before\n const spend = res.billed_bytes; // flat, base-endpoint only\n // after\n const spend = res.billing?.billed_bytes;\n const why = res.billing?.factors; // [{ name: 'endpoint', value: 1.5, reason: 'scrape_md' }, …]\n ```\n\n This is a correction, not a rename: the two surfaces reported **different numbers for the\n same charge**. The flat pair carried the BASE-endpoint composition, so a markdown cache hit\n read `0.5` / `400` while the real charge — and the `X-Billing-Multiplier` header — was\n `0.75` / `600`; an html-only miss read the per-format credits estimate `1.5` / `150` against\n an endpoint factor of `1.0` / `100`. The flat pair also never carried the `clean_markdown`\n ×3 surcharge, so on a successful clean it under-reported the amount billed by two thirds.\n `billing.multiplier` composes every applied factor behind exactly one rounding, so it is the\n number that predicts your invoice.\n\n `billing` is optional and is **absent** on resources that completed before the billing node\n existed. A pre-node row omits the field rather than reporting a zero node, because a zero\n node would assert that a real past charge was zero. Test the node for presence\n (`res.billing !== undefined`, or equivalently a plain truthiness check — `billing` is an\n object or `undefined`, and an object is always truthy, so the two are the same test here).\n The hazard is a condition that reaches _into_ the node: `if (res.billing?.billed_bytes)`\n silently skips a genuine zero-byte charge, because `0` is falsy. Check that the node is\n present, then read `billed_bytes` from it.\n\n ```ts\n // wrong — a real 0-byte charge is falsy and disappears\n if (res.billing?.billed_bytes) record(res.billing.billed_bytes);\n // right — presence first, value second\n if (res.billing) record(res.billing.billed_bytes); // 0 is a charge, not an absence\n ```\n\n Two endpoints deliberately carry no node: `/v1/search` is billed per credit and reports\n `credits_used`, and a single `/v1/fetch` reports its charge through response headers only.\n The `/v1/logs` row field named `billing_multiplier` is a **different field** and is not the\n envelope field this release removed. It carries the BASE settled `credits_charged` factor,\n not the composed real-endpoint value the `X-Billing-Multiplier` header reports — a markdown\n cache hit reads `0.5` on the logs row and `0.75` on the header.\n\n#### Changed\n\n- Generated `ScrapeErrorEnvelope` types now describe terminal asynchronous `scrape.failed`\n webhook delivery (#1856). No runtime SDK behavior or API shape changed.\n\n#### Fixed\n\n- **`GET /v1/logs` entries now carry `billing_multiplier`, as a JSON number** (#3022). The\n gateway had been serializing that value under an undeclared key `credits`, and as the raw\n Postgres `NUMERIC(10,2)` string (`\"1.50\"`), while the OpenAPI spec — and therefore the\n generated types in `src/generated/api.d.ts` — declared `billing_multiplier?: number | null`.\n Anything typed against this package read `undefined` for the field.\n\n **Breaking at the wire level:** the undeclared `credits` key is gone from every `/v1/logs`\n entry. Code that reached past the generated types to read `credits` must read\n `billing_multiplier`. No SDK method exposes this endpoint, so the only change inside this\n package is the regenerated type description.\n\n- **`change_threshold` (on `monitors.create`/`monitors.list`/`monitors.get`/\n `monitors.update` responses) and `change_pct` (on `monitors.captures.list` entries)\n now serialize as JSON numbers, not strings** (#3021). Both are Postgres `NUMERIC(5,2)`\n columns; the gateway passed the raw driver string through unconverted (`\"5.00\"` /\n `\"7.25\"`) while the OpenAPI spec's _request_ schemas already declared `number` — only\n the _response_ schemas had been (incorrectly) edited to match the buggy string output.\n This release fixes the gateway serializer and corrects the two response schemas to\n `number` / `number | null`, so spec and runtime now agree.\n\n **Breaking at the wire level:** `client.monitors.create()`, `client.monitors.list()`,\n `client.monitors.get()`, and `client.monitors.update()` now return a JS number for\n `change_threshold` instead of a string (screenshot-type monitors only); the create\n response's `MonitorCreateResponse` and every other monitor route serialize through the\n same `MonitorResponse` schema, so all four are affected identically.\n `client.monitors.captures.list()` now returns a JS number for `change_pct` instead of a\n string. Code doing `parseFloat(monitor.change_threshold)` or template-literal\n interpolation keeps working; strict `typeof x === 'string'` checks or string methods\n (`.trim()`, `.padStart()`) will now throw. `change_pct` is `null` (not `0`) when there is\n no prior capture to diff against, unchanged from before. No SDK method-level shape\n changed otherwise — the only change inside this package is the regenerated type\n description.\n\n### [0.7.4] - 2026-08-19\n\n#### Changed\n\n- **`gen:version` no longer runs as part of `build`** (#3144). `scripts/gen-version.ts` writes\n `src/version.ts`, a _tracked_ source file, and it was chained into the `build` script. That made\n a build silently rewrite committed source whenever the file disagreed with the manifest: local\n runs went green on a tree CI could fail, the resulting ` M src/version.ts` was indistinguishable\n from routine build noise, and in CI the outcome depended on whether Turbo's build cache hit\n (restoring `dist/**` without re-running the generator) or missed. `build` now starts at\n `rm -rf dist ...`, so building this package touches nothing tracked. This changes `prepack` /\n `prepublishOnly` behavior too: both call `build`, so the publish path now reads the committed\n `src/version.ts` rather than regenerating it, and the committed value is what ships.\n- **New `gen:version-check` script**, `pnpm gen:version && git diff --exit-code src/version.ts`,\n mirroring the existing `gen:types-check` in the same manifest. It runs in `.woodpecker/ci.yaml`'s\n `types-drift` step, so a manifest bump without the matching `src/version.ts` regeneration now\n fails a named PR check instead of reaching `staging`. `src/__tests__/version-parity.test.ts`\n stays in place as the in-suite assertion; the gate is what makes its failure reachable before\n merge rather than after.\n\nNo runtime or type changes. `SDK_VERSION` and the `X-ByteKit-Client: sdk_ts/<version>` affix\nbehave exactly as before.\n\n### [0.7.3] - 2026-08-18\n\n#### Changed\n\n- **`XFetchContentLength`'s description no longer calls the header a wire-byte count** (#3133).\n `X-Fetch-Content-Length` is the byte length of the response body actually served: on a\n passthrough `/v1/fetch` (no `format`) that is the relayed upstream payload, so it does equal\n the upstream wire bytes — but with `format=html` or `format=markdown` the gateway overwrites\n it with the transformed document's length, which is typically far smaller than what is billed.\n The old description therefore read as a billing discrepancy on every transform request. Billing\n is unchanged and has always used the upstream compressed wire bytes reported by `X-Raw-Bytes` /\n `X-Billable-Bytes`. Generated-type comments only; no type or runtime behavior changes.\n\n### [0.7.2] - 2026-08-17\n\n#### Changed\n\n- **`ScrapeResponses.202`'s headers no longer advertise `X-Raw-Bytes`, `X-Billable-Bytes`, or\n `X-Billing-Multiplier`** (#3068). The gateway's async `/v1/scrape` path only ever emitted\n `X-Scrape-ID` and `X-Scrape-Status: queued` on a 202 — a queued scrape has no finalized byte\n charge yet — but `docs/api/openapi.yaml` documented the billing-transparency trio there too,\n so `src/generated/api.d.ts` typed three response headers the runtime never sends. This corrects\n the generated type to match the gateway's actual behavior; it does not change any runtime\n behavior. The synchronous `200` response, and `/v1/screenshots`' `202` (which does finalize a\n charge before responding), are unaffected.\n\n### [0.7.1] - 2026-08-11\n\n#### Changed\n\n- **Generated types follow the spec's corrected error and format vocabularies** (#2959). Two\n vocabulary corrections in `docs/api/openapi.yaml` flow through `src/generated/api.d.ts`:\n - `ScrapeErrorEnvelope.error.code` no longer lists `quota_exhausted`. The API has emitted\n `quota_exceeded` since #1539 and there is no throw site for `quota_exhausted` anywhere in\n the gateway, so this removes a code that has never been sent — not one that stops being\n sent. A consumer switching on it was matching a branch that could not be reached; the\n live code for an exceeded quota is `quota_exceeded`. `invalid_url`, which the API does\n emit, is unchanged and still listed.\n - `createBulk`'s `formats` now spells the raw-HTML value `raw_html`, matching `ScrapeRequest`\n and `createScrapeBulk`. `/v1/bulk` previously accepted only the internal `rawHtml`\n spelling and the spec documented that; it now accepts both, so the one endpoint that\n disagreed with the rest of the surface no longer does. `rawHtml` keeps working.\n\n#### Added\n\n- **`ByteKitError.headers` — the failing response's headers, so you can write your own backoff**\n (#2957). This SDK performs exactly one `fetch` per call and never retries, deliberately, so that\n retry policy stays the caller's. But the policy was unwritable: `ByteKitError` carried no\n headers and `requestWithResponse` returns headers only on 2xx — which a rate-limited request\n never reaches — so `Retry-After` and the `X-RateLimit-*` family were unreachable through the SDK\n at every entry point. `err.headers` closes that:\n\n ```ts\n if (err instanceof ByteKitError && err.status === 429) {\n const waitMs = Number(err.headers?.get('Retry-After') ?? 1) * 1000;\n }\n ```\n\n It is the runtime's own `Headers` object rather than a snapshot, so `get()` stays\n case-insensitive whatever casing the wire used. **Strictly additive**: it is optional and last\n on the constructor, follows the same `declare` discipline `details` uses, and an error\n constructed without one carries no `headers` key at all — `'headers' in err`, spreads and\n `JSON.stringify` are unchanged for every pre-existing construction, as are `status`, `code`,\n `message`, `details` and both 2xx return shapes. Only **response** headers are exposed;\n `Authorization` rides on the request and is never reachable through it.\n `ByteKitConnectionError` is unchanged — no response, no headers to carry.\n\n#### Fixed\n\n- **`screenshots.getWithResponse`'s docstring no longer promises headers that endpoint never\n emits** (#2957). The JSDoc — the one an IDE surfaces on hover, and the one the published SDK\n reference is generated from — claimed the documented `X-Screenshot-*` / `X-Raw-Bytes` /\n `X-Billable-Bytes` / `X-Billing-Multiplier` headers \"are on `headers`\". They are not:\n `GET /v1/screenshots/{id}` is declared with **no** `X-*` response headers, which is what\n `ByteKit.requestWithResponse`'s own doc comment and the README have said all along, and what a\n live GET confirms. Documentation only — no signature, return type or runtime behavior changed.\n `screenshots.createWithResponse` (`POST /v1/screenshots`) really does emit that family, and its\n docstring still says so.\n\n- **README documents the `signal`-vs-`timeoutMs` precedence and the `requestTimeoutMs` escape\n hatch** (#2957). Passing your own `AbortSignal` silently disables the constructor's `timeoutMs`\n — the signal becomes the request's only abort source, so a client built with `timeoutMs: 200`\n waits indefinitely if the signal never fires. That precedence was documented on\n `RequestOptions.signal` in the types, where only a reader already inspecting the option would\n meet it, and nowhere in the README. A new \"Timeouts and cancellation\" section states it with the\n full four-row precedence ta\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 149708 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/changelog]"
276
281
  },
277
282
  "cli": {
278
283
  "title": "Install & Authenticate",
@@ -292,7 +297,7 @@
292
297
  "cli/fetch": {
293
298
  "title": "Fetch",
294
299
  "section": "CLI Reference",
295
- "body": "# Fetch\n\nFetch URL content operations\n\nFetch URL content operations\n\n### fetch › bulk\n\nBulk fetch operations\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n#### fetch › bulk › create\n\nCreate a bulk fetch job\n\n| Option | Description |\n| --- | --- |\n| `--file <path>` | Path to a newline-delimited file. Each line is a plain URL, or a JSON object carrying \"url\" plus per-item config. A line whose only key is \"url\" behaves exactly as before (sent as a bare URL string); any line with additional keys switches the payload to the per-item shape. |\n| `--webhook-url <url>` | HTTPS webhook URL notified when the job completes |\n| `--webhook-secret <secret>` | HMAC secret used to sign the completion webhook (omitted → unsigned) |\n| `--defaults <json>` | Defaults applied to every entry, as a JSON object (omitted → none). Unknown keys are rejected by /v1/bulk (422) and ignored by scrape bulk / fetch bulk; fetch bulk additionally rejects browser-only keys (cookies, wait_until, wait_for_selector, delay_ms) with a 400. |\n| `--metadata <json>` | Arbitrary metadata echoed on the job envelope, as a JSON object, e.g. '\\{\"run\":\"7\"\\}' (omitted → none) |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit fetch bulk create --file <path> --webhook-url <url> --webhook-secret <secret> --defaults <json> --metadata <json>\n```\n\n#### fetch › bulk › get\n\nGet a bulk fetch job\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit fetch bulk get <id>\n```\n\n### fetch › create\n\nFetch URL content (POST)\n\n| Option | Description |\n| --- | --- |\n| `--url <url>` | URL to fetch |\n| `--format <format>` | Response format (markdown or html) |\n| `--country <cc>` | Two-letter country code to route the request through (e.g. us, de) |\n| `--timeout-ms <n>` | Per-request timeout in milliseconds |\n| `--cache-ttl <ttl>` | Cache freshness: 0, Nh (hours), or Nd (days), e.g. 48h, 2d, 0 (omitted → server default) |\n| `--markdown-mode <mode>` | Markdown mode: article, raw, llm |\n| `--markdown-query <q>` | BM25 query string for relevance-ranked markdown filtering (omitted → disabled) |\n| `--markdown-links <mode>` | Link rendering: inline, references, none, text (omitted → server default) |\n| `--markdown-images <mode>` | Image retention: inline, references, none, text (omitted → server default) |\n| `--with-links-summary` | Append a Links footer to the markdown output (omitted → off) |\n| `--with-images-summary` | Append an Images footer to the markdown output (omitted → off) |\n| `--markdown-compact` | Collapse excessive whitespace in the markdown output (omitted → off) |\n| `--markdown-filter-images` | Filter low-signal images from the markdown output (omitted → off) |\n| `--markdown-include-media` | Return rich link/image objects and a tables array (omitted → off) |\n| `--markdown-include-warnings` | Include markdown-pipeline and tag-filter warnings (omitted → off) |\n| `--markdown-include-stats` | Include a top-level stats object (chars, tokens, blocks) (omitted → off) |\n| `--custom <json>` | User payload echoed on the envelope as a JSON object, e.g. '\\{\"job\":\"1\"\\}' (omitted → none) |\n| `-o, --output <file>` | Write the fetched body bytes to the given file path |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit fetch create --url <url> --format <format> --country <cc> --timeout-ms <n> --cache-ttl <ttl> --markdown-mode <mode> --markdown-query <q> --markdown-links <mode> --markdown-images <mode> --with-links-summary --with-images-summary --markdown-compact --markdown-filter-images --markdown-include-media --markdown-include-warnings --markdown-include-stats --custom <json>\n```\n\n### fetch › get\n\nFetch URL content (GET via query params)\n\n| Option | Description |\n| --- | --- |\n| `--url <url>` | URL to fetch |\n| `--format <format>` | Response format (markdown or html) |\n| `--country <cc>` | Two-letter country code to route the request through (e.g. us, de) |\n| `--timeout-ms <n>` | Per-request timeout in milliseconds |\n| `--cache-ttl <ttl>` | Cache freshness: 0, Nh (hours), or Nd (days), e.g. 48h, 2d, 0 (omitted → server default) |\n| `-o, --output <file>` | Write the fetched body bytes to the given file path |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit fetch get --url <url> --format <format> --country <cc> --timeout-ms <n> --cache-ttl <ttl>\n```"
300
+ "body": "# Fetch\n\nFetch URL content operations\n\nFetch URL content operations\n\n### fetch › bulk\n\nBulk fetch operations\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n#### fetch › bulk › create\n\nCreate a bulk fetch job\n\n| Option | Description |\n| --- | --- |\n| `--file <path>` | Path to a newline-delimited file. Each line is a plain URL, or a JSON object carrying \"url\" plus per-item config. A line whose only key is \"url\" behaves exactly as before (sent as a bare URL string); any line with additional keys switches the payload to the per-item shape. |\n| `--webhook-url <url>` | HTTPS webhook URL notified when the job completes |\n| `--webhook-secret <secret>` | HMAC secret used to sign the completion webhook (omitted → unsigned) |\n| `--defaults <json>` | Defaults applied to every entry, as a JSON object (omitted → none). Unknown keys are rejected by /v1/bulk (422) and ignored by scrape bulk / fetch bulk; fetch bulk additionally rejects browser-only keys (cookies, wait_until, wait_for_selector, delay_ms) with a 400. |\n| `--metadata <json>` | Arbitrary metadata echoed on the job envelope, as a JSON object, e.g. '\\{\"run\":\"7\"\\}' (omitted → none) |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit fetch bulk create --file <path> --webhook-url <url> --webhook-secret <secret> --defaults <json> --metadata <json>\n```\n\n#### fetch › bulk › get\n\nGet a bulk fetch job\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit fetch bulk get <id>\n```\n\n### fetch › create\n\nFetch URL content (POST)\n\n| Option | Description |\n| --- | --- |\n| `--url <url>` | URL to fetch |\n| `--country <cc>` | Two-letter country code to route the request through (e.g. us, de) |\n| `--timeout-ms <n>` | Per-request timeout in milliseconds |\n| `--cache-ttl <ttl>` | Cache freshness: 0, Nh (hours), or Nd (days), e.g. 48h, 2d, 0 (omitted → server default) |\n| `--custom <json>` | User payload echoed on the envelope as a JSON object, e.g. '\\{\"job\":\"1\"\\}' (omitted → none) |\n| `-o, --output <file>` | Write the fetched body bytes to the given file path |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit fetch create --url <url> --country <cc> --timeout-ms <n> --cache-ttl <ttl> --custom <json>\n```\n\n### fetch › get\n\nFetch URL content (GET via query params)\n\n| Option | Description |\n| --- | --- |\n| `--url <url>` | URL to fetch |\n| `--country <cc>` | Two-letter country code to route the request through (e.g. us, de) |\n| `--timeout-ms <n>` | Per-request timeout in milliseconds |\n| `--cache-ttl <ttl>` | Cache freshness: 0, Nh (hours), or Nd (days), e.g. 48h, 2d, 0 (omitted → server default) |\n| `-o, --output <file>` | Write the fetched body bytes to the given file path |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit fetch get --url <url> --country <cc> --timeout-ms <n> --cache-ttl <ttl>\n```"
296
301
  },
297
302
  "cli/monitors": {
298
303
  "title": "Monitors",
@@ -302,12 +307,12 @@
302
307
  "cli/scrape": {
303
308
  "title": "Scrape",
304
309
  "section": "CLI Reference",
305
- "body": "# Scrape\n\nScrape URL content\n\nScrape URL content\n\n### scrape › bulk\n\nBulk scrape operations\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n#### scrape › bulk › create\n\nCreate a bulk scrape job\n\n| Option | Description |\n| --- | --- |\n| `--file <path>` | Path to a newline-delimited file. Each line is a plain URL, or a JSON object carrying \"url\" plus per-item config. A line whose only key is \"url\" behaves exactly as before (sent as a bare URL string); any line with additional keys switches the payload to the per-item shape. |\n| `--webhook-url <url>` | HTTPS webhook URL notified when the job completes |\n| `--webhook-secret <secret>` | HMAC secret used to sign the completion webhook (omitted → unsigned) |\n| `--defaults <json>` | Defaults applied to every entry, as a JSON object (omitted → none). Unknown keys are rejected by /v1/bulk (422) and ignored by scrape bulk / fetch bulk; fetch bulk additionally rejects browser-only keys (cookies, wait_until, wait_for_selector, delay_ms) with a 400. |\n| `--metadata <json>` | Arbitrary metadata echoed on the job envelope, as a JSON object, e.g. '\\{\"run\":\"7\"\\}' (omitted → none) |\n| `--custom <json>` | User payload echoed on every scrape entry, as a JSON object, e.g. '\\{\"job\":\"1\"\\}' (omitted → none; a per-entry value in --file wins) |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit scrape bulk create --file <path> --webhook-url <url> --webhook-secret <secret> --defaults <json> --metadata <json> --custom <json>\n```\n\n#### scrape › bulk › get\n\nGet a bulk scrape job\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit scrape bulk get <id>\n```\n\n### scrape › create\n\nCreate a scrape job\n\n| Option | Description |\n| --- | --- |\n| `--url <url>` | URL to scrape |\n| `--format <format>` | Output format; repeat or comma-separate for multiple (e.g. --format raw_html --format markdown, or --format raw_html,markdown). Sent as the formats array; omitted → server default. |\n| `--country <cc>` | Two-letter country code to route the request through (e.g. us, de) |\n| `--timeout-ms <n>` | Per-request timeout in milliseconds |\n| `--markdown-mode <mode>` | Markdown extraction mode: article, raw, llm |\n| `--markdown-query <q>` | BM25 query string for relevance-ranked markdown filtering (omitted → disabled) |\n| `--cache-ttl <ttl>` | Cache freshness: 0, Nh (hours), or Nd (days), e.g. 48h, 2d, 0 (omitted → server default) |\n| `--cookies <json>` | Cookies as a JSON array, e.g. '[\\{\"name\":\"a\",\"value\":\"b\"\\}]' (omitted → none) |\n| `--headers <json>` | Extra request headers as a JSON object, e.g. '\\{\"X-A\":\"b\"\\}' (omitted → none) |\n| `--delay-ms <n>` | Post-load delay in milliseconds before capture |\n| `--events <csv>` | Webhook events (comma-separated): queued, completed, failed (omitted → server default) |\n| `--token-encoding <enc>` | Tokenizer for --token-budget: cl100k_base, o200k_base (omitted → server default) |\n| `--custom <json>` | User payload echoed on the envelope as a JSON object, e.g. '\\{\"job\":\"1\"\\}' (omitted → none) |\n| `--remove-base64-images` | Strip base64 data: images before conversion (server default) |\n| `--no-remove-base64-images` | Preserve base64 data: images in the pipeline output |\n| `--markdown-links <mode>` | Link rendering: inline, references, none, text |\n| `--markdown-images <mode>` | Image retention: inline, references, none, text |\n| `--with-links-summary` | Append a Links footer to the markdown output |\n| `--with-images-summary` | Append an Images footer to the markdown output |\n| `--markdown-compact` | Collapse excessive whitespace in the markdown output |\n| `--markdown-filter-images` | Filter low-signal images from the markdown output |\n| `--markdown-include-media` | Return rich link/image objects and a tables array |\n| `--markdown-include-warnings` | Include markdown-pipeline and tag-filter warnings |\n| `--markdown-include-stats` | Include a top-level stats object (chars, tokens, blocks) |\n| `--async` | Queue the scrape and return a job envelope immediately (no wait) |\n| `--webhook-url <url>` | HTTPS webhook URL notified when an async scrape completes |\n| `--token-budget <n>` | Maximum tokens of markdown to return |\n| `--clean-markdown` | Post-process markdown with the LLM cleaner (billed 3x) |\n| `--include-tags <csv>` | Comma-separated HTML tags to keep (e.g. article,main) |\n| `--exclude-tags <csv>` | Comma-separated HTML tags to drop (e.g. nav,footer) |\n| `--mobile` | Render with a mobile viewport/user-agent |\n| `--raw` | Print the requested format body raw, with no JSON wrapper |\n| `-o, --output <file>` | Write the output to the given file path (implies --raw unless --json is set) |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit scrape create --url <url> --format <format> --country <cc> --timeout-ms <n> --markdown-mode <mode> --markdown-query <q> --cache-ttl <ttl> --cookies <json> --headers <json> --delay-ms <n> --events <csv> --token-encoding <enc> --custom <json> --remove-base64-images --no-remove-base64-images --markdown-links <mode> --markdown-images <mode> --with-links-summary --with-images-summary --markdown-compact --markdown-filter-images --markdown-include-media --markdown-include-warnings --markdown-include-stats --async --webhook-url <url> --token-budget <n> --clean-markdown --include-tags <csv> --exclude-tags <csv> --mobile --raw\n```\n\n### scrape › get\n\nGet a scrape job by ID (use --raw/-o/--format to retrieve a completed body)\n\n| Option | Description |\n| --- | --- |\n| `--raw` | Print the requested format body raw, with no JSON wrapper |\n| `-o, --output <file>` | Write the output to the given file path (implies --raw unless --json is set) |\n| `--format <format>` | Which persisted format to emit — only takes effect with --raw/-o; ignored otherwise |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit scrape get <id> --raw --format <format>\n```"
310
+ "body": "# Scrape\n\nScrape URL content\n\nScrape URL content\n\n### scrape › bulk\n\nBulk scrape operations\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n#### scrape › bulk › create\n\nCreate a bulk scrape job\n\n| Option | Description |\n| --- | --- |\n| `--file <path>` | Path to a newline-delimited file. Each line is a plain URL, or a JSON object carrying \"url\" plus per-item config. A line whose only key is \"url\" behaves exactly as before (sent as a bare URL string); any line with additional keys switches the payload to the per-item shape. |\n| `--webhook-url <url>` | HTTPS webhook URL notified when the job completes |\n| `--webhook-secret <secret>` | HMAC secret used to sign the completion webhook (omitted → unsigned) |\n| `--defaults <json>` | Defaults applied to every entry, as a JSON object (omitted → none). Unknown keys are rejected by /v1/bulk (422) and ignored by scrape bulk / fetch bulk; fetch bulk additionally rejects browser-only keys (wait_until, wait_for_selector, delay_ms) with a 400. `cookies` and `headers` are no longer accepted by any capture endpoint and 400 (#3242). |\n| `--metadata <json>` | Arbitrary metadata echoed on the job envelope, as a JSON object, e.g. '\\{\"run\":\"7\"\\}' (omitted → none) |\n| `--custom <json>` | User payload echoed on every scrape entry, as a JSON object, e.g. '\\{\"job\":\"1\"\\}' (omitted → none; a per-entry value in --file wins) |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit scrape bulk create --file <path> --webhook-url <url> --webhook-secret <secret> --defaults <json> --metadata <json> --custom <json>\n```\n\n#### scrape › bulk › get\n\nGet a bulk scrape job\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit scrape bulk get <id>\n```\n\n### scrape › create\n\nCreate a scrape job\n\n| Option | Description |\n| --- | --- |\n| `--url <url>` | URL to scrape |\n| `--format <format>` | Output format; repeat or comma-separate for multiple (e.g. --format raw_html --format markdown, or --format raw_html,markdown). Sent as the formats array; omitted → server default. |\n| `--country <cc>` | Two-letter country code to route the request through (e.g. us, de) |\n| `--timeout-ms <n>` | Per-request timeout in milliseconds |\n| `--markdown-mode <mode>` | Markdown extraction mode: article, raw, llm |\n| `--markdown-query <q>` | BM25 query string for relevance-ranked markdown filtering (omitted → disabled) |\n| `--cache-ttl <ttl>` | Cache freshness: 0, Nh (hours), or Nd (days), e.g. 48h, 2d, 0 (omitted → server default) |\n| `--delay-ms <n>` | Post-load delay in milliseconds before capture |\n| `--events <csv>` | Webhook events (comma-separated): queued, completed, failed (omitted → server default) |\n| `--token-encoding <enc>` | Tokenizer for --token-budget: cl100k_base, o200k_base (omitted → server default) |\n| `--custom <json>` | User payload echoed on the envelope as a JSON object, e.g. '\\{\"job\":\"1\"\\}' (omitted → none) |\n| `--remove-base64-images` | Strip base64 data: images before conversion (server default) |\n| `--no-remove-base64-images` | Preserve base64 data: images in the pipeline output |\n| `--markdown-links <mode>` | Link rendering: inline, references, none, text |\n| `--markdown-images <mode>` | Image retention: inline, references, none, text |\n| `--with-links-summary` | Append a Links footer to the markdown output |\n| `--with-images-summary` | Append an Images footer to the markdown output |\n| `--markdown-compact` | Collapse excessive whitespace in the markdown output |\n| `--markdown-filter-images` | Filter low-signal images from the markdown output |\n| `--markdown-include-media` | Return rich link/image objects and a tables array |\n| `--markdown-include-warnings` | Include markdown-pipeline and tag-filter warnings |\n| `--markdown-include-stats` | Include a top-level stats object (chars, tokens, blocks) |\n| `--async` | Queue the scrape and return a job envelope immediately (no wait) |\n| `--webhook-url <url>` | HTTPS webhook URL notified when an async scrape completes |\n| `--token-budget <n>` | Maximum tokens of markdown to return |\n| `--clean-markdown` | Post-process markdown with the LLM cleaner (billed 3x) |\n| `--include-tags <csv>` | Comma-separated HTML tags to keep (e.g. article,main) |\n| `--exclude-tags <csv>` | Comma-separated HTML tags to drop (e.g. nav,footer) |\n| `--mobile` | Render with a mobile viewport/user-agent |\n| `--raw` | Print the requested format body raw, with no JSON wrapper |\n| `-o, --output <file>` | Write the output to the given file path (implies --raw unless --json is set) |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit scrape create --url <url> --format <format> --country <cc> --timeout-ms <n> --markdown-mode <mode> --markdown-query <q> --cache-ttl <ttl> --delay-ms <n> --events <csv> --token-encoding <enc> --custom <json> --remove-base64-images --no-remove-base64-images --markdown-links <mode> --markdown-images <mode> --with-links-summary --with-images-summary --markdown-compact --markdown-filter-images --markdown-include-media --markdown-include-warnings --markdown-include-stats --async --webhook-url <url> --token-budget <n> --clean-markdown --include-tags <csv> --exclude-tags <csv> --mobile --raw\n```\n\n### scrape › get\n\nGet a scrape job by ID (use --raw/-o/--format to retrieve a completed body)\n\n| Option | Description |\n| --- | --- |\n| `--raw` | Print the requested format body raw, with no JSON wrapper |\n| `-o, --output <file>` | Write the output to the given file path (implies --raw unless --json is set) |\n| `--format <format>` | Which persisted format to emit — only takes effect with --raw/-o; ignored otherwise |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit scrape get <id> --raw --format <format>\n```"
306
311
  },
307
312
  "cli/screenshots": {
308
313
  "title": "Screenshots",
309
314
  "section": "CLI Reference",
310
- "body": "# Screenshots\n\nScreenshot operations\n\nScreenshot operations\n\n### screenshots › create\n\nCapture a screenshot\n\n| Option | Description |\n| --- | --- |\n| `--url <url>` | URL to screenshot |\n| `--full-page` | Capture the full page (default: viewport only) |\n| `--device <device>` | Device profile: desktop, mobile |\n| `--viewport <WxH>` | Viewport size WIDTHxHEIGHT (e.g. 1280x720) |\n| `--format <format>` | Image format: jpeg, png |\n| `--quality <n>` | JPEG quality (1-100) |\n| `--wait-until <event>` | Wait condition: load, domcontentloaded, networkidle |\n| `--clip <x,y,w,h>` | Clip region X,Y,WIDTH,HEIGHT (e.g. 0,0,800,600) |\n| `--block-ads` | Block ads before capture (server default) |\n| `--no-block-ads` | Do not block ads |\n| `--block-cookie-banners` | Block cookie-consent banners before capture (server default) |\n| `--no-block-cookie-banners` | Do not block cookie-consent banners |\n| `--scroll` | Scroll the page before capture to trigger lazy content (server default) |\n| `--no-scroll` | Do not scroll the page before capture |\n| `--wait-for-selector <sel>` | Wait until this CSS selector is present before capture |\n| `--delay-ms <n>` | Post-load delay in milliseconds before capture |\n| `--dark-mode` | Emulate prefers-color-scheme: dark |\n| `--device-scale-factor <n>` | Device pixel ratio: 1, 2 |\n| `--include-html` | Include the rendered HTML alongside the screenshot |\n| `--country <cc>` | Two-letter country code to route the request through (e.g. us, de) |\n| `--language <lang>` | Accept-Language override (e.g. en-US) |\n| `--headers <json>` | Extra request headers as a JSON object, e.g. '\\{\"X-A\":\"b\"\\}' (omitted → none) |\n| `--cookies <json>` | Cookies as a JSON array of \\{name,value,domain\\}, e.g. '[\\{\"name\":\"a\",\"value\":\"b\",\"domain\":\"example.com\"\\}]' (omitted → none) |\n| `--metadata <json>` | Arbitrary metadata echoed on the screenshot envelope, as a JSON object, e.g. '\\{\"run\":\"7\"\\}' (omitted → none) |\n| `--async` | Queue the screenshot and return a job envelope immediately (no wait) |\n| `-o, --output <file>` | Download the captured image to this file path (use - for stdout). Not valid with --json. |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit screenshots create --url <url> --full-page --device <device> --viewport <WxH> --format <format> --quality <n> --wait-until <event> --clip <x,y,w,h> --block-ads --no-block-ads --block-cookie-banners --no-block-cookie-banners --scroll --no-scroll --wait-for-selector <sel> --delay-ms <n> --dark-mode --device-scale-factor <n> --include-html --country <cc> --language <lang> --headers <json> --cookies <json> --metadata <json> --async\n```\n\n### screenshots › get\n\nGet a screenshot by ID\n\n| Option | Description |\n| --- | --- |\n| `-o, --output <file>` | Download the captured image to this file path (use - for stdout). Not valid with --json. |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit screenshots get <id>\n```"
315
+ "body": "# Screenshots\n\nScreenshot operations\n\nScreenshot operations\n\n### screenshots › create\n\nCapture a screenshot\n\n| Option | Description |\n| --- | --- |\n| `--url <url>` | URL to screenshot |\n| `--full-page` | Capture the full page (default: viewport only) |\n| `--device <device>` | Device profile: desktop, mobile |\n| `--viewport <WxH>` | Viewport size WIDTHxHEIGHT (e.g. 1280x720) |\n| `--format <format>` | Image format: jpeg, png |\n| `--quality <n>` | JPEG quality (1-100) |\n| `--wait-until <event>` | Wait condition: load, domcontentloaded, networkidle |\n| `--clip <x,y,w,h>` | Clip region X,Y,WIDTH,HEIGHT (e.g. 0,0,800,600) |\n| `--block-ads` | Block ads before capture (server default) |\n| `--no-block-ads` | Do not block ads |\n| `--block-cookie-banners` | Block cookie-consent banners before capture (server default) |\n| `--no-block-cookie-banners` | Do not block cookie-consent banners |\n| `--scroll` | Scroll the page before capture to trigger lazy content (server default) |\n| `--no-scroll` | Do not scroll the page before capture |\n| `--wait-for-selector <sel>` | Wait until this CSS selector is present before capture |\n| `--delay-ms <n>` | Post-load delay in milliseconds before capture |\n| `--dark-mode` | Emulate prefers-color-scheme: dark |\n| `--device-scale-factor <n>` | Device pixel ratio: 1, 2 |\n| `--include-html` | Include the rendered HTML alongside the screenshot |\n| `--country <cc>` | Two-letter country code to route the request through (e.g. us, de) |\n| `--language <lang>` | Accept-Language override (e.g. en-US) |\n| `--metadata <json>` | Arbitrary metadata echoed on the screenshot envelope, as a JSON object, e.g. '\\{\"run\":\"7\"\\}' (omitted → none) |\n| `--async` | Queue the screenshot and return a job envelope immediately (no wait) |\n| `-o, --output <file>` | Download the captured image to this file path (use - for stdout). Not valid with --json. |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit screenshots create --url <url> --full-page --device <device> --viewport <WxH> --format <format> --quality <n> --wait-until <event> --clip <x,y,w,h> --block-ads --no-block-ads --block-cookie-banners --no-block-cookie-banners --scroll --no-scroll --wait-for-selector <sel> --delay-ms <n> --dark-mode --device-scale-factor <n> --include-html --country <cc> --language <lang> --metadata <json> --async\n```\n\n### screenshots › get\n\nGet a screenshot by ID\n\n| Option | Description |\n| --- | --- |\n| `-o, --output <file>` | Download the captured image to this file path (use - for stdout). Not valid with --json. |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit screenshots get <id>\n```"
311
316
  },
312
317
  "cli/search": {
313
318
  "title": "Search",
@@ -329,6 +334,11 @@
329
334
  "section": "CLI Reference",
330
335
  "body": "# Webhook-deliveries\n\nWebhook delivery operations\n\nWebhook delivery operations\n\n### webhook-deliveries › list\n\nList webhook deliveries\n\n| Option | Description |\n| --- | --- |\n| `--limit <n>` | Maximum number of deliveries to return |\n| `--cursor <cursor>` | Pagination cursor from a previous page |\n| `--status <status>` | Filter by delivery status: pending, delivered, failed, exhausted |\n| `--since <iso>` | Only deliveries created after this ISO date-time |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit webhook-deliveries list --limit <n> --cursor <cursor> --status <status> --since <iso>\n```\n\n### webhook-deliveries › retry\n\nRequeue a failed or exhausted webhook delivery\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit webhook-deliveries retry <id>\n```"
331
336
  },
337
+ "guides": {
338
+ "title": "Guides",
339
+ "section": "Guides",
340
+ "body": "# Guides\n\nTask-oriented walkthroughs of authentication, scraping, errors, limits, monitors, and webhooks.\n\nTask-oriented walkthroughs of the ByteKit API. Start with\n[Authentication](https://bytekit.com/docs/guides/authentication) to get a key onto a request, then follow whichever\nguide matches the job in front of you. Per-endpoint request and response shapes live in the\n[API Reference](https://bytekit.com/docs/api).\n\n- [Authentication](https://bytekit.com/docs/guides/authentication) — How to authenticate with the ByteKit API using API keys.\n- [Scraping](https://bytekit.com/docs/guides/scraping) — Scrape any URL as HTML, markdown, or structured content — formats, options, latency, and async polling.\n- [Errors](https://bytekit.com/docs/guides/errors) — ByteKit error response shape, common error codes, and retry guidance.\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — How ByteKit enforces quotas, concurrency slots, and rate limits.\n- [Monitors](https://bytekit.com/docs/guides/monitors) — Detect page changes on any URL and receive webhook notifications.\n- [Webhooks](https://bytekit.com/docs/guides/webhooks) — Verify webhook deliveries — signature and timestamp headers, the HMAC scheme, and verification code."
341
+ },
332
342
  "guides/authentication": {
333
343
  "title": "Authentication",
334
344
  "section": "Guides",
@@ -337,28 +347,38 @@
337
347
  "guides/errors": {
338
348
  "title": "Errors",
339
349
  "section": "Guides",
340
- "body": "# Errors\n\nByteKit error response shape, common error codes, and retry guidance.\n\nAll errors from the ByteKit API follow a consistent envelope shape so you can handle them\nprogrammatically.\n\n## Error response shape\n\nEvery `4xx`/`5xx` response across the API uses one unified envelope. `status` is\nalways the literal string `\"failed\"`, so you can branch on the response body alone.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"rate_limited\",\n \"message\": \"Too many requests. Retry after 2 seconds.\",\n \"httpStatus\": 429,\n \"failedAt\": \"2026-06-16T19:38:02.084Z\",\n \"details\": {}\n }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| `status` | Always `\"failed\"` on an error response — the top-level discriminator |\n| `error.code` | Machine-readable string identifier |\n| `error.message` | Human-readable explanation |\n| `error.httpStatus` | Mirrors the HTTP response status (useful for logged or replayed bodies) |\n| `error.failedAt` | ISO-8601 UTC timestamp of when the error was produced |\n| `error.details` | Optional object with additional context (e.g. which field failed validation) |\n\n## Common error codes\n\n| HTTP status | Code | Meaning |\n|-------------|------|---------|\n| `400` | `invalid_url` | A supplied URL (including `webhook_url`) is malformed or uses an unsupported scheme |\n| `401` | `unauthorized` | Missing or malformed `Authorization` header |\n| `401` | `invalid_api_key` | API key is present but not valid |\n| `402` | `quota_exceeded` | Account has exceeded its plan quota |\n| `403` | `forbidden` | Key is valid but lacks permission for this action |\n| `422` | `validation_error` | Malformed JSON or a request field failed validation |\n| `429` | `rate_limited` | Too many requests per second; back off and retry |\n| `429` | `concurrency_limit` | Too many simultaneous in-flight requests; back off and retry |\n| `500` | `internal_error` | The upstream fetch or browser render failed |\n\n## Webhook URLs Must Use HTTPS\n\nAll webhook URLs submitted to the ByteKit API must use HTTPS. Plain HTTP URLs (e.g. `http://example.com/webhook`) are rejected with a `400` `invalid_url` error.\n\n**Why HTTPS only?** Webhook payloads may contain sensitive data (API keys, session tokens, scrape results). HTTPS encryption protects this data in transit.\n\n**Request with an invalid webhook URL:**\n\n```json\n{\n \"webhook_url\": \"http://example.com/webhook\"\n}\n```\n\n**Response (HTTP 400)** — the same unified envelope as every other error; `error.details` names the offending field and reason:\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"invalid_url\",\n \"message\": \"url is not a valid HTTP(S) URL: scheme_unsupported\",\n \"httpStatus\": 400,\n \"failedAt\": \"2026-06-16T19:38:02.340Z\",\n \"details\": {\n \"url\": \"http://example.com/webhook\",\n \"field\": \"webhook_url\",\n \"reason\": \"scheme_unsupported\"\n }\n }\n}\n```\n\n**Working example:**\n\n```json\n{\n \"webhook_url\": \"https://example.com/webhook\"\n}\n```\n\nThis applies to all endpoints that accept a `webhook_url` parameter: `/v1/scrape` (async), `/v1/scrape/bulk`, `/v1/fetch/bulk`, `/v1/bulk`, `/v1/monitors`, and `/v1/sitemap`.\n\n## Retry guidance\n\nNot all errors are retryable. Use this table to decide:\n\n| Code | Retry? | Guidance |\n|------|--------|---------|\n| `invalid_url` | No | Fix the URL before retrying |\n| `validation_error` | No | Fix the request body before retrying |\n| `unauthorized` / `invalid_api_key` | No | Check your API key |\n| `quota_exceeded` | No | Upgrade your plan or wait for quota reset |\n| `forbidden` | No | You do not have access to this resource |\n| `rate_limited` | Yes | Exponential backoff; honour the `Retry-After` header |\n| `concurrency_limit` | Yes | Honour the `Retry-After` header (a short fixed back-off — a slot frees on job completion, not a fixed window) |\n| `internal_error` | Yes | Exponential backoff; most resolve on retry |\n\nFor retriable errors, start with a 1-second delay and double on each subsequent failure, up to\na maximum of 60 seconds. Respect the `Retry-After` header value when it is present on `429`\nresponses.\n\n## Example: handling errors in curl\n\n```bash\nresponse=$(curl -s -w \"\\n%{http_code}\" -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}')\n\nhttp_code=$(echo \"$response\" | tail -1)\n# Body is everything except the trailing status-code line — drop only the last\n# line so multi-line JSON responses survive intact.\nbody=$(echo \"$response\" | sed '$d')\n\nif [ \"$http_code\" -ge 400 ]; then\n echo \"Error $http_code: $body\"\nfi\n```\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, rate limit headers\n- [Scraping](https://bytekit.com/docs/guides/scraping) — when `500 internal_error` occurs and how fallback works\n- [API Reference](https://bytekit.com/docs/api) — per-endpoint error codes"
350
+ "body": "# Errors\n\nByteKit error response shape, common error codes, and retry guidance.\n\nAll errors from the ByteKit API follow a consistent envelope shape so you can handle them\nprogrammatically.\n\n## Error response shape\n\nEvery `4xx`/`5xx` response across the API uses one unified envelope. `status` is\nalways the literal string `\"failed\"`, so you can branch on the response body alone.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"rate_limited\",\n \"message\": \"Rate limit exceeded. Allowed 5 requests per second.\",\n \"http_status\": 429,\n \"failed_at\": \"2026-08-27T12:17:46.234Z\"\n }\n}\n```\n\nThe number in a `rate_limited` message is your own plan's per-second limit — the same value the `X-RateLimit-Limit` response header carries.\n\n| Field | Description |\n|-------|-------------|\n| `status` | Always `\"failed\"` on an error response — the top-level discriminator |\n| `error.code` | Machine-readable string identifier |\n| `error.message` | Human-readable explanation |\n| `error.http_status` | Mirrors the HTTP response status (useful for logged or replayed bodies) |\n| `error.failed_at` | ISO-8601 UTC timestamp of when the error was produced |\n| `error.details` | Optional object with additional context (e.g. which field failed validation). Absent — not `{}` — when the error carries no context |\n\n## Common error codes\n\n| HTTP status | Code | Meaning |\n|-------------|------|---------|\n| `400` | `invalid_url` | A supplied URL (including `webhook_url`) is malformed or uses an unsupported scheme |\n| `401` | `unauthorized` | Missing or malformed `Authorization` header |\n| `401` | `invalid_api_key` | API key is present but not valid |\n| `402` | `quota_exceeded` | Account has exceeded its plan quota |\n| `402` | `spending_cap_reached` | A credit-metered request would push overage spend past the account's cap. Only reachable on a custom plan with an overage agreement — standard plans have no automatic overage and stop at `quota_exceeded` |\n| `403` | `forbidden` | Key is valid but lacks permission for this action |\n| `422` | `validation_error` | Malformed JSON or a request field failed validation |\n| `429` | `rate_limited` | Too many requests per second; back off and retry |\n| `429` | `concurrency_limit` | Too many simultaneous in-flight requests; back off and retry |\n| `500` | `internal_error` | The upstream fetch or browser render failed |\n\n## Webhook URLs Must Use HTTPS\n\nAll webhook URLs submitted to the ByteKit API must use HTTPS. Plain HTTP URLs (e.g. `http://example.com/webhook`) are rejected with a `400` `invalid_url` error.\n\n**Why HTTPS only?** Webhook payloads may contain sensitive data (API keys, session tokens, scrape results). HTTPS encryption protects this data in transit.\n\n**Request with an invalid webhook URL:**\n\n```json\n{\n \"webhook_url\": \"http://example.com/webhook\"\n}\n```\n\n**Response (HTTP 400)** — the same unified envelope as every other error; `error.details` names the offending field and reason:\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"invalid_url\",\n \"message\": \"url is not a valid HTTP(S) URL: scheme_unsupported\",\n \"http_status\": 400,\n \"failed_at\": \"2026-08-27T12:16:29.033Z\",\n \"details\": {\n \"url\": \"http://example.com/webhook\",\n \"field\": \"webhook_url\",\n \"reason\": \"scheme_unsupported\"\n }\n }\n}\n```\n\n**Working example:**\n\n```json\n{\n \"webhook_url\": \"https://example.com/webhook\"\n}\n```\n\nThis applies to all endpoints that accept a `webhook_url` parameter: `/v1/scrape` (async), `/v1/scrape/bulk`, `/v1/fetch/bulk`, `/v1/bulk`, `/v1/monitors`, and `/v1/sitemap`.\n\n## Retry guidance\n\nNot all errors are retryable. Use this table to decide:\n\n| Code | Retry? | Guidance |\n|------|--------|---------|\n| `invalid_url` | No | Fix the URL before retrying |\n| `validation_error` | No | Fix the request body before retrying |\n| `unauthorized` / `invalid_api_key` | No | Check your API key |\n| `quota_exceeded` | No | Upgrade your plan or wait for quota reset |\n| `spending_cap_reached` | No | The overage cap is account-level and has no self-service control — [contact support](https://bytekit.com/docs/billing/spending) to raise it, or upgrade the plan |\n| `forbidden` | No | You do not have access to this resource |\n| `rate_limited` | Yes | Exponential backoff; honour the `Retry-After` header |\n| `concurrency_limit` | Yes | Honour the `Retry-After` header (a short fixed back-off — a slot frees on job completion, not a fixed window) |\n| `internal_error` | Yes | Exponential backoff; most resolve on retry |\n\nFor retriable errors, start with a 1-second delay and double on each subsequent failure, up to\na maximum of 60 seconds. Respect the `Retry-After` header value when it is present on `429`\nresponses.\n\n## Example: handling errors in curl\n\n```bash\nresponse=$(curl -s -w \"\\n%{http_code}\" -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}')\n\nhttp_code=$(echo \"$response\" | tail -1)\n# Body is everything except the trailing status-code line — drop only the last\n# line so multi-line JSON responses survive intact.\nbody=$(echo \"$response\" | sed '$d')\n\nif [ \"$http_code\" -ge 400 ]; then\n echo \"Error $http_code: $body\"\nfi\n```\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, rate limit headers\n- [Scraping](https://bytekit.com/docs/guides/scraping) — when `500 internal_error` occurs and how fallback works\n- [API Reference](https://bytekit.com/docs/api) — per-endpoint error codes"
341
351
  },
342
352
  "guides/monitors": {
343
353
  "title": "Monitors",
344
354
  "section": "Guides",
345
- "body": "# Monitors\n\nDetect page changes on any URL — by screenshot or scrape — and receive webhook notifications.\n\nMonitors periodically capture a URL and notify you when the page changes. Each monitor uses one\nof two capture types: `screenshot` (perceptual/visual change detection) or `scrape` (content and\nmarkdown change detection). Use them for price tracking, content alerts, uptime monitoring, or\ncompetitor surveillance.\n\n## Create a monitor\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com/pricing\",\n \"interval_type\": \"hourly\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\"\n }'\n```\n\n| Field | Description |\n|-------|-------------|\n| `url` | The page to monitor (required) |\n| `interval_type` | Check frequency — one of `hourly`, `daily`, `weekly`, or `cron` (required) |\n| `webhook_url` | HTTPS webhook endpoint to receive notifications. `http://` is rejected with a 400 `invalid_url` (reason `scheme_unsupported`) (required) |\n| `cron_expression` | 5-field cron expression. Required when `interval_type` is `cron` |\n| `type` | Capture mode — `screenshot` (default) or `scrape` |\n| `change_threshold` | Percentage of change required to trigger a notification (0–100, default `5`). Screenshot monitors only |\n| `notify_on` | `change` (default — notify only when content changed) or `every` (notify on every capture) |\n| `webhook_secret` | Optional secret used to sign webhook deliveries |\n| `webhook_headers` | Optional custom headers (max 20) to include on each webhook delivery |\n\nA successful response returns the monitor object with an `id` prefixed `mon_`:\n\n```json\n{\n \"id\": \"mon_...\",\n \"type\": \"screenshot\",\n \"url\": \"https://example.com/pricing\",\n \"status\": \"active\",\n \"interval_type\": \"hourly\",\n \"cron_expression\": null,\n \"next_capture_at\": \"2026-01-01T01:00:00Z\",\n \"notify_on\": \"change\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\",\n \"captures_count\": 0,\n \"changes_count\": 0,\n \"created_at\": \"2026-01-01T00:00:00Z\"\n}\n```\n\nTo monitor on a schedule, set `interval_type` to `cron` and supply a 5-field `cron_expression`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com/pricing\",\n \"interval_type\": \"cron\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\"\n }'\n```\n\n## List monitors\n\n```bash\ncurl https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Get a monitor\n\n```bash\ncurl https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Update a monitor\n\n```bash\ncurl -X PATCH https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"interval_type\": \"daily\"}'\n```\n\nYou can update any subset of the monitor's mutable fields — for example `interval_type`,\n`cron_expression`, `webhook_url`, `notify_on`, `change_threshold`, or `status`\n(`active` / `paused`). Switching to a `cron` schedule requires a `cron_expression`:\n\n```bash\ncurl -X PATCH https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"interval_type\": \"cron\", \"cron_expression\": \"*/30 * * * *\"}'\n```\n\n## Delete a monitor\n\n```bash\ncurl -X DELETE https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Monitor captures\n\nEach time a monitor fires it records a capture event — on **every** run, whether or not the\ncontent changed. Each capture carries a `has_change` flag marking whether the content differed\nfrom the previous capture. Webhook delivery is separate: the capture is always recorded, but\nwhether a webhook is *sent* depends on `has_change` and the monitor's `notify_on` setting (see\n[Webhook payload](#webhook-payload) below). Retrieve the capture history with:\n\n```bash\ncurl https://api.bytekit.com/v1/monitors/mon_.../captures \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\nEach capture in the list represents one capture event and includes change metadata — the\ntimestamp, whether the content changed (`has_change`), the percentage of content that changed\n(`change_pct`), and the perceptual hash distance from the previous capture. Captures record\n*that* the content changed and by how much; they do not include a line-by-line textual diff.\n\n### First-capture behavior (silent baseline for both types)\n\nThe very first capture of a monitor has **no previous capture to compare against**. Both monitor\ntypes treat that first run as a **silent baseline** — one universal \"first capture\" behavior,\nno per-type divergence:\n\n| Monitor type | First capture | `has_change` | `change_pct` | Webhook on first capture |\n|--------------|---------------|--------------|--------------|--------------------------|\n| `scrape` | Silent baseline | `false` | `null` | **No** `monitor.change_detected`-equivalent webhook (the baseline is just recorded) |\n| `screenshot` | Silent baseline | `false` | `null` | **No** `monitor.change_detected` webhook (the baseline is just recorded) |\n\nNeither a **scrape** nor a **screenshot** monitor alerts you on its first run — both only alert\nonce a *subsequent* capture differs (scrape by exact content-hash inequality, screenshot by at\nleast `change_threshold`). A monitor with `notify_on: \"every\"` still sends a `monitor.captured`\nwebhook on the first capture — that is the per-capture notification, not a change alert, and it\nfires for both monitor types. From the second capture onward both types behave the same way each\nnew capture is compared against the previous one — scrape by exact SHA-256 content equality,\nscreenshot by perceptual-hash distance against `change_threshold`.\n\n**Existing scrape monitors:** if you created a scrape monitor before this change shipped, its\nfirst post-deploy capture will no longer fire a `monitor.change_detected`-equivalent webhook —\nthe first capture after the change is now the silent baseline, matching screenshot monitors.\nSteady-state alerting (second capture onward) is unaffected.\n\n**Repointing a monitor's `url`:** `PATCH`-ing a monitor's `url` to a different address re-enters\nthis same silent-baseline behavior — the capture immediately after a repoint is treated as a\nfresh first capture (`has_change: false`, `change_pct: null`, no `monitor.change_detected`-equivalent\nwebhook for `scrape` monitors, no `monitor.change_detected` webhook for `screenshot` monitors),\nsince the stored comparison baseline for the old URL no longer applies to the new one.\nSteady-state alerting resumes from the *second* capture after the repoint.\n\nThis silence isn't guaranteed if a capture was already in flight against the old URL when the\n`PATCH` landed: that capture can still complete and write its result back as the new baseline,\nso the repoint's silent-baseline behavior is deferred to the *next* capture rather than applying\nto the in-flight one.\n\n## Webhook payload\n\nWhen a monitor fires, ByteKit sends a `POST` to your `webhook_url`. Every delivery carries an\n`X-ByteKit-Event` header naming the event type — dispatch on that header rather than inspecting\nthe body shape. The event type and payload depend on the monitor's `type`.\n\n### Screenshot monitors (`type: \"screenshot\"`, default)\n\nScreenshot captures send `monitor.change_detected` when the page changed (`X-ByteKit-Event:\nmonitor.change_detected`) and `monitor.captured` when there was no change but\n`notify_on: \"every\"` is set (`X-ByteKit-Event: monitor.captured`). The body carries the capture\nmetadata:\n\n```json\n{\n \"monitor_id\": \"mon_...\",\n \"screenshot_id\": \"ss_...\",\n \"has_change\": true,\n \"change_pct\": 42.0,\n \"hash_distance\": 18,\n \"url\": \"https://example.com/pricing\"\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| `has_change` | `true` when the captured content differs from the previous capture |\n| `change_pct` | Percentage of content that changed (0–100) |\n| `hash_distance` | Perceptual-hash distance from the previous capture |\n| `screenshot_id` | The screenshot that triggered the notification |\n\n### Scrape monitors (`type: \"scrape\"`)\n\nScrape captures send `scrape.completed` (`X-ByteKit-Event: scrape.completed`) with the full\nscrape result envelope inline:\n\n```json\n{\n \"success\": true,\n \"type\": \"scrape.completed\",\n \"id\": \"mon_...\",\n \"scrape_id\": \"sc_...\",\n \"has_change\": true,\n \"change_pct\": 100.0,\n \"metadata\": {},\n \"scrape\": {\n \"status\": \"success\",\n \"id\": \"sc_...\",\n \"url\": \"https://example.com/pricing\",\n \"final_url\": \"https://example.com/pricing\",\n \"content_length\": 1256,\n \"status_code\": 200,\n \"formats\": {\n \"markdown\": \"...\"\n }\n }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| `has_change` | `true` when the captured content differs from the previous capture |\n| `change_pct` | Percentage of content that changed (0–100) |\n| `scrape` | Full scrape result envelope (same shape as `POST /v1/scrape` response) |\n\nYour endpoint must respond with `2xx` within 10 seconds. Failed deliveries are retried with\nexponential backoff.\n\n## Next steps\n\n- [API Reference: Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — full endpoint schema\n- [Errors](https://bytekit.com/docs/guides/errors) — error codes returned by monitor endpoints"
355
+ "body": "# Monitors\n\nDetect page changes on any URL — by screenshot or scrape — and receive webhook notifications.\n\nMonitors periodically capture a URL and notify you when the page changes. Each monitor uses one\nof two capture types: `screenshot` (perceptual/visual change detection) or `scrape` (content and\nmarkdown change detection). Use them for price tracking, content alerts, uptime monitoring, or\ncompetitor surveillance.\n\n## Create a monitor\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com/pricing\",\n \"interval_type\": \"hourly\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\"\n }'\n```\n\n| Field | Description |\n|-------|-------------|\n| `url` | The page to monitor (required) |\n| `interval_type` | Check frequency — one of `hourly`, `daily`, `weekly`, or `cron` (required) |\n| `webhook_url` | HTTPS webhook endpoint to receive notifications. `http://` is rejected with a 400 `invalid_url` (reason `scheme_unsupported`) (required) |\n| `cron_expression` | 5-field cron expression. Required when `interval_type` is `cron` |\n| `type` | Capture mode — `screenshot` (default) or `scrape` |\n| `change_threshold` | Percentage of change required to trigger a notification (0–100, default `5`). Screenshot monitors only |\n| `notify_on` | `change` (default — notify only when content changed) or `every` (notify on every capture) |\n| `webhook_secret` | Optional secret used to sign webhook deliveries. Deliveries carry `X-Webhook-Signature` and `X-Webhook-Timestamp` — see [Webhooks](https://bytekit.com/docs/guides/webhooks) to verify them |\n| `webhook_headers` | Optional custom headers (max 20) to include on each webhook delivery |\n\nA successful response returns the monitor object with an `id` prefixed `mon_`:\n\n```json\n{\n \"id\": \"mon_...\",\n \"type\": \"screenshot\",\n \"url\": \"https://example.com/pricing\",\n \"status\": \"active\",\n \"interval_type\": \"hourly\",\n \"cron_expression\": null,\n \"next_capture_at\": \"2026-01-01T01:00:00Z\",\n \"notify_on\": \"change\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\",\n \"captures_count\": 0,\n \"changes_count\": 0,\n \"created_at\": \"2026-01-01T00:00:00Z\"\n}\n```\n\nTo monitor on a schedule, set `interval_type` to `cron` and supply a 5-field `cron_expression`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com/pricing\",\n \"interval_type\": \"cron\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\"\n }'\n```\n\n## List monitors\n\n```bash\ncurl https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Get a monitor\n\n```bash\ncurl https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Update a monitor\n\n```bash\ncurl -X PATCH https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"interval_type\": \"daily\"}'\n```\n\nYou can update any subset of the monitor's mutable fields — for example `interval_type`,\n`cron_expression`, `webhook_url`, `notify_on`, `change_threshold`, or `status`\n(`active` / `paused`). Switching to a `cron` schedule requires a `cron_expression`:\n\n```bash\ncurl -X PATCH https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"interval_type\": \"cron\", \"cron_expression\": \"*/30 * * * *\"}'\n```\n\n## Delete a monitor\n\n```bash\ncurl -X DELETE https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Monitor captures\n\nEach time a monitor fires it records a capture event — on **every** run, whether or not the\ncontent changed. Each capture carries a `has_change` flag marking whether the content differed\nfrom the previous capture. Webhook delivery is separate: the capture is always recorded, but\nwhether a webhook is *sent* depends on `has_change` and the monitor's `notify_on` setting (see\n[Webhook payload](#webhook-payload) below). Retrieve the capture history with:\n\n```bash\ncurl https://api.bytekit.com/v1/monitors/mon_.../captures \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\nEach capture in the list represents one capture event and includes change metadata — the\ntimestamp, whether the content changed (`has_change`), the percentage of content that changed\n(`change_pct`), and the perceptual hash distance from the previous capture. Captures record\n*that* the content changed and by how much; they do not include a line-by-line textual diff.\n\n### First-capture behavior (silent baseline for both types)\n\nThe very first capture of a monitor has **no previous capture to compare against**. Both monitor\ntypes treat that first run as a **silent baseline** — one universal \"first capture\" behavior,\nno per-type divergence:\n\n| Monitor type | First capture | `has_change` | `change_pct` | Webhook on first capture |\n|--------------|---------------|--------------|--------------|--------------------------|\n| `scrape` | Silent baseline | `false` | `null` | **No** `monitor.change_detected`-equivalent webhook (the baseline is just recorded) |\n| `screenshot` | Silent baseline | `false` | `null` | **No** `monitor.change_detected` webhook (the baseline is just recorded) |\n\nNeither a **scrape** nor a **screenshot** monitor alerts you on its first run — both only alert\nonce a *subsequent* capture differs (scrape by exact content-hash inequality, screenshot by at\nleast `change_threshold`). A monitor with `notify_on: \"every\"` still sends a `monitor.captured`\nwebhook on the first capture — that is the per-capture notification, not a change alert, and it\nfires for both monitor types. From the second capture onward both types behave the same way each\nnew capture is compared against the previous one — scrape by exact SHA-256 content equality,\nscreenshot by perceptual-hash distance against `change_threshold`.\n\n**Existing scrape monitors:** if you created a scrape monitor before this change shipped, its\nfirst post-deploy capture will no longer fire a `monitor.change_detected`-equivalent webhook —\nthe first capture after the change is now the silent baseline, matching screenshot monitors.\nSteady-state alerting (second capture onward) is unaffected.\n\n**Repointing a monitor's `url`:** `PATCH`-ing a monitor's `url` to a different address re-enters\nthis same silent-baseline behavior — the capture immediately after a repoint is treated as a\nfresh first capture (`has_change: false`, `change_pct: null`, no `monitor.change_detected`-equivalent\nwebhook for `scrape` monitors, no `monitor.change_detected` webhook for `screenshot` monitors),\nsince the stored comparison baseline for the old URL no longer applies to the new one.\nSteady-state alerting resumes from the *second* capture after the repoint.\n\nThis silence isn't guaranteed if a capture was already in flight against the old URL when the\n`PATCH` landed: that capture can still complete and write its result back as the new baseline,\nso the repoint's silent-baseline behavior is deferred to the *next* capture rather than applying\nto the in-flight one.\n\n## Webhook payload\n\nWhen a monitor fires, ByteKit sends a `POST` to your `webhook_url`. Every delivery carries an\n`X-ByteKit-Event` header naming the event type — dispatch on that header rather than inspecting\nthe body shape. The event type and payload depend on the monitor's `type`.\n\n### Screenshot monitors (`type: \"screenshot\"`, default)\n\nScreenshot captures send `monitor.change_detected` when the page changed (`X-ByteKit-Event:\nmonitor.change_detected`) and `monitor.captured` when there was no change but\n`notify_on: \"every\"` is set (`X-ByteKit-Event: monitor.captured`). The body carries the capture\nmetadata:\n\n```json\n{\n \"monitor_id\": \"mon_...\",\n \"screenshot_id\": \"ss_...\",\n \"has_change\": true,\n \"change_pct\": 42.0,\n \"hash_distance\": 18,\n \"url\": \"https://example.com/pricing\"\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| `has_change` | `true` when the captured content differs from the previous capture |\n| `change_pct` | Percentage of content that changed (0–100) |\n| `hash_distance` | Perceptual-hash distance from the previous capture |\n| `screenshot_id` | The screenshot that triggered the notification |\n\n### Scrape monitors (`type: \"scrape\"`)\n\nScrape captures send `scrape.completed` (`X-ByteKit-Event: scrape.completed`) with the full\nscrape result envelope inline:\n\n```json\n{\n \"success\": true,\n \"type\": \"scrape.completed\",\n \"id\": \"mon_...\",\n \"scrape_id\": \"sc_...\",\n \"has_change\": true,\n \"change_pct\": 100.0,\n \"metadata\": {},\n \"scrape\": {\n \"status\": \"success\",\n \"id\": \"sc_...\",\n \"url\": \"https://example.com/pricing\",\n \"final_url\": \"https://example.com/pricing\",\n \"content_length\": 1256,\n \"status_code\": 200,\n \"formats\": {\n \"markdown\": \"...\"\n }\n }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| `has_change` | `true` when the captured content differs from the previous capture |\n| `change_pct` | Percentage of content that changed (0–100) |\n| `scrape` | Full scrape result envelope (same shape as `POST /v1/scrape` response) |\n\nYour endpoint must respond with `2xx` within 10 seconds. Failed deliveries are retried with\nexponential backoff.\n\n## Next steps\n\n- [Webhooks](https://bytekit.com/docs/guides/webhooks) — verify the `X-Webhook-Signature` on every delivery\n- [API Reference: Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — full endpoint schema\n- [Errors](https://bytekit.com/docs/guides/errors) — error codes returned by monitor endpoints"
346
356
  },
347
357
  "guides/rate-limits": {
348
358
  "title": "Rate Limits",
349
359
  "section": "Guides",
350
- "body": "# Rate Limits\n\nHow ByteKit enforces quotas, concurrency slots, and rate limits.\n\nByteKit enforces three independent limits: **rate limits** (requests per second),\n**concurrency slots** (simultaneous in-flight requests), and **quota** (monthly usage caps).\nAll three are enforced before any capture work begins.\n\n## Quota model\n\nQuota is pre-incremented on every request and corrected after the request completes:\n\n1. **Pre-increment** — your usage counter is incremented by an estimate before the capture\n starts. This prevents over-committing capacity even for concurrent requests.\n2. **Adjust** — once the response returns, the actual `contentLength` (compressed wire bytes)\n replaces the estimate for bandwidth accounting.\n3. **Compensating decrement** — if the request fails with a terminal error, the pre-incremented\n amount is rolled back so you are not charged for failed requests.\n\nThis means your dashboard usage counter may briefly read higher than actual consumption during\na burst of requests, then settle to the true value.\n\n## Concurrency slots\n\nEach account has a concurrency limit — the maximum number of in-flight requests at one time.\nSlots are released automatically a few minutes after a client disconnects, so a crashed client\ncannot permanently hold them.\n\nWhen you exceed your concurrency limit, you receive `429 concurrency_limit` (not\n`rate_limited` — a distinct error code) with a `Retry-After` header indicating how long to\nwait before retrying.\n\n## Rate limit headers\n\nEvery response includes headers that show your current position:\n\n| Header | Description |\n|--------|-------------|\n| `X-RateLimit-Limit` | Your account's request-per-second limit |\n| `X-RateLimit-Remaining` | Requests remaining in the current window |\n| `X-RateLimit-Reset` | Unix timestamp when the window resets |\n| `Retry-After` | Seconds to wait before retrying (present on `429` only) |\n\n## Bandwidth metering\n\nBandwidth usage is measured as `contentLength` — the compressed wire bytes returned by the\norigin server. If the origin sends gzip or Brotli-encoded content, the compressed size is what\ncounts, not the decompressed size. This matches what your client actually receives over the\nnetwork.\n\n## Handling 429 responses\n\nWhen you receive `429 rate_limited` or `429 concurrency_limit`:\n\n1. Read the `Retry-After` header value (in seconds).\n2. Wait at least that long before retrying.\n3. If no `Retry-After` is present, use exponential backoff starting at 1 second.\n\n```bash\n# Check rate limit headers\ncurl -I -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n## Next steps\n\n- [Errors](https://bytekit.com/docs/guides/errors) — full error code reference and retry guidance\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, latency, and async polling"
360
+ "body": "# Rate Limits\n\nHow ByteKit enforces quotas, concurrency slots, and rate limits.\n\nByteKit enforces three independent limits: **rate limits** (requests per second),\n**concurrency slots** (simultaneous in-flight requests), and **quota** (monthly usage caps).\nAll three are enforced before any capture work begins.\n\n## Quota model\n\nQuota is pre-incremented on every request and corrected after the request completes:\n\n1. **Pre-increment** — your usage counter is incremented by an estimate before the capture\n starts. This prevents over-committing capacity even for concurrent requests.\n2. **Adjust** — once the response returns, the actual `content_length` (compressed wire bytes)\n replaces the estimate for bandwidth accounting.\n3. **Compensating decrement** — if the request fails with a terminal error, the pre-incremented\n amount is rolled back so you are not charged for failed requests.\n\nThis means your dashboard usage counter may briefly read higher than actual consumption during\na burst of requests, then settle to the true value.\n\n## Concurrency slots\n\nEach account has a concurrency limit — the maximum number of in-flight requests at one time.\nSlots are released automatically a few minutes after a client disconnects, so a crashed client\ncannot permanently hold them.\n\nWhen you exceed your concurrency limit, you receive `429 concurrency_limit` (not\n`rate_limited` — a distinct error code) with a `Retry-After` header indicating how long to\nwait before retrying.\n\n## Rate limit headers\n\nEvery response includes headers that show your current position:\n\n| Header | Description |\n|--------|-------------|\n| `X-RateLimit-Limit` | Your account's request-per-second limit |\n| `X-RateLimit-Remaining` | Requests remaining in the current window |\n| `X-RateLimit-Reset` | Unix timestamp when the window resets |\n| `Retry-After` | Seconds to wait before retrying (present on `429` only) |\n\n## Bandwidth metering\n\nBandwidth usage is measured as `content_length` — the compressed wire bytes returned by the\norigin server. If the origin sends gzip or Brotli-encoded content, the compressed size is what\ncounts, not the decompressed size. This matches what your client actually receives over the\nnetwork.\n\n## Handling 429 responses\n\nWhen you receive `429 rate_limited` or `429 concurrency_limit`:\n\n1. Read the `Retry-After` header value (in seconds).\n2. Wait at least that long before retrying.\n3. If no `Retry-After` is present, use exponential backoff starting at 1 second.\n\n```bash\n# Check rate limit headers\ncurl -I -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n## Next steps\n\n- [Errors](https://bytekit.com/docs/guides/errors) — full error code reference and retry guidance\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, latency, and async polling"
351
361
  },
352
362
  "guides/scraping": {
353
363
  "title": "Scraping",
354
364
  "section": "Guides",
355
- "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| `cookies` | Non-empty array |\n| `headers` | Non-empty object |\n| `delay_ms` | Greater than `0` |\n| `async` | `true` (request is queued and processed off the fast path) |\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```bash\n# A simple, low-latency scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n```bash\n# Slower: delay_ms forces a full render and waits before returning\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"delay_ms\": 2000\n }'\n```\n\n## Response fields\n\nThe default format is `raw_html` — pass `formats` to request others (`markdown`, `html`,\n`links`, `images`). The `formats` object in the response is keyed by the format you requested.\n\n| Field | Description |\n|-------|-------------|\n| `formats.raw_html` | Page content in the requested format (`raw_html` is the default when `formats` is omitted) |\n| `contentLength` | Compressed wire bytes — used for bandwidth billing |\n| `statusCode` | HTTP status code of the origin page |\n| `metadata.title` | Page `<title>` element |\n\nThe `X-Scrape-*` response headers describe how each request was handled (cache status, timing,\nand the final URL) — useful for debugging.\n\n## Async scrapes\n\nFor long-running pages, pass `\"async\": true` to get a `202 Accepted` response with a scrape\n`id` prefixed `sc_`. Poll the result with `GET /v1/scrape/{id}`.\n\n```bash\n# Start async scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"async\": true}'\n\n# Poll for result\ncurl https://api.bytekit.com/v1/scrape/sc_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Webhook event header\n\nEvery outbound webhook POST includes an `X-ByteKit-Event` header with the event type:\n\n| Event type | Trigger |\n|---|---|\n| `bulk.completed` | A bulk job finishes (all items processed) |\n| `scrape.completed` | An async scrape succeeds |\n| `scrape.failed` | An async scrape fails terminally |\n| `monitor.change_detected` | A monitor fires and detects a change (screenshot or content) |\n| `monitor.captured` | A monitor fires with no change detected (notify_on: every) |\n| `sitemap.completed` | A sitemap job finishes |\n| `sitemap.failed` | A sitemap job fails terminally |\n\nUse this header to dispatch events without inspecting the body shape:\n\n```python\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route(\"/webhooks/bytekit\", methods=[\"POST\"])\ndef handle():\n event = request.headers.get(\"X-ByteKit-Event\")\n if event == \"bulk.completed\":\n handle_bulk(request.json)\n elif event == \"scrape.completed\":\n handle_scrape(request.json)\n return \"\", 200\n```\n\n`X-ByteKit-Event` is a reserved header — you cannot supply it via `webhook_headers` in\nmonitor or bulk configuration. Attempts to do so will be rejected with a `422` at request\ntime.\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model and concurrency slots\n- [Errors](https://bytekit.com/docs/guides/errors) — how to interpret and retry error responses\n- [API Reference: Scrape](https://bytekit.com/docs/api/scrape/createscrape) — full request/response schema"
365
+ "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` (request is queued and processed off the fast path) |\n\nThe `country` option routes the request through a geo-located proxy. On its own it does not add\nrendering latency; it only does so when combined with one of the options above.\n\nLooking for `wait_for_selector` or `wait_until`? Those are not `ScrapeRequest` options — they\nbelong to the [Screenshot](https://bytekit.com/docs/api/screenshots/createscreenshot) endpoint. Sending them to\n`/v1/scrape` returns `422`.\n\n`cookies` and `headers` are no longer request options on any capture endpoint. Sending either\nreturns `400 validation_error`.\n\n```bash\n# A simple, low-latency scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n```bash\n# Slower: delay_ms forces a full render and waits before returning\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"delay_ms\": 2000\n }'\n```\n\n## Response fields\n\nThe default format is `raw_html` — pass `formats` to request others (`markdown`, `html`,\n`links`, `images`). The `formats` object in the response is keyed by the format you requested.\n\nEnvelope fields are `snake_case`; the keys inside `metadata` are the page's own metadata and\nstay `camelCase`.\n\n| Field | Description |\n|-------|-------------|\n| `schema_version` | Response envelope version (currently `1`) |\n| `formats.raw_html` | Page content in the requested format (`raw_html` 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 — used for bandwidth billing |\n| `status_code` | HTTP status code of the origin page |\n| `retrieved_at` | ISO-8601 UTC timestamp of the fetch |\n| `cache` | `\"hit\"` or `\"miss\"` |\n| `cache_age_s` | Age of the cached entry in seconds — present only on a hit |\n| `billing` | What the request cost: `raw_bytes`, the `factors` applied, the resulting `multiplier`, and `billed_bytes` |\n| `metadata.title` | Page `<title>` element |\n\nThe `X-Scrape-*` response headers describe how each request was handled (cache status, timing,\nand the final URL) — useful for debugging.\n\n## Async scrapes\n\nFor long-running pages, pass `\"async\": true` to get a `202 Accepted` response with a scrape\n`id` prefixed `sc_`. Poll the result with `GET /v1/scrape/{id}`.\n\n```bash\n# Start async scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"async\": true}'\n\n# Poll for result\ncurl https://api.bytekit.com/v1/scrape/sc_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Webhook event header\n\nEvery outbound webhook POST includes an `X-ByteKit-Event` header with the event type:\n\n| Event type | Trigger |\n|---|---|\n| `bulk.completed` | A bulk job finishes (all items processed) |\n| `scrape.completed` | An async scrape succeeds |\n| `scrape.failed` | An async scrape fails terminally |\n| `monitor.change_detected` | A monitor fires and detects a change (screenshot or content) |\n| `monitor.captured` | A monitor fires with no change detected (notify_on: every) |\n| `sitemap.completed` | A sitemap job finishes |\n| `sitemap.failed` | A sitemap job fails terminally |\n\nUse this header to dispatch events without inspecting the body shape:\n\n```python\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route(\"/webhooks/bytekit\", methods=[\"POST\"])\ndef handle():\n event = request.headers.get(\"X-ByteKit-Event\")\n if event == \"bulk.completed\":\n handle_bulk(request.json)\n elif event == \"scrape.completed\":\n handle_scrape(request.json)\n return \"\", 200\n```\n\n`X-ByteKit-Event` is a reserved header — you cannot supply it via `webhook_headers` in\nmonitor or bulk configuration. Attempts to do so will be rejected with a `422` at request\ntime.\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model and concurrency slots\n- [Errors](https://bytekit.com/docs/guides/errors) — how to interpret and retry error responses\n- [API Reference: Scrape](https://bytekit.com/docs/api/scrape/createscrape) — full request/response schema"
366
+ },
367
+ "guides/webhooks": {
368
+ "title": "Webhooks",
369
+ "section": "Guides",
370
+ "body": "# Webhooks\n\nVerify ByteKit webhook deliveries — signature and timestamp headers, the HMAC-SHA256 scheme, and Node and Python verification code.\n\nByteKit delivers webhooks for monitors, async scrapes, bulk jobs, and sitemap jobs. Anyone who\nlearns your webhook URL can POST to it, so every delivery is signed with a secret only you and\nByteKit hold. Verify that signature before you trust a payload.\n\n## Delivery headers\n\n| Header | Always present | Description |\n|--------|----------------|-------------|\n| `X-Webhook-Timestamp` | Yes | Unix timestamp in **seconds** at the moment the delivery attempt was signed |\n| `X-Webhook-Signature` | Only when the webhook has a secret | `sha256=` followed by the lowercase hex HMAC-SHA256 digest |\n| `X-ByteKit-Event` | Yes | Event type — see [Webhook event header](https://bytekit.com/docs/guides/scraping#webhook-event-header) |\n\nAll three are reserved: they cannot be overridden through a `webhook_headers` map.\n\n## The signing scheme\n\nThe signed string is the timestamp, a literal `.`, and the **raw** request body:\n\n```\nsignature = \"sha256=\" + hex(HMAC_SHA256(secret, timestamp + \".\" + raw_body))\n```\n\nThree details decide whether your verification works:\n\n- **`timestamp` is the `X-Webhook-Timestamp` header value verbatim**, as the decimal string it\n arrives as — not a re-formatted or re-parsed date.\n- **`raw_body` is the exact bytes of the request body**, captured before any JSON parsing.\n Re-serializing the parsed object changes key order and whitespace, and the digest with it.\n- **`secret` is the webhook secret** — the value you passed as `webhook_secret`, or the one\n returned once in the `webhook_secret` field of a monitor create response (64 lowercase hex\n characters). It is never returned again, so store it when you create the webhook.\n\nCompare the result against `X-Webhook-Signature` with a constant-time comparison\n(`crypto.timingSafeEqual`, `hmac.compare_digest`), never with `==`.\n\n## Replay window\n\nEach delivery attempt is signed at the moment it is sent, so a retry carries a **fresh**\ntimestamp rather than replaying the original one. A tight tolerance therefore does not break\nretries.\n\nReject a delivery whose `X-Webhook-Timestamp` is further from your own clock than a tolerance\nyou choose — five minutes is a reasonable default. Without that check, a signature captured off\nthe wire stays valid forever. ByteKit does not enforce the window for you, and it does not\nde-duplicate: a delivery your endpoint accepted but answered slowly can arrive again, so make\nyour handler idempotent.\n\nYour endpoint must answer `2xx` within 10 seconds. Failed deliveries are retried with\nexponential backoff.\n\n## Verify a delivery\n\n### Node.js\n\n```js title=\"verify-webhook.js\"\nconst crypto = require('node:crypto');\n\n// `rawBody` must be the request body as received (string or Buffer), NOT a\n// re-serialized JSON object. In Express, use express.raw({ type: 'application/json' }).\nfunction verifyWebhook(rawBody, headers, secret, toleranceSeconds = 300) {\n const timestamp = headers['x-webhook-timestamp'];\n const signature = headers['x-webhook-signature'];\n\n // No signature header means the webhook has no secret: the delivery is\n // unauthenticated. Treat it as unverified.\n if (!timestamp || !signature) return false;\n\n const age = Math.abs(Math.floor(Date.now() / 1000) - Number(timestamp));\n if (!Number.isFinite(age) || age > toleranceSeconds) return false;\n\n const expected =\n 'sha256=' +\n crypto.createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex');\n\n const a = Buffer.from(expected);\n const b = Buffer.from(signature);\n return a.length === b.length && crypto.timingSafeEqual(a, b);\n}\n```\n\nNode lowercases incoming header names, so `headers['x-webhook-signature']` is the right lookup\non a raw `http` or Express request.\n\n### Python\n\n```python title=\"verify_webhook.py\"\nimport hashlib\nimport hmac\nimport time\n\n\n# `raw_body` must be the request body as received (bytes), NOT a re-serialized\n# JSON object. In Flask, use `request.get_data()`.\ndef verify_webhook(raw_body, headers, secret, tolerance_seconds=300):\n timestamp = headers.get(\"X-Webhook-Timestamp\")\n signature = headers.get(\"X-Webhook-Signature\")\n\n # No signature header means the webhook has no secret: the delivery is\n # unauthenticated. Treat it as unverified.\n if not timestamp or not signature:\n return False\n\n try:\n age = abs(int(time.time()) - int(timestamp))\n except (TypeError, ValueError):\n return False\n if age > tolerance_seconds:\n return False\n\n signed = timestamp.encode() + b\".\" + raw_body\n expected = \"sha256=\" + hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()\n return hmac.compare_digest(expected, signature)\n```\n\nFlask, Django, and FastAPI all expose request headers through a case-insensitive mapping, so the\ncapitalized lookups above match however the header arrives on the wire.\n\n## Unsigned deliveries\n\n`X-Webhook-Signature` is set only when the webhook has a secret. A small number of monitors\ncreated before secrets became mandatory still have none, and their deliveries go out **unsigned**\n— `X-Webhook-Timestamp` is present, `X-Webhook-Signature` is absent.\n\nAn unsigned delivery cannot be authenticated. Both snippets above return `false` for it, which is\nthe safe reading: treat it as unverified rather than as trusted. If you own such a monitor,\nrecreate it so it gets a secret.\n\n## Next steps\n\n- [Monitors](https://bytekit.com/docs/guides/monitors) — webhook payload shapes per monitor type\n- [Scraping](https://bytekit.com/docs/guides/scraping) — the `X-ByteKit-Event` header and its event types\n- [API Reference: Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — where `webhook_secret` is set"
356
371
  },
357
372
  "introduction": {
358
373
  "title": "Introduction",
359
374
  "section": "General",
360
375
  "body": "# Introduction\n\nA REST API for screenshots, scraping, and page-change monitoring — one key, one base URL, every output.\n\n## What ByteKit is\n\nByteKit is a REST API for capturing what a webpage looks like and what it says —\nscreenshots, raw HTML or clean markdown, and page-change monitoring.\nOne API key, one base URL, every output you'd otherwise stitch together from a headless-browser\nfarm and a scraping proxy.\n\n## What you can do with it\n\n- **Scrape** — Fetch a URL as raw HTML, clean markdown, or structured content.\n- **Screenshot** — Capture full-page or viewport PNG/JPEG.\n- **Monitor** — Watch a URL on a schedule and webhook you when the rendered output changes.\n- **Bulk** — Fan out thousands of URLs in parallel and receive a webhook as each finishes.\n- **Sitemap** — Discover URLs from a domain's sitemap or by light crawling.\n\nScrape calls accept an `\"async\": true` body field, in which case the API returns `202` with a `sc_…`\nID that you poll or receive via webhook. Screenshots are synchronous by default (the call holds up to\n28s and returns `200`); pass the `?async=true` query parameter to get back `202` with an `ss_…` ID\nimmediately.\n\n## Authentication and accounts\n\nEvery request carries a Bearer API key, prefixed `sk_live_`. Manage keys from the dashboard —\nup to 50 active keys per account, with per-key billing attribution so you can split usage\ncleanly across services.\n\nFull details in the [Authentication guide](https://bytekit.com/docs/guides/authentication).\n\n## Where to go next\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — first call in under five minutes, no SDK required.\n- [Client Libraries](https://bytekit.com/docs/libraries/typescript) — official TypeScript and Python SDKs.\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, async polling.\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, response headers.\n- [Monitors](https://bytekit.com/docs/guides/monitors) — schedule-based change detection with webhooks.\n- [API Reference](https://bytekit.com/docs/api) — every endpoint, request, and response."
361
376
  },
377
+ "libraries": {
378
+ "title": "Client Libraries",
379
+ "section": "Libraries",
380
+ "body": "# Client Libraries\n\nThe official TypeScript and Python clients, and how to call ByteKit from Go.\n\nByteKit ships official SDKs for TypeScript and Python. Both are thin wrappers over the same\nREST endpoints, so nothing they do is out of reach from a language without an SDK — the Go page\nshows the plain standard-library equivalent. These pages cover installing and configuring each\nclient; the per-method reference is in the [SDK Reference](https://bytekit.com/docs/sdk).\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — Type-safe ByteKit client for Node.js and modern JavaScript runtimes.\n- [Python SDK](https://bytekit.com/docs/libraries/python) — Official Python client for ByteKit, with sync and async support.\n- [Go](https://bytekit.com/docs/libraries/go) — Call the ByteKit REST API from Go with the standard library."
381
+ },
362
382
  "libraries/go": {
363
383
  "title": "Go",
364
384
  "section": "Libraries",
@@ -382,7 +402,12 @@
382
402
  "quickstart": {
383
403
  "title": "Quickstart",
384
404
  "section": "General",
385
- "body": "# Quickstart\n\nMake your first ByteKit API call in under 5 minutes — no SDK required.\n\nNothing to install. You only need `curl` and an API key.\n\n## Get an API key\n\nSign up at [app.bytekit.com](https://app.bytekit.com) and create an API key from the\ndashboard. Keys are prefixed `sk_live_`.\n\nSee [Authentication](https://bytekit.com/docs/guides/authentication) for details on key formats and management.\n\n## Make your first scrape\n\nSet your API key and run this — no file to save, no `chmod`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer $BYTEKIT_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\":\"https://example.com\"}'\n```\n\nWant a full-featured script with error handling and `jq` formatting? Use this instead:\n\n<!-- example omitted: curl/scrape.sh (source unavailable) -->\n\nA successful response looks like this:\n\n```json\n{\n \"status\": \"success\",\n \"id\": \"sc_...\",\n \"url\": \"https://example.com\",\n \"finalUrl\": \"https://example.com/\",\n \"contentType\": \"text/html; charset=UTF-8\",\n \"contentLength\": 1256,\n \"statusCode\": 200,\n \"retrievedAt\": \"2025-01-15T12:00:00Z\",\n \"formats\": {\n \"markdown\": \"# Example Domain\\n\\nThis domain is for use in illustrative examples...\"\n },\n \"metadata\": {\n \"title\": \"Example Domain\"\n }\n}\n```\n\n`contentLength` is the compressed wire size in bytes (used for bandwidth billing). The `id`\nfield uses the `sc_` prefix — you can poll `GET /v1/scrape/{id}` if the scrape was queued\nasynchronously.\n\n## Prefer an SDK?\n\nSkip the raw HTTP and use an official client:\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — `npm install @hunt-labs/bytekit-sdk`\n- [Python SDK](https://bytekit.com/docs/libraries/python) — `pip install bytekit-sdk`\n\n## Next steps\n\n- [Authentication](https://bytekit.com/docs/guides/authentication) — key formats, Bearer header, self-serve key management\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, latency, and async polling\n- [Errors](https://bytekit.com/docs/guides/errors) — error shape, common codes, retry guidance\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, rate limit headers\n- [Monitors](https://bytekit.com/docs/guides/monitors) — page-change detection (screenshot or scrape) with webhook notifications\n- [API Reference](https://bytekit.com/docs/api) — full endpoint documentation"
405
+ "body": "# Quickstart\n\nMake your first ByteKit API call in under 5 minutes — no SDK required.\n\nNothing to install. You only need `curl` and an API key.\n\n## Get an API key\n\nSign up at [app.bytekit.com](https://app.bytekit.com) and create an API key from the\ndashboard. Keys are prefixed `sk_live_`.\n\nSee [Authentication](https://bytekit.com/docs/guides/authentication) for details on key formats and management.\n\n## Make your first scrape\n\nSet your API key and run this — no file to save, no `chmod`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer $BYTEKIT_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\":\"https://example.com\"}'\n```\n\nWant a full-featured script with error handling and `jq` formatting? Use this instead:\n\n<!-- example omitted: curl/scrape.sh (source unavailable) -->\n\nA successful response looks like this — every envelope field is `snake_case`:\n\n```json\n{\n \"schema_version\": 1,\n \"status\": \"success\",\n \"id\": \"sc_84c14b1058184045b97ae360ad74888b\",\n \"url\": \"https://example.com\",\n \"final_url\": \"https://example.com\",\n \"content_type\": \"text/html\",\n \"content_length\": 318,\n \"status_code\": 200,\n \"retrieved_at\": \"2026-08-27T12:16:01.872Z\",\n \"formats\": {\n \"raw_html\": \"<!doctype html><html lang=\\\"en\\\"><head><title>Example Domain</title>…</html>\\n\"\n },\n \"metadata\": {\n \"title\": \"Example Domain\",\n \"description\": null,\n \"language\": \"en\",\n \"canonicalUrl\": null,\n \"ogTitle\": null,\n \"ogDescription\": null,\n \"ogImage\": null,\n \"ogUrl\": null,\n \"ogSiteName\": null,\n \"robots\": null,\n \"byline\": null,\n \"publishedAt\": null\n },\n \"cache\": \"miss\",\n \"billing\": {\n \"raw_bytes\": 318,\n \"factors\": [{ \"name\": \"endpoint\", \"value\": 1, \"reason\": \"scrape\" }],\n \"multiplier\": 1,\n \"billed_bytes\": 318\n }\n}\n```\n\n`content_length` is the compressed wire size in bytes (used for bandwidth billing), and\n`billing` breaks down what the request actually cost. `cache` is `\"miss\"` or `\"hit\"`, and a\nhit adds a `cache_age_s` field. The `id` field uses the `sc_` prefix — you can poll\n`GET /v1/scrape/{id}` if the scrape was queued asynchronously.\n\nThe keys inside `metadata` stay `camelCase` (`canonicalUrl`, `ogTitle`, …): they are the\npage's own metadata, not envelope fields.\n\n## Ask for markdown\n\nThe default format is `raw_html` — that is why the response above carries no\n`formats.markdown`. Request markdown explicitly:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer $BYTEKIT_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\":\"https://example.com\",\"formats\":[\"markdown\"]}'\n```\n\nThe response's `formats` object is keyed by what you asked for:\n\n```json\n{\n \"schema_version\": 1,\n \"status\": \"success\",\n \"id\": \"sc_f659fa67dfb244159767132c2aa50917\",\n \"url\": \"https://example.com\",\n \"final_url\": \"https://example.com\",\n \"content_type\": \"text/html\",\n \"content_length\": 318,\n \"status_code\": 200,\n \"retrieved_at\": \"2026-08-27T12:16:11.337Z\",\n \"formats\": {\n \"markdown\": \"---\\ntitle: \\\"Example Domain\\\"\\nurl: \\\"https://example.com\\\"\\ncaptured_at: \\\"2026-08-27T12:16:11.416Z\\\"\\n---\\nThis domain is for use in documentation examples without needing permission. Avoid use in operations.\\n\\n[Learn more](https://iana.org/domains/example)\"\n },\n \"metadata\": {\n \"title\": \"Example Domain\",\n \"description\": null,\n \"language\": \"en\",\n \"canonicalUrl\": null,\n \"ogTitle\": null,\n \"ogDescription\": null,\n \"ogImage\": null,\n \"ogUrl\": null,\n \"ogSiteName\": null,\n \"robots\": null,\n \"byline\": null,\n \"publishedAt\": null\n },\n \"cache\": \"hit\",\n \"cache_age_s\": 8,\n \"billing\": {\n \"raw_bytes\": 318,\n \"factors\": [\n { \"name\": \"endpoint\", \"value\": 1.5, \"reason\": \"scrape_md\" },\n { \"name\": \"cache_hit\", \"value\": 0.5, \"reason\": \"hit, age 8s\" }\n ],\n \"multiplier\": 0.75,\n \"billed_bytes\": 239\n }\n}\n```\n\nSee [Scraping](https://bytekit.com/docs/guides/scraping) for the other formats (`html`, `links`, `images`).\n\n## Prefer an SDK?\n\nSkip the raw HTTP and use an official client:\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — `npm install @hunt-labs/bytekit-sdk`\n- [Python SDK](https://bytekit.com/docs/libraries/python) — `pip install bytekit-sdk`\n\n## Next steps\n\n- [Authentication](https://bytekit.com/docs/guides/authentication) — key formats, Bearer header, self-serve key management\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, latency, and async polling\n- [Errors](https://bytekit.com/docs/guides/errors) — error shape, common codes, retry guidance\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, rate limit headers\n- [Monitors](https://bytekit.com/docs/guides/monitors) — page-change detection (screenshot or scrape) with webhook notifications\n- [API Reference](https://bytekit.com/docs/api) — full endpoint documentation"
406
+ },
407
+ "sdk": {
408
+ "title": "SDK Reference",
409
+ "section": "SDK Reference",
410
+ "body": "# SDK Reference\n\nPer-resource reference for the ByteKit TypeScript and Python SDKs.\n\nPer-resource reference for the two official ByteKit SDKs — client options, methods, and\nparameters, generated from the SDK sources so they track the shipped clients. For installation\nand a first call, start with the [Client Libraries](https://bytekit.com/docs/libraries) overview.\n\nEach SDK documents the same resources; the links below open at the client page, and the sidebar\nlists every resource in that SDK.\n\n- [TypeScript SDK](https://bytekit.com/docs/sdk/typescript/client) — Instantiate and configure the ByteKit TypeScript client.\n- [Python SDK](https://bytekit.com/docs/sdk/python/client) — HTTP client classes for the ByteKit Python SDK."
386
411
  },
387
412
  "sdk/python/account": {
388
413
  "title": "Account",
@@ -392,7 +417,7 @@
392
417
  "sdk/python/bulk": {
393
418
  "title": "Bulk",
394
419
  "section": "SDK Reference",
395
- "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.\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\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateBulkResponse202, Error]]\n```\n\n## Delete Bulk\n\nCancel a bulk job\n\nCancels an in-flight bulk job: drains its still-queued (pending) child jobs and refunds the quota\nheld for exactly those drained children. Children already completed, failed, or in progress are\nuntouched and keep their charge. Idempotent — cancelling an already-terminal job (completed, failed,\nor cancelled) is a no-op that returns 200 with the job's real, unchanged status and refunds nothing.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[DeleteBulkResponse200, Error]]\nsync(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[DeleteBulkResponse200, Error]]\nawait asyncio(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\n```\n\n## Get Bulk\n\nGet bulk job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200]]\nsync(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200]]\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.** `image_url` (`type: screenshot`) and both\n`content_url` and `markdown_url` (`type: scrape`) are **pre-signed** URLs,\nminted fresh on every read of this endpoint and valid for **600 seconds\n(10 minutes)** —\nthe same signing lifetime as `content_url` on `GET /v1/fetch/bulk/\\{id\\}`.\nThe underlying objects are private, so an unsigned URL returns `401`:\ndownload inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, carry `null` or the unsigned stored URL instead.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[ListBulkScreenshotsResponse200]\nsync(id=id, client=client) -> Optional[ListBulkScreenshotsResponse200]\nawait asyncio_detailed(id=id, client=client) -> Response[ListBulkScreenshotsResponse200]\nawait asyncio(id=id, client=client) -> Optional[ListBulkScreenshotsResponse200]\n```"
420
+ "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.\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\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateBulkResponse202, Error]]\n```\n\n## Delete Bulk\n\nCancel a bulk job\n\nCancels an in-flight bulk job: drains its still-queued (pending) child jobs and refunds the quota\nheld for exactly those drained children. Children already completed, failed, or in progress are\nuntouched and keep their charge. Idempotent — cancelling an already-terminal job (completed, failed,\nor cancelled) is a no-op that returns 200 with the job's real, unchanged status and refunds nothing.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[DeleteBulkResponse200, Error]]\nsync(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[DeleteBulkResponse200, Error]]\nawait asyncio(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\n```\n\n## Get Bulk\n\nGet bulk job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200, GetBulkResponse202]]\nsync(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200, GetBulkResponse202]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200, GetBulkResponse202]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200, GetBulkResponse202]]\n```\n\n## List Bulk Screenshots\n\nList bulk job items\n\nReturns the bulk job's items, discriminated by `type`.\n\n**Downloading item artifacts.** `image_url` (`type: screenshot`) and both\n`content_url` and `markdown_url` (`type: scrape`) are **pre-signed** URLs,\nminted fresh on every read of this endpoint and valid for **600 seconds\n(10 minutes)** —\nthe same signing lifetime as `content_url` on `GET /v1/fetch/bulk/\\{id\\}`.\nThe underlying objects are private, so an unsigned URL returns `401`:\ndownload inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, carry `null` or the unsigned stored URL instead.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[ListBulkScreenshotsResponse200]\nsync(id=id, client=client) -> Optional[ListBulkScreenshotsResponse200]\nawait asyncio_detailed(id=id, client=client) -> Response[ListBulkScreenshotsResponse200]\nawait asyncio(id=id, client=client) -> Optional[ListBulkScreenshotsResponse200]\n```"
396
421
  },
397
422
  "sdk/python/client": {
398
423
  "title": "Client",
@@ -402,12 +427,12 @@
402
427
  "sdk/python/fetch": {
403
428
  "title": "Fetch",
404
429
  "section": "SDK Reference",
405
- "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. The response body IS the content; metadata is returned in X-Fetch-* headers.\nOmit `format` for raw passthrough. Use `format=markdown` or `format=html` for conversion.\n\n**Parameters**\n\n- `url_query (str)`\n- `format_ (Union[Unset, GetFetchFormat])`\n- `country (Union[Unset, str])`\n- `timeout_ms (Union[Unset, int])`\n- `cache_ttl (Union[GetFetchCacheTtlType1, Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, url_query=url_query, format_=format_, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl) -> Response[Union[Error, str]]\nsync(client=client, url_query=url_query, format_=format_, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl) -> Optional[Union[Error, str]]\nawait asyncio_detailed(client=client, url_query=url_query, format_=format_, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl) -> Response[Union[Error, str]]\nawait asyncio(client=client, url_query=url_query, format_=format_, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl) -> Optional[Union[Error, str]]\n```\n\n## Post Fetch\n\nFetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (FetchRequest)`\n\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```"
430
+ "body": "# Fetch\n\nFunctions for interacting with the `fetch` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Fetch\n\nFetch a URL (GET)\n\nDirect HTTP fetch. Successful responses return the upstream response bytes verbatim;\nmetadata is returned in X-Fetch-* headers. Non-2xx upstream responses use the\n`upstream_error` JSON envelope with the upstream HTTP status.\n\n**Parameters**\n\n- `url_query (str)`\n- `country (Union[Unset, str])`\n- `timeout_ms (Union[Unset, int])`\n- `cache_ttl (Union[GetFetchCacheTtlType1, Unset, str])`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl) -> Response[Union[Error, str]]\nsync(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl) -> Optional[Union[Error, str]]\nawait asyncio_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl) -> Response[Union[Error, str]]\nawait asyncio(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl) -> Optional[Union[Error, str]]\n```\n\n## Post Fetch\n\nFetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (FetchRequest)`\n\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```"
406
431
  },
407
432
  "sdk/python/fetch-bulk": {
408
433
  "title": "Fetch Bulk",
409
434
  "section": "SDK Reference",
410
- "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 (cookies, wait_for_selector, etc.).\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\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, Error]]\n```\n\n## Get Fetch Bulk\n\nGet fetch bulk job status\n\nReturns the job envelope plus its per-URL items.\n\n**Downloading item content.** Each completed item's `content_url` is a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **600 seconds (10 minutes)** — the same signing lifetime as the\n`image_url` returned by `GET /v1/bulk/\\{id\\}/screenshots`. The underlying\nobjects are private, so an unsigned URL returns `401`: download the\ncontent inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, carry `null` or the unsigned stored URL instead.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, GetFetchBulkResponse200]]\nsync(id=id, client=client) -> Optional[Union[Error, GetFetchBulkResponse200]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetFetchBulkResponse200]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetFetchBulkResponse200]]\n```"
435
+ "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.).\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\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, Error]]\n```\n\n## Get Fetch Bulk\n\nGet fetch bulk job status\n\nReturns the job envelope plus its per-URL items.\n\n**Downloading item content.** Each completed item's `content_url` is a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **600 seconds (10 minutes)** — the same signing lifetime as the\n`image_url` returned by `GET /v1/bulk/\\{id\\}/screenshots`. The underlying\nobjects are private, so an unsigned URL returns `401`: download the\ncontent inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, carry `null` or the unsigned stored URL instead.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\nsync(id=id, client=client) -> Optional[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetFetchBulkResponse200, GetFetchBulkResponse202]]\n```"
411
436
  },
412
437
  "sdk/python/monitors": {
413
438
  "title": "Monitors",
@@ -422,7 +447,7 @@
422
447
  "sdk/python/scrape-bulk": {
423
448
  "title": "Scrape Bulk",
424
449
  "section": "SDK Reference",
425
- "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.\nWebhook deliveries include `X-ByteKit-Event: scrape.completed` or\n`X-ByteKit-Event: scrape.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\n**Parameters**\n\n- `body (CreateScrapeBulkBody)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateScrapeBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateScrapeBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateScrapeBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateScrapeBulkResponse202, Error]]\n```\n\n## Get Scrape Bulk\n\nGet scrape bulk job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, GetScrapeBulkResponse200]]\nsync(id=id, client=client) -> Optional[Union[Error, GetScrapeBulkResponse200]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetScrapeBulkResponse200]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetScrapeBulkResponse200]]\n```"
450
+ "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.\nWebhook deliveries include `X-ByteKit-Event: scrape.completed` or\n`X-ByteKit-Event: scrape.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\n**Parameters**\n\n- `body (CreateScrapeBulkBody)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateScrapeBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateScrapeBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateScrapeBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateScrapeBulkResponse202, Error]]\n```\n\n## Get Scrape Bulk\n\nGet scrape bulk job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\nsync(id=id, client=client) -> Optional[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetScrapeBulkResponse200, GetScrapeBulkResponse202]]\n```"
426
451
  },
427
452
  "sdk/python/screenshots": {
428
453
  "title": "Screenshots",
@@ -462,12 +487,12 @@
462
487
  "sdk/typescript/client": {
463
488
  "title": "Client",
464
489
  "section": "SDK Reference",
465
- "body": "# Client\n\nThe ByteKit TypeScript SDK is a thin, type-safe wrapper over the REST API. Create a\n client with your API key, then call resource methods.\n\n```ts\nimport { ByteKit } from '@hunt-labs/bytekit-sdk';\n\nconst client = new ByteKit({\n apiKey: process.env.BYTEKIT_API_KEY!, // your sk_live_… key\n});\n```\n\n## Options (`ByteKitOptions`)\n\n- `apiKey` (required) — `string`\n- `baseUrl` — `string` Defaults to `https://api.bytekit.com`.\n- `timeoutMs` — `number` — Default CLIENT-SIDE request timeout in ms — the abort budget for the whole HTTP\nround-trip made by this SDK, covering time-to-headers **and** the response body\nread (so a large legitimate body counts against it too). `0` disables the SDK-side\ntimeout. Default 120000.\n\nNOT the same thing as `ScrapeOpts.timeout_ms`, which is the SERVER-side budget the\ngateway applies to the scrape itself. Override per call with\n`RequestOptions.requestTimeoutMs`.\n\n## Resources\n\nThe client exposes one property per resource:\n\n- [`client.scrape`](https://bytekit.com/docs/sdk/typescript/scrape) — Fetch a URL as raw HTML, clean markdown, or structured content.\n- [`client.screenshots`](https://bytekit.com/docs/sdk/typescript/screenshots) — Capture full-page or viewport screenshots.\n- [`client.bulk`](https://bytekit.com/docs/sdk/typescript/bulk) — Fan out many URLs in parallel with per-item webhooks.\n- [`client.fetch`](https://bytekit.com/docs/sdk/typescript/fetch) — Low-latency raw HTTP fetch with optional conversion.\n- [`client.monitors`](https://bytekit.com/docs/sdk/typescript/monitors) — Watch a URL on a schedule and webhook on change.\n- [`client.sitemap`](https://bytekit.com/docs/sdk/typescript/sitemap) — Discover URLs from a domain's sitemap or by crawling.\n- [`client.search`](https://bytekit.com/docs/sdk/typescript/search) — Run a web search and return ranked organic results.\n- [`client.account`](https://bytekit.com/docs/sdk/typescript/account) — Account info and API key management.\n- [`client.usage`](https://bytekit.com/docs/sdk/typescript/usage) — Billing-period and daily usage breakdowns.\n- [`client.webhooks`](https://bytekit.com/docs/sdk/typescript/webhooks) — List and retry webhook deliveries.\n\n## Errors\n\nAny non-2xx response throws a `ByteKitError` carrying the HTTP `status` and the API `code`.\n\n```ts\nimport { ByteKit, ByteKitError } from '@hunt-labs/bytekit-sdk';\n\ntry {\n await client.scrape.create({ url: 'https://example.com' });\n} catch (err) {\n if (err instanceof ByteKitError) {\n console.error(`${err.status} ${err.code}: ${err.message}`);\n }\n}\n```"
490
+ "body": "# Client\n\nThe ByteKit TypeScript SDK is a thin, type-safe wrapper over the REST API. Create a\n client with your API key, then call resource methods.\n\n```ts\nimport { ByteKit } from '@hunt-labs/bytekit-sdk';\n\nconst client = new ByteKit({\n apiKey: process.env.BYTEKIT_API_KEY!, // your sk_live_… key\n});\n```\n\n## Options (`ByteKitOptions`)\n\n- `apiKey` (required) — `string`\n- `baseUrl` — `string` Defaults to `https://api.bytekit.com`.\n- `timeoutMs` — `number` — Default CLIENT-SIDE request timeout in ms — the abort budget for the whole HTTP\nround-trip made by this SDK, covering time-to-headers **and** the response body\nread (so a large legitimate body counts against it too). `0` disables the SDK-side\ntimeout. Default 120000.\n\nNOT the same thing as `ScrapeOpts.timeout_ms`, which is the SERVER-side budget the\ngateway applies to the scrape itself. Override per call with\n`RequestOptions.requestTimeoutMs`.\n\n## Resources\n\nThe client exposes one property per resource:\n\n- [`client.scrape`](https://bytekit.com/docs/sdk/typescript/scrape) — Fetch a URL as raw HTML, clean markdown, or structured content.\n- [`client.screenshots`](https://bytekit.com/docs/sdk/typescript/screenshots) — Capture full-page or viewport screenshots.\n- [`client.bulk`](https://bytekit.com/docs/sdk/typescript/bulk) — Fan out many URLs in parallel with per-item webhooks.\n- [`client.fetch`](https://bytekit.com/docs/sdk/typescript/fetch) — Low-latency raw HTTP fetch with byte-for-byte upstream responses.\n- [`client.monitors`](https://bytekit.com/docs/sdk/typescript/monitors) — Watch a URL on a schedule and webhook on change.\n- [`client.sitemap`](https://bytekit.com/docs/sdk/typescript/sitemap) — Discover URLs from a domain's sitemap or by crawling.\n- [`client.search`](https://bytekit.com/docs/sdk/typescript/search) — Run a web search and return ranked organic results.\n- [`client.account`](https://bytekit.com/docs/sdk/typescript/account) — Account info and API key management.\n- [`client.usage`](https://bytekit.com/docs/sdk/typescript/usage) — Billing-period and daily usage breakdowns.\n- [`client.webhooks`](https://bytekit.com/docs/sdk/typescript/webhooks) — List and retry webhook deliveries.\n\n## Errors\n\nAny non-2xx response throws a `ByteKitError` carrying the HTTP `status` and the API `code`.\n\n```ts\nimport { ByteKit, ByteKitError } from '@hunt-labs/bytekit-sdk';\n\ntry {\n await client.scrape.create({ url: 'https://example.com' });\n} catch (err) {\n if (err instanceof ByteKitError) {\n console.error(`${err.status} ${err.code}: ${err.message}`);\n }\n}\n```"
466
491
  },
467
492
  "sdk/typescript/fetch": {
468
493
  "title": "Fetch",
469
494
  "section": "SDK Reference",
470
- "body": "# Fetch\n\nLow-latency raw HTTP fetch with optional conversion. Accessed via `client.fetch`.\n\n## create\n\n```ts\nclient.fetch.create(opts: FetchOpts, requestOptions?: RequestOptions): Promise<FetchResult>\n```\n\nPOST /v1/fetch — fetch URL content via POST body.\n\nResolves a `FetchResult` — the raw content body plus `X-Fetch-*` metadata.\nThe body is returned verbatim — a JSON-serving upstream comes back as the\nraw JSON string, not a parsed object.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`. It matters most here: the gateway's own ceiling for a\nfetch is 60 s, so without a per-call budget a slow upstream holds the caller for\nthe constructor default (2 minutes) rather than a duration the caller chose.\n\n## get\n\n```ts\nclient.fetch.get(opts: FetchGetOpts, requestOptions?: RequestOptions): Promise<FetchResult>\n```\n\nGET /v1/fetch — fetch URL content via query params.\n\nResolves a `FetchResult` — the raw content body plus `X-Fetch-*` metadata.\n\nAccepts only the five params the spec declares for this endpoint. `custom`\n(#2481) and the `markdown_*` / `with_*` tuning fields (#2539) are POST-body\noptions with no GET query param — they were silently dropped by this builder,\nso they are now compile errors instead. Use `create()` (POST) for those.\n\nThe query string is built by iterating `FETCH_GET_QUERY_KEYS`, the same list\n`FetchGetOpts` is derived from, so every accepted option is necessarily\nserialized.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`. As on `create`, the gateway's own ceiling for a fetch is\n60 s, so a per-call budget is what keeps a slow upstream from holding the caller\nfor the constructor default.\n\n## Options (`FetchOpts`)\n\n- `url` (required) — `string`\n- `format` — `'markdown' | 'html'` — Output format. `'markdown'` runs the HTML→markdown pipeline; `'html'` returns raw HTML. Narrowed to the spec union — off-spec values (e.g. `'pdf'`) are rejected at compile time.\n- `country` — `string`\n- `timeout_ms` — `number`\n- `markdown_mode` — `'article' | 'raw' | 'llm'` — Markdown processing mode. Only used when `format=markdown`. article/raw/llm.\n- `markdown_query` — `string` — BM25 query string for relevance-ranked filtering. Only used when `format=markdown`.\n- `markdown_links` — `'inline' | 'references' | 'none' | 'text'` — Link rendering style. Only used when `format=markdown`.\n- `markdown_images` — `'inline' | 'references' | 'none' | 'text'` — Image retention mode. Only used when `format=markdown`.\n- `with_links_summary` — `boolean` — Append a `Links:` footer to the markdown output. Only used when `format=markdown`.\n- `with_images_summary` — `boolean` — Append an `Images:` footer to the markdown output. Only used when `format=markdown`.\n- `markdown_compact` — `boolean` — Compact whitespace output. Only used when `format=markdown`.\n- `markdown_filter_images` — `boolean` — Filter low-signal images. Only used when `format=markdown`.\n- `markdown_include_media` — `boolean` — When true, `formats.links`/`formats.images` return rich objects and a top-level `tables` array is included. Only used when `format=markdown`.\n- `markdown_include_warnings` — `boolean` — When true, enables markdown-pipeline and tag-filter warnings for affected html/markdown requests.\n- `markdown_include_stats` — `boolean` — When true, includes a top-level `stats` object (chars, tokens, blocks). Only used when `format=markdown`.\n- `cache_ttl` — `string | 0` — How long a freshly fetched URL may be served from cache. Matches the\nOpenAPI `FetchRequest.cache_ttl` schema: a duration string (`\"48h\"`,\n`\"2d\"`, up to `168h` / `7d`) or the integer `0` to disable caching.\nDefaults to `\"48h\"` server-side when omitted.\n- `custom` — `Record<string, unknown>` — User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom`\nresponse header so callers can correlate the response to caller-side\nstate. Capped at 4096 UTF-8 bytes after JSON serialization. Does NOT\naffect cache-key inputs."
495
+ "body": "# Fetch\n\nLow-latency raw HTTP fetch with byte-for-byte upstream responses. Accessed via `client.fetch`.\n\n## create\n\n```ts\nclient.fetch.create(opts: FetchOpts, requestOptions?: RequestOptions): Promise<FetchResult>\n```\n\nPOST /v1/fetch — fetch URL content via POST body.\n\nResolves a `FetchResult` — the raw content body plus `X-Fetch-*` metadata.\nThe body is returned verbatim — a JSON-serving upstream comes back as the\nraw JSON string, not a parsed object.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`. It matters most here: the gateway's own ceiling for a\nfetch is 60 s, so without a per-call budget a slow upstream holds the caller for\nthe constructor default (2 minutes) rather than a duration the caller chose.\n\n## get\n\n```ts\nclient.fetch.get(opts: FetchGetOpts, requestOptions?: RequestOptions): Promise<FetchResult>\n```\n\nGET /v1/fetch — fetch URL content via query params.\n\nResolves a `FetchResult` — the raw content body plus `X-Fetch-*` metadata.\n\nAccepts only the four params the spec declares for this endpoint. `custom`\nis a POST-body option with no GET query param; use `create()` for custom metadata.\n\nThe query string is built by iterating `FETCH_GET_QUERY_KEYS`, the same list\n`FetchGetOpts` is derived from, so every accepted option is necessarily\nserialized.\n\n`requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an\noptional caller `signal`. As on `create`, the gateway's own ceiling for a fetch is\n60 s, so a per-call budget is what keeps a slow upstream from holding the caller\nfor the constructor default.\n\n## Options (`FetchOpts`)\n\n- `url` (required) — `string`\n- `country` — `string`\n- `timeout_ms` — `number`\n- `cache_ttl` — `string | 0` — How long a freshly fetched URL may be served from cache. Matches the\nOpenAPI `FetchRequest.cache_ttl` schema: a duration string (`\"48h\"`,\n`\"2d\"`, up to `168h` / `7d`) or the integer `0` to disable caching.\nDefaults to `\"48h\"` server-side when omitted.\n- `custom` — `Record<string, unknown>` — User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom`\nresponse header so callers can correlate the response to caller-side\nstate. Capped at 4096 UTF-8 bytes after JSON serialization. Does NOT\naffect cache-key inputs."
471
496
  },
472
497
  "sdk/typescript/fetch-bulk": {
473
498
  "title": "Fetch Bulk",
@@ -482,7 +507,7 @@
482
507
  "sdk/typescript/scrape": {
483
508
  "title": "Scrape",
484
509
  "section": "SDK Reference",
485
- "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 envelope, or the 202 queued envelope when\n`async: true`. Narrow on `status` before reading the result.\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_html' | 'html' | 'markdown' | 'links' | 'images'>`\n- `country` — `string`\n- `cookies` — `ScrapeCookie[]` — Cookies to set before loading the page. `name` and `value` are required (spec `Cookie` schema).\n- `headers` — `Record<string, string>`\n- `delay_ms` — `number`\n- `timeout_ms` — `number` — SERVER-side scrape budget in ms — how long the gateway 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- `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 and from `html` output. Set false to preserve them. Does not affect `raw_html`.\n- `include_tags` — `string[]` — HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in `html`/`markdown` output. Applied before `exclude_tags`. Does not affect `raw_html`.\n- `exclude_tags` — `string[]` — HTML element names (not CSS selectors) to strip from `html`/`markdown` output. Applied after `include_tags`. Does not affect `raw_html`.\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."
510
+ "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 envelope, or the 202 queued envelope when\n`async: true`. Narrow on `status` before reading the result.\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_html' | 'html' | 'markdown' | 'links' | 'images'>`\n- `country` — `string`\n- `delay_ms` — `number`\n- `timeout_ms` — `number` — SERVER-side scrape budget in ms — how long the gateway 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- `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 and from `html` output. Set false to preserve them. Does not affect `raw_html`.\n- `include_tags` — `string[]` — HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in `html`/`markdown` output. Applied before `exclude_tags`. Does not affect `raw_html`.\n- `exclude_tags` — `string[]` — HTML element names (not CSS selectors) to strip from `html`/`markdown` output. Applied after `include_tags`. Does not affect `raw_html`.\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."
486
511
  },
487
512
  "sdk/typescript/scrape-bulk": {
488
513
  "title": "Scrape Bulk",