@hunt-labs/bytekit-mcp 0.1.2 → 0.1.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.
- package/CHANGELOG.md +65 -0
- package/dist/cli.d.ts +18 -1
- package/dist/cli.js +21 -3
- package/dist/client.js +1 -1
- package/dist/docs-bundle/docs-bundle.json +60 -70
- package/dist/tools/web-search.d.ts +1 -1
- package/dist/tools/web-search.js +2 -2
- package/package.json +5 -10
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@hunt-labs/bytekit-mcp` are documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
This file records only the delta between versions. For how to use the package
|
|
9
|
+
today, see [README.md](./README.md), which remains the authoritative usage guide.
|
|
10
|
+
|
|
11
|
+
## [0.1.3] - 2026-07-16
|
|
12
|
+
|
|
13
|
+
### Changed (**BREAKING**)
|
|
14
|
+
|
|
15
|
+
- The MCP tool `web-search` is renamed to `web_search` (snake_case, consistent
|
|
16
|
+
with every other tool). MCP clients bound to the old `web-search` name must
|
|
17
|
+
update. (#2421)
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- The 401 error message now references `BYTEKIT_API_KEY`; `--base-url` now falls
|
|
22
|
+
back to the `BYTEKIT_BASE_URL` environment variable when no flag is passed. (#2421)
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- The bundled offline docs (`get_doc`/`list_docs`/`search_docs`) now teach the
|
|
27
|
+
correct `@hunt-labs/bytekit-sdk` install/import name instead of the dead
|
|
28
|
+
`@bytekit/sdk` scope. (#2449)
|
|
29
|
+
|
|
30
|
+
## [0.1.2] - 2026-07-15
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- `scrape_url` now reads the snake_case envelope fields the API actually returns
|
|
35
|
+
(`id`, `final_url`, `status_code`); the published 0.1.1 tarball read the old
|
|
36
|
+
camelCase fields (`scrapeId`, `finalUrl`, `statusCode`), so every metadata line
|
|
37
|
+
rendered `undefined` (#2419).
|
|
38
|
+
- The MCP handshake `serverInfo.version` is now derived from `package.json` instead
|
|
39
|
+
of a hardcoded literal, so it can never drift from the published version (#2419).
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- Compiled test code and fixtures are excluded from the published tarball — only
|
|
44
|
+
runtime `dist/**` (plus `README.md`, `LICENSE`, and now `CHANGELOG.md`) ships (#2419).
|
|
45
|
+
|
|
46
|
+
## [0.1.1] - 2026-07 [DEPRECATED]
|
|
47
|
+
|
|
48
|
+
### Note
|
|
49
|
+
|
|
50
|
+
- Superseded by 0.1.2. This release shipped stale `scrape_url` metadata rendering
|
|
51
|
+
(camelCase fields the API no longer returned) and included compiled test code in
|
|
52
|
+
the tarball. Upgrade to 0.1.2 or later.
|
|
53
|
+
|
|
54
|
+
## [0.1.0] - 2026-07
|
|
55
|
+
|
|
56
|
+
### Added
|
|
57
|
+
|
|
58
|
+
- Initial release of the ByteKit MCP server, exposing ByteKit web-data tools
|
|
59
|
+
(scrape, screenshot, search, docs) to AI agents over the Model Context Protocol,
|
|
60
|
+
as a local stdio server or hosted.
|
|
61
|
+
|
|
62
|
+
[0.1.3]: https://github.com/Hunt-Labs-Inc/ByteKit/tree/main/packages/mcp-server
|
|
63
|
+
[0.1.2]: https://github.com/Hunt-Labs-Inc/ByteKit/tree/main/packages/mcp-server
|
|
64
|
+
[0.1.1]: https://github.com/Hunt-Labs-Inc/ByteKit/tree/main/packages/mcp-server
|
|
65
|
+
[0.1.0]: https://github.com/Hunt-Labs-Inc/ByteKit/tree/main/packages/mcp-server
|
package/dist/cli.d.ts
CHANGED
|
@@ -24,7 +24,24 @@ export declare function resolveApiKey(opts: {
|
|
|
24
24
|
env: Record<string, string | undefined>;
|
|
25
25
|
}): string | undefined;
|
|
26
26
|
export declare const API_KEY_REQUIRED_MESSAGE = "Error: API key required. Use --api-key or set the BYTEKIT_API_KEY environment variable.\n";
|
|
27
|
-
|
|
27
|
+
/** The API host the server defaults to when no flag and no env var resolve a base URL. */
|
|
28
|
+
export declare const DEFAULT_BASE_URL = "https://api.bytekit.com";
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the API base URL from, in precedence order:
|
|
31
|
+
* 1. the `--base-url` flag
|
|
32
|
+
* 2. the `BYTEKIT_BASE_URL` env var
|
|
33
|
+
* 3. the built-in {@link DEFAULT_BASE_URL}
|
|
34
|
+
*
|
|
35
|
+
* Mirrors {@link resolveApiKey}'s shape (empty/absent flag falls through). This is the single
|
|
36
|
+
* base-URL resolution site for the binary; the `parseArgs` option deliberately carries NO
|
|
37
|
+
* `default:` so an absent flag yields `undefined` here rather than shadowing the env fallback.
|
|
38
|
+
* The MCP server never had a legacy `RAPIDCRAWL_BASE_URL` var, so none is honored.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveBaseUrl(opts: {
|
|
41
|
+
flag?: string | undefined;
|
|
42
|
+
env: Record<string, string | undefined>;
|
|
43
|
+
}): string;
|
|
44
|
+
export declare const HELP_TEXT = "ByteKit MCP Server\n\nUsage:\n bytekit-mcp --api-key <key> [--base-url <url>] [--verbose]\n\nOptions:\n --api-key ByteKit API key. Resolution order: --api-key flag, then\n BYTEKIT_API_KEY, then RAPIDCRAWL_API_KEY (legacy fallback).\n --base-url API base URL. Resolution order: --base-url flag, then\n BYTEKIT_BASE_URL (default: https://api.bytekit.com)\n --verbose Log requests to stderr\n --help Show this help message\n";
|
|
28
45
|
/**
|
|
29
46
|
* True when this module is the process entrypoint (run directly or via its bin),
|
|
30
47
|
* false when it is merely imported (e.g. the test suite exercising resolveApiKey).
|
package/dist/cli.js
CHANGED
|
@@ -29,6 +29,23 @@ export function resolveApiKey(opts) {
|
|
|
29
29
|
return flag ?? opts.env['BYTEKIT_API_KEY'] ?? opts.env['RAPIDCRAWL_API_KEY'];
|
|
30
30
|
}
|
|
31
31
|
export const API_KEY_REQUIRED_MESSAGE = 'Error: API key required. Use --api-key or set the BYTEKIT_API_KEY environment variable.\n';
|
|
32
|
+
/** The API host the server defaults to when no flag and no env var resolve a base URL. */
|
|
33
|
+
export const DEFAULT_BASE_URL = 'https://api.bytekit.com';
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the API base URL from, in precedence order:
|
|
36
|
+
* 1. the `--base-url` flag
|
|
37
|
+
* 2. the `BYTEKIT_BASE_URL` env var
|
|
38
|
+
* 3. the built-in {@link DEFAULT_BASE_URL}
|
|
39
|
+
*
|
|
40
|
+
* Mirrors {@link resolveApiKey}'s shape (empty/absent flag falls through). This is the single
|
|
41
|
+
* base-URL resolution site for the binary; the `parseArgs` option deliberately carries NO
|
|
42
|
+
* `default:` so an absent flag yields `undefined` here rather than shadowing the env fallback.
|
|
43
|
+
* The MCP server never had a legacy `RAPIDCRAWL_BASE_URL` var, so none is honored.
|
|
44
|
+
*/
|
|
45
|
+
export function resolveBaseUrl(opts) {
|
|
46
|
+
const flag = opts.flag && opts.flag.length > 0 ? opts.flag : undefined;
|
|
47
|
+
return flag ?? opts.env['BYTEKIT_BASE_URL'] ?? DEFAULT_BASE_URL;
|
|
48
|
+
}
|
|
32
49
|
export const HELP_TEXT = `ByteKit MCP Server
|
|
33
50
|
|
|
34
51
|
Usage:
|
|
@@ -37,7 +54,8 @@ Usage:
|
|
|
37
54
|
Options:
|
|
38
55
|
--api-key ByteKit API key. Resolution order: --api-key flag, then
|
|
39
56
|
BYTEKIT_API_KEY, then RAPIDCRAWL_API_KEY (legacy fallback).
|
|
40
|
-
--base-url API base URL
|
|
57
|
+
--base-url API base URL. Resolution order: --base-url flag, then
|
|
58
|
+
BYTEKIT_BASE_URL (default: https://api.bytekit.com)
|
|
41
59
|
--verbose Log requests to stderr
|
|
42
60
|
--help Show this help message
|
|
43
61
|
`;
|
|
@@ -45,7 +63,7 @@ async function main() {
|
|
|
45
63
|
const { values } = parseArgs({
|
|
46
64
|
options: {
|
|
47
65
|
'api-key': { type: 'string' },
|
|
48
|
-
'base-url': { type: 'string'
|
|
66
|
+
'base-url': { type: 'string' },
|
|
49
67
|
verbose: { type: 'boolean', default: false },
|
|
50
68
|
help: { type: 'boolean', default: false },
|
|
51
69
|
},
|
|
@@ -62,7 +80,7 @@ async function main() {
|
|
|
62
80
|
}
|
|
63
81
|
const client = new BytekitClient({
|
|
64
82
|
apiKey,
|
|
65
|
-
baseUrl: values['base-url'],
|
|
83
|
+
baseUrl: resolveBaseUrl({ flag: values['base-url'], env: process.env }),
|
|
66
84
|
verbose: values.verbose,
|
|
67
85
|
});
|
|
68
86
|
const server = createServer(client);
|
package/dist/client.js
CHANGED
|
@@ -133,7 +133,7 @@ export class BytekitClient {
|
|
|
133
133
|
async handleErrorResponse(response) {
|
|
134
134
|
const status = response.status;
|
|
135
135
|
if (status === 401) {
|
|
136
|
-
throw new BytekitApiError('Invalid API key. Check your
|
|
136
|
+
throw new BytekitApiError('Invalid API key. Check your BYTEKIT_API_KEY.', 401, 'invalid_api_key');
|
|
137
137
|
}
|
|
138
138
|
if (status === 402) {
|
|
139
139
|
throw new BytekitApiError('Bandwidth quota exhausted. Check usage with get_account.', 402, 'quota_exceeded');
|
|
@@ -12,43 +12,18 @@
|
|
|
12
12
|
"mcp": {
|
|
13
13
|
"title": "MCP Server",
|
|
14
14
|
"section": "General",
|
|
15
|
-
"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, so a legacy setup keeps\nworking:\n\n1. `--api-key <key>` flag\n2. `BYTEKIT_API_KEY` environment variable\n3. `RAPIDCRAWL_API_KEY` environment variable (legacy fallback)\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| `
|
|
15
|
+
"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, so a legacy setup keeps\nworking:\n\n1. `--api-key <key>` flag\n2. `BYTEKIT_API_KEY` environment variable\n3. `RAPIDCRAWL_API_KEY` environment variable (legacy fallback)\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## 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."
|
|
16
16
|
},
|
|
17
17
|
"quickstart": {
|
|
18
18
|
"title": "Quickstart",
|
|
19
19
|
"section": "General",
|
|
20
|
-
"body": "# Quickstart\n\nMake your first ByteKit API call in under 5 minutes — no SDK required.\n\nNothing to install. You only need `curl` and an API key.\n\n## Get an API key\n\nSign up at [app.bytekit.com](https://app.bytekit.com) and create an API key from the\ndashboard. Keys are prefixed `sk_live_`.\n\nSee [Authentication](https://bytekit.com/docs/guides/authentication) for details on key formats and management.\n\n## Make your first scrape\n\nSet your API key and run this — no file to save, no `chmod`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer $BYTEKIT_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\":\"https://example.com\"}'\n```\n\nWant a full-featured script with error handling and `jq` formatting? Use this instead:\n\n<!-- example omitted: curl/scrape.sh (source unavailable) -->\n\nA successful response looks like this:\n\n```json\n{\n \"status\": \"success\",\n \"id\": \"sc_...\",\n \"url\": \"https://example.com\",\n \"finalUrl\": \"https://example.com/\",\n \"contentType\": \"text/html; charset=UTF-8\",\n \"contentLength\": 1256,\n \"statusCode\": 200,\n \"retrievedAt\": \"2025-01-15T12:00:00Z\",\n \"formats\": {\n \"markdown\": \"# Example Domain\\n\\nThis domain is for use in illustrative examples...\"\n },\n \"metadata\": {\n \"title\": \"Example Domain\"\n }\n}\n```\n\n`contentLength` is the compressed wire size in bytes (used for bandwidth billing). The `id`\nfield uses the `sc_` prefix — you can poll `GET /v1/scrape/{id}` if the scrape was queued\nasynchronously.\n\n## Prefer an SDK?\n\nSkip the raw HTTP and use an official client:\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — `npm install @bytekit
|
|
20
|
+
"body": "# Quickstart\n\nMake your first ByteKit API call in under 5 minutes — no SDK required.\n\nNothing to install. You only need `curl` and an API key.\n\n## Get an API key\n\nSign up at [app.bytekit.com](https://app.bytekit.com) and create an API key from the\ndashboard. Keys are prefixed `sk_live_`.\n\nSee [Authentication](https://bytekit.com/docs/guides/authentication) for details on key formats and management.\n\n## Make your first scrape\n\nSet your API key and run this — no file to save, no `chmod`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer $BYTEKIT_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\":\"https://example.com\"}'\n```\n\nWant a full-featured script with error handling and `jq` formatting? Use this instead:\n\n<!-- example omitted: curl/scrape.sh (source unavailable) -->\n\nA successful response looks like this:\n\n```json\n{\n \"status\": \"success\",\n \"id\": \"sc_...\",\n \"url\": \"https://example.com\",\n \"finalUrl\": \"https://example.com/\",\n \"contentType\": \"text/html; charset=UTF-8\",\n \"contentLength\": 1256,\n \"statusCode\": 200,\n \"retrievedAt\": \"2025-01-15T12:00:00Z\",\n \"formats\": {\n \"markdown\": \"# Example Domain\\n\\nThis domain is for use in illustrative examples...\"\n },\n \"metadata\": {\n \"title\": \"Example Domain\"\n }\n}\n```\n\n`contentLength` is the compressed wire size in bytes (used for bandwidth billing). The `id`\nfield uses the `sc_` prefix — you can poll `GET /v1/scrape/{id}` if the scrape was queued\nasynchronously.\n\n## Prefer an SDK?\n\nSkip the raw HTTP and use an official client:\n\n- [TypeScript SDK](https://bytekit.com/docs/libraries/typescript) — `npm install @hunt-labs/bytekit-sdk`\n- [Python SDK](https://bytekit.com/docs/libraries/python) — `pip install bytekit`\n\n## Next steps\n\n- [Authentication](https://bytekit.com/docs/guides/authentication) — key formats, Bearer header, self-serve key management\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, latency, and async polling\n- [Errors](https://bytekit.com/docs/guides/errors) — error shape, common codes, retry guidance\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, rate limit headers\n- [Monitors](https://bytekit.com/docs/guides/monitors) — page-change detection (screenshot or scrape) with webhook notifications\n- [API Reference](https://bytekit.com/docs/api) — full endpoint documentation"
|
|
21
21
|
},
|
|
22
22
|
"api": {
|
|
23
23
|
"title": "API Reference",
|
|
24
24
|
"section": "API Reference",
|
|
25
25
|
"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."
|
|
26
26
|
},
|
|
27
|
-
"guides/authentication": {
|
|
28
|
-
"title": "Authentication",
|
|
29
|
-
"section": "Guides",
|
|
30
|
-
"body": "# Authentication\n\nHow to authenticate with the ByteKit API using API keys.\n\nByteKit authenticates requests with Bearer API keys. Every request to a capture or data\nendpoint must include an `Authorization` header.\n\n## API key format\n\nKeys are prefixed `sk_live_` so they are easy to identify in logs and config. Treat\nthe full value as a secret.\n\n## Sending the Bearer header\n\nInclude the key in every request:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\nThe key is stored as a SHA-256 hash on the server. The plaintext value is only ever visible\nonce — at creation time.\n\n## Managing API keys\n\nCreate, rename, and revoke API keys from the [dashboard](https://app.bytekit.com). Each account\ncan hold up to **50 active keys**, with per-key billing attribution so you can split usage cleanly\nacross services.\n\nThe plaintext key is shown **once**, at creation time — copy it immediately and store it as a\nsecret. Revoke a key from the dashboard to free a slot; revoked keys do not count toward the limit.\n\n## Next steps\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — make your first API call\n- [API Reference: Account](https://bytekit.com/docs/api/account/getaccount) — read your account, plan, and usage"
|
|
31
|
-
},
|
|
32
|
-
"guides/errors": {
|
|
33
|
-
"title": "Errors",
|
|
34
|
-
"section": "Guides",
|
|
35
|
-
"body": "# Errors\n\nByteKit error response shape, common error codes, and retry guidance.\n\nAll errors from the ByteKit API follow a consistent envelope shape so you can handle them\nprogrammatically.\n\n## Error response shape\n\nEvery `4xx`/`5xx` response across the API uses one unified envelope. `status` is\nalways the literal string `\"failed\"`, so you can branch on the response body alone.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"rate_limited\",\n \"message\": \"Too many requests. Retry after 2 seconds.\",\n \"httpStatus\": 429,\n \"failedAt\": \"2026-06-16T19:38:02.084Z\",\n \"details\": {}\n }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| `status` | Always `\"failed\"` on an error response — the top-level discriminator |\n| `error.code` | Machine-readable string identifier |\n| `error.message` | Human-readable explanation |\n| `error.httpStatus` | Mirrors the HTTP response status (useful for logged or replayed bodies) |\n| `error.failedAt` | ISO-8601 UTC timestamp of when the error was produced |\n| `error.details` | Optional object with additional context (e.g. which field failed validation) |\n\n## Common error codes\n\n| HTTP status | Code | Meaning |\n|-------------|------|---------|\n| `400` | `invalid_url` | A supplied URL (including `webhook_url`) is malformed or uses an unsupported scheme |\n| `401` | `unauthorized` | Missing or malformed `Authorization` header |\n| `401` | `invalid_api_key` | API key is present but not valid |\n| `402` | `quota_exceeded` | Account has exceeded its plan quota |\n| `403` | `forbidden` | Key is valid but lacks permission for this action |\n| `422` | `validation_error` | Malformed JSON or a request field failed validation |\n| `429` | `rate_limited` | Too many requests; back off and retry |\n| `500` | `internal_error` | The upstream fetch or browser render failed |\n\n## Webhook URLs Must Use HTTPS\n\nAll webhook URLs submitted to the ByteKit API must use HTTPS. Plain HTTP URLs (e.g. `http://example.com/webhook`) are rejected with a `400` `invalid_url` error.\n\n**Why HTTPS only?** Webhook payloads may contain sensitive data (API keys, session tokens, scrape results). HTTPS encryption protects this data in transit.\n\n**Request with an invalid webhook URL:**\n\n```json\n{\n \"webhook_url\": \"http://example.com/webhook\"\n}\n```\n\n**Response (HTTP 400)** — the same unified envelope as every other error; `error.details` names the offending field and reason:\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"invalid_url\",\n \"message\": \"url is not a valid HTTP(S) URL: scheme_unsupported\",\n \"httpStatus\": 400,\n \"failedAt\": \"2026-06-16T19:38:02.340Z\",\n \"details\": {\n \"url\": \"http://example.com/webhook\",\n \"field\": \"webhook_url\",\n \"reason\": \"scheme_unsupported\"\n }\n }\n}\n```\n\n**Working example:**\n\n```json\n{\n \"webhook_url\": \"https://example.com/webhook\"\n}\n```\n\nThis applies to all endpoints that accept a `webhook_url` parameter: `/v1/scrape` (async), `/v1/scrape/bulk`, `/v1/fetch/bulk`, `/v1/bulk`, `/v1/monitors`, and `/v1/sitemap`.\n\n## Retry guidance\n\nNot all errors are retryable. Use this table to decide:\n\n| Code | Retry? | Guidance |\n|------|--------|---------|\n| `invalid_url` | No | Fix the URL before retrying |\n| `validation_error` | No | Fix the request body before retrying |\n| `unauthorized` / `invalid_api_key` | No | Check your API key |\n| `quota_exceeded` | No | Upgrade your plan or wait for quota reset |\n| `forbidden` | No | You do not have access to this resource |\n| `rate_limited` | Yes | Exponential backoff; honour the `Retry-After` header |\n| `internal_error` | Yes | Exponential backoff; most resolve on retry |\n\nFor retriable errors, start with a 1-second delay and double on each subsequent failure, up to\na maximum of 60 seconds. Respect the `Retry-After` header value when it is present on `429`\nresponses.\n\n## Example: handling errors in curl\n\n```bash\nresponse=$(curl -s -w \"\\n%{http_code}\" -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}')\n\nhttp_code=$(echo \"$response\" | tail -1)\n# Body is everything except the trailing status-code line — drop only the last\n# line so multi-line JSON responses survive intact.\nbody=$(echo \"$response\" | sed '$d')\n\nif [ \"$http_code\" -ge 400 ]; then\n echo \"Error $http_code: $body\"\nfi\n```\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, rate limit headers\n- [Scraping](https://bytekit.com/docs/guides/scraping) — when `500 internal_error` occurs and how fallback works\n- [API Reference](https://bytekit.com/docs/api) — per-endpoint error codes"
|
|
36
|
-
},
|
|
37
|
-
"guides/monitors": {
|
|
38
|
-
"title": "Monitors",
|
|
39
|
-
"section": "Guides",
|
|
40
|
-
"body": "# Monitors\n\nDetect page changes on any URL — by screenshot or scrape — and receive webhook notifications.\n\nMonitors periodically capture a URL and notify you when the page changes. Each monitor uses one\nof two capture types: `screenshot` (perceptual/visual change detection) or `scrape` (content and\nmarkdown change detection). Use them for price tracking, content alerts, uptime monitoring, or\ncompetitor surveillance.\n\n## Create a monitor\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com/pricing\",\n \"interval_type\": \"hourly\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\"\n }'\n```\n\n| Field | Description |\n|-------|-------------|\n| `url` | The page to monitor (required) |\n| `interval_type` | Check frequency — one of `hourly`, `daily`, `weekly`, or `cron` (required) |\n| `webhook_url` | HTTPS webhook endpoint to receive notifications. `http://` is rejected with a 400 `invalid_url` (reason `scheme_unsupported`) (required) |\n| `cron_expression` | 5-field cron expression. Required when `interval_type` is `cron` |\n| `type` | Capture mode — `screenshot` (default) or `scrape` |\n| `change_threshold` | Percentage of change required to trigger a notification (0–100, default `5`). Screenshot monitors only |\n| `notify_on` | `change` (default — notify only when content changed) or `every` (notify on every capture) |\n| `webhook_secret` | Optional secret used to sign webhook deliveries |\n| `webhook_headers` | Optional custom headers (max 20) to include on each webhook delivery |\n\nA successful response returns the monitor object with an `id` prefixed `mon_`:\n\n```json\n{\n \"id\": \"mon_...\",\n \"type\": \"screenshot\",\n \"url\": \"https://example.com/pricing\",\n \"status\": \"active\",\n \"interval_type\": \"hourly\",\n \"cron_expression\": null,\n \"next_capture_at\": \"2026-01-01T01:00:00Z\",\n \"notify_on\": \"change\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\",\n \"captures_count\": 0,\n \"changes_count\": 0,\n \"created_at\": \"2026-01-01T00:00:00Z\"\n}\n```\n\nTo monitor on a schedule, set `interval_type` to `cron` and supply a 5-field `cron_expression`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com/pricing\",\n \"interval_type\": \"cron\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\"\n }'\n```\n\n## List monitors\n\n```bash\ncurl https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Get a monitor\n\n```bash\ncurl https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Update a monitor\n\n```bash\ncurl -X PATCH https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"interval_type\": \"daily\"}'\n```\n\nYou can update any subset of the monitor's mutable fields — for example `interval_type`,\n`cron_expression`, `webhook_url`, `notify_on`, `change_threshold`, or `status`\n(`active` / `paused`). Switching to a `cron` schedule requires a `cron_expression`:\n\n```bash\ncurl -X PATCH https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"interval_type\": \"cron\", \"cron_expression\": \"*/30 * * * *\"}'\n```\n\n## Delete a monitor\n\n```bash\ncurl -X DELETE https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Monitor captures\n\nEach time a monitor fires it records a capture event — on **every** run, whether or not the\ncontent changed. Each capture carries a `has_change` flag marking whether the content differed\nfrom the previous capture. Webhook delivery is separate: the capture is always recorded, but\nwhether a webhook is *sent* depends on `has_change` and the monitor's `notify_on` setting (see\n[Webhook payload](#webhook-payload) below). Retrieve the capture history with:\n\n```bash\ncurl https://api.bytekit.com/v1/monitors/mon_.../captures \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\nEach capture in the list represents one capture event and includes change metadata — the\ntimestamp, whether the content changed (`has_change`), the percentage of content that changed\n(`change_pct`), and the perceptual hash distance from the previous capture. Captures record\n*that* the content changed and by how much; they do not include a line-by-line textual diff.\n\n### First-capture behavior (silent baseline for both types)\n\nThe very first capture of a monitor has **no previous capture to compare against**. Both monitor\ntypes treat that first run as a **silent baseline** — one universal \"first capture\" behavior,\nno per-type divergence:\n\n| Monitor type | First capture | `has_change` | `change_pct` | Webhook on first capture |\n|--------------|---------------|--------------|--------------|--------------------------|\n| `scrape` | Silent baseline | `false` | `null` | **No** `monitor.change_detected`-equivalent webhook (the baseline is just recorded) |\n| `screenshot` | Silent baseline | `false` | `null` | **No** `monitor.change_detected` webhook (the baseline is just recorded) |\n\nNeither a **scrape** nor a **screenshot** monitor alerts you on its first run — both only alert\nonce a *subsequent* capture differs (scrape by exact content-hash inequality, screenshot by at\nleast `change_threshold`). A monitor with `notify_on: \"every\"` still sends a `monitor.captured`\nwebhook on the first capture — that is the per-capture notification, not a change alert, and it\nfires for both monitor types. From the second capture onward both types behave the same way each\nnew capture is compared against the previous one — scrape by exact SHA-256 content equality,\nscreenshot by perceptual-hash distance against `change_threshold`.\n\n**Existing scrape monitors:** if you created a scrape monitor before this change shipped, its\nfirst post-deploy capture will no longer fire a `monitor.change_detected`-equivalent webhook —\nthe first capture after the change is now the silent baseline, matching screenshot monitors.\nSteady-state alerting (second capture onward) is unaffected.\n\n## Webhook payload\n\nWhen a monitor fires, ByteKit sends a `POST` to your `webhook_url`. Every delivery carries an\n`X-ByteKit-Event` header naming the event type — dispatch on that header rather than inspecting\nthe body shape. The event type and payload depend on the monitor's `type`.\n\n### Screenshot monitors (`type: \"screenshot\"`, default)\n\nScreenshot captures send `monitor.change_detected` when the page changed (`X-ByteKit-Event:\nmonitor.change_detected`) and `monitor.captured` when there was no change but\n`notify_on: \"every\"` is set (`X-ByteKit-Event: monitor.captured`). The body carries the capture\nmetadata:\n\n```json\n{\n \"monitor_id\": \"mon_...\",\n \"screenshot_id\": \"ss_...\",\n \"has_change\": true,\n \"change_pct\": 42.0,\n \"hash_distance\": 18,\n \"url\": \"https://example.com/pricing\"\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| `has_change` | `true` when the captured content differs from the previous capture |\n| `change_pct` | Percentage of content that changed (0–100) |\n| `hash_distance` | Perceptual-hash distance from the previous capture |\n| `screenshot_id` | The screenshot that triggered the notification |\n\n### Scrape monitors (`type: \"scrape\"`)\n\nScrape captures send `scrape.completed` (`X-ByteKit-Event: scrape.completed`) with the full\nscrape result envelope inline:\n\n```json\n{\n \"success\": true,\n \"type\": \"scrape.completed\",\n \"id\": \"mon_...\",\n \"scrape_id\": \"sc_...\",\n \"has_change\": true,\n \"change_pct\": 100.0,\n \"metadata\": {},\n \"scrape\": {\n \"status\": \"success\",\n \"id\": \"sc_...\",\n \"url\": \"https://example.com/pricing\",\n \"final_url\": \"https://example.com/pricing\",\n \"content_length\": 1256,\n \"status_code\": 200,\n \"formats\": {\n \"markdown\": \"...\"\n }\n }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| `has_change` | `true` when the captured content differs from the previous capture |\n| `change_pct` | Percentage of content that changed (0–100) |\n| `scrape` | Full scrape result envelope (same shape as `POST /v1/scrape` response) |\n\nYour endpoint must respond with `2xx` within 10 seconds. Failed deliveries are retried with\nexponential backoff.\n\n## Next steps\n\n- [API Reference: Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — full endpoint schema\n- [Errors](https://bytekit.com/docs/guides/errors) — error codes returned by monitor endpoints"
|
|
41
|
-
},
|
|
42
|
-
"guides/rate-limits": {
|
|
43
|
-
"title": "Rate Limits",
|
|
44
|
-
"section": "Guides",
|
|
45
|
-
"body": "# Rate Limits\n\nHow ByteKit enforces quotas, concurrency slots, and rate limits.\n\nByteKit enforces three independent limits: **rate limits** (requests per second),\n**concurrency slots** (simultaneous in-flight requests), and **quota** (monthly usage caps).\nAll three are enforced before any capture work begins.\n\n## Quota model\n\nQuota is pre-incremented on every request and corrected after the request completes:\n\n1. **Pre-increment** — your usage counter is incremented by an estimate before the capture\n starts. This prevents over-committing capacity even for concurrent requests.\n2. **Adjust** — once the response returns, the actual `contentLength` (compressed wire bytes)\n replaces the estimate for bandwidth accounting.\n3. **Compensating decrement** — if the request fails with a terminal error, the pre-incremented\n amount is rolled back so you are not charged for failed requests.\n\nThis means your dashboard usage counter may briefly read higher than actual consumption during\na burst of requests, then settle to the true value.\n\n## Concurrency slots\n\nEach account has a concurrency limit — the maximum number of in-flight requests at one time.\nSlots are released automatically a few minutes after a client disconnects, so a crashed client\ncannot permanently hold them.\n\nWhen you exceed your concurrency limit, you receive `429 rate_limited` with a `Retry-After`\nheader indicating how long to wait before retrying.\n\n## Rate limit headers\n\nEvery response includes headers that show your current position:\n\n| Header | Description |\n|--------|-------------|\n| `X-RateLimit-Limit` | Your account's request-per-second limit |\n| `X-RateLimit-Remaining` | Requests remaining in the current window |\n| `X-RateLimit-Reset` | Unix timestamp when the window resets |\n| `Retry-After` | Seconds to wait before retrying (present on `429` only) |\n\n## Bandwidth metering\n\nBandwidth usage is measured as `contentLength` — the compressed wire bytes returned by the\norigin server. If the origin sends gzip or Brotli-encoded content, the compressed size is what\ncounts, not the decompressed size. This matches what your client actually receives over the\nnetwork.\n\n## Handling 429 responses\n\nWhen you receive `429 rate_limited`:\n\n1. Read the `Retry-After` header value (in seconds).\n2. Wait at least that long before retrying.\n3. If no `Retry-After` is present, use exponential backoff starting at 1 second.\n\n```bash\n# Check rate limit headers\ncurl -I -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n## Next steps\n\n- [Errors](https://bytekit.com/docs/guides/errors) — full error code reference and retry guidance\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, latency, and async polling"
|
|
46
|
-
},
|
|
47
|
-
"guides/scraping": {
|
|
48
|
-
"title": "Scraping",
|
|
49
|
-
"section": "Guides",
|
|
50
|
-
"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"
|
|
51
|
-
},
|
|
52
27
|
"cli/account": {
|
|
53
28
|
"title": "Account",
|
|
54
29
|
"section": "General",
|
|
@@ -74,11 +49,6 @@
|
|
|
74
49
|
"section": "General",
|
|
75
50
|
"body": "# Monitors\n\nPage-change monitor operations\n\nPage-change monitor operations\n\nFirst-capture behavior is the same for both monitor types: the first capture is a silent baseline (`has_change: false`, `change_pct: null`) with no `change_detected` webhook, whether the monitor is `scrape` or `screenshot`. From the second capture onward both types diff against the previous capture.\n\n### monitors › captures\n\nMonitor capture sub-resources\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n#### monitors › captures › list\n\nList captures for a monitor\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit monitors captures list <id>\n```\n\n### monitors › create\n\nCreate a page-change monitor\n\n| Option | Description |\n| --- | --- |\n| `--url <url>` | URL to monitor |\n| `--interval-type <type>` | Check interval: hourly, daily, weekly, or cron |\n| `--webhook-url <url>` | HTTPS webhook URL notified on change |\n| `--cron <expr>` | Cron expression (required when --interval-type is |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit monitors create --url <url> --interval-type <type> --webhook-url <url> --cron <expr>\n```\n\n### monitors › list\n\nList all monitors\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit monitors list\n```\n\n### monitors › get\n\nGet a monitor by ID\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit monitors get <id>\n```\n\n### monitors › update\n\nUpdate a monitor\n\n| Option | Description |\n| --- | --- |\n| `--interval-type <type>` | New check interval: hourly, daily, weekly, or cron |\n| `--cron <expr>` | New cron expression (when interval-type is cron, e.g. |\n| `--webhook-url <url>` | New HTTPS webhook URL |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit monitors update <id> --interval-type <type> --cron <expr> --webhook-url <url>\n```\n\n### monitors › delete\n\nDelete a monitor\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit monitors delete <id>\n```"
|
|
76
51
|
},
|
|
77
|
-
"cli/recordings": {
|
|
78
|
-
"title": "Recordings",
|
|
79
|
-
"section": "General",
|
|
80
|
-
"body": "# Recordings\n\nRecording operations\n\nRecording operations\n\n### recordings › create\n\nStart a page recording\n\n| Option | Description |\n| --- | --- |\n| `--url <url>` | URL to record |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit recordings create --url <url>\n```\n\n### recordings › get\n\nGet a recording by ID\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit recordings get <id>\n```"
|
|
81
|
-
},
|
|
82
52
|
"cli/scrape": {
|
|
83
53
|
"title": "Scrape",
|
|
84
54
|
"section": "General",
|
|
@@ -94,6 +64,31 @@
|
|
|
94
64
|
"section": "General",
|
|
95
65
|
"body": "# Sitemap\n\nSitemap crawl operations\n\nSitemap crawl operations\n\n### sitemap › create\n\nStart a sitemap crawl\n\n| Option | Description |\n| --- | --- |\n| `--url <url>` | Root URL to crawl |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit sitemap create --url <url>\n```\n\n### sitemap › get\n\nGet a sitemap job by ID\n\n| Option | Description |\n| --- | --- |\n| `-h, --help` | display help for command |\n\n```bash\n$ bytekit sitemap get <id>\n```"
|
|
96
66
|
},
|
|
67
|
+
"guides/authentication": {
|
|
68
|
+
"title": "Authentication",
|
|
69
|
+
"section": "Guides",
|
|
70
|
+
"body": "# Authentication\n\nHow to authenticate with the ByteKit API using API keys.\n\nByteKit authenticates requests with Bearer API keys. Every request to a capture or data\nendpoint must include an `Authorization` header.\n\n## API key format\n\nKeys are prefixed `sk_live_` so they are easy to identify in logs and config. Treat\nthe full value as a secret.\n\n## Sending the Bearer header\n\nInclude the key in every request:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\nThe key is stored as a SHA-256 hash on the server. The plaintext value is only ever visible\nonce — at creation time.\n\n## Managing API keys\n\nCreate, rename, and revoke API keys from the [dashboard](https://app.bytekit.com). Each account\ncan hold up to **50 active keys**, with per-key billing attribution so you can split usage cleanly\nacross services.\n\nThe plaintext key is shown **once**, at creation time — copy it immediately and store it as a\nsecret. Revoke a key from the dashboard to free a slot; revoked keys do not count toward the limit.\n\n## Next steps\n\n- [Quickstart](https://bytekit.com/docs/quickstart) — make your first API call\n- [API Reference: Account](https://bytekit.com/docs/api/account/getaccount) — read your account, plan, and usage"
|
|
71
|
+
},
|
|
72
|
+
"guides/errors": {
|
|
73
|
+
"title": "Errors",
|
|
74
|
+
"section": "Guides",
|
|
75
|
+
"body": "# Errors\n\nByteKit error response shape, common error codes, and retry guidance.\n\nAll errors from the ByteKit API follow a consistent envelope shape so you can handle them\nprogrammatically.\n\n## Error response shape\n\nEvery `4xx`/`5xx` response across the API uses one unified envelope. `status` is\nalways the literal string `\"failed\"`, so you can branch on the response body alone.\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"rate_limited\",\n \"message\": \"Too many requests. Retry after 2 seconds.\",\n \"httpStatus\": 429,\n \"failedAt\": \"2026-06-16T19:38:02.084Z\",\n \"details\": {}\n }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| `status` | Always `\"failed\"` on an error response — the top-level discriminator |\n| `error.code` | Machine-readable string identifier |\n| `error.message` | Human-readable explanation |\n| `error.httpStatus` | Mirrors the HTTP response status (useful for logged or replayed bodies) |\n| `error.failedAt` | ISO-8601 UTC timestamp of when the error was produced |\n| `error.details` | Optional object with additional context (e.g. which field failed validation) |\n\n## Common error codes\n\n| HTTP status | Code | Meaning |\n|-------------|------|---------|\n| `400` | `invalid_url` | A supplied URL (including `webhook_url`) is malformed or uses an unsupported scheme |\n| `401` | `unauthorized` | Missing or malformed `Authorization` header |\n| `401` | `invalid_api_key` | API key is present but not valid |\n| `402` | `quota_exceeded` | Account has exceeded its plan quota |\n| `403` | `forbidden` | Key is valid but lacks permission for this action |\n| `422` | `validation_error` | Malformed JSON or a request field failed validation |\n| `429` | `rate_limited` | Too many requests; back off and retry |\n| `500` | `internal_error` | The upstream fetch or browser render failed |\n\n## Webhook URLs Must Use HTTPS\n\nAll webhook URLs submitted to the ByteKit API must use HTTPS. Plain HTTP URLs (e.g. `http://example.com/webhook`) are rejected with a `400` `invalid_url` error.\n\n**Why HTTPS only?** Webhook payloads may contain sensitive data (API keys, session tokens, scrape results). HTTPS encryption protects this data in transit.\n\n**Request with an invalid webhook URL:**\n\n```json\n{\n \"webhook_url\": \"http://example.com/webhook\"\n}\n```\n\n**Response (HTTP 400)** — the same unified envelope as every other error; `error.details` names the offending field and reason:\n\n```json\n{\n \"status\": \"failed\",\n \"error\": {\n \"code\": \"invalid_url\",\n \"message\": \"url is not a valid HTTP(S) URL: scheme_unsupported\",\n \"httpStatus\": 400,\n \"failedAt\": \"2026-06-16T19:38:02.340Z\",\n \"details\": {\n \"url\": \"http://example.com/webhook\",\n \"field\": \"webhook_url\",\n \"reason\": \"scheme_unsupported\"\n }\n }\n}\n```\n\n**Working example:**\n\n```json\n{\n \"webhook_url\": \"https://example.com/webhook\"\n}\n```\n\nThis applies to all endpoints that accept a `webhook_url` parameter: `/v1/scrape` (async), `/v1/scrape/bulk`, `/v1/fetch/bulk`, `/v1/bulk`, `/v1/monitors`, and `/v1/sitemap`.\n\n## Retry guidance\n\nNot all errors are retryable. Use this table to decide:\n\n| Code | Retry? | Guidance |\n|------|--------|---------|\n| `invalid_url` | No | Fix the URL before retrying |\n| `validation_error` | No | Fix the request body before retrying |\n| `unauthorized` / `invalid_api_key` | No | Check your API key |\n| `quota_exceeded` | No | Upgrade your plan or wait for quota reset |\n| `forbidden` | No | You do not have access to this resource |\n| `rate_limited` | Yes | Exponential backoff; honour the `Retry-After` header |\n| `internal_error` | Yes | Exponential backoff; most resolve on retry |\n\nFor retriable errors, start with a 1-second delay and double on each subsequent failure, up to\na maximum of 60 seconds. Respect the `Retry-After` header value when it is present on `429`\nresponses.\n\n## Example: handling errors in curl\n\n```bash\nresponse=$(curl -s -w \"\\n%{http_code}\" -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}')\n\nhttp_code=$(echo \"$response\" | tail -1)\n# Body is everything except the trailing status-code line — drop only the last\n# line so multi-line JSON responses survive intact.\nbody=$(echo \"$response\" | sed '$d')\n\nif [ \"$http_code\" -ge 400 ]; then\n echo \"Error $http_code: $body\"\nfi\n```\n\n## Next steps\n\n- [Rate Limits](https://bytekit.com/docs/guides/rate-limits) — quota model, concurrency slots, rate limit headers\n- [Scraping](https://bytekit.com/docs/guides/scraping) — when `500 internal_error` occurs and how fallback works\n- [API Reference](https://bytekit.com/docs/api) — per-endpoint error codes"
|
|
76
|
+
},
|
|
77
|
+
"guides/monitors": {
|
|
78
|
+
"title": "Monitors",
|
|
79
|
+
"section": "Guides",
|
|
80
|
+
"body": "# Monitors\n\nDetect page changes on any URL — by screenshot or scrape — and receive webhook notifications.\n\nMonitors periodically capture a URL and notify you when the page changes. Each monitor uses one\nof two capture types: `screenshot` (perceptual/visual change detection) or `scrape` (content and\nmarkdown change detection). Use them for price tracking, content alerts, uptime monitoring, or\ncompetitor surveillance.\n\n## Create a monitor\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com/pricing\",\n \"interval_type\": \"hourly\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\"\n }'\n```\n\n| Field | Description |\n|-------|-------------|\n| `url` | The page to monitor (required) |\n| `interval_type` | Check frequency — one of `hourly`, `daily`, `weekly`, or `cron` (required) |\n| `webhook_url` | HTTPS webhook endpoint to receive notifications. `http://` is rejected with a 400 `invalid_url` (reason `scheme_unsupported`) (required) |\n| `cron_expression` | 5-field cron expression. Required when `interval_type` is `cron` |\n| `type` | Capture mode — `screenshot` (default) or `scrape` |\n| `change_threshold` | Percentage of change required to trigger a notification (0–100, default `5`). Screenshot monitors only |\n| `notify_on` | `change` (default — notify only when content changed) or `every` (notify on every capture) |\n| `webhook_secret` | Optional secret used to sign webhook deliveries |\n| `webhook_headers` | Optional custom headers (max 20) to include on each webhook delivery |\n\nA successful response returns the monitor object with an `id` prefixed `mon_`:\n\n```json\n{\n \"id\": \"mon_...\",\n \"type\": \"screenshot\",\n \"url\": \"https://example.com/pricing\",\n \"status\": \"active\",\n \"interval_type\": \"hourly\",\n \"cron_expression\": null,\n \"next_capture_at\": \"2026-01-01T01:00:00Z\",\n \"notify_on\": \"change\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\",\n \"captures_count\": 0,\n \"changes_count\": 0,\n \"created_at\": \"2026-01-01T00:00:00Z\"\n}\n```\n\nTo monitor on a schedule, set `interval_type` to `cron` and supply a 5-field `cron_expression`:\n\n```bash\ncurl -X POST https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"url\": \"https://example.com/pricing\",\n \"interval_type\": \"cron\",\n \"cron_expression\": \"0 9 * * 1-5\",\n \"webhook_url\": \"https://your-server.example.com/webhooks/bytekit\"\n }'\n```\n\n## List monitors\n\n```bash\ncurl https://api.bytekit.com/v1/monitors \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Get a monitor\n\n```bash\ncurl https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Update a monitor\n\n```bash\ncurl -X PATCH https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"interval_type\": \"daily\"}'\n```\n\nYou can update any subset of the monitor's mutable fields — for example `interval_type`,\n`cron_expression`, `webhook_url`, `notify_on`, `change_threshold`, or `status`\n(`active` / `paused`). Switching to a `cron` schedule requires a `cron_expression`:\n\n```bash\ncurl -X PATCH https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"interval_type\": \"cron\", \"cron_expression\": \"*/30 * * * *\"}'\n```\n\n## Delete a monitor\n\n```bash\ncurl -X DELETE https://api.bytekit.com/v1/monitors/mon_... \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\n## Monitor captures\n\nEach time a monitor fires it records a capture event — on **every** run, whether or not the\ncontent changed. Each capture carries a `has_change` flag marking whether the content differed\nfrom the previous capture. Webhook delivery is separate: the capture is always recorded, but\nwhether a webhook is *sent* depends on `has_change` and the monitor's `notify_on` setting (see\n[Webhook payload](#webhook-payload) below). Retrieve the capture history with:\n\n```bash\ncurl https://api.bytekit.com/v1/monitors/mon_.../captures \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\"\n```\n\nEach capture in the list represents one capture event and includes change metadata — the\ntimestamp, whether the content changed (`has_change`), the percentage of content that changed\n(`change_pct`), and the perceptual hash distance from the previous capture. Captures record\n*that* the content changed and by how much; they do not include a line-by-line textual diff.\n\n### First-capture behavior (silent baseline for both types)\n\nThe very first capture of a monitor has **no previous capture to compare against**. Both monitor\ntypes treat that first run as a **silent baseline** — one universal \"first capture\" behavior,\nno per-type divergence:\n\n| Monitor type | First capture | `has_change` | `change_pct` | Webhook on first capture |\n|--------------|---------------|--------------|--------------|--------------------------|\n| `scrape` | Silent baseline | `false` | `null` | **No** `monitor.change_detected`-equivalent webhook (the baseline is just recorded) |\n| `screenshot` | Silent baseline | `false` | `null` | **No** `monitor.change_detected` webhook (the baseline is just recorded) |\n\nNeither a **scrape** nor a **screenshot** monitor alerts you on its first run — both only alert\nonce a *subsequent* capture differs (scrape by exact content-hash inequality, screenshot by at\nleast `change_threshold`). A monitor with `notify_on: \"every\"` still sends a `monitor.captured`\nwebhook on the first capture — that is the per-capture notification, not a change alert, and it\nfires for both monitor types. From the second capture onward both types behave the same way each\nnew capture is compared against the previous one — scrape by exact SHA-256 content equality,\nscreenshot by perceptual-hash distance against `change_threshold`.\n\n**Existing scrape monitors:** if you created a scrape monitor before this change shipped, its\nfirst post-deploy capture will no longer fire a `monitor.change_detected`-equivalent webhook —\nthe first capture after the change is now the silent baseline, matching screenshot monitors.\nSteady-state alerting (second capture onward) is unaffected.\n\n## Webhook payload\n\nWhen a monitor fires, ByteKit sends a `POST` to your `webhook_url`. Every delivery carries an\n`X-ByteKit-Event` header naming the event type — dispatch on that header rather than inspecting\nthe body shape. The event type and payload depend on the monitor's `type`.\n\n### Screenshot monitors (`type: \"screenshot\"`, default)\n\nScreenshot captures send `monitor.change_detected` when the page changed (`X-ByteKit-Event:\nmonitor.change_detected`) and `monitor.captured` when there was no change but\n`notify_on: \"every\"` is set (`X-ByteKit-Event: monitor.captured`). The body carries the capture\nmetadata:\n\n```json\n{\n \"monitor_id\": \"mon_...\",\n \"screenshot_id\": \"ss_...\",\n \"has_change\": true,\n \"change_pct\": 42.0,\n \"hash_distance\": 18,\n \"url\": \"https://example.com/pricing\"\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| `has_change` | `true` when the captured content differs from the previous capture |\n| `change_pct` | Percentage of content that changed (0–100) |\n| `hash_distance` | Perceptual-hash distance from the previous capture |\n| `screenshot_id` | The screenshot that triggered the notification |\n\n### Scrape monitors (`type: \"scrape\"`)\n\nScrape captures send `scrape.completed` (`X-ByteKit-Event: scrape.completed`) with the full\nscrape result envelope inline:\n\n```json\n{\n \"success\": true,\n \"type\": \"scrape.completed\",\n \"id\": \"mon_...\",\n \"scrape_id\": \"sc_...\",\n \"has_change\": true,\n \"change_pct\": 100.0,\n \"metadata\": {},\n \"scrape\": {\n \"status\": \"success\",\n \"id\": \"sc_...\",\n \"url\": \"https://example.com/pricing\",\n \"final_url\": \"https://example.com/pricing\",\n \"content_length\": 1256,\n \"status_code\": 200,\n \"formats\": {\n \"markdown\": \"...\"\n }\n }\n}\n```\n\n| Field | Description |\n|-------|-------------|\n| `has_change` | `true` when the captured content differs from the previous capture |\n| `change_pct` | Percentage of content that changed (0–100) |\n| `scrape` | Full scrape result envelope (same shape as `POST /v1/scrape` response) |\n\nYour endpoint must respond with `2xx` within 10 seconds. Failed deliveries are retried with\nexponential backoff.\n\n## Next steps\n\n- [API Reference: Monitors](https://bytekit.com/docs/api/monitors/createmonitor) — full endpoint schema\n- [Errors](https://bytekit.com/docs/guides/errors) — error codes returned by monitor endpoints"
|
|
81
|
+
},
|
|
82
|
+
"guides/rate-limits": {
|
|
83
|
+
"title": "Rate Limits",
|
|
84
|
+
"section": "Guides",
|
|
85
|
+
"body": "# Rate Limits\n\nHow ByteKit enforces quotas, concurrency slots, and rate limits.\n\nByteKit enforces three independent limits: **rate limits** (requests per second),\n**concurrency slots** (simultaneous in-flight requests), and **quota** (monthly usage caps).\nAll three are enforced before any capture work begins.\n\n## Quota model\n\nQuota is pre-incremented on every request and corrected after the request completes:\n\n1. **Pre-increment** — your usage counter is incremented by an estimate before the capture\n starts. This prevents over-committing capacity even for concurrent requests.\n2. **Adjust** — once the response returns, the actual `contentLength` (compressed wire bytes)\n replaces the estimate for bandwidth accounting.\n3. **Compensating decrement** — if the request fails with a terminal error, the pre-incremented\n amount is rolled back so you are not charged for failed requests.\n\nThis means your dashboard usage counter may briefly read higher than actual consumption during\na burst of requests, then settle to the true value.\n\n## Concurrency slots\n\nEach account has a concurrency limit — the maximum number of in-flight requests at one time.\nSlots are released automatically a few minutes after a client disconnects, so a crashed client\ncannot permanently hold them.\n\nWhen you exceed your concurrency limit, you receive `429 rate_limited` with a `Retry-After`\nheader indicating how long to wait before retrying.\n\n## Rate limit headers\n\nEvery response includes headers that show your current position:\n\n| Header | Description |\n|--------|-------------|\n| `X-RateLimit-Limit` | Your account's request-per-second limit |\n| `X-RateLimit-Remaining` | Requests remaining in the current window |\n| `X-RateLimit-Reset` | Unix timestamp when the window resets |\n| `Retry-After` | Seconds to wait before retrying (present on `429` only) |\n\n## Bandwidth metering\n\nBandwidth usage is measured as `contentLength` — the compressed wire bytes returned by the\norigin server. If the origin sends gzip or Brotli-encoded content, the compressed size is what\ncounts, not the decompressed size. This matches what your client actually receives over the\nnetwork.\n\n## Handling 429 responses\n\nWhen you receive `429 rate_limited`:\n\n1. Read the `Retry-After` header value (in seconds).\n2. Wait at least that long before retrying.\n3. If no `Retry-After` is present, use exponential backoff starting at 1 second.\n\n```bash\n# Check rate limit headers\ncurl -I -X POST https://api.bytekit.com/v1/scrape \\\n -H \"Authorization: Bearer sk_live_YOUR_KEY_HERE\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"url\": \"https://example.com\"}'\n```\n\n## Next steps\n\n- [Errors](https://bytekit.com/docs/guides/errors) — full error code reference and retry guidance\n- [Scraping](https://bytekit.com/docs/guides/scraping) — formats, options, latency, and async polling"
|
|
86
|
+
},
|
|
87
|
+
"guides/scraping": {
|
|
88
|
+
"title": "Scraping",
|
|
89
|
+
"section": "Guides",
|
|
90
|
+
"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"
|
|
91
|
+
},
|
|
97
92
|
"libraries/go": {
|
|
98
93
|
"title": "Go",
|
|
99
94
|
"section": "General",
|
|
@@ -107,7 +102,7 @@
|
|
|
107
102
|
"libraries/typescript": {
|
|
108
103
|
"title": "TypeScript SDK",
|
|
109
104
|
"section": "General",
|
|
110
|
-
"body": "# TypeScript SDK\n\nType-safe ByteKit client for Node.js and modern JavaScript runtimes.\n\nThe official TypeScript SDK is a thin, type-safe wrapper over the ByteKit REST API. It works\nin Node.js and any runtime with a global `fetch` (Bun, Deno, Cloudflare Workers, modern\nbrowsers).\n\n## Install\n\n```bash\nnpm install @bytekit
|
|
105
|
+
"body": "# TypeScript SDK\n\nType-safe ByteKit client for Node.js and modern JavaScript runtimes.\n\nThe official TypeScript SDK is a thin, type-safe wrapper over the ByteKit REST API. It works\nin Node.js and any runtime with a global `fetch` (Bun, Deno, Cloudflare Workers, modern\nbrowsers).\n\n## Install\n\n```bash\nnpm install @hunt-labs/bytekit-sdk\n```\n\n## Initialize\n\n```ts\nimport { RapidCrawl } from '@hunt-labs/bytekit-sdk';\n\nconst client = new RapidCrawl({\n apiKey: process.env.BYTEKIT_API_KEY!, // your sk_live_… key\n});\n```\n\n## Your first scrape\n\n```ts\nconst result = await client.scrape.create({\n url: 'https://example.com',\n formats: ['markdown'],\n});\n\nconsole.log(result);\n```\n\n## Capture a screenshot\n\n```ts\nconst shot = await client.screenshots.create({\n url: 'https://example.com',\n full_page: true,\n});\n\nconsole.log(shot);\n```\n\n## Handle errors\n\nAny 4xx/5xx response throws a `RapidCrawlError` carrying the HTTP `status` and the API\n`error.code`:\n\n```ts\nimport { RapidCrawl, RapidCrawlError } from '@hunt-labs/bytekit-sdk';\n\ntry {\n await client.scrape.create({ url: 'https://example.com' });\n} catch (err) {\n if (err instanceof RapidCrawlError) {\n console.error(`${err.status} ${err.code}: ${err.message}`);\n } else {\n throw err;\n }\n}\n```\n\n## Async scrapes\n\nPass `async: true` to enqueue the job and poll by ID:\n\n```ts\nconst queued = await client.scrape.create({ url: 'https://example.com', async: true });\n// later — poll with the returned sc_… id\nconst final = await client.scrape.get('sc_...');\n```\n\n## What's available\n\nThe client exposes one resource per capability: `scrape`, `screenshots`, `recordings`, `bulk`,\n`fetch`, `monitors`, `sitemap`, and `account` (each with `create` / `get` / `list` methods as\napplicable, plus nested resources like `scrape.bulk` and `monitors.captures`).\n\nSee the [TypeScript SDK Reference](https://bytekit.com/docs/sdk/typescript/client) for every method and option.\n\n## Next steps\n\n- [Python SDK](https://bytekit.com/docs/libraries/python) — the same API surface in Python.\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."
|
|
111
106
|
},
|
|
112
107
|
"api/account/getaccount": {
|
|
113
108
|
"title": "Get account details",
|
|
@@ -119,6 +114,21 @@
|
|
|
119
114
|
"section": "API Reference",
|
|
120
115
|
"body": "# Account\n\nAccount API — endpoints, requests, and responses.\n\nThe **Account** API. 1 endpoint:\n\n- [Get account details](https://bytekit.com/docs/api/account/getaccount) — GET /v1/account"
|
|
121
116
|
},
|
|
117
|
+
"api/fetch/getfetch": {
|
|
118
|
+
"title": "Fetch a URL (GET)",
|
|
119
|
+
"section": "API Reference",
|
|
120
|
+
"body": "# Fetch a URL (GET)\n\nDirect HTTP fetch. The response body IS the content; metadata is returned in X-Fetch-* headers.\nOmit `format` for raw passthrough. Use `format=markdown` or `format=html` for conversion.\n"
|
|
121
|
+
},
|
|
122
|
+
"api/fetch": {
|
|
123
|
+
"title": "Fetch",
|
|
124
|
+
"section": "API Reference",
|
|
125
|
+
"body": "# Fetch\n\nFetch API — endpoints, requests, and responses.\n\nThe **Fetch** API. 2 endpoints:\n\n- [Fetch a URL (GET)](https://bytekit.com/docs/api/fetch/getfetch) — GET /v1/fetch\n- [Fetch a URL (POST)](https://bytekit.com/docs/api/fetch/postfetch) — POST /v1/fetch"
|
|
126
|
+
},
|
|
127
|
+
"api/fetch/postfetch": {
|
|
128
|
+
"title": "Fetch a URL (POST)",
|
|
129
|
+
"section": "API Reference",
|
|
130
|
+
"body": "# Fetch a URL (POST)\n\nSame as GET /v1/fetch but with a JSON request body."
|
|
131
|
+
},
|
|
122
132
|
"api/bulk/createbulk": {
|
|
123
133
|
"title": "Create mixed bulk job",
|
|
124
134
|
"section": "API Reference",
|
|
@@ -149,20 +159,20 @@
|
|
|
149
159
|
"section": "API Reference",
|
|
150
160
|
"body": "# List bulk job items"
|
|
151
161
|
},
|
|
152
|
-
"api/fetch/
|
|
153
|
-
"title": "
|
|
162
|
+
"api/fetch-bulk/createfetchbulk": {
|
|
163
|
+
"title": "Bulk fetch URLs",
|
|
154
164
|
"section": "API Reference",
|
|
155
|
-
"body": "#
|
|
165
|
+
"body": "# Bulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (cookies, wait_for_selector, etc.).\n"
|
|
156
166
|
},
|
|
157
|
-
"api/fetch": {
|
|
158
|
-
"title": "
|
|
167
|
+
"api/fetch-bulk/getfetchbulk": {
|
|
168
|
+
"title": "Get fetch bulk job status",
|
|
159
169
|
"section": "API Reference",
|
|
160
|
-
"body": "#
|
|
170
|
+
"body": "# Get fetch bulk job status"
|
|
161
171
|
},
|
|
162
|
-
"api/fetch
|
|
163
|
-
"title": "Fetch
|
|
172
|
+
"api/fetch-bulk": {
|
|
173
|
+
"title": "Fetch Bulk",
|
|
164
174
|
"section": "API Reference",
|
|
165
|
-
"body": "# Fetch
|
|
175
|
+
"body": "# Fetch Bulk\n\nFetch Bulk API — endpoints, requests, and responses.\n\nThe **Fetch Bulk** API. 2 endpoints:\n\n- [Bulk fetch URLs](https://bytekit.com/docs/api/fetch-bulk/createfetchbulk) — POST /v1/fetch/bulk\n- [Get fetch bulk job status](https://bytekit.com/docs/api/fetch-bulk/getfetchbulk) — GET /v1/fetch/bulk/:id"
|
|
166
176
|
},
|
|
167
177
|
"api/health/healthcheck": {
|
|
168
178
|
"title": "Health check",
|
|
@@ -174,20 +184,15 @@
|
|
|
174
184
|
"section": "API Reference",
|
|
175
185
|
"body": "# Health\n\nHealth API — endpoints, requests, and responses.\n\nThe **Health** API. 1 endpoint:\n\n- [Health check](https://bytekit.com/docs/api/health/healthcheck) — GET /health"
|
|
176
186
|
},
|
|
177
|
-
"api/
|
|
178
|
-
"title": "
|
|
179
|
-
"section": "API Reference",
|
|
180
|
-
"body": "# Bulk fetch URLs\n\nEnqueues multiple URLs for HTTP fetching. Results delivered via webhook.\nDoes not support options that require page rendering (cookies, wait_for_selector, etc.).\n"
|
|
181
|
-
},
|
|
182
|
-
"api/fetch-bulk/getfetchbulk": {
|
|
183
|
-
"title": "Get fetch bulk job status",
|
|
187
|
+
"api/plans": {
|
|
188
|
+
"title": "Plans",
|
|
184
189
|
"section": "API Reference",
|
|
185
|
-
"body": "#
|
|
190
|
+
"body": "# Plans\n\nPlans API — endpoints, requests, and responses.\n\nThe **Plans** API. 1 endpoint:\n\n- [List public plan catalog](https://bytekit.com/docs/api/plans/listplans) — GET /v1/plans"
|
|
186
191
|
},
|
|
187
|
-
"api/
|
|
188
|
-
"title": "
|
|
192
|
+
"api/plans/listplans": {
|
|
193
|
+
"title": "List public plan catalog",
|
|
189
194
|
"section": "API Reference",
|
|
190
|
-
"body": "#
|
|
195
|
+
"body": "# List public plan catalog\n\nReturns the catalog of public plans (`is_custom = false`) as the\npricing source-of-truth for the dashboard and marketing site. Custom\ncontract plans are excluded. Unauthenticated — this is catalog data,\nnot per-account state (per-account plan lives on `GET /v1/account`).\n"
|
|
191
196
|
},
|
|
192
197
|
"api/monitors/createmonitor": {
|
|
193
198
|
"title": "Create a change-detection monitor",
|
|
@@ -224,16 +229,6 @@
|
|
|
224
229
|
"section": "API Reference",
|
|
225
230
|
"body": "# Update monitor"
|
|
226
231
|
},
|
|
227
|
-
"api/plans": {
|
|
228
|
-
"title": "Plans",
|
|
229
|
-
"section": "API Reference",
|
|
230
|
-
"body": "# Plans\n\nPlans API — endpoints, requests, and responses.\n\nThe **Plans** API. 1 endpoint:\n\n- [List public plan catalog](https://bytekit.com/docs/api/plans/listplans) — GET /v1/plans"
|
|
231
|
-
},
|
|
232
|
-
"api/plans/listplans": {
|
|
233
|
-
"title": "List public plan catalog",
|
|
234
|
-
"section": "API Reference",
|
|
235
|
-
"body": "# List public plan catalog\n\nReturns the catalog of public plans (`is_custom = false`) as the\npricing source-of-truth for the dashboard and marketing site. Custom\ncontract plans are excluded. Unauthenticated — this is catalog data,\nnot per-account state (per-account plan lives on `GET /v1/account`).\n"
|
|
236
|
-
},
|
|
237
232
|
"api/schema/createschemaextraction": {
|
|
238
233
|
"title": "Schema-driven structured extraction",
|
|
239
234
|
"section": "API Reference",
|
|
@@ -412,7 +407,7 @@
|
|
|
412
407
|
"sdk/typescript/account": {
|
|
413
408
|
"title": "Account",
|
|
414
409
|
"section": "SDK Reference",
|
|
415
|
-
"body": "# Account\n\nAccount info and API key management.\n\n# Account\n\nAccount info and API key management. Accessed via `client.account`.\n\n## get\n\n```ts\nclient.account.get(): Promise<GetAccountResponse>\n```\n\nGET /v1/account — get the authenticated account\n\n## apiKeys\n\n### create\n\n```ts\nclient.account.apiKeys.create(opts?: CreateApiKeyRequest): Promise<CreateApiKeyResponse>\n```\n\nPOST /v1/account/api-keys — create a new API key.\n\n`opts` is optional: the spec declares the request body itself as optional,\nso `create()` with no arguments is valid and sends no body.\n\n### list\n\n```ts\nclient.account.apiKeys.list(): Promise<ListApiKeysResponse>\n```\n\nGET /v1/account/api-keys — list all API keys for the account\n\n### get\n\n```ts\nclient.account.apiKeys.get(id: ApiKeyId): Promise<GetApiKeyResponse>\n```\n\nGET /v1/account/api-keys/\\{id\\} — get an API key by ID\n\n### update\n\n```ts\nclient.account.apiKeys.update(id: ApiKeyId, opts: UpdateApiKeyRequest): Promise<UpdateApiKeyResponse>\n```\n\nPATCH /v1/account/api-keys/\\{id\\} — update an API key\n\n### revoke\n\n```ts\nclient.account.apiKeys.revoke(id: ApiKeyId): Promise<void>\n```\n\nDELETE /v1/account/api-keys/\\{id\\} — revoke an API key (idempotent).\n\nReturns 204 No Content: `operations['revokeApiKey']['responses'][204]`\ndeclares `content?: never`, so there is no JSON arm to derive a payload\nfrom — hence `Promise<void>`.\n\
|
|
410
|
+
"body": "# Account\n\nAccount info and API key management.\n\n# Account\n\nAccount info and API key management. Accessed via `client.account`.\n\n## get\n\n```ts\nclient.account.get(): Promise<GetAccountResponse>\n```\n\nGET /v1/account — get the authenticated account\n\n## apiKeys\n\n### create\n\n```ts\nclient.account.apiKeys.create(opts?: CreateApiKeyRequest): Promise<CreateApiKeyResponse>\n```\n\nPOST /v1/account/api-keys — create a new API key.\n\n`opts` is optional: the spec declares the request body itself as optional,\nso `create()` with no arguments is valid and sends no body.\n\n### list\n\n```ts\nclient.account.apiKeys.list(): Promise<ListApiKeysResponse>\n```\n\nGET /v1/account/api-keys — list all API keys for the account\n\n### get\n\n```ts\nclient.account.apiKeys.get(id: ApiKeyId): Promise<GetApiKeyResponse>\n```\n\nGET /v1/account/api-keys/\\{id\\} — get an API key by ID\n\n### update\n\n```ts\nclient.account.apiKeys.update(id: ApiKeyId, opts: UpdateApiKeyRequest): Promise<UpdateApiKeyResponse>\n```\n\nPATCH /v1/account/api-keys/\\{id\\} — update an API key\n\n### revoke\n\n```ts\nclient.account.apiKeys.revoke(id: ApiKeyId): Promise<void>\n```\n\nDELETE /v1/account/api-keys/\\{id\\} — revoke an API key (idempotent).\n\nReturns 204 No Content: `operations['revokeApiKey']['responses'][204]`\ndeclares `content?: never`, so there is no JSON arm to derive a payload\nfrom — hence `Promise<void>`.\n\n`client.request()` short-circuits an empty body (204 or any empty response)\nto `undefined` before it would parse the body as JSON (#2450), so this\nmethod resolves cleanly on the gateway's empty 204 body.\n\n### reveal\n\n```ts\nclient.account.apiKeys.reveal(id: ApiKeyId): Promise<RevealApiKeyResponse>\n```\n\nPOST /v1/account/api-keys/\\{id\\}/reveal — reveal the plaintext API key value"
|
|
416
411
|
},
|
|
417
412
|
"sdk/typescript/bulk": {
|
|
418
413
|
"title": "Bulk",
|
|
@@ -422,7 +417,7 @@
|
|
|
422
417
|
"sdk/typescript/client": {
|
|
423
418
|
"title": "Client",
|
|
424
419
|
"section": "SDK Reference",
|
|
425
|
-
"body": "# Client\n\nInstantiate and configure the ByteKit TypeScript client.\n\n# Client\n\nThe ByteKit TypeScript SDK is a thin, type-safe wrapper over the REST API. Create a\n client with your API key, then call resource methods.\n\n```ts\nimport {
|
|
420
|
+
"body": "# Client\n\nInstantiate and configure the ByteKit TypeScript client.\n\n# Client\n\nThe ByteKit TypeScript SDK is a thin, type-safe wrapper over the REST API. Create a\n client with your API key, then call resource methods.\n\n```ts\nimport { ByteKit } from '@hunt-labs/bytekit-sdk';\n\nconst client = new ByteKit({\n apiKey: process.env.BYTEKIT_API_KEY!, // your sk_live_… key\n});\n```\n\n## Options (`ByteKitOptions`)\n\n- `apiKey` (required) — `string`\n- `baseUrl` — `string` Defaults to `https://api.bytekit.com`.\n- `timeoutMs` — `number` — Default CLIENT-SIDE request timeout in ms — the abort budget for the whole HTTP\nround-trip made by this SDK. `0` disables the SDK-side timeout. Default 120000.\n\nNOT the same thing as `ScrapeOpts.timeout_ms`, which is the SERVER-side budget the\ngateway applies to the scrape itself. Override per call with\n`RequestOptions.requestTimeoutMs`.\n\n## Resources\n\nThe client exposes one property per resource:\n\n- [`client.scrape`](https://bytekit.com/docs/sdk/typescript/scrape) — Fetch a URL as raw HTML, clean markdown, or structured content.\n- [`client.screenshots`](https://bytekit.com/docs/sdk/typescript/screenshots) — Capture full-page or viewport screenshots.\n- [`client.bulk`](https://bytekit.com/docs/sdk/typescript/bulk) — Fan out many URLs in parallel with per-item webhooks.\n- [`client.fetch`](https://bytekit.com/docs/sdk/typescript/fetch) — Low-latency raw HTTP fetch with optional conversion.\n- [`client.monitors`](https://bytekit.com/docs/sdk/typescript/monitors) — Watch a URL on a schedule and webhook on change.\n- [`client.sitemap`](https://bytekit.com/docs/sdk/typescript/sitemap) — Discover URLs from a domain's sitemap or by crawling.\n- [`client.search`](https://bytekit.com/docs/sdk/typescript/search) — Run a web search and return ranked organic results.\n- [`client.account`](https://bytekit.com/docs/sdk/typescript/account) — Account info and API key management.\n\n## Errors\n\nAny non-2xx response throws a `ByteKitError` carrying the HTTP `status` and the API `code`.\n\n```ts\nimport { ByteKit, ByteKitError } from '@hunt-labs/bytekit-sdk';\n\ntry {\n await client.scrape.create({ url: 'https://example.com' });\n} catch (err) {\n if (err instanceof ByteKitError) {\n console.error(`${err.status} ${err.code}: ${err.message}`);\n }\n}\n```"
|
|
426
421
|
},
|
|
427
422
|
"sdk/typescript/fetch-bulk": {
|
|
428
423
|
"title": "Fetch Bulk",
|
|
@@ -439,11 +434,6 @@
|
|
|
439
434
|
"section": "SDK Reference",
|
|
440
435
|
"body": "# Monitors\n\nWatch a URL on a schedule and webhook on change.\n\n# Monitors\n\nWatch a URL on a schedule and webhook on change. Accessed via `client.monitors`.\n\n## create\n\n```ts\nclient.monitors.create(opts: Record<string, unknown>): Promise<unknown>\n```\n\nPOST /v1/monitors — create a page-change monitor (screenshot or scrape capture).\nFirst-capture behavior is the same for both types: the first capture is a silent baseline (has_change=false, change_pct=null) with no change_detected webhook, whether the monitor is `scrape` or `screenshot`. From the second capture onward both types diff against the previous capture.\n\n## list\n\n```ts\nclient.monitors.list(): Promise<unknown>\n```\n\nGET /v1/monitors — list all monitors for the account\n\n## get\n\n```ts\nclient.monitors.get(id: MonitorId): Promise<unknown>\n```\n\nGET /v1/monitors/\\{id\\} — get a monitor by ID\n\n## update\n\n```ts\nclient.monitors.update(id: MonitorId, opts: Record<string, unknown>): Promise<unknown>\n```\n\nPATCH /v1/monitors/\\{id\\} — update a monitor\n\n## delete\n\n```ts\nclient.monitors.delete(id: MonitorId): Promise<unknown>\n```\n\nDELETE /v1/monitors/\\{id\\} — delete a monitor\n\n## captures\n\n### list\n\n```ts\nclient.monitors.captures.list(id: MonitorId): Promise<unknown>\n```\n\nGET /v1/monitors/\\{id\\}/captures — list captures for a monitor"
|
|
441
436
|
},
|
|
442
|
-
"sdk/typescript/recordings": {
|
|
443
|
-
"title": "Recordings",
|
|
444
|
-
"section": "SDK Reference",
|
|
445
|
-
"body": "# Recordings\n\nGenerate a scrolling video of a page.\n\n# Recordings\n\nGenerate a scrolling video of a page. Accessed via `client.recordings`.\n\n## create\n\n```ts\nclient.recordings.create(opts: Record<string, unknown>): Promise<unknown>\n```\n\nPOST /v1/recordings — start a recording\n\n## get\n\n```ts\nclient.recordings.get(id: RecordingId): Promise<unknown>\n```\n\nGET /v1/recordings/\\{id\\} — poll a recording by ID"
|
|
446
|
-
},
|
|
447
437
|
"sdk/typescript/scrape-bulk": {
|
|
448
438
|
"title": "Scrape Bulk",
|
|
449
439
|
"section": "SDK Reference",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { type BytekitClient } from '../client.js';
|
|
3
3
|
/**
|
|
4
|
-
* `
|
|
4
|
+
* `web_search` MCP tool — runs a web search and returns ranked organic results.
|
|
5
5
|
*
|
|
6
6
|
* Distinct from `search_docs` (which searches the bundled documentation). All
|
|
7
7
|
* HTTP/search logic lives in the client; this tool only validates input,
|
package/dist/tools/web-search.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BytekitApiError, } from '../client.js';
|
|
3
3
|
/**
|
|
4
|
-
* `
|
|
4
|
+
* `web_search` MCP tool — runs a web search and returns ranked organic results.
|
|
5
5
|
*
|
|
6
6
|
* Distinct from `search_docs` (which searches the bundled documentation). All
|
|
7
7
|
* HTTP/search logic lives in the client; this tool only validates input,
|
|
8
8
|
* delegates to `client.search`, and shapes the response into MCP content.
|
|
9
9
|
*/
|
|
10
10
|
export function webSearchTool(server, client) {
|
|
11
|
-
server.tool('
|
|
11
|
+
server.tool('web_search', 'Run a web search and return ranked organic results (position, title, url, snippet, date). Distinct from search_docs, which searches the documentation.', {
|
|
12
12
|
query: z.string().min(1, 'query must be non-empty').describe('The search query'),
|
|
13
13
|
// Kept as a free-form string (not z.enum) on purpose: the API is the
|
|
14
14
|
// source of truth for the valid set, so the MCP tool must stay
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hunt-labs/bytekit-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "ByteKit MCP server — exposes ByteKit web-data tools (scrape, screenshot, search, docs) to AI agents over the Model Context Protocol, hosted or as a local stdio server.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"bytekit-mcp": "./dist/cli.js"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
|
-
"dist"
|
|
21
|
+
"dist",
|
|
22
|
+
"CHANGELOG.md"
|
|
22
23
|
],
|
|
23
24
|
"exports": {
|
|
24
25
|
".": {
|
|
@@ -49,19 +50,13 @@
|
|
|
49
50
|
],
|
|
50
51
|
"homepage": "https://bytekit.com/mcp/",
|
|
51
52
|
"bugs": {
|
|
52
|
-
"email": "support@bytekit.com"
|
|
53
|
+
"email": "support@bytekit.com",
|
|
54
|
+
"url": "https://bytekit.com/contact"
|
|
53
55
|
},
|
|
54
56
|
"dependencies": {
|
|
55
57
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
56
58
|
"zod": "^3.23.6"
|
|
57
59
|
},
|
|
58
|
-
"devDependencies": {
|
|
59
|
-
"@types/node": "^22.0.0",
|
|
60
|
-
"tsx": "^4.11.0",
|
|
61
|
-
"typescript": "^5.4.5",
|
|
62
|
-
"vitest": "^1.6.0",
|
|
63
|
-
"@bytekit/docs": "0.0.1"
|
|
64
|
-
},
|
|
65
60
|
"scripts": {
|
|
66
61
|
"prebuild": "pnpm check:scrape-contract && tsx scripts/build-docs-bundle.ts",
|
|
67
62
|
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc && mkdir -p dist/docs-bundle && cp src/docs-bundle/docs-bundle.json dist/docs-bundle/docs-bundle.json",
|