@hunt-labs/bytekit-mcp 0.3.24 → 0.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,23 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.3.26] - 2026-11-27
14
+
15
+ ### Changed
16
+
17
+ - Refreshed the bundled documentation snapshot after the `timeout_ms` contract was documented
18
+ (#5777): the scraping guide now says which paths the 1000 to 90000 range applies to, and
19
+ `/v1/scrape` defaults to 90000. This refresh itself changes no tool, schema or transport.
20
+
21
+ ## [0.3.25] - 2026-11-23
22
+
23
+ ### Changed
24
+
25
+ - Refreshed the bundled documentation snapshot after the async-scrape time bound was documented
26
+ (#5778): the scraping guide's async section now says that an async scrape of a page that keeps
27
+ blocking or never finishes loading reaches a final `blocked` or `timeout` within about 6 minutes
28
+ of starting work. This refresh itself changes no tool, schema or transport.
29
+
13
30
  ## [0.3.24] - 2026-11-12
14
31
 
15
32
  ### Changed
@@ -72,7 +72,7 @@
72
72
  "api/fetch/getfetch": {
73
73
  "title": "Fetch a URL (GET)",
74
74
  "section": "API Reference",
75
- "body": "# Fetch a URL (GET)\n\nDirect HTTP fetch. Metadata is returned in X-Fetch-* headers. What the body holds\ndepends on `X-Fetch-Fast-Path`. When it is `true`, a successful response returns the\nupstream response bytes verbatim. When it is `false` the request fell back to a browser\nrender, and the body is the rendered page rather than the bytes the target sent;\n`X-Fetch-Content-Length` is then the compressed size of that page. Non-2xx upstream\nresponses use the `upstream_error` JSON envelope with the upstream HTTP status.\n\n**GET** `/v1/fetch`\n\n## Parameters\n\n- `url` (query, string, required)\n- `country` (query, string) — Two-letter country code. Either case is accepted; the value is upper-cased.\n- `timeout_ms` (query, integer)\n- `cache_ttl` (query) — How long a freshly fetched URL may be served from cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts `Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values receive a 422 validation_error with an actionable message.\n- `custom` (query, string) — A JSON-encoded object, URL-encoded in the query string. It is echoed back base64-encoded in\nthe `X-Fetch-Custom` response header so callers can correlate the response to caller-side\nstate. Capped at 4096 UTF-8 bytes after JSON serialization, and not part of the cache key.\nA value that is not valid JSON answers `422 validation_error` (\"custom must be a\nJSON-encoded object\"); valid JSON that is not an object is also rejected with `422`.\n\n## Responses\n\n### 200 — Content from upstream.\n\n### 400 — Invalid URL (`invalid_url`) or oversized request.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error (e.g. slow-path-only field), or a fetch that failed for a\ntarget-side reason.\n\nThree distinct conditions answer `422`. Read `error.code` to tell them apart.\n\n- **`validation_error`** — the request itself was rejected.\n- **`blocked`** or **`upstream_error`** — the fetch ran and the target could not\n be read. `blocked` means the target's bot protection refused every attempt;\n `upstream_error` (message `Failed to fetch URL.`) is any other exhausted-retries\n failure, such as a host that does not resolve. This is a result about the URL,\n not an outage of this API, so it is a `4xx` rather than `502` or `503`. No\n upstream HTTP status was received, so `error.http_status` reports `422`,\n mirroring what was served — unlike the relayed `upstream_error` under `503`\n below, whose `error.http_status` is the target's own. A target `502` or `504`\n ends here too whenever it does not meet the condition for `503` below. The\n request transfers no billable bytes and is charged nothing (#4669).\n- **`timeout`** — the fetch ran out of its time limit before the page could be\n fetched (message `The request hit its time limit before the page could be\n fetched.`). It takes precedence over `blocked` and `upstream_error`, and like\n them it is charged nothing and reports `error.http_status` `422`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 503 — Two distinct conditions answer `503`, and they disagree about what the body's\n`error.http_status` reports. Read `error.code` to tell them apart.\n\n- **`upstream_error`** — the target returned HTTP `502` or `504`, relayed here as\n `503`. This happens only when the escalation ladder ended on that answer, or when a\n cached copy of it is served. A `502` or `504` is not terminal, so ByteKit first\n retries it through its proxy tiers and the browser fallback; if the ladder ends any\n other way, or a bot-protection vendor was seen on the way, the request answers\n `422` (`upstream_error` or `blocked`) instead.\n Cloudflare fronts this API and replaces a clean origin 502 or 504 with its\n own generic `text/plain` error page, discarding the envelope before it reaches\n you, while a 503 is passed through unchanged. The body's `error.http_status`\n still reports the **true upstream status**, `502` or `504` — not `503` — and is\n the only surviving record of what the target answered, so the body rather than\n the HTTP status is authoritative here (#3355, #4891). Every other non-2xx\n upstream response is relayed at its own HTTP status with the same\n `upstream_error` envelope, so any other 4xx/5xx the target returns surfaces as an\n Error envelope rather than a raw body (#1462).\n- **`internal_error`** (message `Fetch service unavailable.`) — no fetch service\n endpoint could be resolved on this deployment, a fault of this API and not of the\n target. There is no upstream status to preserve: the `503` is this API's own\n choice of wire status, so the body's `error.http_status` reports `503`, mirroring\n what was served (#3373). A fetch that ran and failed for a target-side reason\n answers `422` instead (#4669).\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
75
+ "body": "# Fetch a URL (GET)\n\nDirect HTTP fetch. Metadata is returned in X-Fetch-* headers. What the body holds\ndepends on `X-Fetch-Fast-Path`. When it is `true`, a successful response returns the\nupstream response bytes verbatim. When it is `false` the request fell back to a browser\nrender, and the body is the rendered page rather than the bytes the target sent;\n`X-Fetch-Content-Length` is then the compressed size of that page. Non-2xx upstream\nresponses use the `upstream_error` JSON envelope with the upstream HTTP status.\n\n**GET** `/v1/fetch`\n\n## Parameters\n\n- `url` (query, string, required)\n- `country` (query, string) — Two-letter country code. Either case is accepted; the value is upper-cased.\n- `timeout_ms` (query, integer) — Time budget for the fetch, in milliseconds, from 1000 to 90000 (default 60000). The fetch is bounded by the lower of this value and the server's fast-path limit, a deployment setting that is not part of this contract, so a value above that limit has no effect while a lower value tightens the budget. The response does not report which limit applied.\n- `cache_ttl` (query) — How long a freshly fetched URL may be served from cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts `Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values receive a 422 validation_error with an actionable message.\n- `custom` (query, string) — A JSON-encoded object, URL-encoded in the query string. It is echoed back base64-encoded in\nthe `X-Fetch-Custom` response header so callers can correlate the response to caller-side\nstate. Capped at 4096 UTF-8 bytes after JSON serialization, and not part of the cache key.\nA value that is not valid JSON answers `422 validation_error` (\"custom must be a\nJSON-encoded object\"); valid JSON that is not an object is also rejected with `422`.\n\n## Responses\n\n### 200 — Content from upstream.\n\n### 400 — Invalid URL (`invalid_url`) or oversized request.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error (e.g. slow-path-only field), or a fetch that failed for a\ntarget-side reason.\n\nThree distinct conditions answer `422`. Read `error.code` to tell them apart.\n\n- **`validation_error`** — the request itself was rejected.\n- **`blocked`** or **`upstream_error`** — the fetch ran and the target could not\n be read. `blocked` means the target's bot protection refused every attempt;\n `upstream_error` (message `Failed to fetch URL.`) is any other exhausted-retries\n failure, such as a host that does not resolve. This is a result about the URL,\n not an outage of this API, so it is a `4xx` rather than `502` or `503`. No\n upstream HTTP status was received, so `error.http_status` reports `422`,\n mirroring what was served — unlike the relayed `upstream_error` under `503`\n below, whose `error.http_status` is the target's own. A target `502` or `504`\n ends here too whenever it does not meet the condition for `503` below. The\n request transfers no billable bytes and is charged nothing (#4669).\n- **`timeout`** — the fetch ran out of its time limit before the page could be\n fetched (message `The request hit its time limit before the page could be\n fetched.`). It takes precedence over `blocked` and `upstream_error`, and like\n them it is charged nothing and reports `error.http_status` `422`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 503 — Two distinct conditions answer `503`, and they disagree about what the body's\n`error.http_status` reports. Read `error.code` to tell them apart.\n\n- **`upstream_error`** — the target returned HTTP `502` or `504`, relayed here as\n `503`. This happens only when the escalation ladder ended on that answer, or when a\n cached copy of it is served. A `502` or `504` is not terminal, so ByteKit first\n retries it through its proxy tiers and the browser fallback; if the ladder ends any\n other way, or a bot-protection vendor was seen on the way, the request answers\n `422` (`upstream_error` or `blocked`) instead.\n Cloudflare fronts this API and replaces a clean origin 502 or 504 with its\n own generic `text/plain` error page, discarding the envelope before it reaches\n you, while a 503 is passed through unchanged. The body's `error.http_status`\n still reports the **true upstream status**, `502` or `504` — not `503` — and is\n the only surviving record of what the target answered, so the body rather than\n the HTTP status is authoritative here (#3355, #4891). Every other non-2xx\n upstream response is relayed at its own HTTP status with the same\n `upstream_error` envelope, so any other 4xx/5xx the target returns surfaces as an\n Error envelope rather than a raw body (#1462).\n- **`internal_error`** (message `Fetch service unavailable.`) — no fetch service\n endpoint could be resolved on this deployment, a fault of this API and not of the\n target. There is no upstream status to preserve: the `503` is this API's own\n choice of wire status, so the body's `error.http_status` reports `503`, mirroring\n what was served (#3373). A fetch that ran and failed for a target-side reason\n answers `422` instead (#4669).\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
76
76
  },
77
77
  "api/fetch/postfetch": {
78
78
  "title": "Fetch a URL (POST)",
@@ -382,7 +382,7 @@
382
382
  "guides/scraping": {
383
383
  "title": "Scraping",
384
384
  "section": "Guides",
385
- "body": "# Scraping\n\nScrape any URL as HTML, markdown, or structured content — formats, options, latency, and async polling.\n\n`POST /v1/scrape` fetches a URL and returns its content in the format you ask for. The same\nrequest shape works for every site; the options you pass determine the output and how long the\ncall takes.\n\n## Rendering & latency\n\nMost scrapes return in well under a second. Some options require ByteKit to fully render the page\nbefore it can return content, which takes longer — typically a few seconds. Pass these only when\nyou need them:\n\n| Option | When it adds latency |\n| ----------------- | -------------------------------------------------------------- |\n| `delay_ms` | Greater than `0` |\n| `solve_challenge` | `true` (can outlast the 28 s hold, so expect a `202` receipt) |\n| `formats` | Includes `outline` |\n| `async` | `true` (the request is queued and processed in the background) |\n\nThe `country` option routes the request through a geo-located proxy. On its own it does not add\nrendering latency; it only does so when combined with one of the options above.\n\nLooking for `wait_for_selector` or `wait_until`? Those are not `ScrapeRequest` options — they\nbelong to the [Screenshot](https://bytekit.com/docs/api/screenshots/createscreenshot) endpoint. Sending them to\n`/v1/scrape` returns `422`.\n\n`cookies` and `headers` are no longer request options on any capture endpoint. Sending either\nreturns `400 validation_error`.\n\n```bash\n# A simple, low-latency scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n```bash\n# Slower: delay_ms forces a full render and waits before returning\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"delay_ms\": 2000\n }'\n```\n\n## Options\n\nEvery `POST /v1/scrape` option is listed here by the job it does. Only `url` is required. The\n[API reference](https://bytekit.com/docs/api/scrape/createscrape) carries the full request schema.\n\n### Output shaping\n\n- `url` — the page to scrape.\n- `formats` — what to return: any of `raw` (the default), `markdown`, `links`, `images` and `outline`. The\n `formats` object in the response is keyed by what you asked for. `outline` is experimental: an\n indented text accessibility tree of the browser-rendered page. It forces the browser path, adds\n no credits, and is not accepted on monitors.\n- `markdown_mode` — how the page becomes markdown: `article` (the default) extracts the article\n content, `raw` applies minimal cleanup, and `llm` produces compact, LLM-optimised output.\n- `markdown_query` — a BM25 query string (up to 200 characters) that filters the markdown by\n relevance to it. Omit it or leave it empty to disable.\n- `include_tags` and `exclude_tags` — HTML element names (not CSS selectors). `include_tags` keeps\n only the content inside those elements in the `markdown` output; `exclude_tags` strips them from\n it. `include_tags` is applied first, then `exclude_tags`. Neither affects `raw`, which always\n returns the full page.\n- `clean_markdown` — when `true` and `markdown` is in `formats`, the converted markdown is sent to\n an LLM (Groq) to remove boilerplate and ads and improve formatting before it is returned. If that\n step fails for any reason (key unset, 4xx/5xx, timeout, empty response), you get the raw markdown\n unchanged plus a warning in the `warnings` array. Billing is 3× credits and bytes, applied only\n when cleaning succeeds.\n- `markdown_links` — how links are written in the markdown: `inline` (the default) keeps\n `[text](url)`, `text` keeps only the anchor text, `none` strips URLs and removes reference\n definitions, and `references` converts to numbered `[text][N]` references with a Links footer.\n- `markdown_images` — how images are written in the markdown: `inline` (the default) keeps\n `![alt](url)`, `text` keeps only the alt text, `none` removes images entirely, and `references`\n converts to numbered `![alt][N]` references with an Images footer. This is distinct from\n `markdown_filter_images`, which drops low-signal images before conversion.\n- `with_links_summary` and `with_images_summary` — append a `Links:` or `Images:` footer, a\n numbered list of the extracted URLs, to the markdown. `with_links_summary` is enabled\n automatically when `markdown_links` is `references`.\n- `markdown_compact` — collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — filter low-signal images out of the markdown output.\n- `markdown_include_media` — return `formats.links` and `formats.images` as rich scored objects\n instead of string arrays, and include a top-level `tables` array. Only effective when `markdown`\n is in `formats`.\n- `markdown_include_warnings` — enable markdown-pipeline and tag-filter warnings for requests that\n include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may\n appear independently of this flag.\n- `remove_base64_images` — base64-encoded `data:` image sources are stripped from the HTML before\n markdown conversion (the default, `true`). Set it to `false` to keep them. It does not affect\n `raw`, which always returns the original source unchanged.\n\n### Token control\n\n- `token_budget` — the maximum token count for the markdown output. When set and `markdown` is in\n `formats`, the output is truncated at the last paragraph, then sentence, then token boundary that\n keeps the estimated count under the limit. Leave it out for no truncation. Setting it adds a\n `markdown_tokens` field to the response.\n- `token_encoding` — the tokenizer hint for `token_budget`: `cl100k_base` (the default) matches\n GPT-4/4o and `o200k_base` matches GPT-4o-mini and the o-series. Both use the same 4-characters-\n per-token heuristic internally.\n- `markdown_include_stats` — include a top-level `stats` object (characters, tokens, blocks) in the\n response. Only effective when `markdown` is in `formats`.\n\n### Rendering and access\n\n- `delay_ms` — milliseconds to wait after page load before capturing, for content that renders\n late. See [Rendering & latency](#rendering--latency) above.\n- `country` — a two-letter uppercase country code (default `US`) that routes the request through a\n geo-located proxy.\n- `mobile` — ask for the mobile version of the page. A page fetched over plain HTTP is requested\n with a mobile (Android) user agent. A page rendered in a browser renders in a phone-sized window\n but presents a desktop (Windows) browser identity, so a site that checks for a real phone may\n serve its desktop page. The default is `false` (desktop). The value is part of\n the cache key, so mobile and desktop responses are cached independently.\n- `solve_challenge` — attempts to clear a Cloudflare challenge. Success is not guaranteed, and it\n is billed as a normal browser render. A synchronous scrape with `solve_challenge: true` takes\n the held browser render; a solve can outlast the hold window (28 seconds by default), and the\n request then returns the `202` receipt while the job continues in the background. Poll\n `GET /v1/scrape/{id}` for the result.\n- `timeout_ms` — the request timeout in milliseconds, from `1000` to `90000` (default `60000`).\n\n### Caching and delivery\n\n- `cache_ttl` — how long a freshly fetched URL may be served from cache. `0` (string or integer)\n skips the cache read, though cache-eligible results are still written. `Nh` or `Nd` sets a TTL,\n capped at 168 h / 7 d. The default is `48h`. Safety-classified WAF husks are returned live but\n never stored in the shared cache. It is honoured on both the synchronous and asynchronous paths.\n- `async` — queue the scrape and get a `202` receipt immediately; see\n [Async scrapes](#async-scrapes) below.\n- `webhook_url` — an HTTPS endpoint to notify. An `http://` URL is rejected with `400 invalid_url`\n (reason `scheme_unsupported`).\n- `events` — which webhook events to deliver when `webhook_url` is set: any of `queued`,\n `completed` and `failed`. All three are delivered by default; send a subset to receive fewer.\n- `custom` — a JSON object of your own, echoed back on the success envelope (sync, async and\n webhook). It is capped at 4096 UTF-8 bytes and does not affect the cache key, so two requests\n that differ only in `custom` resolve to the same cache entry.\n\n### Examples\n\nA markdown scrape trimmed to a token budget, with the response's token statistics:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"formats\": [\"markdown\"],\n \"markdown_mode\": \"llm\",\n \"token_budget\": 4000,\n \"token_encoding\": \"o200k_base\",\n \"markdown_include_stats\": true\n }'\n```\n\nA content-only scrape: keep the `article` and `main` elements, then strip navigation and footers\nfrom what is left.\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"formats\": [\"markdown\"],\n \"include_tags\": [\"article\", \"main\"],\n \"exclude_tags\": [\"nav\", \"footer\", \"aside\"]\n }'\n```\n\n## Response fields\n\nThe default format is `raw` — pass `formats` to request others (`markdown`, `links`,\n`images`, `outline`). The `formats` object in the response is keyed by the format you requested.\n\nThe `scrape_url` tool in the [MCP server](https://bytekit.com/docs/mcp) differs: it returns markdown when `formats` is\nomitted. A request that includes `markdown` bills the 1.5× `scrape_md` endpoint factor; one that\ndoes not bills 1× (`scrape`). The API default stays `raw` so that omitting `formats` does not\nsilently raise a request's cost.\n\nEnvelope fields are `snake_case`; the keys inside `metadata` are the page's own metadata and\nstay `camelCase`.\n\n| Field | Description |\n| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `schema_version` | Response envelope version (currently `1`) |\n| `formats.raw` | Page content in the requested format (`raw` is the default when `formats` is omitted) |\n| `final_url` | URL the fetch landed on after redirects |\n| `content_type` | `Content-Type` reported by the origin |\n| `content_length` | Compressed wire bytes — the _basis_ for bandwidth billing, before the endpoint factor (see `billing`). A page served by a hosted browser reports the browser's full measured transfer |\n| `status_code` | HTTP status code of the origin page |\n| `retrieved_at` | ISO-8601 UTC timestamp of the fetch |\n| `cache` | `\"hit\"` or `\"miss\"` |\n| `cache_age_s` | Age of the cached entry in seconds — present only on a hit |\n| `billing` | What the request cost: `raw_bytes`, the `factors` applied, the resulting `multiplier`, and `billed_bytes` |\n| `metadata.title` | Page `<title>` element |\n\nThe `X-Scrape-*` response headers describe how each request was handled (cache status, timing,\nand the final URL) — useful for debugging.\n\n## Async scrapes\n\nFor long-running pages, pass `\"async\": true` to get a `202 Accepted` response with a scrape\n`id` prefixed `sc_`. Poll the result with `GET /v1/scrape/{id}`.\n\n```bash\n# Start async scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"async\": true}'\n\n# Poll for result\ncurl https://api.bytekit.com/v1/scrape/sc_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Webhook event header\n\nEvery outbound webhook POST includes an `X-ByteKit-Event` header with the event type:\n\n| Event type | Trigger |\n| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |\n| `bulk.completed` | A bulk job finishes (all items processed) |\n| `scrape.completed` | An async scrape succeeds, or a scrape monitor delivers a capture (`has_change` tells a change from a no-change capture) |\n| `scrape.failed` | An async scrape fails terminally |\n| `monitor.change_detected` | A screenshot monitor fires and detects a change |\n| `monitor.captured` | A screenshot monitor fires with no change detected (notify_on: every) |\n| `monitor.suspended` | A monitor is suspended because the account ran out of balance (reason `insufficient_balance`) |\n| `sitemap.completed` | A sitemap job finishes |\n| `sitemap.failed` | A sitemap job fails terminally |\n\nUse this header to dispatch events without inspecting the body shape:\n\n```python\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route(\"/webhooks/bytekit\", methods=[\"POST\"])\ndef handle():\n event = request.headers.get(\"X-ByteKit-Event\")\n if event == \"bulk.completed\":\n handle_bulk(request.json)\n elif event == \"scrape.completed\":\n handle_scrape(request.json)\n return \"\", 200\n```\n\n`X-ByteKit-Event` is a reserved header — you cannot supply it via `webhook_headers` in\nmonitor or bulk configuration. Attempts to do so will be rejected with a `422` at request\ntime.\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — usage counting and concurrency slots\n- [Errors](https://bytekit.com/docs/guides/errors) — how to interpret and retry error responses\n- [API Reference: Scrape](https://bytekit.com/docs/api/scrape/createscrape) — full request/response schema"
385
+ "body": "# Scraping\n\nScrape any URL as HTML, markdown, or structured content — formats, options, latency, and async polling.\n\n`POST /v1/scrape` fetches a URL and returns its content in the format you ask for. The same\nrequest shape works for every site; the options you pass determine the output and how long the\ncall takes.\n\n## Rendering & latency\n\nMost scrapes return in well under a second. Some options require ByteKit to fully render the page\nbefore it can return content, which takes longer — typically a few seconds. Pass these only when\nyou need them:\n\n| Option | When it adds latency |\n| ----------------- | -------------------------------------------------------------- |\n| `delay_ms` | Greater than `0` |\n| `solve_challenge` | `true` (can outlast the 28 s hold, so expect a `202` receipt) |\n| `formats` | Includes `outline` |\n| `async` | `true` (the request is queued and processed in the background) |\n\nThe `country` option routes the request through a geo-located proxy. On its own it does not add\nrendering latency; it only does so when combined with one of the options above.\n\nLooking for `wait_for_selector` or `wait_until`? Those are not `ScrapeRequest` options — they\nbelong to the [Screenshot](https://bytekit.com/docs/api/screenshots/createscreenshot) endpoint. Sending them to\n`/v1/scrape` returns `422`.\n\n`cookies` and `headers` are no longer request options on any capture endpoint. Sending either\nreturns `400 validation_error`.\n\n```bash\n# A simple, low-latency scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n```bash\n# Slower: delay_ms forces a full render and waits before returning\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"delay_ms\": 2000\n }'\n```\n\n## Options\n\nEvery `POST /v1/scrape` option is listed here by the job it does. Only `url` is required. The\n[API reference](https://bytekit.com/docs/api/scrape/createscrape) carries the full request schema.\n\n### Output shaping\n\n- `url` — the page to scrape.\n- `formats` — what to return: any of `raw` (the default), `markdown`, `links`, `images` and `outline`. The\n `formats` object in the response is keyed by what you asked for. `outline` is experimental: an\n indented text accessibility tree of the browser-rendered page. It forces the browser path, adds\n no credits, and is not accepted on monitors.\n- `markdown_mode` — how the page becomes markdown: `article` (the default) extracts the article\n content, `raw` applies minimal cleanup, and `llm` produces compact, LLM-optimised output.\n- `markdown_query` — a BM25 query string (up to 200 characters) that filters the markdown by\n relevance to it. Omit it or leave it empty to disable.\n- `include_tags` and `exclude_tags` — HTML element names (not CSS selectors). `include_tags` keeps\n only the content inside those elements in the `markdown` output; `exclude_tags` strips them from\n it. `include_tags` is applied first, then `exclude_tags`. Neither affects `raw`, which always\n returns the full page.\n- `clean_markdown` — when `true` and `markdown` is in `formats`, the converted markdown is sent to\n an LLM (Groq) to remove boilerplate and ads and improve formatting before it is returned. If that\n step fails for any reason (key unset, 4xx/5xx, timeout, empty response), you get the raw markdown\n unchanged plus a warning in the `warnings` array. Billing is 3× credits and bytes, applied only\n when cleaning succeeds.\n- `markdown_links` — how links are written in the markdown: `inline` (the default) keeps\n `[text](url)`, `text` keeps only the anchor text, `none` strips URLs and removes reference\n definitions, and `references` converts to numbered `[text][N]` references with a Links footer.\n- `markdown_images` — how images are written in the markdown: `inline` (the default) keeps\n `![alt](url)`, `text` keeps only the alt text, `none` removes images entirely, and `references`\n converts to numbered `![alt][N]` references with an Images footer. This is distinct from\n `markdown_filter_images`, which drops low-signal images before conversion.\n- `with_links_summary` and `with_images_summary` — append a `Links:` or `Images:` footer, a\n numbered list of the extracted URLs, to the markdown. `with_links_summary` is enabled\n automatically when `markdown_links` is `references`.\n- `markdown_compact` — collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — filter low-signal images out of the markdown output.\n- `markdown_include_media` — return `formats.links` and `formats.images` as rich scored objects\n instead of string arrays, and include a top-level `tables` array. Only effective when `markdown`\n is in `formats`.\n- `markdown_include_warnings` — enable markdown-pipeline and tag-filter warnings for requests that\n include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may\n appear independently of this flag.\n- `remove_base64_images` — base64-encoded `data:` image sources are stripped from the HTML before\n markdown conversion (the default, `true`). Set it to `false` to keep them. It does not affect\n `raw`, which always returns the original source unchanged.\n\n### Token control\n\n- `token_budget` — the maximum token count for the markdown output. When set and `markdown` is in\n `formats`, the output is truncated at the last paragraph, then sentence, then token boundary that\n keeps the estimated count under the limit. Leave it out for no truncation. Setting it adds a\n `markdown_tokens` field to the response.\n- `token_encoding` — the tokenizer hint for `token_budget`: `cl100k_base` (the default) matches\n GPT-4/4o and `o200k_base` matches GPT-4o-mini and the o-series. Both use the same 4-characters-\n per-token heuristic internally.\n- `markdown_include_stats` — include a top-level `stats` object (characters, tokens, blocks) in the\n response. Only effective when `markdown` is in `formats`.\n\n### Rendering and access\n\n- `delay_ms` — milliseconds to wait after page load before capturing, for content that renders\n late. See [Rendering & latency](#rendering--latency) above.\n- `country` — a two-letter uppercase country code (default `US`) that routes the request through a\n geo-located proxy.\n- `mobile` — ask for the mobile version of the page. A page fetched over plain HTTP is requested\n with a mobile (Android) user agent. A page rendered in a browser renders in a phone-sized window\n but presents a desktop (Windows) browser identity, so a site that checks for a real phone may\n serve its desktop page. The default is `false` (desktop). The value is part of\n the cache key, so mobile and desktop responses are cached independently.\n- `solve_challenge` — attempts to clear a Cloudflare challenge. Success is not guaranteed, and it\n is billed as a normal browser render. A synchronous scrape with `solve_challenge: true` takes\n the held browser render; a solve can outlast the hold window (28 seconds by default), and the\n request then returns the `202` receipt while the job continues in the background. Poll\n `GET /v1/scrape/{id}` for the result.\n- `timeout_ms` — the time budget for the scrape in milliseconds, from `1000` to `90000` (default `90000`). A synchronous request served on the fast path is bounded by the lower of this value and the server's fast-path limit, a deployment setting that is not part of this contract, so a value above that limit has no effect there while a lower value tightens the budget. A queued scrape (`async: true`, or a request routed to the background worker) is bounded by this value up to the worker's job timeout.\n\n### Caching and delivery\n\n- `cache_ttl` — how long a freshly fetched URL may be served from cache. `0` (string or integer)\n skips the cache read, though cache-eligible results are still written. `Nh` or `Nd` sets a TTL,\n capped at 168 h / 7 d. The default is `48h`. Safety-classified WAF husks are returned live but\n never stored in the shared cache. It is honoured on both the synchronous and asynchronous paths.\n- `async` — queue the scrape and get a `202` receipt immediately; see\n [Async scrapes](#async-scrapes) below.\n- `webhook_url` — an HTTPS endpoint to notify. An `http://` URL is rejected with `400 invalid_url`\n (reason `scheme_unsupported`).\n- `events` — which webhook events to deliver when `webhook_url` is set: any of `queued`,\n `completed` and `failed`. All three are delivered by default; send a subset to receive fewer.\n- `custom` — a JSON object of your own, echoed back on the success envelope (sync, async and\n webhook). It is capped at 4096 UTF-8 bytes and does not affect the cache key, so two requests\n that differ only in `custom` resolve to the same cache entry.\n\n### Examples\n\nA markdown scrape trimmed to a token budget, with the response's token statistics:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"formats\": [\"markdown\"],\n \"markdown_mode\": \"llm\",\n \"token_budget\": 4000,\n \"token_encoding\": \"o200k_base\",\n \"markdown_include_stats\": true\n }'\n```\n\nA content-only scrape: keep the `article` and `main` elements, then strip navigation and footers\nfrom what is left.\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"formats\": [\"markdown\"],\n \"include_tags\": [\"article\", \"main\"],\n \"exclude_tags\": [\"nav\", \"footer\", \"aside\"]\n }'\n```\n\n## Response fields\n\nThe default format is `raw` — pass `formats` to request others (`markdown`, `links`,\n`images`, `outline`). The `formats` object in the response is keyed by the format you requested.\n\nThe `scrape_url` tool in the [MCP server](https://bytekit.com/docs/mcp) differs: it returns markdown when `formats` is\nomitted. A request that includes `markdown` bills the 1.5× `scrape_md` endpoint factor; one that\ndoes not bills 1× (`scrape`). The API default stays `raw` so that omitting `formats` does not\nsilently raise a request's cost.\n\nEnvelope fields are `snake_case`; the keys inside `metadata` are the page's own metadata and\nstay `camelCase`.\n\n| Field | Description |\n| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `schema_version` | Response envelope version (currently `1`) |\n| `formats.raw` | Page content in the requested format (`raw` is the default when `formats` is omitted) |\n| `final_url` | URL the fetch landed on after redirects |\n| `content_type` | `Content-Type` reported by the origin |\n| `content_length` | Compressed wire bytes — the _basis_ for bandwidth billing, before the endpoint factor (see `billing`). A page served by a hosted browser reports the browser's full measured transfer |\n| `status_code` | HTTP status code of the origin page |\n| `retrieved_at` | ISO-8601 UTC timestamp of the fetch |\n| `cache` | `\"hit\"` or `\"miss\"` |\n| `cache_age_s` | Age of the cached entry in seconds — present only on a hit |\n| `billing` | What the request cost: `raw_bytes`, the `factors` applied, the resulting `multiplier`, and `billed_bytes` |\n| `metadata.title` | Page `<title>` element |\n\nThe `X-Scrape-*` response headers describe how each request was handled (cache status, timing,\nand the final URL) — useful for debugging.\n\n## Async scrapes\n\nFor long-running pages, pass `\"async\": true` to get a `202 Accepted` response with a scrape\n`id` prefixed `sc_`. Poll the result with `GET /v1/scrape/{id}`.\n\nAn async scrape of a page that keeps blocking or never finishes loading reaches a final `blocked`\nor `timeout` within about 6 minutes of starting work: up to 3 attempts of up to 2 minutes each,\nretried 5 seconds apart.\n\n```bash\n# Start async scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"async\": true}'\n\n# Poll for result\ncurl https://api.bytekit.com/v1/scrape/sc_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Webhook event header\n\nEvery outbound webhook POST includes an `X-ByteKit-Event` header with the event type:\n\n| Event type | Trigger |\n| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |\n| `bulk.completed` | A bulk job finishes (all items processed) |\n| `scrape.completed` | An async scrape succeeds, or a scrape monitor delivers a capture (`has_change` tells a change from a no-change capture) |\n| `scrape.failed` | An async scrape fails terminally |\n| `monitor.change_detected` | A screenshot monitor fires and detects a change |\n| `monitor.captured` | A screenshot monitor fires with no change detected (notify_on: every) |\n| `monitor.suspended` | A monitor is suspended because the account ran out of balance (reason `insufficient_balance`) |\n| `sitemap.completed` | A sitemap job finishes |\n| `sitemap.failed` | A sitemap job fails terminally |\n\nUse this header to dispatch events without inspecting the body shape:\n\n```python\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route(\"/webhooks/bytekit\", methods=[\"POST\"])\ndef handle():\n event = request.headers.get(\"X-ByteKit-Event\")\n if event == \"bulk.c\n\n---\n[Truncated to the 16384-byte per-page limit — this page is 16799 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/scraping]"
386
386
  },
387
387
  "guides/screenshots": {
388
388
  "title": "Screenshots",
@@ -467,7 +467,7 @@
467
467
  "sdk/python/fetch": {
468
468
  "title": "Fetch",
469
469
  "section": "SDK Reference",
470
- "body": "# Fetch\n\nFunctions for interacting with the `fetch` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Fetch\n\nFetch a URL (GET)\n\nDirect HTTP fetch. Metadata is returned in X-Fetch-* headers. What the body holds\ndepends on `X-Fetch-Fast-Path`. When it is `true`, a successful response returns the\nupstream response bytes verbatim. When it is `false` the request fell back to a browser\nrender, and the body is the rendered page rather than the bytes the target sent;\n`X-Fetch-Content-Length` is then the compressed size of that page. Non-2xx upstream\nresponses use the `upstream_error` JSON envelope with the upstream HTTP status.\n\n**Parameters**\n\n- `url_query (str)`\n- `country (str | Unset)`\n- `timeout_ms (int | Unset)`\n- `cache_ttl (GetFetchCacheTtlType1 | str | Unset)`\n- `custom (str | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Response[Error | str]\nsync(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Error | str | None\nawait asyncio_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Response[Error | str]\nawait asyncio(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Error | str | None\n```\n\n## Post Fetch\n\nFetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body. The response is the same, including\nthe `X-Fetch-Fast-Path` rule for what the body holds: the upstream bytes verbatim when\nit is `true`, the rendered page when it is `false`.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (FetchRequest)`\n- `url` — `str`\n- `country` — `str | Unset` — Two-letter country code. Either case is accepted; the value is upper-cased.\n- `timeout_ms` — `int | Unset`\n- `cache_ttl` — `FetchRequestCacheTtlType1 | str | Unset` — How long a freshly fetched URL may be served from cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts `Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values receive a 422 validation_error with an actionable message.\n- `custom` — `FetchRequestCustom | Unset` — User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom` response header so callers can correlate the response back to caller-side state (job IDs, batch metadata, etc.). Capped at 4096 UTF-8 bytes after JSON serialization. Does NOT affect cache-key inputs — two requests differing only in `custom` share the same cache slot.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Error | str]\nsync(client=client, body=body) -> Error | str | None\nawait asyncio_detailed(client=client, body=body) -> Response[Error | str]\nawait asyncio(client=client, body=body) -> Error | str | None\n```"
470
+ "body": "# Fetch\n\nFunctions for interacting with the `fetch` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Fetch\n\nFetch a URL (GET)\n\nDirect HTTP fetch. Metadata is returned in X-Fetch-* headers. What the body holds\ndepends on `X-Fetch-Fast-Path`. When it is `true`, a successful response returns the\nupstream response bytes verbatim. When it is `false` the request fell back to a browser\nrender, and the body is the rendered page rather than the bytes the target sent;\n`X-Fetch-Content-Length` is then the compressed size of that page. Non-2xx upstream\nresponses use the `upstream_error` JSON envelope with the upstream HTTP status.\n\n**Parameters**\n\n- `url_query (str)`\n- `country (str | Unset)`\n- `timeout_ms (int | Unset)`\n- `cache_ttl (GetFetchCacheTtlType1 | str | Unset)`\n- `custom (str | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Response[Error | str]\nsync(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Error | str | None\nawait asyncio_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Response[Error | str]\nawait asyncio(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Error | str | None\n```\n\n## Post Fetch\n\nFetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body. The response is the same, including\nthe `X-Fetch-Fast-Path` rule for what the body holds: the upstream bytes verbatim when\nit is `true`, the rendered page when it is `false`.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (FetchRequest)`\n- `url` — `str`\n- `country` — `str | Unset` — Two-letter country code. Either case is accepted; the value is upper-cased.\n- `timeout_ms` — `int | Unset` — Time budget for the fetch, in milliseconds, from 1000 to 90000 (default 60000). The fetch is bounded by the lower of this value and the server's fast-path limit, a deployment setting that is not part of this contract, so a value above that limit has no effect while a lower value tightens the budget. The response does not report which limit applied.\n- `cache_ttl` — `FetchRequestCacheTtlType1 | str | Unset` — How long a freshly fetched URL may be served from cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts `Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values receive a 422 validation_error with an actionable message.\n- `custom` — `FetchRequestCustom | Unset` — User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom` response header so callers can correlate the response back to caller-side state (job IDs, batch metadata, etc.). Capped at 4096 UTF-8 bytes after JSON serialization. Does NOT affect cache-key inputs — two requests differing only in `custom` share the same cache slot.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Error | str]\nsync(client=client, body=body) -> Error | str | None\nawait asyncio_detailed(client=client, body=body) -> Response[Error | str]\nawait asyncio(client=client, body=body) -> Error | str | None\n```"
471
471
  },
472
472
  "sdk/python/fetch-bulk": {
473
473
  "title": "Fetch Bulk",
@@ -482,7 +482,7 @@
482
482
  "sdk/python/scrape": {
483
483
  "title": "Scrape",
484
484
  "section": "SDK Reference",
485
- "body": "# Scrape\n\nFunctions for interacting with the `scrape` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Scrape\n\nScrape a URL\n\nFetches and processes a URL, returning content in one or more formats wrapped in a ScrapeEnvelope.\n\n**The response shape is decided by your request, not by how we route it.** In precedence order:\n\n1. `async: true` in the body, or `?async=true` in the query string (either one is enough; `false` in\none never cancels `true` in the other) → **202** with a `ScrapeQueuedEnvelope` receipt, returned\nimmediately. Poll `GET /v1/scrape/\\{id\\}` for the result.\n2. Otherwise, a request that needs a full page render — today that is any of `delay_ms > 0`,\n`solve_challenge: true`, or `outline` in `formats` — is **held open** until the render reaches a\nterminal state, then returns **200** with the content envelope (`success` or `failed`). If the\nrender is still running when the hold window expires (28 seconds by default), the request returns\nthe **202** receipt instead and the job continues in the background. A `solve_challenge` render can\noutlast the hold window, so expect the 202 receipt from such a request.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content\nenvelope, typically in under a second.\n\n**A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or\na target whose bot protection defeats every proxy tier all come back on the same **200** as a\n`failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A\nfailure the fast path decides inline is recorded as a failed job, so its envelope normally carries\nthat job's `id` and `GET /v1/scrape/\\{id\\}` returns the same envelope; if recording the failed job\nitself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is\nnothing to poll. A failure a held render reaches carries that render's real `id`. Either way the\nrequest transfers no billable bytes and is charged nothing.\n\n**A target that rate-limits us is not ByteKit rate-limiting you.** The `failed` envelope's\n`error.code` is `target_rate_limited` when the target rate-limits the request. On the fast path that\nmeans our proxy attempts end on an HTTP 429 and no bot protection is identified on any attempt, even\nif the browser fallback then fails or reaches only an unidentified block page; the inline failure\ncarries `error.retry_after_seconds` when the target sent a usable `Retry-After`. On a held render\nthe browser's own answer decides: it observes a 429 on the page itself, or it fails outright after\nthe proxy attempts ended on an HTTP 429. A bot-protection verdict on an earlier fetch attempt does\nnot keep a held render `blocked` when the browser then observes the 429. A held render never carries\n`error.retry_after_seconds`. Retrying a `target_rate_limited` failure later is likely to work. A\nheld render whose browser reaches an unidentified 403 or 503 page after a proxy 429 is `blocked`. A\n429 that bot protection sends as a block stays `blocked` when it is the answer that decides the\ncode: the fast path's proxy attempts, or the browser render on a held render. Your own per-key limit\nis a separate case: it answers HTTP 429 `rate_limited` with a `Retry-After` header (see the `429`\nresponse).\n\nSo a 202 means one of exactly two things: you asked for one with `async: true` or `?async=true`, or\nthe hold window expired. `wait_for_selector` and `wait_until` are `ScreenshotRequest` options, not\n`ScrapeRequest` options — sending either to this endpoint returns `422 validation_error`, so neither\ncan produce a 202 here.\n\n**Parameters**\n\n- `async_ (bool | Unset)`\n- `body (ScrapeRequest)`\n- `url` — `str`\n- `formats` — `list[ScrapeRequestFormatsItem | ScrapeRequestJsonFormat] | Unset` — What to return. Each entry is either a string format (`raw`, `markdown`, `links` or `images`) or a `json` object entry that extracts structured data from the page. The string `\"json\"` is not a format value; the `json` entry is an object, described by `ScrapeRequestJsonFormat`. A list may hold at most one `json` entry, and a list holding only the `json` entry still captures `raw`. The `json` entry is accepted on `POST /v1/scrape`, `POST /v1/scrape/bulk` and `POST /v1/bulk` (scrape entries); monitor `formats` accept the string formats alone. Its result is `formats.json` on the response, and its charge is described on `ScrapeRequestJsonFormat`.\n- `country` — `str | Unset`\n- `delay_ms` — `int | Unset` — Milliseconds to wait after page load before capturing, for content that renders late. Any value above 0 puts the request on the full browser render path. Unless `async: true` is also set, the request is then HELD until the render finishes and returns 200 with the content envelope, or returns the 202 receipt if the hold window expires first. `0` (the default) keeps the request on the fast HTTP path, which returns 200 in one round trip.\n- `timeout_ms` — `int | Unset`\n- `async_` — `bool | Unset` — When true, the request returns 202 with a `ScrapeQueuedEnvelope` receipt immediately and the scrape runs in the background; poll `GET /v1/scrape/\\{id\\}` for the result. The `?async=true` query parameter is a second spelling of this field: the request is async when either one says true, and `false` in one never cancels `true` in the other. Asking for a receipt this way outranks every routing consequence: when neither is set (the default) a browser-path request is held to completion instead of being receipted. A 202 can still arrive without either, but only when the hold window expires.\n- `webhook_url` — `str | Unset` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `events` — `list[ScrapeRequestEventsItem] | Unset` — Webhook event types to deliver when webhook_url is set. Defaults to all three (queued, completed, failed); send an explicit subset to receive fewer.\n- `markdown_mode` — `ScrapeRequestMarkdownMode | Unset` — Markdown processing mode. article=article extraction (default), raw=minimal cleanup, llm=compact LLM-optimised output.\n- `markdown_query` — `str | Unset` — BM25 query string for relevance-ranked content filtering. Omit or leave empty to disable.\n- `markdown_links` — `ScrapeRequestMarkdownLinks | Unset` — Link rendering style in the markdown output. 'inline' (default) keeps `[text](url)` as-is. 'text' strips URLs, keeping only anchor text. 'none' strips URLs and removes reference definitions. 'references' converts to numbered `[text][N]` refs with a Links footer.\n- `markdown_images` — `ScrapeRequestMarkdownImages | Unset` — Image retention mode in the markdown output. 'inline' (default) keeps `![alt](url)` as-is. 'text' strips the URL, keeping only alt text. 'none' removes images entirely. 'references' converts to numbered `![alt][N]` refs with an Images footer. Distinct from markdown_filter_images (which drops low-signal images before conversion).\n- `with_links_summary` — `bool | Unset` — When true, appends a 'Links:\\n[1]: url\\n...' footer to the markdown output, built from the extracted link list. Automatically enabled when markdown_links is 'references'.\n- `with_images_summary` — `bool | Unset` — When true, appends an 'Images:\\n[1]: url\\n...' footer to the markdown output, built from the extracted image list.\n- `markdown_compact` — `bool | Unset` — Collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — `bool | Unset` — Filter low-signal images from the markdown output.\n- `markdown_include_media` — `bool | Unset` — When true, `formats.links` and `formats.images` return `ScrapeScoredLink[]` / `ScrapeScoredImage[]` (rich objects) instead of `string[]`, and a top-level `tables` array is included. Only effective when `markdown` is in `formats`.\n- `markdown_include_warnings` — `bool | Unset` — When true, enables markdown-pipeline and tag-filter warnings for requests that include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may appear independently of this flag.\n- `markdown_include_stats` — `bool | Unset` — When true, the response includes a top-level `stats` object with `ScrapeStats` (chars, tokens, blocks). Only effective when `markdown` is in `formats`.\n- `token_budget` — `int | Unset` — Maximum token count for the markdown output. When set and `markdown` is in `formats`, the output is truncated at the last paragraph → sentence → token boundary that keeps the estimated count under this limit. Absent → no truncation. Triggers a `markdown_tokens` field in the response.\n- `token_encoding` — `ScrapeRequestTokenEncoding | Unset` — Tokenizer encoding hint for `token_budget`. `cl100k_base` (default) matches GPT-4/4o; `o200k_base` matches GPT-4o-mini / o-series. Both use the same 4-char/token heuristic internally.\n- `mobile` — `bool | Unset` — When true, ask for the mobile version of the page. A page fetched over plain HTTP is requested with a mobile (Android) user agent. A page rendered in a browser renders in a phone-sized window but presents a desktop (Windows) browser identity, so a site that checks for a real phone may serve its desktop page. Default false (desktop). The value is part of the cache key, so mobile and desktop responses are cached independently.\n- `solve_challenge` — `bool | Unset` — Attempts to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render. On a synchronous `POST /v1/scrape` this routes the request to the held browser render; a solve can outlast the hold window (28 seconds by default), and the request then returns the 202 receipt while the job continues in the background. With `async: true` the 202 receipt is returned immediately.\n- `remove_base64_images` — `bool | Unset` — When true (default), base64-encoded `data:` image sources are stripped from the HTML before markdown conversion. Set to false to preserve base64 images in the pipeline output. Does not affect `raw`, which always returns the original source unchanged.\n- `include_tags` — `list[str] | Unset` — HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in the `markdown` output. Applied before `exclude_tags`. Does not affect `raw`, which always returns the full page.\n- `exclude_tags` — `list[str] | Unset` — HTML element names (not CSS selectors) to strip from the `markdown` output. Applied after `include_tags` when both are present. Does not affect `raw`, which always returns the full page.\n- `cache_ttl` — `ScrapeRequestCacheTtlType1 | str | Unset` — How long a freshly fetched URL may be served from cache. `0` (string or integer) skips the cache read; cache-eligible results are still written. `Nh`/`Nd` set a TTL (capped at 168 h / 7 d). Safety-classified WAF husks are returned live but never stored in the shared cache. Honoured on both the synchronous and asynchronous paths; the async success envelope reports the lookup outcome via the `cache` field.\n- `custom` — `ScrapeRequestCustom | Unset` — User-supplied JSON payload, echoed back on the success envelope (sync, async, webhook). Capped at 4096 UTF-8 bytes (`Buffer.byteLength`). Distinct from the system-owned `metadata` column. Does NOT affect cache-key inputs — two requests differing only in `custom` resolve to the same cache entry.\n- `clean_markdown` — `bool | Unset` — When `true` and `markdown` is in `formats`, the converted markdown is sent to Groq LLM for cleaning (boilerplate removal, ad stripping, formatting improvement) before being returned. Graceful degradation: any Groq failure (key unset, 4xx/5xx, timeout, empty response) returns the raw markdown unchanged plus a warning in the `warnings` array. Billing: 3× credits and bytes applied only when cleaning succeeds.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope]\nsync(client=client, body=body, async_=async_) -> Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope | None\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope]\nawait asyncio(client=client, body=body, async_=async_) -> Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope | None\n```\n\n## Get Scrape\n\nGet scrape result\n\nAlways returns 200. Check the `status` discriminator for the scrape state.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope]\nsync(id=id, client=client) -> Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope]\nawait asyncio(id=id, client=client) -> Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope | None\n```"
485
+ "body": "# Scrape\n\nFunctions for interacting with the `scrape` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Scrape\n\nScrape a URL\n\nFetches and processes a URL, returning content in one or more formats wrapped in a ScrapeEnvelope.\n\n**The response shape is decided by your request, not by how we route it.** In precedence order:\n\n1. `async: true` in the body, or `?async=true` in the query string (either one is enough; `false` in\none never cancels `true` in the other) → **202** with a `ScrapeQueuedEnvelope` receipt, returned\nimmediately. Poll `GET /v1/scrape/\\{id\\}` for the result.\n2. Otherwise, a request that needs a full page render — today that is any of `delay_ms > 0`,\n`solve_challenge: true`, or `outline` in `formats` — is **held open** until the render reaches a\nterminal state, then returns **200** with the content envelope (`success` or `failed`). If the\nrender is still running when the hold window expires (28 seconds by default), the request returns\nthe **202** receipt instead and the job continues in the background. A `solve_challenge` render can\noutlast the hold window, so expect the 202 receipt from such a request.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content\nenvelope, typically in under a second.\n\n**A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or\na target whose bot protection defeats every proxy tier all come back on the same **200** as a\n`failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A\nfailure the fast path decides inline is recorded as a failed job, so its envelope normally carries\nthat job's `id` and `GET /v1/scrape/\\{id\\}` returns the same envelope; if recording the failed job\nitself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is\nnothing to poll. A failure a held render reaches carries that render's real `id`. Either way the\nrequest transfers no billable bytes and is charged nothing.\n\n**A target that rate-limits us is not ByteKit rate-limiting you.** The `failed` envelope's\n`error.code` is `target_rate_limited` when the target rate-limits the request. On the fast path that\nmeans our proxy attempts end on an HTTP 429 and no bot protection is identified on any attempt, even\nif the browser fallback then fails or reaches only an unidentified block page; the inline failure\ncarries `error.retry_after_seconds` when the target sent a usable `Retry-After`. On a held render\nthe browser's own answer decides: it observes a 429 on the page itself, or it fails outright after\nthe proxy attempts ended on an HTTP 429. A bot-protection verdict on an earlier fetch attempt does\nnot keep a held render `blocked` when the browser then observes the 429. A held render never carries\n`error.retry_after_seconds`. Retrying a `target_rate_limited` failure later is likely to work. A\nheld render whose browser reaches an unidentified 403 or 503 page after a proxy 429 is `blocked`. A\n429 that bot protection sends as a block stays `blocked` when it is the answer that decides the\ncode: the fast path's proxy attempts, or the browser render on a held render. Your own per-key limit\nis a separate case: it answers HTTP 429 `rate_limited` with a `Retry-After` header (see the `429`\nresponse).\n\nSo a 202 means one of exactly two things: you asked for one with `async: true` or `?async=true`, or\nthe hold window expired. `wait_for_selector` and `wait_until` are `ScreenshotRequest` options, not\n`ScrapeRequest` options — sending either to this endpoint returns `422 validation_error`, so neither\ncan produce a 202 here.\n\n**Parameters**\n\n- `async_ (bool | Unset)`\n- `body (ScrapeRequest)`\n- `url` — `str`\n- `formats` — `list[ScrapeRequestFormatsItem | ScrapeRequestJsonFormat] | Unset` — What to return. Each entry is either a string format (`raw`, `markdown`, `links` or `images`) or a `json` object entry that extracts structured data from the page. The string `\"json\"` is not a format value; the `json` entry is an object, described by `ScrapeRequestJsonFormat`. A list may hold at most one `json` entry, and a list holding only the `json` entry still captures `raw`. The `json` entry is accepted on `POST /v1/scrape`, `POST /v1/scrape/bulk` and `POST /v1/bulk` (scrape entries); monitor `formats` accept the string formats alone. Its result is `formats.json` on the response, and its charge is described on `ScrapeRequestJsonFormat`.\n- `country` — `str | Unset`\n- `delay_ms` — `int | Unset` — Milliseconds to wait after page load before capturing, for content that renders late. Any value above 0 puts the request on the full browser render path. Unless `async: true` is also set, the request is then HELD until the render finishes and returns 200 with the content envelope, or returns the 202 receipt if the hold window expires first. `0` (the default) keeps the request on the fast HTTP path, which returns 200 in one round trip.\n- `timeout_ms` — `int | Unset` — Time budget for the scrape, in milliseconds, from 1000 to 90000 (default 90000). A queued scrape (`async: true`, or a request routed to the background worker) is bounded by this value up to the worker's job timeout. A synchronous request served on the fast path is bounded by the lower of this value and the server's fast-path limit, a deployment setting that is not part of this contract, so a value above that limit has no effect there while a lower value tightens the budget. The response does not report which limit applied.\n- `async_` — `bool | Unset` — When true, the request returns 202 with a `ScrapeQueuedEnvelope` receipt immediately and the scrape runs in the background; poll `GET /v1/scrape/\\{id\\}` for the result. The `?async=true` query parameter is a second spelling of this field: the request is async when either one says true, and `false` in one never cancels `true` in the other. Asking for a receipt this way outranks every routing consequence: when neither is set (the default) a browser-path request is held to completion instead of being receipted. A 202 can still arrive without either, but only when the hold window expires.\n- `webhook_url` — `str | Unset` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `events` — `list[ScrapeRequestEventsItem] | Unset` — Webhook event types to deliver when webhook_url is set. Defaults to all three (queued, completed, failed); send an explicit subset to receive fewer.\n- `markdown_mode` — `ScrapeRequestMarkdownMode | Unset` — Markdown processing mode. article=article extraction (default), raw=minimal cleanup, llm=compact LLM-optimised output.\n- `markdown_query` — `str | Unset` — BM25 query string for relevance-ranked content filtering. Omit or leave empty to disable.\n- `markdown_links` — `ScrapeRequestMarkdownLinks | Unset` — Link rendering style in the markdown output. 'inline' (default) keeps `[text](url)` as-is. 'text' strips URLs, keeping only anchor text. 'none' strips URLs and removes reference definitions. 'references' converts to numbered `[text][N]` refs with a Links footer.\n- `markdown_images` — `ScrapeRequestMarkdownImages | Unset` — Image retention mode in the markdown output. 'inline' (default) keeps `![alt](url)` as-is. 'text' strips the URL, keeping only alt text. 'none' removes images entirely. 'references' converts to numbered `![alt][N]` refs with an Images footer. Distinct from markdown_filter_images (which drops low-signal images before conversion).\n- `with_links_summary` — `bool | Unset` — When true, appends a 'Links:\\n[1]: url\\n...' footer to the markdown output, built from the extracted link list. Automatically enabled when markdown_links is 'references'.\n- `with_images_summary` — `bool | Unset` — When true, appends an 'Images:\\n[1]: url\\n...' footer to the markdown output, built from the extracted image list.\n- `markdown_compact` — `bool | Unset` — Collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — `bool | Unset` — Filter low-signal images from the markdown output.\n- `markdown_include_media` — `bool | Unset` — When true, `formats.links` and `formats.images` return `ScrapeScoredLink[]` / `ScrapeScoredImage[]` (rich objects) instead of `string[]`, and a top-level `tables` array is included. Only effective when `markdown` is in `formats`.\n- `markdown_include_warnings` — `bool | Unset` — When true, enables markdown-pipeline and tag-filter warnings for requests that include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may appear independently of this flag.\n- `markdown_include_stats` — `bool | Unset` — When true, the response includes a top-level `stats` object with `ScrapeStats` (chars, tokens, blocks). Only effective when `markdown` is in `formats`.\n- `token_budget` — `int | Unset` — Maximum token count for the markdown output. When set and `markdown` is in `formats`, the output is truncated at the last paragraph → sentence → token boundary that keeps the estimated count under this limit. Absent → no truncation. Triggers a `markdown_tokens` field in the response.\n- `token_encoding` — `ScrapeRequestTokenEncoding | Unset` — Tokenizer encoding hint for `token_budget`. `cl100k_base` (default) matches GPT-4/4o; `o200k_base` matches GPT-4o-mini / o-series. Both use the same 4-char/token heuristic internally.\n- `mobile` — `bool | Unset` — When true, ask for the mobile version of the page. A page fetched over plain HTTP is requested with a mobile (Android) user agent. A page rendered in a browser renders in a phone-sized window but presents a desktop (Windows) browser identity, so a site that checks for a real phone may serve its desktop page. Default false (desktop). The value is part of the cache key, so mobile and desktop responses are cached independently.\n- `solve_challenge` — `bool | Unset` — Attempts to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render. On a synchronous `POST /v1/scrape` this routes the request to the held browser render; a solve can outlast the hold window (28 seconds by default), and the request then returns the 202 receipt while the job continues in the background. With `async: true` the 202 receipt is returned immediately.\n- `remove_base64_images` — `bool | Unset` — When true (default), base64-encoded `data:` image sources are stripped from the HTML before markdown conversion. Set to false to preserve base64 images in the pipeline output. Does not affect `raw`, which always returns the original source unchanged.\n- `include_tags` — `list[str] | Unset` — HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in the `markdown` output. Applied before `exclude_tags`. Does not affect `raw`, which always returns the full page.\n- `exclude_tags` — `list[str] | Unset` — HTML element names (not CSS selectors) to strip from the `markdown` output. Applied after `include_tags` when both are present. Does not affect `raw`, which always returns the full page.\n- `cache_ttl` — `ScrapeRequestCacheTtlType1 | str | Unset` — How long a freshly fetched URL may be served from cache. `0` (string or integer) skips the cache read; cache-eligible results are still written. `Nh`/`Nd` set a TTL (capped at 168 h / 7 d). Safety-classified WAF husks are returned live but never stored in the shared cache. Honoured on both the synchronous and asynchronous paths; the async success envelope reports the lookup outcome via the `cache` field.\n- `custom` — `ScrapeRequestCustom | Unset` — User-supplied JSON payload, echoed back on the success envelope (sync, async, webhook). Capped at 4096 UTF-8 bytes (`Buffer.byteLength`). Distinct from the system-owned `metadata` column. Does NOT affect cache-key inputs — two requests differing only in `custom` resolve to the same cache entry.\n- `clean_markdown` — `bool | Unset` — When `true` and `markdown` is in `formats`, the converted markdown is sent to Groq LLM for cleaning (boilerplate removal, ad stripping, formatting improvement) before being returned. Graceful degradation: any Groq failure (key unset, 4xx/5xx, timeout, empty response) returns the raw markdown unchanged plus a warning in the `warnings` array. Billing: 3× credits and bytes applied only when cleaning succeeds.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope]\nsync(client=client, body=body, async_=async_) -> Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope | None\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope]\nawait asyncio(client=client, body=body, async_=async_) -> Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope | None\n```\n\n## Get Scrape\n\nGet scrape result\n\nAlways returns 200. Check the `status` discriminator for the scrape state.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope]\nsync(id=id, client=client) -> Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope]\nawait asyncio(id=id, client=client) -> Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope | None\n```"
486
486
  },
487
487
  "sdk/python/scrape-bulk": {
488
488
  "title": "Scrape Bulk",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunt-labs/bytekit-mcp",
3
- "version": "0.3.24",
3
+ "version": "0.3.26",
4
4
  "description": "ByteKit MCP server — exposes ByteKit web-data tools (scrape, screenshot, search, docs) to AI agents over the Model Context Protocol, hosted or as a local stdio server.",
5
5
  "license": "MIT",
6
6
  "type": "module",