API Reference
Auto-generated
Scrape
API reference for scrape endpoints.
Auto-generated
This page was generated from the OpenAPI spec. Run
make generate-docs to refresh after spec changes.POST /api/v1/scrape
Unified scrape endpoint. The legacy mode-specific routes below are deprecated.
All request parameters (POST /api/v1/scrape)
| Name | Type | Default | Description |
|---|---|---|---|
| tag | string | Optional spend-attribution tag (^[a-z0-9][a-z0-9_.-]{0,63}$, max 20 active tags per organization). | |
| url | string | ||
| mode | "auto" | "html" | "js" | "pdf" | "ocr" | "auto" | Scraping mode |
| method | "GET" | "POST" | "GET" | HTTP method to use when fetching the target URL. |
| body | string | Request body to send with POST. | |
| content_type | "application/json" | "application/x-www-form-urlencoded" | "text/plain" | "application/graphql" | Content-Type header for the request body. | |
| source | "playground" | "api" | Request source for tracking. | |
| headers | object | Custom HTTP headers to include in the request to the target URL. | |
| sync | boolean | true | Enable blocking mode: API polls internally until job completes (up to 85s), then returns 200 with result. |
| suggestions | boolean | true | Set false to opt out of the recurring-use `suggestions` item (#40690). |
| response | "full" | "minimal" | Response shape. | |
| sync_policy | "auto" | "wait_until_deadline" | "auto" | Synchronous wait policy. |
| advanced | object | Advanced scraping options with add-on costs (in microcents). | |
| location | object | Geo-targeting parameters. | |
| cost_controls | object | ||
| cache | boolean | false | Enable caching. |
| cache_ttl | integer | Cache TTL in seconds (60-86400). | |
| max_age | integer | Accept a stored result up to this many seconds old (0-86400). | |
| force_refresh | boolean | false | Force fresh fetch even if cache=True. |
| include_raw_html | boolean | false | Return the fetched pre-render origin HTML as top-level `raw_html`. |
| timeout | integer | 90 | |
| max_response_bytes | integer | 5242880 | Soft cap on raw response body size in bytes. |
| formats | "text" | "json" | "json_v2" | "html" | "markdown" | "rag" | "content" | "raw" | "document" | "structured_data"[] | Output formats for content transformation. | |
| agent_profile | string | Opt-in output profile for LLM agents. | |
| max_tokens | integer | Token budget for the markdown format when agent_profile='agent'. | |
| extraction_selectors | object | Deterministic field extraction: {field: {css|xpath, attr?, multiple?}} evaluated on the fetched HTML. | |
| extraction_schema | object | JSON Schema for filtering extracted data. | |
| extraction_prompt | string | Natural language instructions for extraction | |
| extraction_provider | "openai" | "anthropic" | "openrouter" | "groq" | LLM provider to use for extraction. | |
| extraction_model | string | Per-request LLM model override in provider-specific format (e.g. | |
| extraction_profile | "auto" | "product" | "article" | "job_posting" | "faq" | "recipe" | "event" | "ecommerce_homepage" | "directory_listing" | "auto" | Pre-defined extraction profile (schema template) |
| extraction_template | "auto" | "product" | "article" | "job_posting" | "faq" | "recipe" | "event" | "ecommerce_homepage" | "directory_listing" | Shorthand for extraction_profile. | |
| evidence | boolean | false | Include provenance/evidence for extracted fields |
| promote_schema_org | boolean | true | Use Schema.org as primary structure when available |
| filter_content | boolean | false | Apply quality filtering to extracted content. |
| wait_for | string | ||
| screenshot | boolean | false | |
| wait_until | string | "networkidle" | |
| enable_scroll | boolean | Force enable scrolling for lazy-load images. | |
| pdf_format | string | "markdown" | |
| ocr_language | string | "eng" | |
| webhook_url | string | Webhook URL to receive job.completed/job.failed events for this request. | |
| embeddings | object | Optional embeddings configuration. |
POST /api/v1/scrape/js
POST
/api/v1/scrape/jsScrape (JS render mode) [DEPRECATED]
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| url | string | Required | Url |
| method | string | Optional | MethodDefault: GET |
| headers | object | Optional | headers |
| timeout | integer | Optional | TimeoutDefault: 90 |
| follow_redirects | boolean | Optional | Follow RedirectsDefault: True |
| wait_for | string | Optional | wait_for |
| screenshot | boolean | Optional | ScreenshotDefault: False |
| wait_until | string | Optional | Wait UntilDefault: networkidle |
| force_refresh | boolean | Optional | Force RefreshDefault: False |
| include_raw_html | boolean | Optional | Include Raw HtmlDefault: False |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/scrape/js \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "example_url",
"method": "example_method",
"timeout": 90,
"follow_redirects": false
}'Response Example
JSON
{
"url": "example",
"status_code": 0,
"content": "example",
"title": "example",
"published_at": "example",
"author": "example"
}POST /api/v1/scrape/light
POST
/api/v1/scrape/lightScrape (light mode) [DEPRECATED]
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| url | string | Required | Url |
| method | string | Optional | MethodDefault: GET |
| headers | object | Optional | headers |
| timeout | integer | Optional | TimeoutDefault: 90 |
| follow_redirects | boolean | Optional | Follow RedirectsDefault: True |
| force_refresh | boolean | Optional | Force RefreshDefault: False |
| include_raw_html | boolean | Optional | Include Raw HtmlDefault: False |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/scrape/light \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "example_url",
"method": "example_method",
"timeout": 90,
"follow_redirects": false
}'Response Example
JSON
{
"url": "example",
"status_code": 0,
"content": "example",
"title": "example",
"published_at": "example",
"author": "example"
}POST /api/v1/scrape/ocr
POST
/api/v1/scrape/ocrScrape (OCR mode) [DEPRECATED]
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| url | string | Required | Url |
| language | string | Optional | LanguageDefault: eng |
| force_refresh | boolean | Optional | Force RefreshDefault: False |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/scrape/ocr \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "example_url",
"language": "example_language",
"force_refresh": false
}'Response Example
JSON
{
"url": "example",
"status_code": 0,
"content": "example",
"title": "example",
"published_at": "example",
"author": "example"
}POST /api/v1/scrape/pdf
POST
/api/v1/scrape/pdfScrape (PDF mode) [DEPRECATED]
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| url | string | Required | Url |
| format | string | Optional | FormatDefault: markdown |
| force_refresh | boolean | Optional | Force RefreshDefault: False |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/scrape/pdf \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "example_url",
"format": "example_format",
"force_refresh": false
}'Response Example
JSON
{
"url": "example",
"status_code": 0,
"content": "example",
"title": "example",
"published_at": "example",
"author": "example"
}POST /api/v1/scrape/estimate/public
POST
/api/v1/scrape/estimate/publicEstimate scrape cost without an API key
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| tag | string | Optional | tag |
| url | string | Required | Url |
| mode | "auto" | "html" | "js" | "pdf" | "ocr" | Optional | Scraping modeDefault: auto |
| method | "GET" | "POST" | Optional | HTTP method to use when fetching the target URL. Default is GET (standard page scrape). Use POST for GraphQL endpoints, REST APIs, and form submissions. POST costs 1.5x the base tier price. Body and Content-Type are optional — some endpoints (e.g. webhook triggers) accept bodyless POST.Default: GET |
| body | string | Optional | body |
| content_type | "application/json" | "application/x-www-form-urlencoded" | "text/plain" | "application/graphql" | Optional | content_type |
| source | "playground" | "api" | Optional | source |
| headers | object | Optional | headers |
| sync | boolean | Optional | Enable blocking mode: API polls internally until job completes (up to 85s), then returns 200 with result. Simpler than manual polling, but has a safe deadline. Set to False for immediate 202 response with job_id for long-running scrapes (>85s) or when using webhooks/WebSockets. Both modes queue to worker - sync just polls for you.Default: True |
| response | "full" | "minimal" | Optional | response |
| sync_policy | "auto" | "wait_until_deadline" | Optional | Synchronous wait policy. 'auto' preserves the normal early 202 response for predicted T3/T4 jobs; 'wait_until_deadline' keeps the connection open until the terminal result or the existing safe sync deadline. Requires sync=true.Default: auto |
| advanced | object | Optional | Advanced scraping options with add-on costs (in microcents). Add-on Costs (see ADDON_MICROCENTS in pricing.py): - render_js: Forces Tier 4 ($0.004) — no extra surcharge - screenshot: +$0.0002 (200 microcents, requires render_js) - generate_pdf: +$0.0004 (400 microcents, requires render_js) - ocr: +$0.001 (1000 microcents) - use_proxy: +$0.0002 (200 microcents) - actions: included in the browser tier price (no per-action fee) - screenshot action: +$0.0002 (200 microcents) per captured image; failed captures are free - markdown: Free - wait_condition: Free |
| location | object | Optional | Geo-targeting parameters for localized content scraping. Controls proxy country routing, Accept-Language header, and browser locale to retrieve content as seen from a specific geographic location. |
| cost_controls | object | Optional | Cost control parameters for scraping requests. Tier levels: 1: curl - Direct HTTP, no fingerprinting ($0.0002) 2: http - curl_cffi with TLS fingerprinting ($0.0003) 3: proxied - curl_cffi with proxy ($0.002) 3.5: lightjs - T3 + JSON extraction without browser ($0.0025) 4: browser - Playwright full rendering ($0.004) |
| cache | boolean | Optional | Enable caching. When True, results may be returned from cache on repeat calls where the full cache key matches: URL, scraping mode, HTTP method, request body, output options (formats, extraction config, render settings, geo-targeting), and user identity — each user's cache is isolated. For GET: standard opt-in caching. For POST: only valid when the endpoint is idempotent (e.g. GraphQL queries, read-only REST POSTs) — caching a mutating POST will cause stale responses to be returned instead of executing the mutation.Default: False |
| cache_ttl | integer | Optional | cache_ttl |
| max_age | integer | Optional | max_age |
| force_refresh | boolean | Optional | Force fresh fetch even if cache=True. Deprecated: prefer cache=False.Default: False |
| include_raw_html | boolean | Optional | Return the fetched pre-render origin HTML as top-level 'raw_html'. 'formats: ["html"]' returns the post-render cleaned HTML in 'content.html'.Default: False |
| timeout | integer | Optional | TimeoutDefault: 90 |
| max_response_bytes | integer | Optional | Soft cap on raw response body size in bytes. When the downloaded HTML exceeds this value it is truncated before extraction and content_truncated.truncation_reason is set to 'response_body_cap'. Defaults to 5 MB (5_242_880 bytes). Set to 0 for no limit. Maximum: 50 MB (52_428_800).Default: 5242880 |
| formats | string[] | Optional | formats |
| agent_profile | string | Optional | agent_profile |
| max_tokens | integer | Optional | max_tokens |
| extraction_selectors | object | Optional | extraction_selectors |
| extraction_schema | object | Optional | extraction_schema |
| extraction_prompt | string | Optional | extraction_prompt |
| extraction_provider | "openai" | "anthropic" | "openrouter" | "groq" | Optional | extraction_provider |
| extraction_model | string | Optional | extraction_model |
| extraction_profile | "auto" | "product" | "article" | "job_posting" | "faq" | "recipe" | "event" | "ecommerce_homepage" | "directory_listing" | Optional | extraction_profile |
| extraction_template | "auto" | "product" | "article" | "job_posting" | "faq" | "recipe" | "event" | "ecommerce_homepage" | "directory_listing" | Optional | extraction_template |
| evidence | boolean | Optional | Include provenance/evidence for extracted fieldsDefault: False |
| promote_schema_org | boolean | Optional | Use Schema.org as primary structure when availableDefault: True |
| filter_content | boolean | Optional | Apply quality filtering to extracted content. When False (default), returns all parsed content without quality thresholds (lossless mode).Default: False |
| wait_for | string | Optional | wait_for |
| screenshot | boolean | Optional | ScreenshotDefault: False |
| wait_until | string | Optional | Wait UntilDefault: networkidle |
| enable_scroll | boolean | Optional | enable_scroll |
| pdf_format | string | Optional | Pdf FormatDefault: markdown |
| ocr_language | string | Optional | Ocr LanguageDefault: eng |
| webhook_url | string | Optional | webhook_url |
| embeddings | object | Optional | Configuration for optional inline embeddings generation. When enabled, scraped text content is chunked and embedded using OpenAI embedding models. Results are included in the scrape response. A registered OpenAI API key (BYOK, Dashboard > Settings > LLM keys) is required; without one the request is rejected with 400 ''byok_key_required'' before any charge. Add-on cost: +$0.001 per page (1000 microcents). |
Request Example
Bash
curl -X POST https://api.alterlab.io/api/v1/scrape/estimate/public \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "example_url",
"mode": "...",
"method": "..."
}'Response Example
JSON
{
"url": "example",
"estimated_tier": "example",
"estimated_credits": 0,
"confidence": "example",
"max_possible_credits": 0,
"reasoning": "example"
}