@hunt-labs/bytekit-mcp 0.3.20 → 0.3.21
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 +16 -0
- package/dist/docs-bundle/docs-bundle.json +13 -13
- package/dist/tools/scrape-url.js +3 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,22 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.3.21] - 2026-10-24
|
|
14
|
+
|
|
15
|
+
### Security
|
|
16
|
+
|
|
17
|
+
- Bumped `zod` from `^3.23.6` to `^4.6.7` and capped `scrape_url`'s `formats` list at 32 entries
|
|
18
|
+
(GHSA-mrhx-c7xc-m3w5). Zod records one error per bad list entry with no limit, so a long list of
|
|
19
|
+
bad entries could exhaust memory; a longer list is now rejected before any entry is checked. Only
|
|
20
|
+
four formats exist, so no valid call changes. Zod 4 rewords its own built-in validation messages.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- The bundled documentation snapshot's Python SDK reference now shows the type hints
|
|
25
|
+
`bytekit-sdk` 0.10.0 emits after its regeneration with `openapi-python-client` 0.29.1:
|
|
26
|
+
`str | Unset` and `X | None` replace `Union[Unset, str]` and `Optional[X]`. The `get_doc` and
|
|
27
|
+
`search_docs` tools serve the new text; no tool, schema or transport change.
|
|
28
|
+
|
|
13
29
|
## [0.3.20] - 2026-10-23
|
|
14
30
|
|
|
15
31
|
### Security
|
|
@@ -447,67 +447,67 @@
|
|
|
447
447
|
"sdk/python/account": {
|
|
448
448
|
"title": "Account",
|
|
449
449
|
"section": "SDK Reference",
|
|
450
|
-
"body": "# Account\n\nFunctions for interacting with the `account` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Account\n\nGet account details\n\nReturns account, plan, and current API key details, including the\n`api_key` and `subscription` fields.\n\n**Call styles**\n\n```python\nsync_detailed(client=client) -> Response[
|
|
450
|
+
"body": "# Account\n\nFunctions for interacting with the `account` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Account\n\nGet account details\n\nReturns account, plan, and current API key details, including the\n`api_key` and `subscription` fields.\n\n**Call styles**\n\n```python\nsync_detailed(client=client) -> Response[AccountBearerResponse | AccountSessionResponse | Error]\nsync(client=client) -> AccountBearerResponse | AccountSessionResponse | Error | None\nawait asyncio_detailed(client=client) -> Response[AccountBearerResponse | AccountSessionResponse | Error]\nawait asyncio(client=client) -> AccountBearerResponse | AccountSessionResponse | Error | None\n```"
|
|
451
451
|
},
|
|
452
452
|
"sdk/python/bulk": {
|
|
453
453
|
"title": "Bulk",
|
|
454
454
|
"section": "SDK Reference",
|
|
455
|
-
"body": "# Bulk\n\nFunctions for interacting with the `bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Bulk\n\nCreate mixed bulk job\n\nEnqueues screenshots or scrapes in a single batch.\nProvide `urls` (simple list) or `items` (per-item config), not both.\nWebhook deliveries include `X-ByteKit-Event: bulk.completed` so\nreceivers can dispatch on the header without parsing the body shape.\nThe body follows `BulkCompletedWebhook`: at most 500 complete items and\n1 MiB, followed by cursor recovery through the existing mixed-item route\nwhenever `recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 4 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 32 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's richer per-item override\nbudget), which reaches 28.7 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 4 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (CreateBulkBody): Provide `urls` (simple list) OR `items` (per-item config), not`\n- `both. `type` selects the capture kind per entry — only`\n- ``screenshot` and `scrape` are accepted (`recording` is`\n- `deactivated). Behaviour fields may be set per item or via`\n- ``defaults`; a per-item value overrides the matching default.`\n- `This includes `type`: an entry with no `type` of its own`\n- `inherits `defaults.type`, falling back to `screenshot` only`\n- `when neither is set.`\n- `The top-level object, each `items[]` entry, and `defaults``\n- `each reject unrecognized keys with a 422 `validation_error``\n- `(the offending key name appears in the error's `details``\n- `message text) rather than silently discarding them.`\n- ``items[]` and `defaults` do not share one field set`\n- ``device_scale_factor` is accepted only under `defaults` (a`\n- `per-item value 422s), and `duration`/`scenario` are accepted`\n- `only per item (a `defaults` value 422s). `metadata` is`\n- `different from those three: it is valid both at the top`\n- `level of the body and per item, but rejected with a 422 if`\n- `placed under `defaults`. See the `422` response below.`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `urls` — `
|
|
455
|
+
"body": "# Bulk\n\nFunctions for interacting with the `bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Bulk\n\nCreate mixed bulk job\n\nEnqueues screenshots or scrapes in a single batch.\nProvide `urls` (simple list) or `items` (per-item config), not both.\nWebhook deliveries include `X-ByteKit-Event: bulk.completed` so\nreceivers can dispatch on the header without parsing the body shape.\nThe body follows `BulkCompletedWebhook`: at most 500 complete items and\n1 MiB, followed by cursor recovery through the existing mixed-item route\nwhenever `recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 4 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 32 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's richer per-item override\nbudget), which reaches 28.7 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 4 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (CreateBulkBody): Provide `urls` (simple list) OR `items` (per-item config), not`\n- `both. `type` selects the capture kind per entry — only`\n- ``screenshot` and `scrape` are accepted (`recording` is`\n- `deactivated). Behaviour fields may be set per item or via`\n- ``defaults`; a per-item value overrides the matching default.`\n- `This includes `type`: an entry with no `type` of its own`\n- `inherits `defaults.type`, falling back to `screenshot` only`\n- `when neither is set.`\n- `The top-level object, each `items[]` entry, and `defaults``\n- `each reject unrecognized keys with a 422 `validation_error``\n- `(the offending key name appears in the error's `details``\n- `message text) rather than silently discarding them.`\n- ``items[]` and `defaults` do not share one field set`\n- ``device_scale_factor` is accepted only under `defaults` (a`\n- `per-item value 422s), and `duration`/`scenario` are accepted`\n- `only per item (a `defaults` value 422s). `metadata` is`\n- `different from those three: it is valid both at the top`\n- `level of the body and per item, but rejected with a 422 if`\n- `placed under `defaults`. See the `422` response below.`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `urls` — `list[str] | Unset` — Simple URL list. Provide urls OR items, not both.\n- `items` — `list[CreateBulkBodyItemsItem] | Unset` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `CreateBulkBodyDefaults | Unset` — Default behaviour applied to every entry unless the item overrides it.\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateBulkResponse202 | CreateBulkResponse403 | Error]\nsync(client=client, body=body) -> CreateBulkResponse202 | CreateBulkResponse403 | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateBulkResponse202 | CreateBulkResponse403 | Error]\nawait asyncio(client=client, body=body) -> CreateBulkResponse202 | CreateBulkResponse403 | Error | None\n```\n\n## Delete Bulk\n\nCancel a bulk job\n\nCancels an in-flight bulk job: drains its still-queued (pending) child jobs and refunds the quota\nheld for exactly those drained children. Children already completed, failed, or in progress are\nuntouched and keep their charge. Idempotent — cancelling an already-terminal job (completed, failed,\nor cancelled) is a no-op that returns 200 with the job's real, unchanged status and refunds nothing.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[DeleteBulkResponse200 | Error]\nsync(id=id, client=client) -> DeleteBulkResponse200 | Error | None\nawait asyncio_detailed(id=id, client=client) -> Response[DeleteBulkResponse200 | Error]\nawait asyncio(id=id, client=client) -> DeleteBulkResponse200 | Error | None\n```\n\n## Get Bulk\n\nGet bulk job status\n\nReturns the job envelope. Items are listed by `GET /v1/bulk/\\{id\\}/screenshots`.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/scrape/bulk` or `POST /v1/fetch/bulk` is found here too, not\na `404`, with that job's envelope. An id from another account answers `404`.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | GetBulkResponse200 | GetBulkResponse202]\nsync(id=id, client=client) -> Error | GetBulkResponse200 | GetBulkResponse202 | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | GetBulkResponse200 | GetBulkResponse202]\nawait asyncio(id=id, client=client) -> Error | GetBulkResponse200 | GetBulkResponse202 | None\n```\n\n## List Bulk Screenshots\n\nList bulk job items\n\nReturns the bulk job's items, discriminated by `type`.\n\n**Downloading item artifacts.** For a `completed` item with a storage key,\n`image_url` (`type: screenshot`) and both `content_url` and `markdown_url`\n(`type: scrape`) are **pre-signed** URLs, minted fresh on every read of\nthis endpoint and valid for **600 seconds (10 minutes)** —\nthe same signing lifetime as `content_url` on `GET /v1/fetch/bulk/\\{id\\}`.\nDownload inside that window, or re-poll this endpoint for a fresh\nsignature.\n\n**When no signature is minted.** Three cases mint none: an item that is not\n`completed`, a `completed` item with no storage key, and a `completed` item\nwhose object could not be signed — during an object-storage outage, for\ninstance. In all three the item's stored value is returned unchanged: `null`\nwhile nothing has been stored, and otherwise a **private, unsigned**\nobject-storage URL that answers `401`. These fields are neither nulled nor\nflagged in that case, so treat an artifact URL as usable only once you have\ndownloaded it, and re-poll for a fresh signature otherwise.\n`artifact_warnings` and its `artifact_unavailable` code describe the sibling\n`artifacts` object on `type: scrape` items only — they say nothing about\n`image_url`, `content_url`, or `markdown_url`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (str | Unset)`\n- `limit (int | Unset)`\n- `status (ListBulkScreenshotsStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | ListBulkScreenshotsResponse200]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | ListBulkScreenshotsResponse200 | None\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | ListBulkScreenshotsResponse200]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | ListBulkScreenshotsResponse200 | None\n```"
|
|
456
456
|
},
|
|
457
457
|
"sdk/python/client": {
|
|
458
458
|
"title": "Client",
|
|
459
459
|
"section": "SDK Reference",
|
|
460
|
-
"body": "# Client\n\nThe ByteKit Python SDK provides two client classes for making API requests.\n\nInstall the SDK, create a client, run a scrape and read the markdown:\n\n```python\n# pip install bytekit-sdk (import name: bytekit)\nimport os\n\nfrom bytekit import ByteKit\nfrom bytekit.models import ScrapeSuccessEnvelope\n\nclient = ByteKit(api_key=os.environ[\"BYTEKIT_API_KEY\"])\nresult = client.scrape.create(url=\"https://example.com\", formats=[\"markdown\"])\nif isinstance(result, ScrapeSuccessEnvelope):\n print(result.formats.markdown)\n```\n\n## Client\n\nA class for keeping track of data related to the API\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded. A connection that never gets established at\nall — DNS failure, refused connection, TLS handshake failure — raises its transport\nsibling httpx.ConnectError instead. Neither is caught by this SDK: both propagate to the\ncaller, on the generated operations and on ``AuthenticatedClient.search`` alike.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'Client'\n```\n\nGet a new client matching this one with a new timeout
|
|
460
|
+
"body": "# Client\n\nThe ByteKit Python SDK provides two client classes for making API requests.\n\nInstall the SDK, create a client, run a scrape and read the markdown:\n\n```python\n# pip install bytekit-sdk (import name: bytekit)\nimport os\n\nfrom bytekit import ByteKit\nfrom bytekit.models import ScrapeSuccessEnvelope\n\nclient = ByteKit(api_key=os.environ[\"BYTEKIT_API_KEY\"])\nresult = client.scrape.create(url=\"https://example.com\", formats=[\"markdown\"])\nif isinstance(result, ScrapeSuccessEnvelope):\n print(result.formats.markdown)\n```\n\n## Client\n\nA class for keeping track of data related to the API\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded. A connection that never gets established at\nall — DNS failure, refused connection, TLS handshake failure — raises its transport\nsibling httpx.ConnectError instead. Neither is caught by this SDK: both propagate to the\ncaller, on the generated operations and on ``AuthenticatedClient.search`` alike.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'Client'\n```\n\nGet a new client matching this one with a new timeout configuration\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> Self\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> Self\n```\n\nManually set the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set\n\n## AuthenticatedClient\n\nA Client which has been authenticated for use on secured endpoints\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded. A connection that never gets established at\nall — DNS failure, refused connection, TLS handshake failure — raises its transport\nsibling httpx.ConnectError instead. Neither is caught by this SDK: both propagate to the\ncaller, on the generated operations and on ``AuthenticatedClient.search`` alike.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\ntoken: The token to use for authentication. KEYWORD-ONLY.\nprefix: The prefix to use for the Authorization header. KEYWORD-ONLY.\nauth_header_name: The name of the Authorization header. KEYWORD-ONLY.\nAll three are keyword-only so that the pre-0.3.0 positional call\n``AuthenticatedClient(base_url, token)`` raises TypeError instead of\nsilently binding the base URL to ``token`` and the API key to ``prefix``.\n\n### search\n\n```python\nsearch(query: str, type: Optional[Union['CreateSearchBodyType', Literal['web', 'news', 'images']]] = None, limit: Optional[int] = None, country: Optional[str] = None, language: Optional[str] = None, date_range: Optional[Union['CreateSearchBodyDateRange', Literal['any', 'hour', 'day', 'week', 'month', 'year']]] = None) -> 'CreateSearchResponse200'\n```\n\nRun a web search and return ranked organic results.\n\nThin, statically-declared delegate to the hand-written ``_search`` appended at the\nbottom of this module; the full contract (argument semantics, the\n``errors.UnexpectedStatus`` guarantee) is documented there.\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with a new timeout configuration\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> Self\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> Self\n```\n\nManually set the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set"
|
|
461
461
|
},
|
|
462
462
|
"sdk/python/fetch": {
|
|
463
463
|
"title": "Fetch",
|
|
464
464
|
"section": "SDK Reference",
|
|
465
|
-
"body": "# Fetch\n\nFunctions for interacting with the `fetch` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Fetch\n\nFetch a URL (GET)\n\nDirect HTTP fetch. Metadata is returned in X-Fetch-* headers. What the body holds\ndepends on `X-Fetch-Fast-Path`. When it is `true`, a successful response returns the\nupstream response bytes verbatim. When it is `false` the request fell back to a browser\nrender, and the body is the rendered page rather than the bytes the target sent;\n`X-Fetch-Content-Length` is then the compressed size of that page. Non-2xx upstream\nresponses use the `upstream_error` JSON envelope with the upstream HTTP status.\n\n**Parameters**\n\n- `url_query (str)`\n- `country (
|
|
465
|
+
"body": "# Fetch\n\nFunctions for interacting with the `fetch` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Fetch\n\nFetch a URL (GET)\n\nDirect HTTP fetch. Metadata is returned in X-Fetch-* headers. What the body holds\ndepends on `X-Fetch-Fast-Path`. When it is `true`, a successful response returns the\nupstream response bytes verbatim. When it is `false` the request fell back to a browser\nrender, and the body is the rendered page rather than the bytes the target sent;\n`X-Fetch-Content-Length` is then the compressed size of that page. Non-2xx upstream\nresponses use the `upstream_error` JSON envelope with the upstream HTTP status.\n\n**Parameters**\n\n- `url_query (str)`\n- `country (str | Unset)`\n- `timeout_ms (int | Unset)`\n- `cache_ttl (GetFetchCacheTtlType1 | str | Unset)`\n- `custom (str | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Response[Error | str]\nsync(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Error | str | None\nawait asyncio_detailed(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Response[Error | str]\nawait asyncio(client=client, url_query=url_query, country=country, timeout_ms=timeout_ms, cache_ttl=cache_ttl, custom=custom) -> Error | str | None\n```\n\n## Post Fetch\n\nFetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body. The response is the same, including\nthe `X-Fetch-Fast-Path` rule for what the body holds: the upstream bytes verbatim when\nit is `true`, the rendered page when it is `false`.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (FetchRequest)`\n- `url` — `str`\n- `country` — `str | Unset` — Two-letter country code. Either case is accepted; the value is upper-cased.\n- `timeout_ms` — `int | Unset`\n- `cache_ttl` — `FetchRequestCacheTtlType1 | str | Unset` — How long a freshly fetched URL may be served from cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts `Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values receive a 422 validation_error with an actionable message.\n- `custom` — `FetchRequestCustom | Unset` — User-supplied JSON payload, base64-encoded into the `X-Fetch-Custom` response header so callers can correlate the response back to caller-side state (job IDs, batch metadata, etc.). Capped at 4096 UTF-8 bytes after JSON serialization. Does NOT affect cache-key inputs — two requests differing only in `custom` share the same cache slot.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Error | str]\nsync(client=client, body=body) -> Error | str | None\nawait asyncio_detailed(client=client, body=body) -> Response[Error | str]\nawait asyncio(client=client, body=body) -> Error | str | None\n```"
|
|
466
466
|
},
|
|
467
467
|
"sdk/python/fetch-bulk": {
|
|
468
468
|
"title": "Fetch Bulk",
|
|
469
469
|
"section": "SDK Reference",
|
|
470
|
-
"body": "# Fetch Bulk\n\nFunctions for interacting with the `fetch_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Fetch Bulk\n\nBulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (wait_for_selector, etc.).\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/fetch/bulk/\\{id\\}` whenever\n`recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 2 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 20 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's per-item override budget),\nwhich reaches 16.8 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 2 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (CreateFetchBulkBody)`\n- `urls` — `list[
|
|
470
|
+
"body": "# Fetch Bulk\n\nFunctions for interacting with the `fetch_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Fetch Bulk\n\nBulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (wait_for_selector, etc.).\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/fetch/bulk/\\{id\\}` whenever\n`recovery_required` is true.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 2 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 20 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's per-item override budget),\nwhich reaches 16.8 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 2 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (CreateFetchBulkBody)`\n- `urls` — `list[CreateFetchBulkBodyUrlsItemType1 | str]`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `defaults` — `CreateFetchBulkBodyDefaults | Unset`\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error]\nsync(client=client, body=body) -> CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error]\nawait asyncio(client=client, body=body) -> CreateFetchBulkResponse202 | CreateFetchBulkResponse403 | Error | None\n```\n\n## Get Fetch Bulk\n\nGet fetch bulk job status\n\nReturns the job envelope plus its per-URL items.\n\n**Downloading item content.** Each completed item's `content_url` is a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **600 seconds (10 minutes)** — the same signing lifetime as the\n`image_url` returned by `GET /v1/bulk/\\{id\\}/screenshots`. The underlying\nobjects are private, so an unsigned URL returns `401`: download the\ncontent inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, or completed items whose object cannot be signed, carry\n`null`; the latter report `artifact_unavailable`. The private unsigned\nstorage URL is never returned.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/scrape/bulk` or `POST /v1/bulk` is found here too, not a\n`404`, with the job envelope and `items: []`: only items fetched through\n`POST /v1/fetch/bulk` are listed. An id from another account answers `404`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (str | Unset)`\n- `limit (int | Unset)`\n- `status (GetFetchBulkStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetFetchBulkResponse200 | GetFetchBulkResponse202]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetFetchBulkResponse200 | GetFetchBulkResponse202 | None\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetFetchBulkResponse200 | GetFetchBulkResponse202]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetFetchBulkResponse200 | GetFetchBulkResponse202 | None\n```"
|
|
471
471
|
},
|
|
472
472
|
"sdk/python/monitors": {
|
|
473
473
|
"title": "Monitors",
|
|
474
474
|
"section": "SDK Reference",
|
|
475
|
-
"body": "# Monitors\n\nFunctions for interacting with the `monitors` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\nFirst-capture behavior is the same for both monitor types: the first capture is a silent baseline (`has_change=False`, `change_pct=None`) with no `change_detected` webhook, whether the monitor is `scrape` or `screenshot`. From the second capture onward both types diff against the previous capture.\n\n## Create Monitor\n\nCreate a change-detection monitor\n\nCreates a recurring change-detection monitor for a URL, delivering results via webhook.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (MonitorCreateRequest)`\n- `url` — `str`\n- `interval_type` — `MonitorCreateRequestIntervalType`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `type_` — `
|
|
475
|
+
"body": "# Monitors\n\nFunctions for interacting with the `monitors` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\nFirst-capture behavior is the same for both monitor types: the first capture is a silent baseline (`has_change=False`, `change_pct=None`) with no `change_detected` webhook, whether the monitor is `scrape` or `screenshot`. From the second capture onward both types diff against the previous capture.\n\n## Create Monitor\n\nCreate a change-detection monitor\n\nCreates a recurring change-detection monitor for a URL, delivering results via webhook.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (MonitorCreateRequest)`\n- `url` — `str`\n- `interval_type` — `MonitorCreateRequestIntervalType`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `type_` — `MonitorCreateRequestType | Unset`\n- `cron_expression` — `str | Unset` — 5-field cron expression. Required when interval_type is \"cron\".\n- `change_threshold` — `float | Unset`\n- `notify_on` — `MonitorCreateRequestNotifyOn | Unset`\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `webhook_headers` — `MonitorCreateRequestWebhookHeaders | Unset` — Max 20 headers. Keys must match /^[A-Za-z0-9-]+$/ and not be reserved.\n- `options` — `MonitorCreateRequestOptions | Unset` — Screenshot monitor options (device, viewport, format, etc.).\n- `scrape_options` — `MonitorCreateRequestScrapeOptions | Unset` — Scrape monitor options (formats, country, wait_for_selector, wait_until, delay_ms). Only for type=scrape.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Error | MonitorCreateResponse]\nsync(client=client, body=body) -> Error | MonitorCreateResponse | None\nawait asyncio_detailed(client=client, body=body) -> Response[Error | MonitorCreateResponse]\nawait asyncio(client=client, body=body) -> Error | MonitorCreateResponse | None\n```\n\n## Delete Monitor\n\nCancel monitor\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Any | Error]\nsync(id=id, client=client) -> Any | Error | None\nawait asyncio_detailed(id=id, client=client) -> Response[Any | Error]\nawait asyncio(id=id, client=client) -> Any | Error | None\n```\n\n## Get Monitor\n\nGet monitor\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | MonitorResponse]\nsync(id=id, client=client) -> Error | MonitorResponse | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | MonitorResponse]\nawait asyncio(id=id, client=client) -> Error | MonitorResponse | None\n```\n\n## List Monitor Captures\n\nList monitor captures\n\n**Parameters**\n\n- `id (str)`\n- `limit (int | Unset)`\n- `cursor (str | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, limit=limit, cursor=cursor) -> Response[Error | ListMonitorCapturesResponse200]\nsync(id=id, client=client, limit=limit, cursor=cursor) -> Error | ListMonitorCapturesResponse200 | None\nawait asyncio_detailed(id=id, client=client, limit=limit, cursor=cursor) -> Response[Error | ListMonitorCapturesResponse200]\nawait asyncio(id=id, client=client, limit=limit, cursor=cursor) -> Error | ListMonitorCapturesResponse200 | None\n```\n\n## List Monitors\n\nList monitors\n\n**Parameters**\n\n- `limit (int | Unset)`\n- `cursor (str | Unset)`\n- `status (ListMonitorsStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, limit=limit, cursor=cursor, status=status) -> Response[Error | ListMonitorsResponse200]\nsync(client=client, limit=limit, cursor=cursor, status=status) -> Error | ListMonitorsResponse200 | None\nawait asyncio_detailed(client=client, limit=limit, cursor=cursor, status=status) -> Response[Error | ListMonitorsResponse200]\nawait asyncio(client=client, limit=limit, cursor=cursor, status=status) -> Error | ListMonitorsResponse200 | None\n```\n\n## Update Monitor\n\nUpdate monitor\n\n**Parameters**\n\n- `id (str)`\n- `body (MonitorUpdateRequest)`\n- `url` — `str | Unset`\n- `interval_type` — `MonitorUpdateRequestIntervalType | Unset`\n- `cron_expression` — `str | Unset`\n- `change_threshold` — `float | Unset`\n- `notify_on` — `MonitorUpdateRequestNotifyOn | Unset`\n- `webhook_url` — `str | Unset` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `webhook_headers` — `MonitorUpdateRequestWebhookHeaders | Unset`\n- `status` — `MonitorUpdateRequestStatus | Unset`\n- `options` — `MonitorUpdateRequestOptions | Unset`\n- `scrape_options` — `MonitorUpdateRequestScrapeOptions | Unset`\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, body=body) -> Response[Error | MonitorResponse]\nsync(id=id, client=client, body=body) -> Error | MonitorResponse | None\nawait asyncio_detailed(id=id, client=client, body=body) -> Response[Error | MonitorResponse]\nawait asyncio(id=id, client=client, body=body) -> Error | MonitorResponse | None\n```"
|
|
476
476
|
},
|
|
477
477
|
"sdk/python/scrape": {
|
|
478
478
|
"title": "Scrape",
|
|
479
479
|
"section": "SDK Reference",
|
|
480
|
-
"body": "# Scrape\n\nFunctions for interacting with the `scrape` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Scrape\n\nScrape a URL\n\nFetches and processes a URL, returning content in one or more formats wrapped in a ScrapeEnvelope.\n\n**The response shape is decided by your request, not by how we route it.** In precedence order:\n\n1. `async: true` in the body, or `?async=true` in the query string (either one is enough; `false` in\none never cancels `true` in the other) → **202** with a `ScrapeQueuedEnvelope` receipt, returned\nimmediately. Poll `GET /v1/scrape/\\{id\\}` for the result.\n2. Otherwise, a request that needs a full page render — today that is `delay_ms > 0` — is **held\nopen** until the render reaches a terminal state, then returns **200** with the content envelope\n(`success` or `failed`). If the render is still running when the hold window expires (28 seconds by\ndefault), the request returns the **202** receipt instead and the job continues in the background.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content\nenvelope, typically in under a second.\n\n**A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or\na target whose bot protection defeats every proxy tier all come back on the same **200** as a\n`failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A\nfailure the fast path decides inline is recorded as a failed job, so its envelope normally carries\nthat job's `id` and `GET /v1/scrape/\\{id\\}` returns the same envelope; if recording the failed job\nitself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is\nnothing to poll. A failure a held render reaches carries that render's real `id`. Either way the\nrequest transfers no billable bytes and is charged nothing.\n\n**A target that rate-limits us is not ByteKit rate-limiting you.** The `failed` envelope's\n`error.code` is `target_rate_limited` when the target rate-limits the request. On the fast path that\nmeans our proxy attempts end on an HTTP 429 and no bot protection is identified on any attempt, even\nif the browser fallback then fails or reaches only an unidentified block page; the inline failure\ncarries `error.retry_after_seconds` when the target sent a usable `Retry-After`. On a held render\nthe browser's own answer decides: it observes a 429 on the page itself, or it fails outright after\nthe proxy attempts ended on an HTTP 429. A bot-protection verdict on an earlier fetch attempt does\nnot keep a held render `blocked` when the browser then observes the 429. A held render never carries\n`error.retry_after_seconds`. Retrying a `target_rate_limited` failure later is likely to work. A\nheld render whose browser reaches an unidentified 403 or 503 page after a proxy 429 is `blocked`. A\n429 that bot protection sends as a block stays `blocked` when it is the answer that decides the\ncode: the fast path's proxy attempts, or the browser render on a held render. Your own per-key limit\nis a separate case: it answers HTTP 429 `rate_limited` with a `Retry-After` header (see the `429`\nresponse).\n\nSo a 202 means one of exactly two things: you asked for one with `async: true` or `?async=true`, or\nthe hold window expired. `wait_for_selector` and `wait_until` are `ScreenshotRequest` options, not\n`ScrapeRequest` options — sending either to this endpoint returns `422 validation_error`, so neither\ncan produce a 202 here.\n\n**Parameters**\n\n- `async_ (Union[Unset, bool])`\n- `body (ScrapeRequest)`\n- `url` — `str`\n- `formats` — `Union[Unset, list[Union['ScrapeRequestJsonFormat', ScrapeRequestFormatsItem]]]` — What to return. Each entry is either a string format (`raw`, `markdown`, `links` or `images`) or a `json` object entry that extracts structured data from the page. The string `\"json\"` is not a format value; the `json` entry is an object, described by `ScrapeRequestJsonFormat`. A list may hold at most one `json` entry, and a list holding only the `json` entry still captures `raw`. The `json` entry is accepted on `POST /v1/scrape`, `POST /v1/scrape/bulk` and `POST /v1/bulk` (scrape entries); monitor `formats` accept the string formats alone. Its result is `formats.json` on the response, and its charge is described on `ScrapeRequestJsonFormat`.\n- `country` — `Union[Unset, str]`\n- `delay_ms` — `Union[Unset, int]` — Milliseconds to wait after page load before capturing, for content that renders late. Any value above 0 puts the request on the full browser render path. Unless `async: true` is also set, the request is then HELD until the render finishes and returns 200 with the content envelope, or returns the 202 receipt if the hold window expires first. `0` (the default) keeps the request on the fast HTTP path, which returns 200 in one round trip.\n- `timeout_ms` — `Union[Unset, int]`\n- `async_` — `Union[Unset, bool]` — When true, the request returns 202 with a `ScrapeQueuedEnvelope` receipt immediately and the scrape runs in the background; poll `GET /v1/scrape/\\{id\\}` for the result. The `?async=true` query parameter is a second spelling of this field: the request is async when either one says true, and `false` in one never cancels `true` in the other. Asking for a receipt this way outranks every routing consequence: when neither is set (the default) a browser-path request is held to completion instead of being receipted. A 202 can still arrive without either, but only when the hold window expires.\n- `webhook_url` — `Union[Unset, str]` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `events` — `Union[Unset, list[ScrapeRequestEventsItem]]` — Webhook event types to deliver when webhook_url is set. Defaults to all three (queued, completed, failed); send an explicit subset to receive fewer.\n- `markdown_mode` — `Union[Unset, ScrapeRequestMarkdownMode]` — Markdown processing mode. article=article extraction (default), raw=minimal cleanup, llm=compact LLM-optimised output.\n- `markdown_query` — `Union[Unset, str]` — BM25 query string for relevance-ranked content filtering. Omit or leave empty to disable.\n- `markdown_links` — `Union[Unset, ScrapeRequestMarkdownLinks]` — Link rendering style in the markdown output. 'inline' (default) keeps `[text](url)` as-is. 'text' strips URLs, keeping only anchor text. 'none' strips URLs and removes reference definitions. 'references' converts to numbered `[text][N]` refs with a Links footer.\n- `markdown_images` — `Union[Unset, ScrapeRequestMarkdownImages]` — Image retention mode in the markdown output. 'inline' (default) keeps `` as-is. 'text' strips the URL, keeping only alt text. 'none' removes images entirely. 'references' converts to numbered `![alt][N]` refs with an Images footer. Distinct from markdown_filter_images (which drops low-signal images before conversion).\n- `with_links_summary` — `Union[Unset, bool]` — When true, appends a 'Links:\\n[1]: url\\n...' footer to the markdown output, built from the extracted link list. Automatically enabled when markdown_links is 'references'.\n- `with_images_summary` — `Union[Unset, bool]` — When true, appends an 'Images:\\n[1]: url\\n...' footer to the markdown output, built from the extracted image list.\n- `markdown_compact` — `Union[Unset, bool]` — Collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — `Union[Unset, bool]` — Filter low-signal images from the markdown output.\n- `markdown_include_media` — `Union[Unset, bool]` — When true, `formats.links` and `formats.images` return `ScrapeScoredLink[]` / `ScrapeScoredImage[]` (rich objects) instead of `string[]`, and a top-level `tables` array is included. Only effective when `markdown` is in `formats`.\n- `markdown_include_warnings` — `Union[Unset, bool]` — When true, enables markdown-pipeline and tag-filter warnings for requests that include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may appear independently of this flag.\n- `markdown_include_stats` — `Union[Unset, bool]` — When true, the response includes a top-level `stats` object with `ScrapeStats` (chars, tokens, blocks). Only effective when `markdown` is in `formats`.\n- `token_budget` — `Union[Unset, int]` — Maximum token count for the markdown output. When set and `markdown` is in `formats`, the output is truncated at the last paragraph → sentence → token boundary that keeps the estimated count under this limit. Absent → no truncation. Triggers a `markdown_tokens` field in the response.\n- `token_encoding` — `Union[Unset, ScrapeRequestTokenEncoding]` — Tokenizer encoding hint for `token_budget`. `cl100k_base` (default) matches GPT-4/4o; `o200k_base` matches GPT-4o-mini / o-series. Both use the same 4-char/token heuristic internally.\n- `mobile` — `Union[Unset, bool]` — When true, emulate a mobile device — the request uses a mobile (Android) user agent and a mobile viewport, so the upstream serves the mobile version of the page. Default false (desktop). The value is part of the cache key, so mobile and desktop responses are cached independently.\n- `solve_challenge` — `Union[Unset, bool]` — Attempts to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render.\n- `remove_base64_images` — `Union[Unset, bool]` — When true (default), base64-encoded `data:` image sources are stripped from the HTML before markdown conversion. Set to false to preserve base64 images in the pipeline output. Does not affect `raw`, which always returns the original source unchanged.\n- `include_tags` — `Union[Unset, list[str]]` — HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in the `markdown` output. Applied before `exclude_tags`. Does not affect `raw`, which always returns the full page.\n- `exclude_tags` — `Union[Unset, list[str]]` — HTML element names (not CSS selectors) to strip from the `markdown` output. Applied after `include_tags` when both are present. Does not affect `raw`, which always returns the full page.\n- `cache_ttl` — `Union[ScrapeRequestCacheTtlType1, Unset, str]` — How long a freshly fetched URL may be served from cache. `0` (string or integer) skips the cache read; cache-eligible results are still written. `Nh`/`Nd` set a TTL (capped at 168 h / 7 d). Safety-classified WAF husks are returned live but never stored in the shared cache. Honoured on both the synchronous and asynchronous paths; the async success envelope reports the lookup outcome via the `cache` field.\n- `custom` — `Union[Unset, ScrapeRequestCustom]` — User-supplied JSON payload, echoed back on the success envelope (sync, async, webhook). Capped at 4096 UTF-8 bytes (`Buffer.byteLength`). Distinct from the system-owned `metadata` column. Does NOT affect cache-key inputs — two requests differing only in `custom` resolve to the same cache entry.\n- `clean_markdown` — `Union[Unset, bool]` — When `true` and `markdown` is in `formats`, the converted markdown is sent to Groq LLM for cleaning (boilerplate removal, ad stripping, formatting improvement) before being returned. Graceful degradation: any Groq failure (key unset, 4xx/5xx, timeout, empty response) returns the raw markdown unchanged plus a warning in the `warnings` array. Billing: 3× credits and bytes applied only when cleaning succeeds.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\nsync(client=client, body=body, async_=async_) -> Optional[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio(client=client, body=body, async_=async_) -> Optional[Union[Error, ScrapeQueuedEnvelope, Union['ScrapeErrorEnvelope', 'ScrapeSuccessEnvelope']]]\n```\n\n## Get Scrape\n\nGet scrape result\n\nAlways returns 200. Check the `status` discriminator for the scrape state.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\nsync(id=id, client=client) -> Optional[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, Union['ScrapeErrorEnvelope', 'ScrapeQueuedEnvelope', 'ScrapeSuccessEnvelope']]]\n```"
|
|
480
|
+
"body": "# Scrape\n\nFunctions for interacting with the `scrape` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Scrape\n\nScrape a URL\n\nFetches and processes a URL, returning content in one or more formats wrapped in a ScrapeEnvelope.\n\n**The response shape is decided by your request, not by how we route it.** In precedence order:\n\n1. `async: true` in the body, or `?async=true` in the query string (either one is enough; `false` in\none never cancels `true` in the other) → **202** with a `ScrapeQueuedEnvelope` receipt, returned\nimmediately. Poll `GET /v1/scrape/\\{id\\}` for the result.\n2. Otherwise, a request that needs a full page render — today that is `delay_ms > 0` — is **held\nopen** until the render reaches a terminal state, then returns **200** with the content envelope\n(`success` or `failed`). If the render is still running when the hold window expires (28 seconds by\ndefault), the request returns the **202** receipt instead and the job continues in the background.\n3. Otherwise the request is served by the fast HTTP path and returns **200** with the content\nenvelope, typically in under a second.\n\n**A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or\na target whose bot protection defeats every proxy tier all come back on the same **200** as a\n`failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A\nfailure the fast path decides inline is recorded as a failed job, so its envelope normally carries\nthat job's `id` and `GET /v1/scrape/\\{id\\}` returns the same envelope; if recording the failed job\nitself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is\nnothing to poll. A failure a held render reaches carries that render's real `id`. Either way the\nrequest transfers no billable bytes and is charged nothing.\n\n**A target that rate-limits us is not ByteKit rate-limiting you.** The `failed` envelope's\n`error.code` is `target_rate_limited` when the target rate-limits the request. On the fast path that\nmeans our proxy attempts end on an HTTP 429 and no bot protection is identified on any attempt, even\nif the browser fallback then fails or reaches only an unidentified block page; the inline failure\ncarries `error.retry_after_seconds` when the target sent a usable `Retry-After`. On a held render\nthe browser's own answer decides: it observes a 429 on the page itself, or it fails outright after\nthe proxy attempts ended on an HTTP 429. A bot-protection verdict on an earlier fetch attempt does\nnot keep a held render `blocked` when the browser then observes the 429. A held render never carries\n`error.retry_after_seconds`. Retrying a `target_rate_limited` failure later is likely to work. A\nheld render whose browser reaches an unidentified 403 or 503 page after a proxy 429 is `blocked`. A\n429 that bot protection sends as a block stays `blocked` when it is the answer that decides the\ncode: the fast path's proxy attempts, or the browser render on a held render. Your own per-key limit\nis a separate case: it answers HTTP 429 `rate_limited` with a `Retry-After` header (see the `429`\nresponse).\n\nSo a 202 means one of exactly two things: you asked for one with `async: true` or `?async=true`, or\nthe hold window expired. `wait_for_selector` and `wait_until` are `ScreenshotRequest` options, not\n`ScrapeRequest` options — sending either to this endpoint returns `422 validation_error`, so neither\ncan produce a 202 here.\n\n**Parameters**\n\n- `async_ (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 `` as-is. 'text' strips the URL, keeping only alt text. 'none' removes images entirely. 'references' converts to numbered `![alt][N]` refs with an Images footer. Distinct from markdown_filter_images (which drops low-signal images before conversion).\n- `with_links_summary` — `bool | Unset` — When true, appends a 'Links:\\n[1]: url\\n...' footer to the markdown output, built from the extracted link list. Automatically enabled when markdown_links is 'references'.\n- `with_images_summary` — `bool | Unset` — When true, appends an 'Images:\\n[1]: url\\n...' footer to the markdown output, built from the extracted image list.\n- `markdown_compact` — `bool | Unset` — Collapse excessive whitespace for a more compact output.\n- `markdown_filter_images` — `bool | Unset` — Filter low-signal images from the markdown output.\n- `markdown_include_media` — `bool | Unset` — When true, `formats.links` and `formats.images` return `ScrapeScoredLink[]` / `ScrapeScoredImage[]` (rich objects) instead of `string[]`, and a top-level `tables` array is included. Only effective when `markdown` is in `formats`.\n- `markdown_include_warnings` — `bool | Unset` — When true, enables markdown-pipeline and tag-filter warnings for requests that include the `markdown` format. Artifact availability warnings such as `artifact_unavailable` may appear independently of this flag.\n- `markdown_include_stats` — `bool | Unset` — When true, the response includes a top-level `stats` object with `ScrapeStats` (chars, tokens, blocks). Only effective when `markdown` is in `formats`.\n- `token_budget` — `int | Unset` — Maximum token count for the markdown output. When set and `markdown` is in `formats`, the output is truncated at the last paragraph → sentence → token boundary that keeps the estimated count under this limit. Absent → no truncation. Triggers a `markdown_tokens` field in the response.\n- `token_encoding` — `ScrapeRequestTokenEncoding | Unset` — Tokenizer encoding hint for `token_budget`. `cl100k_base` (default) matches GPT-4/4o; `o200k_base` matches GPT-4o-mini / o-series. Both use the same 4-char/token heuristic internally.\n- `mobile` — `bool | Unset` — When true, emulate a mobile device — the request uses a mobile (Android) user agent and a mobile viewport, so the upstream serves the mobile version of the page. Default false (desktop). The value is part of the cache key, so mobile and desktop responses are cached independently.\n- `solve_challenge` — `bool | Unset` — Attempts to clear a Cloudflare challenge; success is not guaranteed. Billed as a normal browser render.\n- `remove_base64_images` — `bool | Unset` — When true (default), base64-encoded `data:` image sources are stripped from the HTML before markdown conversion. Set to false to preserve base64 images in the pipeline output. Does not affect `raw`, which always returns the original source unchanged.\n- `include_tags` — `list[str] | Unset` — HTML element names (not CSS selectors) to keep. When non-empty, only content within these elements is included in the `markdown` output. Applied before `exclude_tags`. Does not affect `raw`, which always returns the full page.\n- `exclude_tags` — `list[str] | Unset` — HTML element names (not CSS selectors) to strip from the `markdown` output. Applied after `include_tags` when both are present. Does not affect `raw`, which always returns the full page.\n- `cache_ttl` — `ScrapeRequestCacheTtlType1 | str | Unset` — How long a freshly fetched URL may be served from cache. `0` (string or integer) skips the cache read; cache-eligible results are still written. `Nh`/`Nd` set a TTL (capped at 168 h / 7 d). Safety-classified WAF husks are returned live but never stored in the shared cache. Honoured on both the synchronous and asynchronous paths; the async success envelope reports the lookup outcome via the `cache` field.\n- `custom` — `ScrapeRequestCustom | Unset` — User-supplied JSON payload, echoed back on the success envelope (sync, async, webhook). Capped at 4096 UTF-8 bytes (`Buffer.byteLength`). Distinct from the system-owned `metadata` column. Does NOT affect cache-key inputs — two requests differing only in `custom` resolve to the same cache entry.\n- `clean_markdown` — `bool | Unset` — When `true` and `markdown` is in `formats`, the converted markdown is sent to Groq LLM for cleaning (boilerplate removal, ad stripping, formatting improvement) before being returned. Graceful degradation: any Groq failure (key unset, 4xx/5xx, timeout, empty response) returns the raw markdown unchanged plus a warning in the `warnings` array. Billing: 3× credits and bytes applied only when cleaning succeeds.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope]\nsync(client=client, body=body, async_=async_) -> Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope | None\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope]\nawait asyncio(client=client, body=body, async_=async_) -> Error | ScrapeErrorEnvelope | ScrapeSuccessEnvelope | ScrapeQueuedEnvelope | None\n```\n\n## Get Scrape\n\nGet scrape result\n\nAlways returns 200. Check the `status` discriminator for the scrape state.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope]\nsync(id=id, client=client) -> Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope]\nawait asyncio(id=id, client=client) -> Error | ScrapeErrorEnvelope | ScrapeQueuedEnvelope | ScrapeSuccessEnvelope | None\n```"
|
|
481
481
|
},
|
|
482
482
|
"sdk/python/scrape-bulk": {
|
|
483
483
|
"title": "Scrape Bulk",
|
|
484
484
|
"section": "SDK Reference",
|
|
485
|
-
"body": "# Scrape Bulk\n\nFunctions for interacting with the `scrape_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Scrape Bulk\n\nBulk scrape URLs\n\nEnqueues multiple URLs for scraping. Results delivered via webhook.\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/scrape/bulk/\\{id\\}` whenever\n`recovery_required` is true.\n\n**Unknown keys.** An unknown key on an `items[]` entry, or at the top level of\nthe body, is rejected with `422 validation_error`. An unknown key inside\n`defaults` is not: it is dropped without a warning and the request is accepted\nwith `202`. The exception is `cookies` and `headers`, on an item or in `defaults`: they\nanswer `400 validation_error`.\n\n**Parameters**\n\n- `body (CreateScrapeBulkBody)`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `urls` — `
|
|
485
|
+
"body": "# Scrape Bulk\n\nFunctions for interacting with the `scrape_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Scrape Bulk\n\nBulk scrape URLs\n\nEnqueues multiple URLs for scraping. Results delivered via webhook.\nCompletion deliveries use `X-ByteKit-Event: bulk.completed` and the\n`BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,\nfollowed by cursor recovery through `GET /v1/scrape/bulk/\\{id\\}` whenever\n`recovery_required` is true.\n\n**Unknown keys.** An unknown key on an `items[]` entry, or at the top level of\nthe body, is rejected with `422 validation_error`. An unknown key inside\n`defaults` is not: it is dropped without a warning and the request is accepted\nwith `202`. The exception is `cookies` and `headers`, on an item or in `defaults`: they\nanswer `400 validation_error`.\n\n**Parameters**\n\n- `body (CreateScrapeBulkBody)`\n- `webhook_url` — `str` — Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)\n- `urls` — `list[str] | Unset` — Simple URL list. Provide urls OR items, not both.\n- `items` — `list[CreateScrapeBulkBodyItemsItem] | Unset` — Per-item configs. Provide urls OR items, not both.\n- `defaults` — `CreateScrapeBulkBodyDefaults | Unset`\n- `webhook_secret` — `str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook- Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n- `custom` — `CreateScrapeBulkBodyCustom | Unset` — Top-level user-supplied JSON payload, capped at 4096 UTF-8 bytes. Applied to every scrape-type entry that does not provide its own per-entry `custom` (the per-entry value wins). Echoed on each entry's success envelope in the bulk results response (the key is omitted when no `custom` was supplied at either level). Distinct from the system-owned `metadata` column and never used as a cache-key input.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error]\nsync(client=client, body=body) -> CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error]\nawait asyncio(client=client, body=body) -> CreateScrapeBulkResponse202 | CreateScrapeBulkResponse403 | Error | None\n```\n\n## Get Scrape Bulk\n\nGet scrape bulk job status\n\nReturns the job envelope plus its rehydrated per-URL scrape envelopes.\n\n**Downloading item content.** A `raw` or `markdown` artifact within the\n10-MiB inline cap is returned inline. An oversized one is replaced by a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **86400 seconds (24 hours)**. The underlying objects are private, so an\nunsigned URL returns `401`: download the content inside that window, or\nre-poll this endpoint for a fresh signature. An artifact that was never\nstored, or whose object cannot be signed, is omitted from `formats` and\nreported as `artifact_unavailable` in `warnings`. The private unsigned\nstorage URL is never returned.\n\n**Cancelled by the platform.** When the account can no longer spend (its bandwidth\nbalance is exhausted, or the account is deleted) while items are still pending, ByteKit\ncancels the job itself. It then reads `status: cancelled` even though you never called\n`DELETE /v1/bulk/\\{id\\}`, and the cancellation sends no webhook.\n\n**Job ids from other create routes.** The job is looked up by account only, so the id\nof a job created by `POST /v1/fetch/bulk` or `POST /v1/bulk` is found here too, not a `404`.\nThe items listed are the job's scrape rows: a fetch-bulk job's items appear, and a\n`POST /v1/bulk` job shows its scrape items but not its screenshots. An id from another\naccount answers `404`.\n\n**Parameters**\n\n- `id (str)`\n- `cursor (str | Unset)`\n- `limit (int | Unset)`\n- `status (GetScrapeBulkStatus | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202]\nsync(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202 | None\nawait asyncio_detailed(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Response[Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202]\nawait asyncio(id=id, client=client, cursor=cursor, limit=limit, status=status) -> Error | GetScrapeBulkResponse200 | GetScrapeBulkResponse202 | None\n```"
|
|
486
486
|
},
|
|
487
487
|
"sdk/python/screenshots": {
|
|
488
488
|
"title": "Screenshots",
|
|
489
489
|
"section": "SDK Reference",
|
|
490
|
-
"body": "# Screenshots\n\nFunctions for interacting with the `screenshots` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Screenshot\n\nCapture a screenshot\n\nSync by default (holds up to 28s). Pass `async: true` in the body or `?async=true` in the\nquery string to return 202 immediately; either one is enough, and `false` in one never\ncancels `true` in the other.\nPoll via GET /v1/screenshots/\\{id\\}.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `async_ (
|
|
490
|
+
"body": "# Screenshots\n\nFunctions for interacting with the `screenshots` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Screenshot\n\nCapture a screenshot\n\nSync by default (holds up to 28s). Pass `async: true` in the body or `?async=true` in the\nquery string to return 202 immediately; either one is enough, and `false` in one never\ncancels `true` in the other.\nPoll via GET /v1/screenshots/\\{id\\}.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `async_ (bool | Unset)`\n- `body (ScreenshotRequest)`\n- `url` — `str`\n- `device` — `ScreenshotRequestDevice | Unset`\n- `viewport` — `None | Unset | Viewport`\n- `async_` — `bool | Unset` — When true, the request returns 202 immediately and the screenshot is captured in the background; poll `GET /v1/screenshots/\\{id\\}`. The `?async=true` query parameter is a second spelling of this field: the request is async when either one says true, and `false` in one never cancels `true` in the other.\n- `full_page` — `bool | Unset`\n- `format_` — `ScreenshotRequestFormat | Unset`\n- `quality` — `int | Unset`\n- `block_ads` — `bool | Unset`\n- `block_cookie_banners` — `bool | Unset`\n- `wait_until` — `ScreenshotRequestWaitUntil | Unset`\n- `wait_for_selector` — `None | str | Unset`\n- `delay_ms` — `int | Unset`\n- `scroll` — `bool | Unset`\n- `clip` — `Clip | None | Unset`\n- `dark_mode` — `bool | Unset`\n- `device_scale_factor` — `None | ScreenshotRequestDeviceScaleFactorType1 | ScreenshotRequestDeviceScaleFactorType2Type1 | ScreenshotRequestDeviceScaleFactorType3Type1 | Unset`\n- `include_html` — `bool | Unset`\n- `country` — `str | Unset`\n- `language` — `None | str | Unset`\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Error | Error | ScreenshotResponse | ScreenshotResponse]\nsync(client=client, body=body, async_=async_) -> Error | Error | ScreenshotResponse | ScreenshotResponse | None\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Error | Error | ScreenshotResponse | ScreenshotResponse]\nawait asyncio(client=client, body=body, async_=async_) -> Error | Error | ScreenshotResponse | ScreenshotResponse | None\n```\n\n## Get Screenshot\n\nGet screenshot status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | Error | ScreenshotResponse | ScreenshotResponse]\nsync(id=id, client=client) -> Error | Error | ScreenshotResponse | ScreenshotResponse | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | Error | ScreenshotResponse | ScreenshotResponse]\nawait asyncio(id=id, client=client) -> Error | Error | ScreenshotResponse | ScreenshotResponse | None\n```"
|
|
491
491
|
},
|
|
492
492
|
"sdk/python/search": {
|
|
493
493
|
"title": "Search",
|
|
494
494
|
"section": "SDK Reference",
|
|
495
|
-
"body": "# Search\n\nFunctions for interacting with the `search` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Search\n\nSearch the web\n\nRuns a web search for `query` and returns ranked organic results with\ncontiguous `position` values from 1.\n\nUse `limit` (1–100, default 10) to request more results in a single\ncall. Results are fetched in pages of 10, so a call consumes\n`ceil(limit / 10)` credits (capped at 10) from the account's monthly\ncredits bucket — for example `limit=10` costs 1 credit and `limit=35`\ncosts 4. Credits are charged for every page fetched regardless of how\nmany results a page returns. The credit count is reported as\n`credits_used` in the response.\n\n**Parameters**\n\n- `body (CreateSearchBody)`\n- `query` — `str` — The search query, up to 2048 characters.\n- `type_` — `
|
|
495
|
+
"body": "# Search\n\nFunctions for interacting with the `search` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Search\n\nSearch the web\n\nRuns a web search for `query` and returns ranked organic results with\ncontiguous `position` values from 1.\n\nUse `limit` (1–100, default 10) to request more results in a single\ncall. Results are fetched in pages of 10, so a call consumes\n`ceil(limit / 10)` credits (capped at 10) from the account's monthly\ncredits bucket — for example `limit=10` costs 1 credit and `limit=35`\ncosts 4. Credits are charged for every page fetched regardless of how\nmany results a page returns. The credit count is reported as\n`credits_used` in the response.\n\n**Parameters**\n\n- `body (CreateSearchBody)`\n- `query` — `str` — The search query, up to 2048 characters.\n- `type_` — `CreateSearchBodyType | Unset` — Which search index to query. `web` (default) returns ranked organic results; `news` returns news articles in the same `results` array, additionally populating `source` and `image` on each item; `images` returns image results, populating `source`, `domain`, and a fuller `image` object (full- image dimensions plus a thumbnail URL and dimensions) while omitting `snippet` and `date`. Billing is identical for all three.\n- `limit` — `int | Unset` — Maximum number of organic results to return. Results are fetched in pages of 10, so the call costs `ceil(limit / 10)` credits (capped at 10).\n- `country` — `str | Unset` — Two-letter country code to localize results (e.g. `us`, `de`), normalized to lowercase. Defaults to `us`.\n- `language` — `str | Unset` — Two-letter ISO-639-1 language code for results (e.g. `en`, `fr`), normalized to lowercase. Defaults to `en`.\n- `date_range` — `CreateSearchBodyDateRange | Unset` — Restrict results to a recency window: `any` (default, no time filter), `hour` (past hour), `day` (past 24 hours), `week` (past week), `month` (past month), or `year` (past year). Applies identically to every `type`; billing is unchanged.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[CreateSearchResponse200 | CreateSearchResponse503 | Error | Error]\nsync(client=client, body=body) -> CreateSearchResponse200 | CreateSearchResponse503 | Error | Error | None\nawait asyncio_detailed(client=client, body=body) -> Response[CreateSearchResponse200 | CreateSearchResponse503 | Error | Error]\nawait asyncio(client=client, body=body) -> CreateSearchResponse200 | CreateSearchResponse503 | Error | Error | None\n```"
|
|
496
496
|
},
|
|
497
497
|
"sdk/python/sitemap": {
|
|
498
498
|
"title": "Sitemap",
|
|
499
499
|
"section": "SDK Reference",
|
|
500
|
-
"body": "# Sitemap\n\nFunctions for interacting with the `sitemap` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Sitemap\n\nDiscover URLs on a domain\n\nCrawls a domain to build a sitemap. Returns cached results if available\nwithin cache_ttl. Results delivered via webhook and downloadable from results_url.\nWebhook deliveries include `X-ByteKit-Event: sitemap.completed` or\n`X-ByteKit-Event: sitemap.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\nThe webhook body is `\\{ event, data \\}`. For a job the worker ran, `data` is not a\n`SitemapResponse`:\n\n- `sitemap.completed` `data` carries `id`, `url`, `strategy`, `status`,\n`total_urls`, `sources`, `total_bytes`, `results_url`, `warnings`,\n`metadata`, `compact` and `billing`.\n- `sitemap.failed` `data` carries `id`, `url`, `strategy`, `status`,\n`error_code`, `error_message`, `warnings` and `metadata`.\n\nIn both, `url` is the host as `scheme://host`, and `warnings` is the\nworker's own warnings or `null`. When the request is answered from a cached job\n(`cache: hit`), the `sitemap.completed` `data` is instead the full job object, the\nsame fields as a `SitemapResponse`.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (SitemapRequest)`\n- `url` — `str` — The site to discover. Sitemap discovery is host-scoped (`robots.txt` and `/sitemap.xml` live at the host root), so only the scheme and host are used: a path, query string or fragment is accepted but ignored, and the `202` response carries a `warnings` entry saying so. A bare host, or a host with just a trailing `/`, produces no warning.\n- `strategy` — `
|
|
500
|
+
"body": "# Sitemap\n\nFunctions for interacting with the `sitemap` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Sitemap\n\nDiscover URLs on a domain\n\nCrawls a domain to build a sitemap. Returns cached results if available\nwithin cache_ttl. Results delivered via webhook and downloadable from results_url.\nWebhook deliveries include `X-ByteKit-Event: sitemap.completed` or\n`X-ByteKit-Event: sitemap.failed` so receivers can dispatch on the\nheader without parsing the body shape.\n\nThe webhook body is `\\{ event, data \\}`. For a job the worker ran, `data` is not a\n`SitemapResponse`:\n\n- `sitemap.completed` `data` carries `id`, `url`, `strategy`, `status`,\n`total_urls`, `sources`, `total_bytes`, `results_url`, `warnings`,\n`metadata`, `compact` and `billing`.\n- `sitemap.failed` `data` carries `id`, `url`, `strategy`, `status`,\n`error_code`, `error_message`, `warnings` and `metadata`.\n\nIn both, `url` is the host as `scheme://host`, and `warnings` is the\nworker's own warnings or `null`. When the request is answered from a cached job\n(`cache: hit`), the `sitemap.completed` `data` is instead the full job object, the\nsame fields as a `SitemapResponse`.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (SitemapRequest)`\n- `url` — `str` — The site to discover. Sitemap discovery is host-scoped (`robots.txt` and `/sitemap.xml` live at the host root), so only the scheme and host are used: a path, query string or fragment is accepted but ignored, and the `202` response carries a `warnings` entry saying so. A bare host, or a host with just a trailing `/`, produces no warning.\n- `strategy` — `SitemapRequestStrategy | Unset` — How much discovery work the job does. - `quick` — reads `robots.txt` and the XML sitemaps only. Every result has `source: sitemap`. - `standard` — the `quick` sources, then fills any remaining `max_urls` budget with URLs from your account's completed scrapes of the host in the last 90 days (`source: known`). - `deep` — the `standard` sources, then crawls page links outward from the URLs found so far, up to `max_depth` levels, until `max_urls` is reached (`source: links`).\n- `max_depth` — `int | Unset`\n- `max_urls` — `int | Unset`\n- `process` — `None | SitemapRequestProcessType0 | Unset` — Accepted, stored and echoed back on the job, but it has no effect: the worker logs that the trigger is not implemented and ignores it.\n- `webhook_url` — `str | Unset` — Optional webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported). When omitted, no `sitemap.completed`/`sitemap.failed` webhook is delivered and the job is poll-only via `GET /v1/sitemap/\\{id\\}`. When present, delivery is unchanged. `webhook_secret` is ignored when `webhook_url` is absent.\n- `webhook_secret` — `None | str | Unset` — HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.\n- `cache_ttl` — `str | Unset` — Max 90 days.\n- `compact` — `bool | Unset`\n- `metadata` — `Metadata | Unset` — Arbitrary key-value metadata. Max 4096 bytes when JSON-serialized.\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Error | SitemapResponse]\nsync(client=client, body=body) -> Error | SitemapResponse | None\nawait asyncio_detailed(client=client, body=body) -> Response[Error | SitemapResponse]\nawait asyncio(client=client, body=body) -> Error | SitemapResponse | None\n```\n\n## Get Sitemap\n\nGet sitemap job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | SitemapResponse]\nsync(id=id, client=client) -> Error | SitemapResponse | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | SitemapResponse]\nawait asyncio(id=id, client=client) -> Error | SitemapResponse | None\n```"
|
|
501
501
|
},
|
|
502
502
|
"sdk/python/usage": {
|
|
503
503
|
"title": "Usage",
|
|
504
504
|
"section": "SDK Reference",
|
|
505
|
-
"body": "# Usage\n\nFunctions for interacting with the `usage` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Usage\n\nGet current billing period usage\n\n**Call styles**\n\n```python\nsync_detailed(client=client) -> Response[
|
|
505
|
+
"body": "# Usage\n\nFunctions for interacting with the `usage` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Get Usage\n\nGet current billing period usage\n\n**Call styles**\n\n```python\nsync_detailed(client=client) -> Response[Error | GetUsageResponse200]\nsync(client=client) -> Error | GetUsageResponse200 | None\nawait asyncio_detailed(client=client) -> Response[Error | GetUsageResponse200]\nawait asyncio(client=client) -> Error | GetUsageResponse200 | None\n```\n\n## Get Usage By Endpoint\n\nGet per-endpoint bandwidth breakdown\n\nReturns bandwidth usage broken down by endpoint (screenshots, recordings, scrape, scrape_md, fetch,\nfetch_md, crawl, crawl_links, sitemap, monitors) for a date range. Each row carries raw bytes, the\nbilling multiplier, and billable bytes. Endpoints with zero raw bytes for the range are omitted from\n`rows`; `totals` is always present. Default range is the last 30 days; max 366 days.\n\n**Parameters**\n\n- `from_ (datetime.date | Unset)`\n- `to (datetime.date | Unset)`\n- `api_key (str | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Error | GetUsageByEndpointResponse200]\nsync(client=client, from_=from_, to=to, api_key=api_key) -> Error | GetUsageByEndpointResponse200 | None\nawait asyncio_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Error | GetUsageByEndpointResponse200]\nawait asyncio(client=client, from_=from_, to=to, api_key=api_key) -> Error | GetUsageByEndpointResponse200 | None\n```\n\n## Get Usage Daily\n\nGet daily usage breakdown\n\nDefault range is last 30 days. Max range is 366 days.\n\n**Parameters**\n\n- `from_ (datetime.date | Unset)`\n- `to (datetime.date | Unset)`\n- `api_key (str | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Error | GetUsageDailyResponse200]\nsync(client=client, from_=from_, to=to, api_key=api_key) -> Error | GetUsageDailyResponse200 | None\nawait asyncio_detailed(client=client, from_=from_, to=to, api_key=api_key) -> Response[Error | GetUsageDailyResponse200]\nawait asyncio(client=client, from_=from_, to=to, api_key=api_key) -> Error | GetUsageDailyResponse200 | None\n```"
|
|
506
506
|
},
|
|
507
507
|
"sdk/python/webhooks": {
|
|
508
508
|
"title": "Webhooks",
|
|
509
509
|
"section": "SDK Reference",
|
|
510
|
-
"body": "# Webhooks\n\nFunctions for interacting with the `webhooks` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## List Webhook Deliveries\n\nList webhook deliveries\n\n**Parameters**\n\n- `limit (
|
|
510
|
+
"body": "# Webhooks\n\nFunctions for interacting with the `webhooks` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## List Webhook Deliveries\n\nList webhook deliveries\n\n**Parameters**\n\n- `limit (int | Unset)`\n- `cursor (str | Unset)`\n- `status (ListWebhookDeliveriesStatus | Unset)`\n- `since (datetime.datetime | Unset)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Response[Error | ListWebhookDeliveriesResponse200]\nsync(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Error | ListWebhookDeliveriesResponse200 | None\nawait asyncio_detailed(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Response[Error | ListWebhookDeliveriesResponse200]\nawait asyncio(client=client, limit=limit, cursor=cursor, status=status, since=since) -> Error | ListWebhookDeliveriesResponse200 | None\n```\n\n## Retry Webhook Delivery\n\nRetry a webhook delivery\n\nRequeues a failed or exhausted webhook delivery for another attempt.\n\n**Limits:** this endpoint takes no request body; any body sent is\ncapped at 64 KB. An oversized body returns a `400` with error code\n`request_too_large`.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Error | WebhookDeliveryResponse]\nsync(id=id, client=client) -> Error | WebhookDeliveryResponse | None\nawait asyncio_detailed(id=id, client=client) -> Response[Error | WebhookDeliveryResponse]\nawait asyncio(id=id, client=client) -> Error | WebhookDeliveryResponse | None\n```"
|
|
511
511
|
},
|
|
512
512
|
"sdk/typescript/account": {
|
|
513
513
|
"title": "Account",
|
package/dist/tools/scrape-url.js
CHANGED
|
@@ -49,6 +49,9 @@ export function scrapeUrlTool(server, client) {
|
|
|
49
49
|
formats: z
|
|
50
50
|
.array(z.enum(ACCEPTED_SCRAPE_FORMATS))
|
|
51
51
|
.min(1, 'formats must list at least one format; omit it entirely for the markdown default')
|
|
52
|
+
// GHSA-mrhx-c7xc-m3w5: Zod records one issue per failing element, so the list is
|
|
53
|
+
// bounded; 32 is far above the four formats it can usefully name.
|
|
54
|
+
.max(32)
|
|
52
55
|
.optional()
|
|
53
56
|
.describe('Content formats to return. Default: ["markdown"]. Options: markdown, raw, links, images. Omit the parameter for the default; an empty array is rejected.'),
|
|
54
57
|
country: z.string().optional().describe('Two-letter country code for geo-targeted scraping'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hunt-labs/bytekit-mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "ByteKit MCP server — exposes ByteKit web-data tools (scrape, screenshot, search, docs) to AI agents over the Model Context Protocol, hosted or as a local stdio server.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@modelcontextprotocol/sdk": "1.32.1",
|
|
58
|
-
"zod": "^
|
|
58
|
+
"zod": "^4.6.7"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"prebuild": "pnpm check:scrape-contract",
|