@hunt-labs/bytekit-mcp 0.3.26 → 0.3.27

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,14 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.3.27] - 2026-12-01
14
+
15
+ ### Changed
16
+
17
+ - Refreshed the bundled documentation snapshot after the `/v1/schema` 200 response gained `id` and
18
+ `credits_used` (#6088): the schema extraction guide now lists both in its Response table and says
19
+ where the credit charge is reported. This refresh itself changes no tool, schema or transport.
20
+
13
21
  ## [0.3.26] - 2026-11-27
14
22
 
15
23
  ### Changed
@@ -142,7 +142,7 @@
142
142
  "api/schema/createschemaextraction": {
143
143
  "title": "Schema-driven structured extraction",
144
144
  "section": "API Reference",
145
- "body": "# Schema-driven structured extraction\n\nFetches `url` and extracts structured JSON conforming to the supplied\nJSON Schema (draft 2020-12) using an LLM. Fast-path only — slow-path\nrendering options (`wait_until=networkidle`, `delay_ms`,\n`wait_for_selector`) cause a `400 unsupported_option`.\n\nDual-axis billing: a fixed per-request credit charge **plus** the\nunderlying page's bandwidth, billed at its upstream wire bytes with no\nendpoint factor (a 100 KiB estimate is pre-charged, then reconciled). The\nbandwidth is still billed when the scrape succeeds but extraction later\nfails; both axes are refunded only when the scrape itself never runs.\n\n**POST** `/v1/schema`\n\n## Request Body\n\n- `url` (required)\n- `schema` (required)\n- `prompt`\n- `model`\n- `wait_for_selector`\n- `wait_until`\n- `delay_ms`\n- `country`\n- `language`\n\n## Responses\n\n### 200 — Extraction completed (success or graceful extract failure).\n- `data`\n- `model`\n- `validated`\n- `metrics`\n- `metrics.scrape_ms`\n- `metrics.llm_total_ms`\n- `metrics.input_tokens`\n- `metrics.output_tokens`\n- `metrics.retries`\n- `metrics.total_ms`\n- `scrape`\n- `scrape.url`\n- `scrape.status_code`\n- `scrape.content_length`\n- `scrape.truncated`\n- `warnings`\n\n### 400 — Invalid URL (`invalid_url`), unsupported model (`unsupported_model`), or unsupported slow-path option (`unsupported_option`).\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error (`validation_error`), non-normalizable schema (`schema_incompatible`),\nor the fetched page's HTML could not be converted for extraction — over the size cap or\npast the conversion deadline (`content_too_large`). On `content_too_large` the page's\nbandwidth is billed and the credits are refunded.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 429 — Per-account rate limit (`rate_limited`) or upstream provider rate limit (`provider_rate_limited`); a `Retry-After` header may be present.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 500 — Internal error (`internal_error`): the request could not be recorded, or its\nbandwidth charge could not be reserved. The credits held for it are refunded.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 503 — Read `error.code` to tell the conditions apart: underlying scrape failed or the\nextraction service was unreachable (`scrape_failed`), upstream provider error\n(`provider_error`), extraction provider unconfigured (`provider_unavailable`), or\nupstream provider timed out (`provider_timeout`). None of these answers `502` or\n`504`: Cloudflare fronts this API and replaces an origin 502 or 504 with its own\n`text/plain` page, discarding the error envelope, while a 503 passes through\nunchanged (#4891).\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
145
+ "body": "# Schema-driven structured extraction\n\nFetches `url` and extracts structured JSON conforming to the supplied\nJSON Schema (draft 2020-12) using an LLM. Fast-path only — slow-path\nrendering options (`wait_until=networkidle`, `delay_ms`,\n`wait_for_selector`) cause a `400 unsupported_option`.\n\nDual-axis billing: a fixed per-request credit charge **plus** the\nunderlying page's bandwidth, billed at its upstream wire bytes with no\nendpoint factor (a 100 KiB estimate is pre-charged, then reconciled). The\nbandwidth is still billed when the scrape succeeds but extraction later\nfails; both axes are refunded only when the scrape itself never runs.\n\n**POST** `/v1/schema`\n\n## Request Body\n\n- `url` (required)\n- `schema` (required)\n- `prompt`\n- `model`\n- `wait_for_selector`\n- `wait_until`\n- `delay_ms`\n- `country`\n- `language`\n\n## Responses\n\n### 200 — Extraction completed (success or graceful extract failure).\n- `id`\n- `data`\n- `model`\n- `validated`\n- `metrics`\n- `metrics.scrape_ms`\n- `metrics.llm_total_ms`\n- `metrics.input_tokens`\n- `metrics.output_tokens`\n- `metrics.retries`\n- `metrics.total_ms`\n- `scrape`\n- `scrape.url`\n- `scrape.status_code`\n- `scrape.content_length`\n- `scrape.truncated`\n- `warnings`\n- `credits_used`\n\n### 400 — Invalid URL (`invalid_url`), unsupported model (`unsupported_model`), or unsupported slow-path option (`unsupported_option`).\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error (`validation_error`), non-normalizable schema (`schema_incompatible`),\nor the fetched page's HTML could not be converted for extraction — over the size cap or\npast the conversion deadline (`content_too_large`). On `content_too_large` the page's\nbandwidth is billed and the credits are refunded.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 429 — Per-account rate limit (`rate_limited`) or upstream provider rate limit (`provider_rate_limited`); a `Retry-After` header may be present.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 500 — Internal error (`internal_error`): the request could not be recorded, or its\nbandwidth charge could not be reserved. The credits held for it are refunded.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 503 — Read `error.code` to tell the conditions apart: underlying scrape failed or the\nextraction service was unreachable (`scrape_failed`), upstream provider error\n(`provider_error`), extraction provider unconfigured (`provider_unavailable`), or\nupstream provider timed out (`provider_timeout`). None of these answers `502` or\n`504`: Cloudflare fronts this API and replaces an origin 502 or 504 with its own\n`text/plain` page, discarding the error envelope, while a 503 passes through\nunchanged (#4891).\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
146
146
  },
147
147
  "api/scrape": {
148
148
  "title": "Scrape",
@@ -182,7 +182,7 @@
182
182
  "api/screenshots/createscreenshot": {
183
183
  "title": "Capture a screenshot",
184
184
  "section": "API Reference",
185
- "body": "# Capture a screenshot\n\nSync by default (holds up to 28s). Pass `async: true` in the body or `?async=true` in the\nquery string to return 202 immediately; either one is enough, and `false` in one never\ncancels `true` in the other.\nPoll via GET /v1/screenshots/{id}.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/screenshots`\n\n## Parameters\n\n- `async` (query, boolean) — Query-string spelling of the body `async` field. `true` returns the 202 immediately; any other value is ignored.\n\n## Request Body\n\n- `url` (required)\n- `device`\n- `viewport`\n- `viewport.width`\n- `viewport.height`\n- `async`\n- `full_page`\n- `format`\n- `quality`\n- `block_ads`\n- `block_cookie_banners`\n- `wait_until`\n- `wait_for_selector`\n- `delay_ms`\n- `scroll`\n- `clip`\n- `clip.x`\n- `clip.y`\n- `clip.width`\n- `clip.height`\n- `dark_mode`\n- `device_scale_factor`\n- `include_html`\n- `country`\n- `language`\n- `metadata`\n\n## Responses\n\n### 200 — Screenshot completed (sync mode).\n- `id`\n- `status`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 202 — Screenshot accepted (async mode or sync timeout).\n- `id`\n- `status`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — The target is on ByteKit's blocklist. Nothing is captured and nothing is billed.\nThe unified `Error` envelope carries one of two codes:\n\n- `host_forbidden` — a blocked domain, any `.gov` host, or a blocked port.\n `details` is `{ host }`.\n- `path_forbidden` — an authentication-style path such as a login page.\n `details` is `{ path }`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error, or a screenshot that failed inside the sync hold.\nThe two carry DIFFERENT bodies (issue #2679):\n\n- A request-validation failure returns the unified `Error` envelope\n with code `validation_error`. A `viewport` outside the `Viewport`\n bounds (width 360 to 2544, height 1 to 1297) is one.\n- A capture that reached a terminal `failed` state inside the sync\n hold returns the full `ScreenshotResponse` resource, whose\n `error_code`/`error_message` carry the real failure (`blocked`,\n `timeout`, …). This is the canonical shape for that case: the\n resource body is what carries the `ss_` handle, `poll_url` and\n `expires_at` a client needs to redeem the failed capture, none of\n which fit the `Error` envelope.\n\nDiscriminate on the shape of the top-level `error` key. The envelope\nform carries `error` as an OBJECT (`{ code, message, http_status,\nfailed_at }`); the resource form has no `error` key at all, and\ncarries the flat `error_code`/`error_message` pair plus `id` instead.\n\nDo NOT discriminate on `status`. Both forms carry\n`\"status\": \"failed\"` on this response — `Error.status` is a required\nproperty with `enum: [failed]` — so it separates nothing here.\n\n`X-Screenshot-ID` accompanies the resource form only: a\nrequest-validation failure is raised before a screenshot row exists,\nso no screenshot headers travel with it.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n- `id`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
185
+ "body": "# Capture a screenshot\n\nSync by default (holds up to 28s). Pass `async: true` in the body or `?async=true` in the\nquery string to return 202 immediately; either one is enough, and `false` in one never\ncancels `true` in the other.\nPoll via GET /v1/screenshots/{id}.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/screenshots`\n\n## Parameters\n\n- `async` (query, boolean) — Query-string spelling of the body `async` field. `true` returns the 202 immediately; any other value is ignored.\n\n## Request Body\n\n- `url` (required)\n- `device`\n- `viewport`\n- `viewport.width`\n- `viewport.height`\n- `async`\n- `full_page`\n- `format`\n- `quality`\n- `block_ads`\n- `block_cookie_banners`\n- `wait_until`\n- `wait_for_selector`\n- `delay_ms`\n- `scroll`\n- `clip`\n- `clip.x`\n- `clip.y`\n- `clip.width`\n- `clip.height`\n- `dark_mode`\n- `device_scale_factor`\n- `include_html`\n- `country`\n- `language`\n- `metadata`\n\n## Responses\n\n### 200 — Screenshot completed (sync mode).\n- `id`\n- `status`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 202 — Screenshot accepted (async mode or sync timeout).\n- `id`\n- `status`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — The target is on ByteKit's blocklist. Nothing is captured and nothing is billed.\nThe unified `Error` envelope carries one of two codes:\n\n- `host_forbidden` — a blocked domain, any government host (`.gov`, or a `.gov.` country domain such as `.gov.uk`), or a blocked port.\n `details` is `{ host }`.\n- `path_forbidden` — an authentication-style path such as a login page.\n `details` is `{ path }`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error, or a screenshot that failed inside the sync hold.\nThe two carry DIFFERENT bodies (issue #2679):\n\n- A request-validation failure returns the unified `Error` envelope\n with code `validation_error`. A `viewport` outside the `Viewport`\n bounds (width 360 to 2544, height 1 to 1297) is one.\n- A capture that reached a terminal `failed` state inside the sync\n hold returns the full `ScreenshotResponse` resource, whose\n `error_code`/`error_message` carry the real failure (`blocked`,\n `timeout`, …). This is the canonical shape for that case: the\n resource body is what carries the `ss_` handle, `poll_url` and\n `expires_at` a client needs to redeem the failed capture, none of\n which fit the `Error` envelope.\n\nDiscriminate on the shape of the top-level `error` key. The envelope\nform carries `error` as an OBJECT (`{ code, message, http_status,\nfailed_at }`); the resource form has no `error` key at all, and\ncarries the flat `error_code`/`error_message` pair plus `id` instead.\n\nDo NOT discriminate on `status`. Both forms carry\n`\"status\": \"failed\"` on this response — `Error.status` is a required\nproperty with `enum: [failed]` — so it separates nothing here.\n\n`X-Screenshot-ID` accompanies the resource form only: a\nrequest-validation failure is raised before a screenshot row exists,\nso no screenshot headers travel with it.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n- `id`\n- `url`\n- `image_url`\n- `page_title`\n- `image_width`\n- `image_height`\n- `file_size_bytes`\n- `credits_charged`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `error_code`\n- `error_message`\n- `created_at`\n- `completed_at`\n- `expires_at`\n- `poll_url`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
186
186
  },
187
187
  "api/screenshots/getscreenshot": {
188
188
  "title": "Get screenshot status",
@@ -207,7 +207,7 @@
207
207
  "api/sitemap/createsitemap": {
208
208
  "title": "Discover URLs on a domain",
209
209
  "section": "API Reference",
210
- "body": "# Discover URLs on a domain\n\nCrawls a domain to build a sitemap. Returns cached results if available\nwithin cache_ttl. Results delivered via webhook and downloadable from results_url.\nWebhook deliveries include `X-ByteKit-Event: sitemap.completed` or\n`X-ByteKit-Event: sitemap.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\nThe webhook body is `{ event, data }`. For a job the worker ran, `data` is not a\n`SitemapResponse`:\n\n- `sitemap.completed` `data` carries `id`, `url`, `strategy`, `status`,\n `total_urls`, `sources`, `total_bytes`, `results_url`, `warnings`,\n `metadata`, `compact` and `billing`.\n- `sitemap.failed` `data` carries `id`, `url`, `strategy`, `status`,\n `error_code`, `error_message`, `warnings` and `metadata`.\n\nIn both, `url` is the host as `scheme://host`, and `warnings` is the\nworker's own warnings or `null`. When the request is answered from a cached job\n(`cache: hit`), the `sitemap.completed` `data` is instead the full job object, the\nsame fields as a `SitemapResponse`.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/sitemap`\n\n## Request Body\n\n- `url` (required)\n- `strategy`\n- `max_depth`\n- `max_urls`\n- `process`\n- `process.action`\n- `process.options`\n- `webhook_url`\n- `webhook_secret`\n- `cache_ttl`\n- `compact`\n- `metadata`\n\n## Responses\n\n### 202 — Sitemap job accepted (or cached result returned).\n- `id`\n- `url`\n- `strategy`\n- `max_depth`\n- `max_urls`\n- `status`\n- `total_urls`\n- `sources`\n- `total_bytes`\n- `results_url`\n- `cache`\n- `cache_age_s`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `warnings`\n- `error_code`\n- `error_message`\n- `compact`\n- `process`\n- `metadata`\n- `created_at`\n- `completed_at`\n- `expires_at`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — The target is on ByteKit's blocklist. Nothing is queued and nothing is billed.\nThe unified `Error` envelope carries one of two codes:\n\n- `host_forbidden` — a blocked domain, any `.gov` host, or a blocked port.\n `details` is `{ host }`.\n- `path_forbidden` — an authentication-style path such as a login page.\n `details` is `{ path }`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
210
+ "body": "# Discover URLs on a domain\n\nCrawls a domain to build a sitemap. Returns cached results if available\nwithin cache_ttl. Results delivered via webhook and downloadable from results_url.\nWebhook deliveries include `X-ByteKit-Event: sitemap.completed` or\n`X-ByteKit-Event: sitemap.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\nThe webhook body is `{ event, data }`. For a job the worker ran, `data` is not a\n`SitemapResponse`:\n\n- `sitemap.completed` `data` carries `id`, `url`, `strategy`, `status`,\n `total_urls`, `sources`, `total_bytes`, `results_url`, `warnings`,\n `metadata`, `compact` and `billing`.\n- `sitemap.failed` `data` carries `id`, `url`, `strategy`, `status`,\n `error_code`, `error_message`, `warnings` and `metadata`.\n\nIn both, `url` is the host as `scheme://host`, and `warnings` is the\nworker's own warnings or `null`. When the request is answered from a cached job\n(`cache: hit`), the `sitemap.completed` `data` is instead the full job object, the\nsame fields as a `SitemapResponse`.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**POST** `/v1/sitemap`\n\n## Request Body\n\n- `url` (required)\n- `strategy`\n- `max_depth`\n- `max_urls`\n- `process`\n- `process.action`\n- `process.options`\n- `webhook_url`\n- `webhook_secret`\n- `cache_ttl`\n- `compact`\n- `metadata`\n\n## Responses\n\n### 202 — Sitemap job accepted (or cached result returned).\n- `id`\n- `url`\n- `strategy`\n- `max_depth`\n- `max_urls`\n- `status`\n- `total_urls`\n- `sources`\n- `total_bytes`\n- `results_url`\n- `cache`\n- `cache_age_s`\n- `billing`\n- `billing.raw_bytes`\n- `billing.factors`\n- `billing.factors.name`\n- `billing.factors.value`\n- `billing.factors.reason`\n- `billing.multiplier`\n- `billing.billed_bytes`\n- `warnings`\n- `error_code`\n- `error_message`\n- `compact`\n- `process`\n- `metadata`\n- `created_at`\n- `completed_at`\n- `expires_at`\n\n### 400 — Bad request. When the `url` field fails strict validation the error\ncode is `invalid_url` and the `details` object contains:\n- `field` — the request field that failed (e.g. `\"url\"`)\n- `url` — the rejected value\n- `reason` — one of: `scheme_missing`, `scheme_unsupported`,\n `scheme_separator_typo`, `host_empty`, `host_invalid`,\n `host_blocked_private`, `host_blocked_loopback`, `host_too_long`,\n `host_unicode_not_punycode`, `userinfo_present`, `url_too_long`,\n `control_chars`, `not_a_url`\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 401 — Unauthorized. The request carried no valid credential, and no work was\nperformed. The unified `Error` envelope carries one of the codes below\nin `error.code`; match on the code, never on the prose.\n\n- `invalid_api_key` — a bearer API key was presented and rejected:\n unknown, revoked, expired or malformed. The bearer-only operations\n (`/v1/webhook-deliveries*` among them) also return it when no\n `Authorization` header is sent. `GET /v1/account` is the exception\n to \"malformed\": it returns `invalid_api_key` only for a key that\n starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.\n- `unauthorized` — the `Authorization` header is absent or malformed on\n an operation that also accepts a dashboard session (the dual-auth and\n billing operations). `GET /v1/account` also returns it, for no\n `Authorization` header and for any bearer value that does not start\n `sk_test_` or `sk_live_` (that value is checked as a dashboard\n session token).\n\nNot retryable as-is: supply a valid API key first.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 402 — Payment required. The account cannot fund this request, and no work was\nperformed. The unified `Error` envelope carries one of the billing codes\nbelow in `error.code`; match on the code, never on the prose.\n\n- `quota_exceeded` — the enforced balance for this request's meter\n cannot fund it. Capture endpoints (`/v1/scrape`, `/v1/fetch`,\n `/v1/screenshots`, `/v1/sitemap` and the bulk siblings) meter\n bandwidth: they reject when the balance cannot fund the request's\n byte reservation, and `error.details.required_bytes` and\n `error.details.available_bytes` report the bytes the request reserves\n and the bytes available. `/v1/search` meters credits.\n- `spending_cap_reached` — the request would push overage spend past the\n account's configured cap. Only reachable on a custom overage-enabled\n plan; standard plans stop at `quota_exceeded`.\n- `billing_entitlement_impaired` — the paid subscription is in a payment\n impairment (e.g. `past_due`). `error.message` names the reason.\n- `billing_entitlement_expired` — the paid subscription entitlement\n period has ended, or its dunning grace period has run out.\n\nNot retryable as-is: settle the balance, raise the cap, or restore the\nsubscription first. This response carries no `X-Quota-*` headers — they\ntravel with the 2xx responses of the operations that emit them.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 403 — The target is on ByteKit's blocklist. Nothing is queued and nothing is billed.\nThe unified `Error` envelope carries one of two codes:\n\n- `host_forbidden` — a blocked domain, any government host (`.gov`, or a `.gov.` country domain such as `.gov.uk`), or a blocked port.\n `details` is `{ host }`.\n- `path_forbidden` — an authentication-style path such as a login page.\n `details` is `{ path }`.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 422 — Validation error.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`\n\n### 429 — Rate limit (`rate_limited`) or concurrency limit (`concurrency_limit`) exceeded. Carries a `Retry-After` header — seconds derived from the same clock as `X-RateLimit-Reset` for the rate-limit variant, a fixed small back-off for the concurrency variant.\n- `status`\n- `error`\n- `error.code`\n- `error.message`\n- `error.http_status`\n- `error.failed_at`\n- `error.details`"
211
211
  },
212
212
  "api/sitemap/getsitemap": {
213
213
  "title": "Get sitemap job status",
@@ -377,7 +377,7 @@
377
377
  "guides/schema-extraction": {
378
378
  "title": "Schema extraction",
379
379
  "section": "Guides",
380
- "body": "# Schema extraction\n\nTurn any page into structured JSON — a working request, the options that matter, the response, what it costs, and the errors to handle.\n\n`POST /v1/schema` fetches a URL and returns data from it as JSON that follows a\n[JSON Schema](https://json-schema.org/) you provide. Send a `url` and a `schema` describing the\nfields you want, such as a product name and price, and you get back an object with those fields\nfilled in from the page. An optional `prompt` tells the extraction what to look for.\n\nThe call is synchronous: it returns `200` with the result in the response body. There is no\nasync mode, and a field this endpoint does not know is rejected (see [Errors](#errors)).\n\n## Run an extraction\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/schema \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"price\": { \"type\": \"number\" },\n \"in_stock\": { \"type\": \"boolean\" }\n }\n },\n \"prompt\": \"Extract the book title, its price as a number, and whether it is in stock.\"\n }'\n```\n\n```json\n{\n \"data\": {\n \"title\": \"A Light in the Attic\",\n \"price\": 51.77,\n \"in_stock\": true\n },\n \"model\": \"openai/gpt-oss-20b\",\n \"validated\": true,\n \"metrics\": {\n \"scrape_ms\": 1006,\n \"llm_total_ms\": 257,\n \"input_tokens\": 977,\n \"output_tokens\": 91,\n \"retries\": 0,\n \"total_ms\": 1502\n },\n \"scrape\": {\n \"url\": \"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html\",\n \"status_code\": 200,\n \"content_length\": 2303,\n \"truncated\": false\n },\n \"warnings\": []\n}\n```\n\n> This request was run for real and returned `200`. The response is printed as it came back,\n> reformatted for reading. The page is a public practice shop for scraping; the timings and token\n> counts will differ on your calls.\n\n## Options\n\n`url` and `schema` are required. Send any of the others alongside them.\n\n| Option | Default | Description |\n| ------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------- |\n| `url` | — | The page to extract from. An `http` or `https` URL |\n| `schema` | — | A JSON Schema describing the output (see [Writing the schema](#writing-the-schema)) |\n| `prompt` | none | A hint in plain language about what to extract, up to 2000 characters |\n| `model` | `openai/gpt-oss-20b` | The extraction model: `openai/gpt-oss-20b` or `openai/gpt-oss-120b`. Any other value is rejected with `400 unsupported_model` |\n| `country` | `US` | Two-letter country code that sets where the page is fetched from, upper-cased for you. `null` is treated as `US` |\n| `language` | `null` | A string or `null`. The API accepts it, but the extraction does not use it today |\n| `wait_until` | `load` | `load` or `domcontentloaded`. `networkidle` is rejected (see [Rendering options](#rendering-options)) |\n| `wait_for_selector` | `null` | Must stay unset or `null` (see [Rendering options](#rendering-options)) |\n| `delay_ms` | `0` | Must stay `0` (see [Rendering options](#rendering-options)). A value outside `0`–`10000` is a `422 validation_error` |\n\n### Rendering options\n\n`/v1/schema` reads the page the quick way, without waiting on a browser to render it. Options\nthat ask for that waiting are therefore refused with `400 unsupported_option`:\n`wait_until` set to `networkidle`, a `wait_for_selector`, or a `delay_ms` above `0`. The error\nmessage lists the options this endpoint does not support; it does not say which of yours\ntriggered it.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"unsupported_option\",\n \"message\": \"Schema extraction does not support slow-path options (wait_for_selector, wait_until=networkidle, cookies, delay_ms, custom headers).\",\n \"http_status\": 400,\n \"failed_at\": \"2026-10-09T23:17:40.806Z\"\n }\n}\n```\n\n> This response came from a real request with `\"wait_until\": \"networkidle\"`.\n\nCaller-supplied `cookies` and `headers` are no longer accepted: sending either returns\n`400 validation_error`.\n\n### Writing the schema\n\nThe `schema` is a JSON Schema (draft 2020-12) object. To keep the output reliable, ByteKit\naccepts a deliberately small part of the language:\n\n- The root must be an object schema: `\"type\": \"object\"` with its `properties`.\n- These keywords are accepted: `type`, `properties`, `required`,\n `additionalProperties`, `items`, `enum`, `$defs`, `$ref`, `description`, `title` and\n `default`. A `$ref` can only point into your own `#/$defs`.\n- Other keywords are rejected with `422 schema_incompatible`, and `error.details.construct`\n names the one found. They include `pattern`, `format`, `minimum`, `maxLength`, `oneOf`, `anyOf`,\n `allOf`, `not` and `if`/`then`/`else`.\n- The schema can be at most 50,000 characters once serialized, and nested `properties` can go\n at most 8 levels deep (the count restarts inside `items`, and `$defs` entries are not counted). A schema over either\n limit, or one that is not valid JSON Schema, returns `422 validation_error`.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"schema_incompatible\",\n \"message\": \"schema_incompatible: unsupported construct \\\"pattern\\\" — unsupported keyword \\\"pattern\\\" found at #/properties/title\",\n \"http_status\": 422,\n \"failed_at\": \"2026-10-09T23:17:43.923Z\",\n \"details\": {\n \"construct\": \"pattern\"\n }\n }\n}\n```\n\n> This response came from a real request whose schema used `pattern`.\n\nEvery property you declare is asked for. What a missing value looks like depends on the\nproperty's type: a `string`, `number`, `integer`, `boolean` or `object` property the page does not\ncontain usually comes back as `null`, and a list (`array`) property usually comes back as an empty\narray, `[]`. Asking the book page above for an `isbn` it does not show returned `\"isbn\": null`.\nAsking it for a `title` and a list of literary awards, declared as an `array` of `string` items,\nreturned `\"awards\": []`. Both responses had `validated` set to `true`.\n\nA property limited by `enum`, such as `{\"type\": \"string\", \"enum\": [\"hardcover\", \"paperback\"]}`,\ncomes back as `null` when the page holds none of the listed values. The `type` is optional: an\n`enum` with no `type` behaves the same way. Your `enum` does not need to list `null`. Asking the\nbook page above for that `format` next to a `title` returned `\"format\": null` with `validated` set\nto `true`; asked for on its own, the same request returned `200` with `validated` set to `false`\nand an `empty_extraction` warning, which charges no credits. A model can also answer with one of the\nlisted values that the page does not support, so treat an `enum` result as a guess when the page is\nsilent. An `integer` property with `\"enum\": [1, 2]` returned `2` on a page that states no edition.\n\nOne kind of schema can instead fail with `503 provider_error` when the page has no value to give: a\nschema whose only properties are lists of strings, such as\n`{\"type\": \"object\", \"properties\": {\"awards\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}}}}`,\nwhen the page has no entries. The same schema returned `\"awards\": []` on one call and\n`503 provider_error` on others, so it does not fail every time. The `title` and `awards` request\nabove, which asks for a `title` as well, returned `[]`.\n\nThis failure can repeat on retry, and it keeps the page's bandwidth charge (see\n[Cost](#cost)), so change the schema instead of retrying the same request.\n\nLists work through `items`. This schema collects every book on a category page:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/schema \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://books.toscrape.com/catalogue/category/books/poetry_23/index.html\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"category\": { \"type\": \"string\" },\n \"books\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"price\": { \"type\": \"number\" }\n }\n }\n }\n }\n },\n \"prompt\": \"List every book on the page with its price as a number.\"\n }'\n```\n\n> This request was run for real and returned `200` with `\"validated\": true` and 19 books in\n> `data.books`. Its `scrape.content_length` was `4521`. The first two books were:\n> `{\"title\": \"A Light in the Attic\", \"price\": 51.77}` and\n> `{\"title\": \"The Black Maria\", \"price\": 52.15}`.\n\n## Response\n\n| Field | Description |\n| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `data` | The extracted object, shaped by your schema. `null` when `validated` is `false` |\n| `model` | The model that produced the result |\n| `validated` | `true` when the output matched your schema, unless it holds values and all of them are `null`. See below for when this is `false` |\n| `metrics` | Timings in milliseconds (`scrape_ms`, `llm_total_ms`, `total_ms`), the token counts (`input_tokens`, `output_tokens`) and `retries`, the number of extra attempts (0 to 2) |\n| `scrape` | The page that was read: its `url`, the `status_code` it answered with (or `null`), `content_length` (its size in bytes, which the bandwidth charge uses) and `truncated` |\n| `warnings` | Codes for results that are less complete than a clean run. An empty array on a clean run |\n\nA `200` does not always mean you got data. `validated` is `false`, with `data: null`, when the\nmodel refused, when its retries ran out before it produced output that matched your schema, or\nwhen the output holds values and every one of them is `null`. That last case is still `true` if your\nschema allows it: each `null` value has to sit at a property whose `type` is a list that includes\n`\"null\"`, for example `[\"string\", \"null\"]`. Check `validated` before you use `data`.\n\n```json\n{\n \"data\": null,\n \"model\": \"openai/gpt-oss-20b\",\n \"validated\": false,\n \"metrics\": {\n \"scrape_ms\": 1455,\n \"llm_total_ms\": 220,\n \"input_tokens\": 303,\n \"output_tokens\": 102,\n \"retries\": 0,\n \"total_ms\": 1711\n },\n \"scrape\": {\n \"url\": \"https://example.com\",\n \"status_code\": 200,\n \"content_length\": 334,\n \"truncated\": false\n },\n \"warnings\": [\"empty_extraction\"]\n}\n```\n\n> This response came from a real request that asked `https://example.com`, which has no price,\n> for a `price` and a `sku`.\n\nThe warning codes are:\n\n| Code | Meaning |\n| --------------------------- | -------------------------------------------------------------------------------------- |\n| `content_truncated` | The page was too long for the model and was cut short, so the result may be incomplete |\n| `extract_validation_failed` | The model's output did not match your schema |\n| `exhausted_retries` | The retries ran out before the model produced output that matched your schema |\n| `model_refusal` | The model declined to extract |\n| `empty_extraction` | The output matched your schema, but it held values and all of them were `null` |\n\n## Cost\n\nA request is billed on two things:\n\n- **A fixed credit charge.** Today a request costs 10 credits, whatever the page or the schema, and they are charged only when the extraction validates.\n- **The page's bandwidth.** The page is billed at the bytes it took to download, which is the\n `scrape.content_length` in the response, with no multiplier. While the page loads the account is\n charged an estimate of 100 KiB; when the download finishes the estimate is replaced by the real\n size.\n\nWhen a request fails, what you keep paying depends on how far it got:\n\n| What happened | Credits | Bandwidth |\n| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | ----------------------------- |\n| Rejected or failed before the page was fetched | Not charged, or refunded | Not charged, or refunded |\n| The page was fetched, but the extraction failed (`provider_error`, `provider_timeout`, `provider_rate_limited`, `content_too_large`, or `schema_incompatible` raised after the fetch) | Refunded | Kept: the page was downloaded |\n| The page was fetched and the call returned `200` with `validated: false` | Not charged | Kept: the page was downloaded |\n| A successful extraction | Charged | Charged |\n\n[Credit billing](https://bytekit.com/docs/billing/credits) covers the two charges and a failure before the fetch, and\n[Rate Limits](https://bytekit.com/docs/guides/rate-limits) covers a failed extraction after it. On real requests,\n`credits_scrape` on `GET /v1/usage` rose by 10 after a successful extraction and did not move after\nthe `validated: false` call or a request for a host that does not exist.\n\n> The credits for this endpoint appear in `credits_scrape` on `GET /v1/usage`.\n\n## Not in the SDKs\n\n`/v1/schema` is not available in the TypeScript SDK, the Python SDK or the CLI: none of them has a\nmethod for it. Call the HTTP endpoint directly, as in the examples above. Any HTTP client works\nwith the same `Authorization: Bearer` header; see [Authentication](https://bytekit.com/docs/guides/authentication).\n\n## Errors\n\nErrors use the unified envelope described in the [Errors guide](https://bytekit.com/docs/guides/errors). These are the\nones you are most likely to meet on this endpoint. The Errors guide does not list\n`unsupported_option`, `unsupported_model`, `schema_incompatible`, `content_too_large`,\n`scrape_failed` or the `provider_*` codes, so handle those here.\n\n| Status | Code | When \n\n---\n[Truncated to the 16384-byte per-page limit — this page is 24026 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/schema-extraction]"
380
+ "body": "# Schema extraction\n\nTurn any page into structured JSON — a working request, the options that matter, the response, what it costs, and the errors to handle.\n\n`POST /v1/schema` fetches a URL and returns data from it as JSON that follows a\n[JSON Schema](https://json-schema.org/) you provide. Send a `url` and a `schema` describing the\nfields you want, such as a product name and price, and you get back an object with those fields\nfilled in from the page. An optional `prompt` tells the extraction what to look for.\n\nThe call is synchronous: it returns `200` with the result in the response body. There is no\nasync mode, and a field this endpoint does not know is rejected (see [Errors](#errors)).\n\n## Run an extraction\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/schema \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"price\": { \"type\": \"number\" },\n \"in_stock\": { \"type\": \"boolean\" }\n }\n },\n \"prompt\": \"Extract the book title, its price as a number, and whether it is in stock.\"\n }'\n```\n\n```json\n{\n \"data\": {\n \"title\": \"A Light in the Attic\",\n \"price\": 51.77,\n \"in_stock\": true\n },\n \"model\": \"openai/gpt-oss-20b\",\n \"validated\": true,\n \"metrics\": {\n \"scrape_ms\": 1006,\n \"llm_total_ms\": 257,\n \"input_tokens\": 977,\n \"output_tokens\": 91,\n \"retries\": 0,\n \"total_ms\": 1502\n },\n \"scrape\": {\n \"url\": \"https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html\",\n \"status_code\": 200,\n \"content_length\": 2303,\n \"truncated\": false\n },\n \"warnings\": []\n}\n```\n\n> This request was run for real and returned `200`. The response is printed as it came back,\n> reformatted for reading. The page is a public practice shop for scraping; the timings and token\n> counts will differ on your calls. It was captured before `id` and `credits_used` were added to the\n> response, so neither appears here.\n\n## Options\n\n`url` and `schema` are required. Send any of the others alongside them.\n\n| Option | Default | Description |\n| ------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------- |\n| `url` | — | The page to extract from. An `http` or `https` URL |\n| `schema` | — | A JSON Schema describing the output (see [Writing the schema](#writing-the-schema)) |\n| `prompt` | none | A hint in plain language about what to extract, up to 2000 characters |\n| `model` | `openai/gpt-oss-20b` | The extraction model: `openai/gpt-oss-20b` or `openai/gpt-oss-120b`. Any other value is rejected with `400 unsupported_model` |\n| `country` | `US` | Two-letter country code that sets where the page is fetched from, upper-cased for you. `null` is treated as `US` |\n| `language` | `null` | A string or `null`. The API accepts it, but the extraction does not use it today |\n| `wait_until` | `load` | `load` or `domcontentloaded`. `networkidle` is rejected (see [Rendering options](#rendering-options)) |\n| `wait_for_selector` | `null` | Must stay unset or `null` (see [Rendering options](#rendering-options)) |\n| `delay_ms` | `0` | Must stay `0` (see [Rendering options](#rendering-options)). A value outside `0`–`10000` is a `422 validation_error` |\n\n### Rendering options\n\n`/v1/schema` reads the page the quick way, without waiting on a browser to render it. Options\nthat ask for that waiting are therefore refused with `400 unsupported_option`:\n`wait_until` set to `networkidle`, a `wait_for_selector`, or a `delay_ms` above `0`. The error\nmessage lists the options this endpoint does not support; it does not say which of yours\ntriggered it.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"unsupported_option\",\n \"message\": \"Schema extraction does not support slow-path options (wait_for_selector, wait_until=networkidle, cookies, delay_ms, custom headers).\",\n \"http_status\": 400,\n \"failed_at\": \"2026-10-09T23:17:40.806Z\"\n }\n}\n```\n\n> This response came from a real request with `\"wait_until\": \"networkidle\"`.\n\nCaller-supplied `cookies` and `headers` are no longer accepted: sending either returns\n`400 validation_error`.\n\n### Writing the schema\n\nThe `schema` is a JSON Schema (draft 2020-12) object. To keep the output reliable, ByteKit\naccepts a deliberately small part of the language:\n\n- The root must be an object schema: `\"type\": \"object\"` with its `properties`.\n- These keywords are accepted: `type`, `properties`, `required`,\n `additionalProperties`, `items`, `enum`, `$defs`, `$ref`, `description`, `title` and\n `default`. A `$ref` can only point into your own `#/$defs`.\n- Other keywords are rejected with `422 schema_incompatible`, and `error.details.construct`\n names the one found. They include `pattern`, `format`, `minimum`, `maxLength`, `oneOf`, `anyOf`,\n `allOf`, `not` and `if`/`then`/`else`.\n- The schema can be at most 50,000 characters once serialized, and nested `properties` can go\n at most 8 levels deep (the count restarts inside `items`, and `$defs` entries are not counted). A schema over either\n limit, or one that is not valid JSON Schema, returns `422 validation_error`.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"schema_incompatible\",\n \"message\": \"schema_incompatible: unsupported construct \\\"pattern\\\" — unsupported keyword \\\"pattern\\\" found at #/properties/title\",\n \"http_status\": 422,\n \"failed_at\": \"2026-10-09T23:17:43.923Z\",\n \"details\": {\n \"construct\": \"pattern\"\n }\n }\n}\n```\n\n> This response came from a real request whose schema used `pattern`.\n\nEvery property you declare is asked for. What a missing value looks like depends on the\nproperty's type: a `string`, `number`, `integer`, `boolean` or `object` property the page does not\ncontain usually comes back as `null`, and a list (`array`) property usually comes back as an empty\narray, `[]`. Asking the book page above for an `isbn` it does not show returned `\"isbn\": null`.\nAsking it for a `title` and a list of literary awards, declared as an `array` of `string` items,\nreturned `\"awards\": []`. Both responses had `validated` set to `true`.\n\nA property limited by `enum`, such as `{\"type\": \"string\", \"enum\": [\"hardcover\", \"paperback\"]}`,\ncomes back as `null` when the page holds none of the listed values. The `type` is optional: an\n`enum` with no `type` behaves the same way. Your `enum` does not need to list `null`. Asking the\nbook page above for that `format` next to a `title` returned `\"format\": null` with `validated` set\nto `true`; asked for on its own, the same request returned `200` with `validated` set to `false`\nand an `empty_extraction` warning, which charges no credits. A model can also answer with one of the\nlisted values that the page does not support, so treat an `enum` result as a guess when the page is\nsilent. An `integer` property with `\"enum\": [1, 2]` returned `2` on a page that states no edition.\n\nOne kind of schema can instead fail with `503 provider_error` when the page has no value to give: a\nschema whose only properties are lists of strings, such as\n`{\"type\": \"object\", \"properties\": {\"awards\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}}}}`,\nwhen the page has no entries. The same schema returned `\"awards\": []` on one call and\n`503 provider_error` on others, so it does not fail every time. The `title` and `awards` request\nabove, which asks for a `title` as well, returned `[]`.\n\nThis failure can repeat on retry, and it keeps the page's bandwidth charge (see\n[Cost](#cost)), so change the schema instead of retrying the same request.\n\nLists work through `items`. This schema collects every book on a category page:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/schema \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://books.toscrape.com/catalogue/category/books/poetry_23/index.html\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"category\": { \"type\": \"string\" },\n \"books\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"price\": { \"type\": \"number\" }\n }\n }\n }\n }\n },\n \"prompt\": \"List every book on the page with its price as a number.\"\n }'\n```\n\n> This request was run for real and returned `200` with `\"validated\": true` and 19 books in\n> `data.books`. Its `scrape.content_length` was `4521`. The first two books were:\n> `{\"title\": \"A Light in the Attic\", \"price\": 51.77}` and\n> `{\"title\": \"The Black Maria\", \"price\": 52.15}`.\n\n## Response\n\n| Field | Description |\n| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | The request's ID, starting `sch_`. It is the same ID the request carries in the Logs feed |\n| `data` | The extracted object, shaped by your schema. `null` when `validated` is `false` |\n| `model` | The model that produced the result |\n| `validated` | `true` when the output matched your schema, unless it holds values and all of them are `null`. See below for when this is `false` |\n| `metrics` | Timings in milliseconds (`scrape_ms`, `llm_total_ms`, `total_ms`), the token counts (`input_tokens`, `output_tokens`) and `retries`, the number of extra attempts (0 to 2) |\n| `scrape` | The page that was read: its `url`, the `status_code` it answered with (or `null`), `content_length` (its size in bytes, which the bandwidth charge uses) and `truncated` |\n| `warnings` | Codes for results that are less complete than a clean run. An empty array on a clean run |\n| `credits_used` | The credits charged for this request: 10 when `validated` is `true`, 0 otherwise. Bandwidth is billed separately, on `scrape.content_length` |\n\nA `200` does not always mean you got data. `validated` is `false`, with `data: null`, when the\nmodel refused, when its retries ran out before it produced output that matched your schema, or\nwhen the output holds values and every one of them is `null`. That last case is still `true` if your\nschema allows it: each `null` value has to sit at a property whose `type` is a list that includes\n`\"null\"`, for example `[\"string\", \"null\"]`. Check `validated` before you use `data`.\n\n```json\n{\n \"data\": null,\n \"model\": \"openai/gpt-oss-20b\",\n \"validated\": false,\n \"metrics\": {\n \"scrape_ms\": 1455,\n \"llm_total_ms\": 220,\n \"input_tokens\": 303,\n \"output_tokens\": 102,\n \"retries\": 0,\n \"total_ms\": 1711\n },\n \"scrape\": {\n \"url\": \"https://example.com\",\n \"status_code\": 200,\n \"content_length\": 334,\n \"truncated\": false\n },\n \"warnings\": [\"empty_extraction\"]\n}\n```\n\n> This response came from a real request that asked `https://example.com`, which has no price,\n> for a `price` and a `sku`. It was captured before `id` and `credits_used` were added to the\n> response, so neither appears here.\n\nThe warning codes are:\n\n| Code | Meaning |\n| --------------------------- | -------------------------------------------------------------------------------------- |\n| `content_truncated` | The page was too long for the model and was cut short, so the result may be incomplete |\n| `extract_validation_failed` | The model's output did not match your schema |\n| `exhausted_retries` | The retries ran out before the model produced output that matched your schema |\n| `model_refusal` | The model declined to extract |\n| `empty_extraction` | The output matched your schema, but it held values and all of them were `null` |\n\n## Cost\n\nA request is billed on two things:\n\n- **A fixed credit charge.** Today a request costs 10 credits, whatever the page or the schema, and they are charged only when the extraction validates. The `200` response reports what was charged in `credits_used`: 10 when `validated` is `true`, 0 otherwise.\n- **The page's bandwidth.** The page is billed at the bytes it took to download, which is the\n `scrape.content_length` in the response, with no multiplier. While the page loads the account is\n charged an estimate of 100 KiB; when the download finishes the estimate is replaced by the real\n size.\n\nWhen a request fails, what you keep paying depends on how far it got:\n\n| What happened | Credits | Bandwidth |\n| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | ----------------------------- |\n| Rejected or failed before the page was fetched | Not charged, or refunded | Not charged, or refunded |\n| The page was fetched, but the extraction failed (`provider_error`, `provider_timeout`, `provider_rate_limited`, `content_too_large`, or `schema_incompatible` raised after the fetch) | Refunded | Kept: the page was downloaded |\n| The page was fetched and the call returned `200` with `validated: false` | Not charged | Kept: the page was downloaded |\n| A successful extraction | Charged | Charged |\n\n[Credit billing](https://bytekit.com/docs/billing/credits) covers the two charges and a failure before the fetch, and\n[Rate Limits](https://bytekit.com/docs/guides/rate-limits) covers a failed extraction after it. On real requests,\n`credits_scrape` on `GET /v1/usage` rose by 10 after a successful extraction and did not move after\nthe `validated: false` call or a request for a host that does not exist.\n\n> The credits for this endpoint appear in `credits_scrape` on `GET /v1/usage`.\n\n## Not in the SDKs\n\n`/v1/schema` is not available in the TypeScript SDK, the Python SDK or the CLI: none of \n\n---\n[Truncated to the 16384-byte per-page limit — this page is 24745 bytes in full. The text cut here is not searchable either: search_docs matches only the part kept above. Read all of it at https://bytekit.com/docs/guides/schema-extraction]"
381
381
  },
382
382
  "guides/scraping": {
383
383
  "title": "Scraping",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunt-labs/bytekit-mcp",
3
- "version": "0.3.26",
3
+ "version": "0.3.27",
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",