@hunt-labs/bytekit-mcp 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  "api": {
3
3
  "title": "API Reference",
4
4
  "section": "API Reference",
5
- "body": "# API Reference\n\nEvery ByteKit endpoint, request, and response.\n\nThe ByteKit REST API is organized by capability. Every endpoint shares one base\nURL and Bearer authentication — start with the [Quickstart](https://bytekit.com/docs/quickstart) and\n[Authentication](https://bytekit.com/docs/guides/authentication) guides.\n\n- [Scrape](https://bytekit.com/docs/api/scrape/createscrape) — Fetch any URL as raw HTML, clean markdown, or structured content.\n- [Screenshots](https://bytekit.com/docs/api/screenshots/createscreenshot) — Capture full-page or viewport PNG/JPEG.\n- [Recordings](https://bytekit.com/docs/api/recordings/createrecording) — Generate a scrolling video of a page.\n- [Bulk](https://bytekit.com/docs/api/bulk/createbulk) — Fan out many URLs in parallel with per-item webhooks.\n- [Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — Watch a URL on a schedule and webhook on change.\n- [Sitemap](https://bytekit.com/docs/api/sitemap/createsitemap) — Discover URLs from a domain's sitemap or by crawling.\n- [Fetch](https://bytekit.com/docs/api/fetch/postfetch) — Low-latency raw HTTP fetch with optional conversion."
5
+ "body": "# API Reference\n\nEvery ByteKit endpoint, request, and response.\n\nThe ByteKit REST API is organized by capability. Every endpoint shares one base\nURL and Bearer authentication — start with the [Quickstart](https://bytekit.com/docs/quickstart) and\n[Authentication](https://bytekit.com/docs/guides/authentication) guides.\n\n- [Scrape](https://bytekit.com/docs/api/scrape/createscrape) — Fetch any URL as raw HTML, clean markdown, or structured content.\n- [Screenshots](https://bytekit.com/docs/api/screenshots/createscreenshot) — Capture full-page or viewport PNG/JPEG.\n- [Bulk](https://bytekit.com/docs/api/bulk/createbulk) — Fan out many URLs in parallel with per-item webhooks.\n- [Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — Watch a URL on a schedule and webhook on change.\n- [Sitemap](https://bytekit.com/docs/api/sitemap/createsitemap) — Discover URLs from a domain's sitemap or by crawling.\n- [Fetch](https://bytekit.com/docs/api/fetch/postfetch) — Low-latency raw HTTP fetch with optional conversion."
6
6
  },
7
7
  "api/account": {
8
8
  "title": "Account",
@@ -42,7 +42,7 @@
42
42
  "api/bulk/listbulkscreenshots": {
43
43
  "title": "List bulk job items",
44
44
  "section": "API Reference",
45
- "body": "# List bulk job items"
45
+ "body": "# List bulk job items\n\nReturns the bulk job's items, discriminated by `type`.\n\n**Downloading item artifacts.** `image_url` (`type: screenshot`) and both\n`content_url` and `markdown_url` (`type: scrape`) are **pre-signed** URLs,\nminted fresh on every read of this endpoint and valid for **600 seconds\n(10 minutes)** —\nthe same signing lifetime as `content_url` on `GET /v1/fetch/bulk/{id}`.\nThe underlying objects are private, so an unsigned URL returns `401`:\ndownload inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, carry `null` or the unsigned stored URL instead.\n"
46
46
  },
47
47
  "api/fetch": {
48
48
  "title": "Fetch",
@@ -62,7 +62,7 @@
62
62
  "api/fetch-bulk/getfetchbulk": {
63
63
  "title": "Get fetch bulk job status",
64
64
  "section": "API Reference",
65
- "body": "# Get fetch bulk job status"
65
+ "body": "# Get fetch bulk job status\n\nReturns the job envelope plus its per-URL items.\n\n**Downloading item content.** Each completed item's `content_url` is a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **600 seconds (10 minutes)** — the same signing lifetime as the\n`image_url` returned by `GET /v1/bulk/{id}/screenshots`. The underlying\nobjects are private, so an unsigned URL returns `401`: download the\ncontent inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, carry `null` or the unsigned stored URL instead.\n"
66
66
  },
67
67
  "api/fetch/getfetch": {
68
68
  "title": "Fetch a URL (GET)",
@@ -252,7 +252,7 @@
252
252
  "cli": {
253
253
  "title": "Install & Authenticate",
254
254
  "section": "CLI Reference",
255
- "body": "# Install & Authenticate\n\nInstall the ByteKit CLI, authenticate, and learn the global flags shared by every command.\n\nThe `bytekit` CLI wraps the ByteKit API as shell subcommands — scrape, screenshot,\nrecord, monitor, and more, straight from your terminal.\n\n## Install\n\nInstall globally from npm:\n\n```bash\nnpm install -g @hunt-labs/bytekit-cli\n```\n\nThis puts the `bytekit` binary on your `PATH`. Verify the install:\n\n```bash\nbytekit --version\n```\n\n## Authenticate\n\nEvery command needs an API key. You can provide it two ways:\n\n**1. Environment variable (recommended)**\n\nSet `BYTEKIT_API_KEY` once and every command picks it up automatically:\n\n```bash\nexport BYTEKIT_API_KEY=\"sk_live_your_api_key_here\"\nbytekit scrape create --url https://example.com\n```\n\n**2. The `--key` flag**\n\nPass the key inline for a single command (overrides the env var):\n\n```bash\nbytekit scrape create --url https://example.com --key sk_live_your_api_key_here\n```\n\nThe resolution order is: `--key` flag → `BYTEKIT_API_KEY` environment variable.\nIf neither is set, the command exits with `Error: API key required. Pass --key or set BYTEKIT_API_KEY.`\n\n## Global flags\n\nThese flags are available on every command:\n\n| Flag | Description |\n| --- | --- |\n| `--key <key>` | API key for this invocation. Overrides `BYTEKIT_API_KEY`. |\n| `--base-url <url>` | Override the API base URL (or set `BYTEKIT_BASE_URL`). Useful for self-hosted or staging endpoints. |\n| `--json` | Print the raw JSON response instead of the formatted, human-readable output. |\n| `-V, --version` | Print the CLI version and exit. |\n| `-h, --help` | Show help for the program or a subcommand. |\n\nFor example, to point at a staging endpoint and get raw JSON:\n\n```bash\nbytekit scrape create --url https://example.com --base-url https://api-stg.bytekit.com --json\n```\n\n## Next steps\n\n- [Scrape](https://bytekit.com/docs/cli/scrape) — capture URL content as markdown, HTML, or structured data.\n- [Screenshots](https://bytekit.com/docs/cli/screenshots) — render full-page or viewport screenshots.\n- [Monitors](https://bytekit.com/docs/cli/monitors) — track page changes on a schedule.\n- [API Reference](https://bytekit.com/docs/api) — the underlying REST endpoints."
255
+ "body": "# Install & Authenticate\n\nInstall the ByteKit CLI, authenticate, and learn the global flags shared by every command.\n\nThe `bytekit` CLI wraps the ByteKit API as shell subcommands — scrape, screenshot,\nsearch, monitor, and more, straight from your terminal.\n\n## Install\n\nInstall globally from npm:\n\n```bash\nnpm install -g @hunt-labs/bytekit-cli\n```\n\nThis puts the `bytekit` binary on your `PATH`. Verify the install:\n\n```bash\nbytekit --version\n```\n\n## Authenticate\n\nEvery command needs an API key. You can provide it two ways:\n\n**1. Environment variable (recommended)**\n\nSet `BYTEKIT_API_KEY` once and every command picks it up automatically:\n\n```bash\nexport BYTEKIT_API_KEY=\"sk_live_your_api_key_here\"\nbytekit scrape create --url https://example.com\n```\n\n**2. The `--key` flag**\n\nPass the key inline for a single command (overrides the env var):\n\n```bash\nbytekit scrape create --url https://example.com --key sk_live_your_api_key_here\n```\n\nThe resolution order is: `--key` flag → `BYTEKIT_API_KEY` environment variable.\nIf neither is set, the command exits with `Error: API key required. Pass --key or set BYTEKIT_API_KEY.`\n\n## Global flags\n\nThese flags are available on every command:\n\n| Flag | Description |\n| --- | --- |\n| `--key <key>` | API key for this invocation. Overrides `BYTEKIT_API_KEY`. |\n| `--base-url <url>` | Override the API base URL (or set `BYTEKIT_BASE_URL`). Useful for self-hosted or staging endpoints. |\n| `--json` | Print the raw JSON response instead of the formatted, human-readable output. |\n| `-V, --version` | Print the CLI version and exit. |\n| `-h, --help` | Show help for the program or a subcommand. |\n\nFor example, to point at a staging endpoint and get raw JSON:\n\n```bash\nbytekit scrape create --url https://example.com --base-url https://api-stg.bytekit.com --json\n```\n\n## Next steps\n\n- [Scrape](https://bytekit.com/docs/cli/scrape) — capture URL content as markdown, HTML, or structured data.\n- [Screenshots](https://bytekit.com/docs/cli/screenshots) — render full-page or viewport screenshots.\n- [Monitors](https://bytekit.com/docs/cli/monitors) — track page changes on a schedule.\n- [API Reference](https://bytekit.com/docs/api) — the underlying REST endpoints."
256
256
  },
257
257
  "cli/account": {
258
258
  "title": "Account",
@@ -327,12 +327,12 @@
327
327
  "guides/scraping": {
328
328
  "title": "Scraping",
329
329
  "section": "Guides",
330
- "body": "# Scraping\n\nScrape any URL as HTML, markdown, or structured content — formats, options, latency, and async polling.\n\n`POST /v1/scrape` fetches a URL and returns its content in the format you ask for. The same\nrequest shape works for every site; the options you pass determine the output and how long the\ncall takes.\n\n## Rendering & latency\n\nMost scrapes return in well under a second. Some options require ByteKit to fully render the page\nbefore it can return content, which takes longer — typically a few seconds. Pass these only when\nyou need them:\n\n| Option | When it adds latency |\n|--------|----------------------|\n| `cookies` | Non-empty array |\n| `headers` | Non-empty object |\n| `delay_ms` | Greater than `0` |\n| `async` | `true` (request is queued and processed off the fast path) |\n\nThe `country` option routes the request through a geo-located proxy. On its own it does not add\nrendering latency; it only does so when combined with one of the options above.\n\nLooking for `wait_for_selector` or `wait_until`? Those are not `ScrapeRequest` options — they\nbelong to the [Screenshot](https://bytekit.com/docs/api/screenshots/createscreenshot) and\n[Recording](https://bytekit.com/docs/api/recordings/createrecording) endpoints. Sending them to `/v1/scrape` returns\n`422`.\n\n```bash\n# A simple, low-latency scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n```bash\n# Slower: delay_ms forces a full render and waits before returning\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"delay_ms\": 2000\n }'\n```\n\n## Response fields\n\nThe default format is `raw_html` — pass `formats` to request others (`markdown`, `html`,\n`links`, `images`). The `formats` object in the response is keyed by the format you requested.\n\n| Field | Description |\n|-------|-------------|\n| `formats.raw_html` | Page content in the requested format (`raw_html` is the default when `formats` is omitted) |\n| `contentLength` | Compressed wire bytes — used for bandwidth billing |\n| `statusCode` | HTTP status code of the origin page |\n| `metadata.title` | Page `<title>` element |\n\nThe `X-Scrape-*` response headers describe how each request was handled (cache status, timing,\nand the final URL) — useful for debugging.\n\n## Async scrapes\n\nFor long-running pages, pass `\"async\": true` to get a `202 Accepted` response with a scrape\n`id` prefixed `sc_`. Poll the result with `GET /v1/scrape/{id}`.\n\n```bash\n# Start async scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"async\": true}'\n\n# Poll for result\ncurl https://api.bytekit.com/v1/scrape/sc_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Webhook event header\n\nEvery outbound webhook POST includes an `X-ByteKit-Event` header with the event type:\n\n| Event type | Trigger |\n|---|---|\n| `bulk.completed` | A bulk job finishes (all items processed) |\n| `scrape.completed` | An async scrape succeeds |\n| `scrape.failed` | An async scrape fails terminally |\n| `monitor.change_detected` | A monitor fires and detects a change (screenshot or content) |\n| `monitor.captured` | A monitor fires with no change detected (notify_on: every) |\n| `sitemap.completed` | A sitemap job finishes |\n| `sitemap.failed` | A sitemap job fails terminally |\n\nUse this header to dispatch events without inspecting the body shape:\n\n```python\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route(\"/webhooks/bytekit\", methods=[\"POST\"])\ndef handle():\n event = request.headers.get(\"X-ByteKit-Event\")\n if event == \"bulk.completed\":\n handle_bulk(request.json)\n elif event == \"scrape.completed\":\n handle_scrape(request.json)\n return \"\", 200\n```\n\n`X-ByteKit-Event` is a reserved header — you cannot supply it via `webhook_headers` in\nmonitor or bulk configuration. Attempts to do so will be rejected with a `422` at request\ntime.\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model and concurrency slots\n- [Errors](https://bytekit.com/docs/guides/errors) — how to interpret and retry error responses\n- [API Reference: Scrape](https://bytekit.com/docs/api/scrape/createscrape) — full request/response schema"
330
+ "body": "# Scraping\n\nScrape any URL as HTML, markdown, or structured content — formats, options, latency, and async polling.\n\n`POST /v1/scrape` fetches a URL and returns its content in the format you ask for. The same\nrequest shape works for every site; the options you pass determine the output and how long the\ncall takes.\n\n## Rendering & latency\n\nMost scrapes return in well under a second. Some options require ByteKit to fully render the page\nbefore it can return content, which takes longer — typically a few seconds. Pass these only when\nyou need them:\n\n| Option | When it adds latency |\n|--------|----------------------|\n| `cookies` | Non-empty array |\n| `headers` | Non-empty object |\n| `delay_ms` | Greater than `0` |\n| `async` | `true` (request is queued and processed off the fast path) |\n\nThe `country` option routes the request through a geo-located proxy. On its own it does not add\nrendering latency; it only does so when combined with one of the options above.\n\nLooking for `wait_for_selector` or `wait_until`? Those are not `ScrapeRequest` options — they\nbelong to the [Screenshot](https://bytekit.com/docs/api/screenshots/createscreenshot) endpoint. Sending them to\n`/v1/scrape` returns `422`.\n\n```bash\n# A simple, low-latency scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n```bash\n# Slower: delay_ms forces a full render and waits before returning\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com\",\n \"delay_ms\": 2000\n }'\n```\n\n## Response fields\n\nThe default format is `raw_html` — pass `formats` to request others (`markdown`, `html`,\n`links`, `images`). The `formats` object in the response is keyed by the format you requested.\n\n| Field | Description |\n|-------|-------------|\n| `formats.raw_html` | Page content in the requested format (`raw_html` is the default when `formats` is omitted) |\n| `contentLength` | Compressed wire bytes — used for bandwidth billing |\n| `statusCode` | HTTP status code of the origin page |\n| `metadata.title` | Page `<title>` element |\n\nThe `X-Scrape-*` response headers describe how each request was handled (cache status, timing,\nand the final URL) — useful for debugging.\n\n## Async scrapes\n\nFor long-running pages, pass `\"async\": true` to get a `202 Accepted` response with a scrape\n`id` prefixed `sc_`. Poll the result with `GET /v1/scrape/{id}`.\n\n```bash\n# Start async scrape\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\", \"async\": true}'\n\n# Poll for result\ncurl https://api.bytekit.com/v1/scrape/sc_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Webhook event header\n\nEvery outbound webhook POST includes an `X-ByteKit-Event` header with the event type:\n\n| Event type | Trigger |\n|---|---|\n| `bulk.completed` | A bulk job finishes (all items processed) |\n| `scrape.completed` | An async scrape succeeds |\n| `scrape.failed` | An async scrape fails terminally |\n| `monitor.change_detected` | A monitor fires and detects a change (screenshot or content) |\n| `monitor.captured` | A monitor fires with no change detected (notify_on: every) |\n| `sitemap.completed` | A sitemap job finishes |\n| `sitemap.failed` | A sitemap job fails terminally |\n\nUse this header to dispatch events without inspecting the body shape:\n\n```python\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route(\"/webhooks/bytekit\", methods=[\"POST\"])\ndef handle():\n event = request.headers.get(\"X-ByteKit-Event\")\n if event == \"bulk.completed\":\n handle_bulk(request.json)\n elif event == \"scrape.completed\":\n handle_scrape(request.json)\n return \"\", 200\n```\n\n`X-ByteKit-Event` is a reserved header — you cannot supply it via `webhook_headers` in\nmonitor or bulk configuration. Attempts to do so will be rejected with a `422` at request\ntime.\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model and concurrency slots\n- [Errors](https://bytekit.com/docs/guides/errors) — how to interpret and retry error responses\n- [API Reference: Scrape](https://bytekit.com/docs/api/scrape/createscrape) — full request/response schema"
331
331
  },
332
332
  "introduction": {
333
333
  "title": "Introduction",
334
334
  "section": "General",
335
- "body": "# Introduction\n\nA REST API for screenshots, scraping, and page-change monitoring — one key, one base URL, every output.\n\n## What ByteKit is\n\nByteKit is a REST API for capturing what a webpage looks like and what it says —\nscreenshots, scrolling recordings, raw HTML or clean markdown, and page-change monitoring.\nOne API key, one base URL, every output you'd otherwise stitch together from a headless-browser\nfarm and a scraping proxy.\n\n## What you can do with it\n\n- **Scrape** — Fetch a URL as raw HTML, clean markdown, or structured content.\n- **Screenshot** — Capture full-page or viewport PNG/JPEG.\n- **Record** — Generate a scrolling video of a page.\n- **Monitor** — Watch a URL on a schedule and webhook you when the rendered output changes.\n- **Bulk** — Fan out thousands of URLs in parallel and receive a webhook as each finishes.\n- **Sitemap** — Discover URLs from a domain's sitemap or by light crawling.\n\nScrape calls accept an `\"async\": true` body field, in which case the API returns `202` with a `sc_…`\nID that you poll or receive via webhook. Screenshots are synchronous by default (the call holds up to\n28s and returns `200`); pass the `?async=true` query parameter to get back `202` with an `ss_…` ID\nimmediately. Recordings are always async — they return `202` with a `rec_…` ID, with no `async` field\nto set.\n\n## Authentication and accounts\n\nEvery request carries a Bearer API key, prefixed `sk_live_`. Manage keys from the dashboard —\nup to 50 active keys per account, with per-key billing attribution so you can split usage\ncleanly across services.\n\nFull details in the [Authentication guide](https://bytekit.com/docs/guides/authentication).\n\n## Where to go next\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — first call in under five minutes, no SDK required.\n- [Client Libraries](https://bytekit.com/docs/libraries/typescript) — official TypeScript and Python SDKs.\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, async polling.\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, response headers.\n- [Monitors](https://bytekit.com/docs/guides/monitors) — schedule-based change detection with webhooks.\n- [API Reference](https://bytekit.com/docs/api) — every endpoint, request, and response."
335
+ "body": "# Introduction\n\nA REST API for screenshots, scraping, and page-change monitoring — one key, one base URL, every output.\n\n## What ByteKit is\n\nByteKit is a REST API for capturing what a webpage looks like and what it says —\nscreenshots, raw HTML or clean markdown, and page-change monitoring.\nOne API key, one base URL, every output you'd otherwise stitch together from a headless-browser\nfarm and a scraping proxy.\n\n## What you can do with it\n\n- **Scrape** — Fetch a URL as raw HTML, clean markdown, or structured content.\n- **Screenshot** — Capture full-page or viewport PNG/JPEG.\n- **Monitor** — Watch a URL on a schedule and webhook you when the rendered output changes.\n- **Bulk** — Fan out thousands of URLs in parallel and receive a webhook as each finishes.\n- **Sitemap** — Discover URLs from a domain's sitemap or by light crawling.\n\nScrape calls accept an `\"async\": true` body field, in which case the API returns `202` with a `sc_…`\nID that you poll or receive via webhook. Screenshots are synchronous by default (the call holds up to\n28s and returns `200`); pass the `?async=true` query parameter to get back `202` with an `ss_…` ID\nimmediately.\n\n## Authentication and accounts\n\nEvery request carries a Bearer API key, prefixed `sk_live_`. Manage keys from the dashboard —\nup to 50 active keys per account, with per-key billing attribution so you can split usage\ncleanly across services.\n\nFull details in the [Authentication guide](https://bytekit.com/docs/guides/authentication).\n\n## Where to go next\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — first call in under five minutes, no SDK required.\n- [Client Libraries](https://bytekit.com/docs/libraries/typescript) — official TypeScript and Python SDKs.\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, async polling.\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, response headers.\n- [Monitors](https://bytekit.com/docs/guides/monitors) — schedule-based change detection with webhooks.\n- [API Reference](https://bytekit.com/docs/api) — every endpoint, request, and response."
336
336
  },
337
337
  "libraries/go": {
338
338
  "title": "Go",
@@ -342,7 +342,7 @@
342
342
  "libraries/python": {
343
343
  "title": "Python SDK",
344
344
  "section": "Libraries",
345
- "body": "# Python SDK\n\nOfficial Python client for ByteKit, with sync and async support.\n\nThe official Python SDK is generated from the ByteKit OpenAPI spec, so its models and\nmethods always match the API. Every operation ships in both synchronous and asynchronous form.\n\n## Install\n\n```bash\npip install bytekit-sdk\n```\n\nThe PyPI distribution is `bytekit-sdk`; the import name is `bytekit`.\n\n## Your first scrape\n\n```python\nfrom bytekit import AuthenticatedClient\nfrom bytekit.api.scrape import create_scrape\nfrom bytekit.models.scrape_request import ScrapeRequest\nfrom bytekit.models.scrape_request_formats_item import ScrapeRequestFormatsItem\nfrom bytekit.models.scrape_success_envelope import ScrapeSuccessEnvelope\n\nclient = AuthenticatedClient(\n base_url=\"https://api.bytekit.com\",\n token=\"sk_live_your_api_key_here\",\n)\n\n# Request the markdown format explicitly — otherwise response.formats.markdown is UNSET.\nbody = ScrapeRequest(\n url=\"https://example.com\",\n formats=[ScrapeRequestFormatsItem.MARKDOWN],\n)\nresponse = create_scrape.sync(client=client, body=body)\n\n# .sync() returns None on a transport error, and a queued/error envelope on the\n# async or failure paths. Only a ScrapeSuccessEnvelope carries populated formats.\nif response is None:\n print(\"Request failed — no response returned.\")\nelif isinstance(response, ScrapeSuccessEnvelope) and isinstance(response.formats.markdown, str):\n print(response.formats.markdown)\nelse:\n # Queued (ScrapeQueuedEnvelope) or error (ScrapeErrorEnvelope) — inspect `response`.\n print(f\"Scrape not complete: {response}\")\n```\n\nEach operation exposes four call styles:\n\n- `create_scrape.sync(...)` — returns the parsed model (or `None`).\n- `create_scrape.sync_detailed(...)` — returns the full `Response` (status code, headers, body).\n- `create_scrape.asyncio(...)` — awaitable form of `sync`.\n- `create_scrape.asyncio_detailed(...)` — awaitable form of `sync_detailed`.\n\n## Async usage\n\n```python\nimport asyncio\nfrom bytekit import AuthenticatedClient\nfrom bytekit.api.screenshots import create_screenshot\nfrom bytekit.models.screenshot_request import ScreenshotRequest\n\nasync def main():\n client = AuthenticatedClient(\n base_url=\"https://api.bytekit.com\",\n token=\"sk_live_your_api_key_here\",\n )\n body = ScreenshotRequest(url=\"https://example.com\")\n response = await create_screenshot.asyncio(client=client, body=body)\n print(response)\n\nasyncio.run(main())\n```\n\n## What's available\n\nOperations are grouped by capability under `bytekit.api.*`: `scrape`, `scrape_bulk`,\n`screenshots`, `recordings`, `bulk`, `fetch`, `fetch_bulk`, `monitors`, `sitemap`, and\n`account`.\n\nSee the [Python SDK Reference](https://bytekit.com/docs/sdk/python/client) for every module, function, and model.\n\n## Next steps\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — the same API surface in TypeScript.\n- [API Reference](https://bytekit.com/docs/api) — the underlying REST endpoints.\n- [Errors](https://bytekit.com/docs/guides/errors) — error codes and retry guidance."
345
+ "body": "# Python SDK\n\nOfficial Python client for ByteKit, with sync and async support.\n\nThe official Python SDK is generated from the ByteKit OpenAPI spec, so its models and\nmethods always match the API. Every operation ships in both synchronous and asynchronous form.\n\n## Install\n\n```bash\npip install bytekit-sdk\n```\n\nThe PyPI distribution is `bytekit-sdk`; the import name is `bytekit`.\n\n## Your first scrape\n\n```python\nfrom bytekit import AuthenticatedClient\nfrom bytekit.api.scrape import create_scrape\nfrom bytekit.models.scrape_request import ScrapeRequest\nfrom bytekit.models.scrape_request_formats_item import ScrapeRequestFormatsItem\nfrom bytekit.models.scrape_success_envelope import ScrapeSuccessEnvelope\n\nclient = AuthenticatedClient(\n base_url=\"https://api.bytekit.com\",\n token=\"sk_live_your_api_key_here\",\n)\n\n# Request the markdown format explicitly — otherwise response.formats.markdown is UNSET.\nbody = ScrapeRequest(\n url=\"https://example.com\",\n formats=[ScrapeRequestFormatsItem.MARKDOWN],\n)\nresponse = create_scrape.sync(client=client, body=body)\n\n# .sync() returns None on a transport error, and a queued/error envelope on the\n# async or failure paths. Only a ScrapeSuccessEnvelope carries populated formats.\nif response is None:\n print(\"Request failed — no response returned.\")\nelif isinstance(response, ScrapeSuccessEnvelope) and isinstance(response.formats.markdown, str):\n print(response.formats.markdown)\nelse:\n # Queued (ScrapeQueuedEnvelope) or error (ScrapeErrorEnvelope) — inspect `response`.\n print(f\"Scrape not complete: {response}\")\n```\n\nEach operation exposes four call styles:\n\n- `create_scrape.sync(...)` — returns the parsed model (or `None`).\n- `create_scrape.sync_detailed(...)` — returns the full `Response` (status code, headers, body).\n- `create_scrape.asyncio(...)` — awaitable form of `sync`.\n- `create_scrape.asyncio_detailed(...)` — awaitable form of `sync_detailed`.\n\n## Async usage\n\n```python\nimport asyncio\nfrom bytekit import AuthenticatedClient\nfrom bytekit.api.screenshots import create_screenshot\nfrom bytekit.models.screenshot_request import ScreenshotRequest\n\nasync def main():\n client = AuthenticatedClient(\n base_url=\"https://api.bytekit.com\",\n token=\"sk_live_your_api_key_here\",\n )\n body = ScreenshotRequest(url=\"https://example.com\")\n response = await create_screenshot.asyncio(client=client, body=body)\n print(response)\n\nasyncio.run(main())\n```\n\n## What's available\n\nOperations are grouped by capability under `bytekit.api.*`: `scrape`, `scrape_bulk`,\n`screenshots`, `bulk`, `fetch`, `fetch_bulk`, `monitors`, `sitemap`, and\n`account`.\n\nSee the [Python SDK Reference](https://bytekit.com/docs/sdk/python/client) for every module, function, and model.\n\n## Next steps\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — the same API surface in TypeScript.\n- [API Reference](https://bytekit.com/docs/api) — the underlying REST endpoints.\n- [Errors](https://bytekit.com/docs/guides/errors) — error codes and retry guidance."
346
346
  },
347
347
  "libraries/typescript": {
348
348
  "title": "TypeScript SDK",
@@ -352,7 +352,7 @@
352
352
  "mcp": {
353
353
  "title": "MCP Server",
354
354
  "section": "General",
355
- "body": "# MCP Server\n\nCall ByteKit web capture as a native tool from Claude, Cursor, and any MCP-compatible agent — hosted over HTTP or run locally over stdio.\n\nThe ByteKit **MCP server** exposes scraping, search, screenshots, and account\nlookups as [Model Context Protocol](https://modelcontextprotocol.io) tools. Your\nagent calls `scrape_url` or `screenshot_url` the same way it calls any other\ntool — no wrapper to write, no headless browser to manage.\n\nThere are two ways to connect: a **hosted HTTP endpoint** (nothing to install)\nand a **local stdio server** (`npx @hunt-labs/bytekit-mcp`).\n\n## Authentication\n\nBoth paths authenticate with a ByteKit API key. Sign up at\n[app.bytekit.com](https://app.bytekit.com) and create a key (prefixed\n`sk_live_`). The local server reads it from the `BYTEKIT_API_KEY` environment\nvariable (or the `--api-key` flag); the hosted endpoint takes it as a bearer\ntoken.\n\n## Option 1 — Hosted HTTP (no install)\n\nPoint any MCP client that speaks the Streamable HTTP transport at:\n\n```\nhttps://api.bytekit.com/mcp\n```\n\nSend your API key as a bearer token. Example client config (Claude Desktop,\nCursor, and most hosts accept this shape):\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"url\": \"https://api.bytekit.com/mcp\",\n \"headers\": {\n \"Authorization\": \"Bearer $BYTEKIT_API_KEY\"\n }\n }\n }\n}\n```\n\n## Option 2 — Local stdio (`npx`)\n\nRun the server as a local subprocess over stdio. Nothing to install globally —\n`npx` fetches it on demand:\n\n```bash\nnpx @hunt-labs/bytekit-mcp --api-key $BYTEKIT_API_KEY\n```\n\nOr set the key in your environment and omit the flag:\n\n```bash\nexport BYTEKIT_API_KEY=sk_live_xxx\nnpx @hunt-labs/bytekit-mcp\n```\n\nClient config for a stdio server:\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@hunt-labs/bytekit-mcp\"],\n \"env\": {\n \"BYTEKIT_API_KEY\": \"sk_live_xxx\"\n }\n }\n }\n}\n```\n\n### API-key resolution order\n\nThe local server resolves the key in this order:\n\n1. `--api-key <key>` flag\n2. `BYTEKIT_API_KEY` environment variable\n\n## Tool inventory\n\n| Tool | What it does |\n| --- | --- |\n| `scrape_url` | Fetch a URL and return HTML, clean markdown, links, or images. |\n| `web_search` | Run a web search and return ranked organic results. |\n| `screenshot_url` | Capture a screenshot of a page (desktop/mobile, PNG/JPEG). |\n| `get_result` | Fetch a previously created screenshot by id. |\n| `get_account` | Return account details, plan, and current usage/quota. |\n| `list_docs` | List every page in the bundled ByteKit documentation. |\n| `search_docs` | Search the bundled documentation. |\n| `get_doc` | Fetch the full markdown of one documentation page. |\n\nThe server also exposes **resources** (`bytekit://account`,\n`bytekit://screenshot/{id}`) and **prompts** (`summarize_webpage`,\n`extract_structured_data`, `research_topic`) that MCP hosts can surface directly.\n\n## Limits\n\nThe hosted `POST /mcp` endpoint caps request bodies at **1 MB**. MCP tool\narguments are small (a URL plus a few options), so this comfortably covers\nevery tool and prompt in the matrix above — including `research_topic`, the\nlargest legitimate call, which carries a list of URLs. An oversized request\ngets a `413` with a JSON-RPC-shaped error body rather than a dropped\nconnection.\n\nEvery route in the table below carries its own body-size limit, sized to\nthat route's shape rather than reused from `/mcp` (a bulk endpoint's\nrealistic payload is far larger than an MCP tool call). This covers both the\ncapture/data create endpoints and the unauthenticated webhook-ingress\nreceivers, which need a guard for the same reason — their handlers read the\nfull body before any check runs:\n\n| Endpoint | Limit | Error |\n|---|---|---|\n| `POST /v1/scrape`, `/v1/search`, `/v1/scrape/bulk`, `/v1/schema` | 512 KB | `400 request_too_large` |\n| `POST /v1/fetch` | 512 KB | `400 request_too_large` |\n| `POST /v1/screenshots` | 512 KB | `400 request_too_large` |\n| `POST /v1/monitors` | 512 KB | `400 request_too_large` |\n| `POST /v1/sitemap` | 512 KB | `400 request_too_large` |\n| `POST /v1/bulk` | 4 MB pre-auth (chunked) / 32 MB fail-safe (declared length) / per-plan up to 28.7 MB | `400 request_too_large` |\n| `POST /v1/fetch/bulk` | 2 MB pre-auth (chunked) / 20 MB fail-safe (declared length) / per-plan up to 16.8 MB | `400 request_too_large` |\n| `POST /v1/webhook-deliveries/{id}/retry` | 64 KB | `400 request_too_large` |\n| `POST /v1/webhooks/stripe` (internal, Stripe ingress) | 256 KB | `400` (bespoke `{ error }` body) |\n| `POST /webhooks/clerk` (internal, Clerk ingress) | 256 KB | `400 request_too_large` (bespoke `{ error }` body) |\n| `POST /mcp` | 1 MB | `413` (JSON-RPC error) |\n\nThe two bulk endpoints are guarded in a two-tier shape, not by a single\nceiling. A streamed body with no `Content-Length` header is capped at the\nsmall pre-auth limit (4 MB / 2 MB) before your API key is checked; a body\nthat declares `Content-Length` is instead bounded there by a larger fail-safe\n(32 MB / 20 MB) rather than the real limit, since that branch reads nothing\nuntil your key is verified. Once your key is verified, a second check\nre-gates the body against your account's own `max_bulk_size` — sized off the\ndocumented custom production account's real `max_bulk_size` of 50,000 URLs\nor per-item configs (root CLAUDE.md: \"50k bulk\") — which reaches 28.7 MB /\n16.8 MB for that account. A standard-plan account's effective ceiling is\nexactly the pre-auth limit; either tier's overrun returns\n`400 request_too_large`.\n\n## Next steps\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — make your first ByteKit API call.\n- [Authentication](https://bytekit.com/docs/guides/authentication) — key formats and management."
355
+ "body": "# MCP Server\n\nCall ByteKit web capture as a native tool from Claude, Cursor, and any MCP-compatible agent — hosted over HTTP or run locally over stdio.\n\nThe ByteKit **MCP server** exposes scraping, search, screenshots, and account\nlookups as [Model Context Protocol](https://modelcontextprotocol.io) tools. Your\nagent calls `scrape_url` or `screenshot_url` the same way it calls any other\ntool — no wrapper to write, no headless browser to manage.\n\nThere are two ways to connect: a **hosted HTTP endpoint** (nothing to install)\nand a **local stdio server** (`npx @hunt-labs/bytekit-mcp`).\n\n## Authentication\n\nBoth paths authenticate with a ByteKit API key. Sign up at\n[app.bytekit.com](https://app.bytekit.com) and create a key (prefixed\n`sk_live_`). The local server reads it from the `BYTEKIT_API_KEY` environment\nvariable (or the `--api-key` flag); the hosted endpoint takes it as a bearer\ntoken.\n\n## Option 1 — Hosted HTTP (no install)\n\nPoint any MCP client that speaks the Streamable HTTP transport at:\n\n```\nhttps://api.bytekit.com/mcp\n```\n\nSend your API key as a bearer token. Example client config for a host that\nspeaks Streamable HTTP directly (Cursor and most hosts accept this shape):\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"url\": \"https://api.bytekit.com/mcp\",\n \"headers\": {\n \"Authorization\": \"Bearer sk_live_xxx\"\n }\n }\n }\n}\n```\n\n**Paste your real key in place of `sk_live_xxx`.** A JSON config file is not a\nshell: most hosts read these values verbatim and do not substitute environment\nvariables inside `headers`, so writing `Bearer $BYTEKIT_API_KEY` here sends that\ntext to the API as the token, verbatim, and the API answers `401`.\n\n**Claude Desktop does not accept this shape.** `claude_desktop_config.json`\nonly launches local **stdio** subprocesses (`command`/`args`/`env`) — it has\nno native `url`-based remote-server entry, so pasting the config above into\nit will not connect. To reach the hosted endpoint from Claude Desktop, either:\n\n- add ByteKit as a [Connector](https://claude.com/connectors) (Settings →\n Connectors → Add custom connector), or\n- bridge it locally with [`mcp-remote`](https://www.npmjs.com/package/mcp-remote):\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"mcp-remote\",\n \"https://api.bytekit.com/mcp\",\n \"--header\",\n \"Authorization:${AUTH_HEADER}\"\n ],\n \"env\": {\n \"AUTH_HEADER\": \"Bearer sk_live_xxx\"\n }\n }\n }\n}\n```\n\nTwo details in that snippet are load-bearing, and both are documented by\n`mcp-remote` itself:\n\n- **`${AUTH_HEADER}`, not `$AUTH_HEADER`.** Claude Desktop launches\n `command`/`args` directly, with no shell in between, so it does not expand\n `$VAR` anywhere in the config. `mcp-remote` does its own substitution on\n `--header` values, but only of the braced `${VAR}` form, reading it from the\n process environment the `env` block supplies. A bare `$BYTEKIT_API_KEY` is\n passed through untouched and authenticates as that literal string — a\n guaranteed `401`.\n- **No space after the colon in `Authorization:${AUTH_HEADER}`.** The header\n value carries the space (`Bearer sk_live_xxx`) instead. `mcp-remote`'s README\n documents this as the workaround for a Cursor / Claude Desktop (Windows) bug\n where spaces inside `args` are not escaped when it invokes `npx`, mangling the\n value: `\"Authorization:${AUTH_HEADER}\" // note no spaces around ':'` with\n `\"AUTH_HEADER\": \"Bearer <auth-token>\" // spaces OK in env vars`.\n\nOr skip the hosted endpoint entirely and run the **local stdio server**\n(Option 2 below), which Claude Desktop supports natively.\n\n## Option 2 — Local stdio (`npx`)\n\nRun the server as a local subprocess over stdio. Nothing to install globally —\n`npx` fetches it on demand:\n\n```bash\nnpx @hunt-labs/bytekit-mcp --api-key $BYTEKIT_API_KEY\n```\n\nOr set the key in your environment and omit the flag:\n\n```bash\nexport BYTEKIT_API_KEY=sk_live_xxx\nnpx @hunt-labs/bytekit-mcp\n```\n\nClient config for a stdio server:\n\n```json\n{\n \"mcpServers\": {\n \"bytekit\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@hunt-labs/bytekit-mcp\"],\n \"env\": {\n \"BYTEKIT_API_KEY\": \"sk_live_xxx\"\n }\n }\n }\n}\n```\n\n### API-key resolution order\n\nThe local server resolves the key in this order:\n\n1. `--api-key <key>` flag\n2. `BYTEKIT_API_KEY` environment variable\n\n## Tool inventory\n\n| Tool | What it does |\n| --- | --- |\n| `scrape_url` | Fetch a URL and return HTML, clean markdown, links, or images. |\n| `web_search` | Run a web search and return ranked organic results. |\n| `screenshot_url` | Capture a screenshot of a page (desktop/mobile, PNG/JPEG). |\n| `get_result` | Fetch a previously created screenshot by id. |\n| `get_account` | Return account details, plan, and current usage/quota. |\n| `list_docs` | List every page in the bundled ByteKit documentation. |\n| `search_docs` | Search the bundled documentation. |\n| `get_doc` | Fetch the full markdown of one documentation page. |\n\nThe server also exposes **resources** (`bytekit://account`,\n`bytekit://screenshot/{id}`) and **prompts** (`summarize_webpage`,\n`extract_structured_data`, `research_topic`) that MCP hosts can surface directly.\n\n## Limits\n\nThe hosted `POST /mcp` endpoint caps request bodies at **1 MB**. MCP tool\narguments are small (a URL plus a few options), so this comfortably covers\nevery tool and prompt in the matrix above — including `research_topic`, the\nlargest legitimate call, which carries a list of URLs. An oversized request\ngets a `413` with a JSON-RPC-shaped error body rather than a dropped\nconnection.\n\nEvery route in the table below carries its own body-size limit, sized to\nthat route's shape rather than reused from `/mcp` (a bulk endpoint's\nrealistic payload is far larger than an MCP tool call). This covers both the\ncapture/data create endpoints and the unauthenticated webhook-ingress\nreceivers, which need a guard for the same reason — their handlers read the\nfull body before any check runs:\n\n| Endpoint | Limit | Error |\n|---|---|---|\n| `POST /v1/scrape`, `/v1/search`, `/v1/scrape/bulk`, `/v1/schema` | 512 KB | `400 request_too_large` |\n| `POST /v1/fetch` | 512 KB | `400 request_too_large` |\n| `POST /v1/screenshots` | 512 KB | `400 request_too_large` |\n| `POST /v1/monitors` | 512 KB | `400 request_too_large` |\n| `POST /v1/sitemap` | 512 KB | `400 request_too_large` |\n| `POST /v1/bulk` | 4 MB pre-auth (chunked) / 32 MB fail-safe (declared length) / per-plan up to 28.7 MB | `400 request_too_large` |\n| `POST /v1/fetch/bulk` | 2 MB pre-auth (chunked) / 20 MB fail-safe (declared length) / per-plan up to 16.8 MB | `400 request_too_large` |\n| `POST /v1/webhook-deliveries/{id}/retry` | 64 KB | `400 request_too_large` |\n| `POST /v1/webhooks/stripe` (internal, Stripe ingress) | 256 KB | `400` (bespoke `{ error }` body) |\n| `POST /webhooks/clerk` (internal, Clerk ingress) | 256 KB | `400 request_too_large` (bespoke `{ error }` body) |\n| `POST /mcp` | 1 MB | `413` (JSON-RPC error) |\n\nThe two bulk endpoints are guarded in a two-tier shape, not by a single\nceiling. A streamed body with no `Content-Length` header is capped at the\nsmall pre-auth limit (4 MB / 2 MB) before your API key is checked; a body\nthat declares `Content-Length` is instead bounded there by a larger fail-safe\n(32 MB / 20 MB) rather than the real limit, since that branch reads nothing\nuntil your key is verified. Once your key is verified, a second check\nre-gates the body against your account's own `max_bulk_size` — sized off the\ndocumented custom production account's real `max_bulk_size` of 50,000 URLs\nor per-item configs (root CLAUDE.md: \"50k bulk\") — which reaches 28.7 MB /\n16.8 MB for that account. A standard-plan account's effective ceiling is\nexactly the pre-auth limit; either tier's overrun returns\n`400 request_too_large`.\n\n## Next steps\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — make your first ByteKit API call.\n- [Authentication](https://bytekit.com/docs/guides/authentication) — key formats and management."
356
356
  },
357
357
  "quickstart": {
358
358
  "title": "Quickstart",
@@ -367,12 +367,12 @@
367
367
  "sdk/python/bulk": {
368
368
  "title": "Bulk",
369
369
  "section": "SDK Reference",
370
- "body": "# Bulk\n\nAPI functions for the Bulk resource.\n\n# Bulk\n\nFunctions for interacting with the `bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Bulk\n\nCreate mixed bulk job\n\nEnqueues screenshots or scrapes in a single batch.\nProvide `urls` (simple list) or `items` (per-item config), not both.\nWebhook deliveries include `X-ByteKit-Event: bulk.completed` so\nreceivers can dispatch on the header without parsing the body shape.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 4 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 32 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's richer per-item override\nbudget), which reaches 28.7 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 4 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (CreateBulkBody): Provide `urls` (simple list) OR `items` (per-item config), not`\n- `both. `type` selects the capture kind per entry — only`\n- ``screenshot` and `scrape` are accepted (`recording` is`\n- `deactivated). Behaviour fields may be set per item or via`\n- ``defaults`; a per-item value overrides the matching default.`\n- `This includes `type`: an entry with no `type` of its own`\n- `inherits `defaults.type`, falling back to `screenshot` only`\n- `when neither is set.`\n- `The top-level object, each `items[]` entry, and `defaults``\n- `each reject unrecognized keys with a 422 `validation_error``\n- `(the offending key name appears in the error's `details``\n- `message text) rather than silently discarding them.`\n- ``items[]` and `defaults` do not share one field set`\n- ``device_scale_factor` is accepted only under `defaults` (a`\n- `per-item value 422s), and `duration`/`scenario` are accepted`\n- `only per item (a `defaults` value 422s). `metadata` is`\n- `different from those three: it is valid both at the top`\n- `level of the body and per item, but rejected with a 422 if`\n- `placed under `defaults`. See the `422` response below.`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateBulkResponse202, Error]]\n```\n\n## Delete Bulk\n\nCancel a bulk job\n\nCancels an in-flight bulk job: drains its still-queued (pending) child jobs and refunds the quota\nheld for exactly those drained children. Children already completed, failed, or in progress are\nuntouched and keep their charge. Idempotent — cancelling an already-terminal job (completed, failed,\nor cancelled) is a no-op that returns 200 with the job's real, unchanged status and refunds nothing.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[DeleteBulkResponse200, Error]]\nsync(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[DeleteBulkResponse200, Error]]\nawait asyncio(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\n```\n\n## Get Bulk\n\nGet bulk job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200]]\nsync(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200]]\n```\n\n## List Bulk Screenshots\n\nList bulk job items\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[ListBulkScreenshotsResponse200]\nsync(id=id, client=client) -> Optional[ListBulkScreenshotsResponse200]\nawait asyncio_detailed(id=id, client=client) -> Response[ListBulkScreenshotsResponse200]\nawait asyncio(id=id, client=client) -> Optional[ListBulkScreenshotsResponse200]\n```"
370
+ "body": "# Bulk\n\nAPI functions for the Bulk resource.\n\n# Bulk\n\nFunctions for interacting with the `bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Bulk\n\nCreate mixed bulk job\n\nEnqueues screenshots or scrapes in a single batch.\nProvide `urls` (simple list) or `items` (per-item config), not both.\nWebhook deliveries include `X-ByteKit-Event: bulk.completed` so\nreceivers can dispatch on the header without parsing the body shape.\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 4 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 32 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's richer per-item override\nbudget), which reaches 28.7 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 4 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (CreateBulkBody): Provide `urls` (simple list) OR `items` (per-item config), not`\n- `both. `type` selects the capture kind per entry — only`\n- ``screenshot` and `scrape` are accepted (`recording` is`\n- `deactivated). Behaviour fields may be set per item or via`\n- ``defaults`; a per-item value overrides the matching default.`\n- `This includes `type`: an entry with no `type` of its own`\n- `inherits `defaults.type`, falling back to `screenshot` only`\n- `when neither is set.`\n- `The top-level object, each `items[]` entry, and `defaults``\n- `each reject unrecognized keys with a 422 `validation_error``\n- `(the offending key name appears in the error's `details``\n- `message text) rather than silently discarding them.`\n- ``items[]` and `defaults` do not share one field set`\n- ``device_scale_factor` is accepted only under `defaults` (a`\n- `per-item value 422s), and `duration`/`scenario` are accepted`\n- `only per item (a `defaults` value 422s). `metadata` is`\n- `different from those three: it is valid both at the top`\n- `level of the body and per item, but rejected with a 422 if`\n- `placed under `defaults`. See the `422` response below.`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateBulkResponse202, Error]]\n```\n\n## Delete Bulk\n\nCancel a bulk job\n\nCancels an in-flight bulk job: drains its still-queued (pending) child jobs and refunds the quota\nheld for exactly those drained children. Children already completed, failed, or in progress are\nuntouched and keep their charge. Idempotent — cancelling an already-terminal job (completed, failed,\nor cancelled) is a no-op that returns 200 with the job's real, unchanged status and refunds nothing.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[DeleteBulkResponse200, Error]]\nsync(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[DeleteBulkResponse200, Error]]\nawait asyncio(id=id, client=client) -> Optional[Union[DeleteBulkResponse200, Error]]\n```\n\n## Get Bulk\n\nGet bulk job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200]]\nsync(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetBulkResponse200]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetBulkResponse200]]\n```\n\n## List Bulk Screenshots\n\nList bulk job items\n\nReturns the bulk job's items, discriminated by `type`.\n\n**Downloading item artifacts.** `image_url` (`type: screenshot`) and both\n`content_url` and `markdown_url` (`type: scrape`) are **pre-signed** URLs,\nminted fresh on every read of this endpoint and valid for **600 seconds\n(10 minutes)** —\nthe same signing lifetime as `content_url` on `GET /v1/fetch/bulk/\\{id\\}`.\nThe underlying objects are private, so an unsigned URL returns `401`:\ndownload inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, carry `null` or the unsigned stored URL instead.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[ListBulkScreenshotsResponse200]\nsync(id=id, client=client) -> Optional[ListBulkScreenshotsResponse200]\nawait asyncio_detailed(id=id, client=client) -> Response[ListBulkScreenshotsResponse200]\nawait asyncio(id=id, client=client) -> Optional[ListBulkScreenshotsResponse200]\n```"
371
371
  },
372
372
  "sdk/python/client": {
373
373
  "title": "Client",
374
374
  "section": "SDK Reference",
375
- "body": "# Client\n\nHTTP client classes for the ByteKit Python SDK.\n\n# Client Reference\n\nThe ByteKit Python SDK provides two client classes for making API requests.\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.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'Client'\n```\n\nGet a new client matching this one with a new timeout (in seconds)\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> 'Client'\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> 'Client'\n```\n\nManually the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set\n\n## AuthenticatedClient\n\nA Client which has been authenticated for use on secured endpoints\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded.\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\nprefix: The prefix to use for the Authorization header\nauth_header_name: The name of the Authorization header\n\n### search\n\n```python\nsearch(query: str, type: Optional[str] = None, limit: Optional[int] = None, country: Optional[str] = None, language: Optional[str] = None, date_range: Optional[str] = None) -> 'CreateSearchResponse200'\n```\n\nRun a web search and return ranked organic results.\n\nThin, statically-declared delegate to the hand-written ``_search`` appended at the\nbottom of this module; the full contract (argument semantics, the\n``errors.UnexpectedStatus`` guarantee) is documented there.\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with a new timeout (in seconds)\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> 'AuthenticatedClient'\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> 'AuthenticatedClient'\n```\n\nManually the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set"
375
+ "body": "# Client\n\nHTTP client classes for the ByteKit Python SDK.\n\n# Client Reference\n\nThe ByteKit Python SDK provides two client classes for making API requests.\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.\n\n``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,\nbut can be set to False for testing purposes.\n\n``follow_redirects``: Whether or not to follow redirects. Default value is False.\n\n``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.\n\nAttributes:\nraise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a\nstatus code that was not documented in the source OpenAPI document. Can also be provided as a keyword\nargument to the constructor.\nExplicit constructor arguments always win over these defaults (explicit arg > default).\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'Client'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'Client'\n```\n\nGet a new client matching this one with a new timeout (in seconds)\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> 'Client'\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> 'Client'\n```\n\nManually the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set\n\n## AuthenticatedClient\n\nA Client which has been authenticated for use on secured endpoints\n\nThe following are accepted as keyword arguments and will be used to construct httpx Clients internally:\n\n``base_url``: The base URL for the API, all requests are made to a relative path to this URL\n\n``cookies``: A dictionary of cookies to be sent with every request\n\n``headers``: A dictionary of headers to be sent with every request\n\n``timeout``: The maximum amount of a time a request can take. API functions will raise\nhttpx.TimeoutException if this is exceeded.\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[str] = None, limit: Optional[int] = None, country: Optional[str] = None, language: Optional[str] = None, date_range: Optional[str] = None) -> 'CreateSearchResponse200'\n```\n\nRun a web search and return ranked organic results.\n\nThin, statically-declared delegate to the hand-written ``_search`` appended at the\nbottom of this module; the full contract (argument semantics, the\n``errors.UnexpectedStatus`` guarantee) is documented there.\n\n### with_headers\n\n```python\nwith_headers(headers: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional headers\n\n### with_cookies\n\n```python\nwith_cookies(cookies: dict[str, str]) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with additional cookies\n\n### with_timeout\n\n```python\nwith_timeout(timeout: httpx.Timeout) -> 'AuthenticatedClient'\n```\n\nGet a new client matching this one with a new timeout (in seconds)\n\n### set_httpx_client\n\n```python\nset_httpx_client(client: httpx.Client) -> 'AuthenticatedClient'\n```\n\nManually set the underlying httpx.Client\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\n### get_httpx_client\n\n```python\nget_httpx_client() -> httpx.Client\n```\n\nGet the underlying httpx.Client, constructing a new one if not previously set\n\n### set_async_httpx_client\n\n```python\nset_async_httpx_client(async_client: httpx.AsyncClient) -> 'AuthenticatedClient'\n```\n\nManually the underlying httpx.AsyncClient\n\n**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.\n\nA client set here is YOURS to manage: the SDK never rebuilds or closes it, even if\nit is later used from a different event loop. Clients the SDK constructs itself are\nrebuilt automatically when the running event loop changes.\n\n### get_async_httpx_client\n\n```python\nget_async_httpx_client() -> httpx.AsyncClient\n```\n\nGet the underlying httpx.AsyncClient, constructing a new one if not previously set"
376
376
  },
377
377
  "sdk/python/fetch": {
378
378
  "title": "Fetch",
@@ -382,7 +382,7 @@
382
382
  "sdk/python/fetch-bulk": {
383
383
  "title": "Fetch Bulk",
384
384
  "section": "SDK Reference",
385
- "body": "# Fetch Bulk\n\nAPI functions for the Fetch Bulk resource.\n\n# Fetch Bulk\n\nFunctions for interacting with the `fetch_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Fetch Bulk\n\nBulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (cookies, wait_for_selector, etc.).\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 2 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 20 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's per-item override budget),\nwhich reaches 16.8 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 2 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (CreateFetchBulkBody)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, Error]]\n```\n\n## Get Fetch Bulk\n\nGet fetch bulk job status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, GetFetchBulkResponse200]]\nsync(id=id, client=client) -> Optional[Union[Error, GetFetchBulkResponse200]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetFetchBulkResponse200]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetFetchBulkResponse200]]\n```"
385
+ "body": "# Fetch Bulk\n\nAPI functions for the Fetch Bulk resource.\n\n# Fetch Bulk\n\nFunctions for interacting with the `fetch_bulk` API resource. Each operation ships in four forms — `sync` / `sync_detailed` and their `async` counterparts.\n\n## Create Fetch Bulk\n\nBulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (cookies, wait_for_selector, etc.).\n\n**Limits:** request bodies are guarded in a two-tier shape. A streamed body\nwith no `Content-Length` header is capped at 2 MB before your API key\nis checked; a body that declares `Content-Length` is instead bounded\nthere by a 20 MB fail-safe (not the real limit — see below), since\nthat branch reads nothing until your key is verified. Once your key\nis verified, a second check re-gates the body against your account's\nown `max_bulk_size` (at this endpoint's per-item override budget),\nwhich reaches 16.8 MB for the largest documented account. A\nstandard-plan account's effective ceiling is 2 MB; either tier's\noverrun returns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `body (CreateFetchBulkBody)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, Error]]\nsync(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, Error]]\nawait asyncio_detailed(client=client, body=body) -> Response[Union[CreateFetchBulkResponse202, Error]]\nawait asyncio(client=client, body=body) -> Optional[Union[CreateFetchBulkResponse202, Error]]\n```\n\n## Get Fetch Bulk\n\nGet fetch bulk job status\n\nReturns the job envelope plus its per-URL items.\n\n**Downloading item content.** Each completed item's `content_url` is a\n**pre-signed** URL, minted fresh on every read of this endpoint and valid\nfor **600 seconds (10 minutes)** — the same signing lifetime as the\n`image_url` returned by `GET /v1/bulk/\\{id\\}/screenshots`. The underlying\nobjects are private, so an unsigned URL returns `401`: download the\ncontent inside that window, or re-poll this endpoint for a fresh\nsignature. Items that are not `completed`, and completed items with no\nstored object, carry `null` or the unsigned stored URL instead.\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, GetFetchBulkResponse200]]\nsync(id=id, client=client) -> Optional[Union[Error, GetFetchBulkResponse200]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, GetFetchBulkResponse200]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, GetFetchBulkResponse200]]\n```"
386
386
  },
387
387
  "sdk/python/monitors": {
388
388
  "title": "Monitors",
@@ -402,7 +402,7 @@
402
402
  "sdk/python/screenshots": {
403
403
  "title": "Screenshots",
404
404
  "section": "SDK Reference",
405
- "body": "# Screenshots\n\nAPI functions for the Screenshots resource.\n\n# 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` to return 202 immediately.\nPoll via GET /v1/screenshots/\\{id\\}.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `async_ (Union[Unset, bool])`\n- `body (ScreenshotRequest)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScreenshotResponse]]\nsync(client=client, body=body, async_=async_) -> Optional[Union[Error, ScreenshotResponse]]\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScreenshotResponse]]\nawait asyncio(client=client, body=body, async_=async_) -> Optional[Union[Error, ScreenshotResponse]]\n```\n\n## Get Screenshot\n\nGet screenshot status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nsync(id=id, client=client) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\n```"
405
+ "body": "# Screenshots\n\nAPI functions for the Screenshots resource.\n\n# 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` to return 202 immediately.\nPoll via GET /v1/screenshots/\\{id\\}.\n\n**Limits:** request bodies are capped at 512 KB. An oversized body\nreturns a `400` with error code `request_too_large`.\n\n**Parameters**\n\n- `async_ (Union[Unset, bool])`\n- `body (ScreenshotRequest)`\n\n**Call styles**\n\n```python\nsync_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nsync(client=client, body=body, async_=async_) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio_detailed(client=client, body=body, async_=async_) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio(client=client, body=body, async_=async_) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\n```\n\n## Get Screenshot\n\nGet screenshot status\n\n**Parameters**\n\n- `id (str)`\n\n**Call styles**\n\n```python\nsync_detailed(id=id, client=client) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nsync(id=id, client=client) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio_detailed(id=id, client=client) -> Response[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\nawait asyncio(id=id, client=client) -> Optional[Union[Error, ScreenshotResponse, Union['Error', 'ScreenshotResponse']]]\n```"
406
406
  },
407
407
  "sdk/python/search": {
408
408
  "title": "Search",
@@ -14,11 +14,13 @@ import type { ScrapeResult } from '../client.js';
14
14
  * handle, and also what GET returns while the job is pending/processing (gateway
15
15
  * routes/scrape.ts `handleGetScrapeById`). Non-error: the agent should poll, not fail.
16
16
  * - failed: `{ status:'failed', id, error:{ code, message, ... } }` — flagged as a tool
17
- * error, rendering the public error code + message only.
17
+ * error, rendering the public error code + message (plus any `warnings` the envelope
18
+ * carries, issue #2679).
18
19
  * - success: full envelope; every textual format present (markdown, html, raw_html) is
19
20
  * rendered, in that fixed canonical order — the first present format is the
20
21
  * unlabeled primary, each remaining one follows under its own
21
- * `--- format: <name> ---` delimiter — plus optional links/images blocks, all inside
22
+ * `--- format: <name> ---` delimiter — plus an optional `warnings` block (issue #2679)
23
+ * and optional links/images blocks, all inside
22
24
  * ONE truncation budget (issue #2589; previously only one format was shown, and
23
25
  * links/images were appended AFTER truncation). The links/images block is passed to
24
26
  * the truncator as a RESERVED trailing block (capped at half the budget) so it
@@ -1,13 +1,41 @@
1
1
  import { truncateContent } from './truncate.js';
2
+ // One rendered line PER ENTRY, deliberately not joined here (issue #2687 item 6): the
3
+ // truncator needs the entry boundaries to cut between whole URLs instead of slicing the
4
+ // joined block to a raw byte count, which severed the tail entry mid-URL.
2
5
  function renderLinks(links) {
3
- return links
4
- .map((link) => typeof link === 'string' ? link : `${link.url}${link.text ? ` — ${link.text}` : ''}`)
5
- .join('\n');
6
+ return links.map((link) => typeof link === 'string' ? link : `${link.url}${link.text ? ` — ${link.text}` : ''}`);
6
7
  }
7
8
  function renderImages(images) {
8
- return images
9
- .map((image) => typeof image === 'string' ? image : `${image.url}${image.alt ? ` — ${image.alt}` : ''}`)
10
- .join('\n');
9
+ return images.map((image) => typeof image === 'string' ? image : `${image.url}${image.alt ? ` — ${image.alt}` : ''}`);
10
+ }
11
+ /**
12
+ * One line per warning: `<code>: <message>` plus ` (<element>)` when the warning names a
13
+ * DOM element or format (issue #2679).
14
+ *
15
+ * The `code` is deliberately part of the LINE, not just of the section header: it is the
16
+ * machine-readable half of the signal, and it is what tells `artifact_unavailable` (a
17
+ * billed format is missing) apart from `lossy_table` (cosmetic). `element` is `null` for
18
+ * every whole-extraction warning (`low_quality_extraction`, `llm_clean_*`, …) and must
19
+ * then render nothing at all rather than a literal `(null)`.
20
+ *
21
+ * The input is the real `ScrapeWarning` union from scrape-contract.generated.ts — all 12
22
+ * codes — so no hand-written subset can drift from the contract.
23
+ */
24
+ function renderWarnings(warnings) {
25
+ return warnings.map((w) => `${w.code}: ${w.message}${w.element ? ` (${w.element})` : ''}`);
26
+ }
27
+ /**
28
+ * `warnings` when the envelope carries a non-empty array, `[]` otherwise (issue #2679 E3).
29
+ *
30
+ * The parameter is structurally typed rather than taking a `ScrapeEnvelope`, because the
31
+ * field is strict-optional on the success envelope and is not declared at all on the
32
+ * failed one — this keeps ONE presence guard for both branches, so an absent field can
33
+ * never reach the render as `undefined`. `status` is in the signature only to keep the
34
+ * parameter off TypeScript's weak-type check (an all-optional parameter type rejects the
35
+ * failed envelope outright with TS2559); every envelope shape carries it.
36
+ */
37
+ function presentWarnings(envelope) {
38
+ return Array.isArray(envelope.warnings) ? envelope.warnings : [];
11
39
  }
12
40
  // Textual formats in canonical render order. The first one present in the envelope is
13
41
  // the unlabeled primary (today's position); every other one present follows under its
@@ -32,11 +60,13 @@ const FORMAT_DELIMITER_MARKERS = TEXTUAL_FORMATS.map((f) => `\n\n--- format: ${f
32
60
  * handle, and also what GET returns while the job is pending/processing (gateway
33
61
  * routes/scrape.ts `handleGetScrapeById`). Non-error: the agent should poll, not fail.
34
62
  * - failed: `{ status:'failed', id, error:{ code, message, ... } }` — flagged as a tool
35
- * error, rendering the public error code + message only.
63
+ * error, rendering the public error code + message (plus any `warnings` the envelope
64
+ * carries, issue #2679).
36
65
  * - success: full envelope; every textual format present (markdown, html, raw_html) is
37
66
  * rendered, in that fixed canonical order — the first present format is the
38
67
  * unlabeled primary, each remaining one follows under its own
39
- * `--- format: <name> ---` delimiter — plus optional links/images blocks, all inside
68
+ * `--- format: <name> ---` delimiter — plus an optional `warnings` block (issue #2679)
69
+ * and optional links/images blocks, all inside
40
70
  * ONE truncation budget (issue #2589; previously only one format was shown, and
41
71
  * links/images were appended AFTER truncation). The links/images block is passed to
42
72
  * the truncator as a RESERVED trailing block (capped at half the budget) so it
@@ -54,11 +84,29 @@ export function renderScrapeResult(result) {
54
84
  'Status: queued',
55
85
  `URL: ${result.url}`,
56
86
  `Status URL: ${result.status_url}`,
87
+ // `events` is spec-required on the queued envelope (ScrapeQueuedEnvelope.events)
88
+ // and was dropped entirely (issue #2687 item 5) — an agent that registered a
89
+ // webhook had no way to see which events the job is actually subscribed to. An
90
+ // empty array renders `none`, because "subscribed to nothing" is a different
91
+ // answer from "not rendered".
92
+ `Events: ${Array.isArray(result.events) && result.events.length > 0 ? result.events.join(', ') : 'none'}`,
93
+ // Mirrors render-screenshot.ts's pending-branch sentence verbatim (issue #2687
94
+ // item 10): 0.2.2 gave a still-pending SCREENSHOT this guidance (#2591 item 4)
95
+ // but left the queued SCRAPE render without it, so an agent holding an `sc_`
96
+ // handle was told the job was queued and left to invent the next step.
97
+ 'Use get_result with this ID to check when it completes.',
57
98
  ].join('\n'),
58
99
  isError: false,
59
100
  };
60
101
  }
61
102
  if (result.status === 'failed') {
103
+ // Warnings on the terminal-failure envelope too (issue #2679). `ScrapeErrorEnvelope`
104
+ // does not DECLARE the field today, and `buildErrorEnvelope` never sets it — this is
105
+ // the renderer's half of the invariant "no warning the API emits is invisible through
106
+ // MCP": whichever terminal envelope a warning arrives on, the renderer is not the
107
+ // reason it is lost. No truncation budget applies here — the failed render has no
108
+ // payload to compete with.
109
+ const failedWarnings = renderWarnings(presentWarnings(result));
62
110
  // `id` is nullable (issue #2591 item 7; openapi.yaml ScrapeErrorEnvelope.id:
63
111
  // `type: ["string", "null"]`) — null when the job was never queued (e.g. a
64
112
  // validation failure before a row existed). Render an em-dash rather than the
@@ -69,6 +117,11 @@ export function renderScrapeResult(result) {
69
117
  'Status: failed',
70
118
  `Error: ${result.error.code}`,
71
119
  result.error.message,
120
+ // Same `Warnings (N):` header the success render uses, so one output contract
121
+ // covers both terminal shapes. Absent/empty appends nothing at all (E3).
122
+ ...(failedWarnings.length > 0
123
+ ? ['', `Warnings (${failedWarnings.length}):`, ...failedWarnings]
124
+ : []),
72
125
  ].join('\n'),
73
126
  isError: true,
74
127
  };
@@ -86,27 +139,58 @@ export function renderScrapeResult(result) {
86
139
  // Links/images are built as a separate trailing block (not folded into `payload`
87
140
  // directly) so they can be passed to truncateContent as a RESERVED block rather
88
141
  // than ordinary tail content — see cr-1/cr-4 in the function doc above.
89
- let trailingBlock = '';
90
- if (Array.isArray(result.formats.links) && result.formats.links.length > 0) {
91
- const linkList = renderLinks(result.formats.links);
92
- trailingBlock += `\n\nLinks (${result.formats.links.length}):\n${linkList}`;
142
+ //
143
+ // Presence of the key — not a non-empty length — is what gates the section (issue
144
+ // #2687 item 1). The API echoes every REQUESTED format back as an array, empty or
145
+ // not, and omits the key entirely for a format that was not requested. So an empty
146
+ // array means "you asked, and the page had none" and gets a `Links (0):` header,
147
+ // while an absent key means "you did not ask" and renders nothing at all (E4) —
148
+ // without this distinction the agent cannot tell an empty page from an unrequested
149
+ // format, and a zero-line on every scrape would be pure noise.
150
+ const trailingSections = [];
151
+ // Warnings go FIRST among the reserved sections (issue #2679). `renderReserveSections`
152
+ // fills sequentially, so section order IS budget priority: a failure signal —
153
+ // `artifact_unavailable` says a format the caller was BILLED for is missing — must not
154
+ // be the thing an oversized links list crowds out. Riding the reserve is also what
155
+ // keeps the block inside #2687's truncation budget accounting (E2) rather than
156
+ // appended outside it.
157
+ //
158
+ // Gated on a NON-EMPTY array, unlike the links/images sections just below. Their
159
+ // presence-of-key rule (#2687 item 1) exists because the API echoes every REQUESTED
160
+ // format back, so `[]` means "you asked, and there were none". Nobody requests
161
+ // warnings, so `warnings: []` carries no such answer and a `Warnings (0):` header would
162
+ // be pure noise on every clean scrape — both `[]` and absent render nothing.
163
+ const warnings = presentWarnings(result);
164
+ if (warnings.length > 0) {
165
+ trailingSections.push({ label: 'Warnings', entries: renderWarnings(warnings) });
166
+ }
167
+ if (Array.isArray(result.formats.links)) {
168
+ trailingSections.push({ label: 'Links', entries: renderLinks(result.formats.links) });
93
169
  }
94
- if (Array.isArray(result.formats.images) && result.formats.images.length > 0) {
95
- const imgList = renderImages(result.formats.images);
96
- trailingBlock += `\n\nImages (${result.formats.images.length}):\n${imgList}`;
170
+ if (Array.isArray(result.formats.images)) {
171
+ trailingSections.push({ label: 'Images', entries: renderImages(result.formats.images) });
97
172
  }
98
173
  // Single truncation site: the WHOLE assembled payload (formats + links + images) is
99
174
  // truncated once, then meta lines are prepended (issue #2589 audit L1 — links/images
100
175
  // used to be appended AFTER truncation, so the combined output could blow past the
101
- // budget). `trailingBlock` is passed as a reserved suffix, not concatenated ahead of
102
- // time, so it survives the cut even when `payload` alone already fills the budget.
103
- const { text, truncated } = truncateContent(payload, undefined, undefined, trailingBlock, FORMAT_DELIMITER_MARKERS);
176
+ // budget). `trailingSections` is passed as a reserved suffix, not concatenated ahead of
177
+ // time, so it survives the cut even when `payload` alone already fills the budget — and
178
+ // it travels as STRUCTURED sections rather than a joined string so the truncator cuts
179
+ // between whole entries and announces each cut per section (issue #2687 item 6).
180
+ const { text, truncated } = truncateContent(payload, undefined, undefined, trailingSections, FORMAT_DELIMITER_MARKERS);
104
181
  const metaLines = [
105
182
  `ID: ${result.id}`,
106
183
  `URL: ${result.url}`,
107
184
  result.final_url !== result.url ? `Final URL: ${result.final_url}` : null,
108
185
  result.status_code !== null ? `Status Code: ${result.status_code}` : null,
109
186
  result.content_type ? `Content-Type: ${result.content_type}` : null,
187
+ // The billing basis — compressed upstream wire bytes (issue #2687 item 5). Nothing
188
+ // else in the render surfaced what the call cost, so an agent budgeting bandwidth
189
+ // was flying blind. Spelled distinctly from the `Content-Type` line above so the two
190
+ // are not confusable at a glance.
191
+ typeof result.content_length === 'number'
192
+ ? `Content Length: ${result.content_length} bytes`
193
+ : null,
110
194
  result.metadata.title ? `Title: ${result.metadata.title}` : null,
111
195
  truncated ? 'Note: Content was truncated to 100KB' : null,
112
196
  ]
@@ -24,8 +24,24 @@ export function renderScreenshotResult(result) {
24
24
  const lines = [
25
25
  result.id ? `ID: ${result.id}` : null,
26
26
  result.url ? `URL: ${result.url}` : null,
27
+ // Spec field (openapi.yaml ScreenshotResponse.page_title) that the tool description
28
+ // already promises as "metadata" but the renderer dropped (issue #2687 item 4). It
29
+ // is the only in-band signal of WHAT was captured — for an agent chasing a redirect
30
+ // or an interstitial, the rendered title is how it learns it got the wrong page.
31
+ // Omitted (never `Page title: null`) when the API returns no title.
32
+ result.page_title ? `Page title: ${result.page_title}` : null,
27
33
  `Status: ${result.status}`,
28
34
  result.image_url ? `Image: ${result.image_url}` : null,
35
+ // The image URL is a short-lived SIGNED link (issue #2687 item 4). Nothing in the
36
+ // render said so, and an agent that stashed the URL and fetched it later got an
37
+ // opaque 403. Emitted only alongside an actual image URL — a pending screenshot has
38
+ // nothing to expire. `expires_at` (openapi.yaml ScreenshotResponse) is preferred
39
+ // when present, because a concrete instant is actionable where a rule of thumb is not.
40
+ result.image_url
41
+ ? result.expires_at
42
+ ? `Note: the image URL is a signed link that expires at ${result.expires_at} — download it before then.`
43
+ : 'Note: the image URL is a signed link that expires roughly 600s after it is issued — download it before then.'
44
+ : null,
29
45
  result.image_width && result.image_height
30
46
  ? `Size: ${result.image_width}x${result.image_height}`
31
47
  : null,
@@ -2,7 +2,44 @@
2
2
  * Truncate text content to a maximum byte size while preserving valid UTF-8.
3
3
  * Returns the truncated text with a suffix indicating truncation + content URL.
4
4
  */
5
- export declare function truncateContent(text: string, maxBytes?: number, contentUrl?: string, reserve?: string, dangleMarkers?: readonly string[]): {
5
+ /**
6
+ * A labeled, entry-addressable block of the reserve (issue #2687 item 6).
7
+ *
8
+ * Passing the reserve as SECTIONS rather than one pre-joined string is what lets the
9
+ * truncator cut at an entry boundary and account for the cut per section. A raw string
10
+ * reserve can only be sliced to a byte count, which routinely severed the tail entry
11
+ * mid-URL and left the section header advertising its pre-cut count.
12
+ */
13
+ export interface ReserveSection {
14
+ /** Section label as rendered in the header, e.g. `Links`. */
15
+ label: string;
16
+ /** One rendered line per entry; never joined by the caller. */
17
+ entries: string[];
18
+ }
19
+ /**
20
+ * Renders `sections` into the reserve block, emitting only WHOLE entries and announcing
21
+ * any cut per section (issue #2687 item 6).
22
+ *
23
+ * Budget policy, in order:
24
+ * 1. Every section header is emitted if it fits — a section the agent asked for must be
25
+ * named even when the budget leaves no room for its entries, otherwise the render is
26
+ * indistinguishable from "you did not request it" (the same signal item 1 restores).
27
+ * 2. Entries are then filled in section order. An entry is taken only if it fits WHOLE,
28
+ * and — unless it is the section's last — only if room for that section's marker
29
+ * survives it. That reservation is what guarantees a cut is always announceable.
30
+ * 3. A section that lost entries gets its marker with the count actually emitted.
31
+ *
32
+ * Filling sequentially (rather than pro-rating across sections) means a later section can
33
+ * end up with a `0 of N` marker. That is deliberate: it reports honestly which entries the
34
+ * caller is not seeing, instead of silently rebalancing which content gets dropped.
35
+ *
36
+ * Degenerate budgets (smaller than the headers plus one marker) degrade to headers alone,
37
+ * or to the empty string. No signal is lost there either: the header still carries the
38
+ * real total, and `truncateContent` only reaches this path when it is about to append its
39
+ * own global truncation suffix.
40
+ */
41
+ export declare function renderReserveSections(sections: readonly ReserveSection[], maxBytes: number): string;
42
+ export declare function truncateContent(text: string, maxBytes?: number, contentUrl?: string, reserve?: string | readonly ReserveSection[], dangleMarkers?: readonly string[]): {
6
43
  text: string;
7
44
  truncated: boolean;
8
45
  };