```yaml
product: AlterLab
title: Scrape API Reference
category: api
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/docs/api/generated/scrape
```

# Scrape API Reference

Auto-generated API reference for scrape endpoints, built from the OpenAPI spec.

## POST /api/v1/scrape

Scrape a web page
Scrape a single URL with intelligent tier escalation. The engine automatically selects the cheapest scraping tier that succeeds (curl → HTTP → stealth → browser → captcha solver) and only charges for the tier actually used. **Modes**: `auto` (default — detect best mode), `html`, `js` (headless browser), `pdf`, `ocr`. **Sync vs async**: `sync=true` (default) blocks until the result is ready (up to 85 s) and returns **200** with content. `sync=false` returns **202** immediately with a `job_id` and canonical relative `poll_url` for polling via `GET /api/v1/jobs/{job_id}`. Every 202 response carrying a `job_id` uses `/api/v1/jobs/{job_id}` as its `poll_url`. **Cost**: 1–20 credits per request depending on the tier used. Use `cost_controls.max_cost` to cap spend. **Agent intent headers (opt-in)**: an agent (or its operator) may optionally send `X-Agent-Intent`, `X-Agent-Context`, and/or `X-Agent-Feedback` to tell AlterLab what it's trying to do and what already failed. All three are independent, free-text, capped at 500 characters (truncated, never rejected), and stored as opaque text alongside this request's implicit retry/error telemetry signal for later analysis — content is never parsed or executed. Omitting all three changes nothing about request handling.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `template` | query | `string` | no | Scrape template slug. When provided, the template's request_config is merged into the request body (caller-provided fields take precedence). Example: ?template=amazon-product |
| `X-Marketplace-Provider` | header | `string` | no |  |
| `X-AlterLab-Source` | header | `string` | no |  |
| `X-Agent-Intent` | header | `string` | no |  |
| `X-Agent-Context` | header | `string` | no |  |
| `X-Agent-Feedback` | header | `string` | no |  |
| `PAYMENT-SIGNATURE` | header | `string` | no | x402 v2 PaymentPayload, base64-encoded JSON. Only for keyless pay-per-request callers (no API key); see the 402 response. |
| `tag` | body | `string` | no |  |
| `url` | body | `string` | yes | Url |
| `mode` | body | `"auto" \| "html" \| "js" \| "pdf" \| "ocr"` | no | Scraping mode |
| `method` | body | `"GET" \| "POST"` | no | 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. |
| `body` | body | `string` | no |  |
| `content_type` | body | `"application/json" \| "application/x-www-form-urlencoded" \| "text/plain" \| "application/graphql"` | no |  |
| `source` | body | `"playground" \| "api"` | no |  |
| `headers` | body | `object` | no |  |
| `sync` | body | `boolean` | no | 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. |
| `response` | body | `"full" \| "minimal"` | no |  |
| `sync_policy` | body | `"auto" \| "wait_until_deadline"` | no | 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. |
| `advanced` | body | `object` | no | 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` | body | `object` | no | 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` | body | `object` | no | 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` | body | `boolean` | no | 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. |
| `cache_ttl` | body | `integer` | no |  |
| `max_age` | body | `integer` | no |  |
| `force_refresh` | body | `boolean` | no | Force fresh fetch even if cache=True. Deprecated: prefer cache=False. |
| `include_raw_html` | body | `boolean` | no | Return the fetched pre-render origin HTML as top-level `raw_html`. `formats: ["html"]` returns the post-render cleaned HTML in `content.html`. |
| `timeout` | body | `integer` | no | Timeout |
| `max_response_bytes` | body | `integer` | no | 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). |
| `formats` | body | `string[]` | no |  |
| `agent_profile` | body | `string` | no |  |
| `max_tokens` | body | `integer` | no |  |
| `extraction_selectors` | body | `object` | no |  |
| `extraction_schema` | body | `object` | no |  |
| `extraction_prompt` | body | `string` | no |  |
| `extraction_provider` | body | `"openai" \| "anthropic" \| "openrouter" \| "groq"` | no |  |
| `extraction_model` | body | `string` | no |  |
| `extraction_profile` | body | `"auto" \| "product" \| "article" \| "job_posting" \| "faq" \| "recipe" \| "event" \| "ecommerce_homepage" \| "directory_listing"` | no |  |
| `extraction_template` | body | `"auto" \| "product" \| "article" \| "job_posting" \| "faq" \| "recipe" \| "event" \| "ecommerce_homepage" \| "directory_listing"` | no |  |
| `evidence` | body | `boolean` | no | Include provenance/evidence for extracted fields |
| `promote_schema_org` | body | `boolean` | no | Use Schema.org as primary structure when available |
| `filter_content` | body | `boolean` | no | Apply quality filtering to extracted content. When False (default), returns all parsed content without quality thresholds (lossless mode). |
| `wait_for` | body | `string` | no |  |
| `screenshot` | body | `boolean` | no | Screenshot |
| `wait_until` | body | `string` | no | Wait Until |
| `enable_scroll` | body | `boolean` | no |  |
| `pdf_format` | body | `string` | no | Pdf Format |
| `ocr_language` | body | `string` | no | Ocr Language |
| `webhook_url` | body | `string` | no |  |
| `embeddings` | body | `object` | no | 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). |

## POST /api/v1/scrape/estimate

Estimate scrape cost (agent pricing-transparency primitive)
Machine-readable pricing manifest for a single URL: predicted tier, credit cost, a hard cost ceiling (max_possible_credits), and a human-readable reasoning string — all without actually scraping. This is the primitive to call for pre-flight budget decisions before committing credits, whether from a UI cost preview or an autonomous agent deciding whether a request is worth its cost.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `tag` | body | `string` | no |  |
| `url` | body | `string` | yes | Url |
| `mode` | body | `"auto" \| "html" \| "js" \| "pdf" \| "ocr"` | no | Scraping mode |
| `method` | body | `"GET" \| "POST"` | no | 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. |
| `body` | body | `string` | no |  |
| `content_type` | body | `"application/json" \| "application/x-www-form-urlencoded" \| "text/plain" \| "application/graphql"` | no |  |
| `source` | body | `"playground" \| "api"` | no |  |
| `headers` | body | `object` | no |  |
| `sync` | body | `boolean` | no | 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. |
| `response` | body | `"full" \| "minimal"` | no |  |
| `sync_policy` | body | `"auto" \| "wait_until_deadline"` | no | 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. |
| `advanced` | body | `object` | no | 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` | body | `object` | no | 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` | body | `object` | no | 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` | body | `boolean` | no | 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. |
| `cache_ttl` | body | `integer` | no |  |
| `max_age` | body | `integer` | no |  |
| `force_refresh` | body | `boolean` | no | Force fresh fetch even if cache=True. Deprecated: prefer cache=False. |
| `include_raw_html` | body | `boolean` | no | Return the fetched pre-render origin HTML as top-level `raw_html`. `formats: ["html"]` returns the post-render cleaned HTML in `content.html`. |
| `timeout` | body | `integer` | no | Timeout |
| `max_response_bytes` | body | `integer` | no | 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). |
| `formats` | body | `string[]` | no |  |
| `agent_profile` | body | `string` | no |  |
| `max_tokens` | body | `integer` | no |  |
| `extraction_selectors` | body | `object` | no |  |
| `extraction_schema` | body | `object` | no |  |
| `extraction_prompt` | body | `string` | no |  |
| `extraction_provider` | body | `"openai" \| "anthropic" \| "openrouter" \| "groq"` | no |  |
| `extraction_model` | body | `string` | no |  |
| `extraction_profile` | body | `"auto" \| "product" \| "article" \| "job_posting" \| "faq" \| "recipe" \| "event" \| "ecommerce_homepage" \| "directory_listing"` | no |  |
| `extraction_template` | body | `"auto" \| "product" \| "article" \| "job_posting" \| "faq" \| "recipe" \| "event" \| "ecommerce_homepage" \| "directory_listing"` | no |  |
| `evidence` | body | `boolean` | no | Include provenance/evidence for extracted fields |
| `promote_schema_org` | body | `boolean` | no | Use Schema.org as primary structure when available |
| `filter_content` | body | `boolean` | no | Apply quality filtering to extracted content. When False (default), returns all parsed content without quality thresholds (lossless mode). |
| `wait_for` | body | `string` | no |  |
| `screenshot` | body | `boolean` | no | Screenshot |
| `wait_until` | body | `string` | no | Wait Until |
| `enable_scroll` | body | `boolean` | no |  |
| `pdf_format` | body | `string` | no | Pdf Format |
| `ocr_language` | body | `string` | no | Ocr Language |
| `webhook_url` | body | `string` | no |  |
| `embeddings` | body | `object` | no | 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). |

## POST /api/v1/scrape/estimate/public

Estimate scrape cost without an API key
Keyless twin of POST /estimate for the hosted MCP's public cost-estimate tool. Pure URL-pattern computation: nothing is fetched, debited or recorded. Rate limited per client IP.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `tag` | body | `string` | no |  |
| `url` | body | `string` | yes | Url |
| `mode` | body | `"auto" \| "html" \| "js" \| "pdf" \| "ocr"` | no | Scraping mode |
| `method` | body | `"GET" \| "POST"` | no | 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. |
| `body` | body | `string` | no |  |
| `content_type` | body | `"application/json" \| "application/x-www-form-urlencoded" \| "text/plain" \| "application/graphql"` | no |  |
| `source` | body | `"playground" \| "api"` | no |  |
| `headers` | body | `object` | no |  |
| `sync` | body | `boolean` | no | 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. |
| `response` | body | `"full" \| "minimal"` | no |  |
| `sync_policy` | body | `"auto" \| "wait_until_deadline"` | no | 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. |
| `advanced` | body | `object` | no | 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` | body | `object` | no | 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` | body | `object` | no | 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` | body | `boolean` | no | 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. |
| `cache_ttl` | body | `integer` | no |  |
| `max_age` | body | `integer` | no |  |
| `force_refresh` | body | `boolean` | no | Force fresh fetch even if cache=True. Deprecated: prefer cache=False. |
| `include_raw_html` | body | `boolean` | no | Return the fetched pre-render origin HTML as top-level `raw_html`. `formats: ["html"]` returns the post-render cleaned HTML in `content.html`. |
| `timeout` | body | `integer` | no | Timeout |
| `max_response_bytes` | body | `integer` | no | 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). |
| `formats` | body | `string[]` | no |  |
| `agent_profile` | body | `string` | no |  |
| `max_tokens` | body | `integer` | no |  |
| `extraction_selectors` | body | `object` | no |  |
| `extraction_schema` | body | `object` | no |  |
| `extraction_prompt` | body | `string` | no |  |
| `extraction_provider` | body | `"openai" \| "anthropic" \| "openrouter" \| "groq"` | no |  |
| `extraction_model` | body | `string` | no |  |
| `extraction_profile` | body | `"auto" \| "product" \| "article" \| "job_posting" \| "faq" \| "recipe" \| "event" \| "ecommerce_homepage" \| "directory_listing"` | no |  |
| `extraction_template` | body | `"auto" \| "product" \| "article" \| "job_posting" \| "faq" \| "recipe" \| "event" \| "ecommerce_homepage" \| "directory_listing"` | no |  |
| `evidence` | body | `boolean` | no | Include provenance/evidence for extracted fields |
| `promote_schema_org` | body | `boolean` | no | Use Schema.org as primary structure when available |
| `filter_content` | body | `boolean` | no | Apply quality filtering to extracted content. When False (default), returns all parsed content without quality thresholds (lossless mode). |
| `wait_for` | body | `string` | no |  |
| `screenshot` | body | `boolean` | no | Screenshot |
| `wait_until` | body | `string` | no | Wait Until |
| `enable_scroll` | body | `boolean` | no |  |
| `pdf_format` | body | `string` | no | Pdf Format |
| `ocr_language` | body | `string` | no | Ocr Language |
| `webhook_url` | body | `string` | no |  |
| `embeddings` | body | `object` | no | 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). |

## POST /api/v1/scrape/js

Scrape (JS render mode) [DEPRECATED]
**Deprecated**: Use POST /api/v1/scrape with mode='js' instead.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `url` | body | `string` | yes | Url |
| `method` | body | `string` | no | Method |
| `headers` | body | `object` | no |  |
| `timeout` | body | `integer` | no | Timeout |
| `follow_redirects` | body | `boolean` | no | Follow Redirects |
| `wait_for` | body | `string` | no |  |
| `screenshot` | body | `boolean` | no | Screenshot |
| `wait_until` | body | `string` | no | Wait Until |
| `force_refresh` | body | `boolean` | no | Force Refresh |
| `include_raw_html` | body | `boolean` | no | Include Raw Html |

## POST /api/v1/scrape/light

Scrape (light mode) [DEPRECATED]
**Deprecated**: Use POST /api/v1/scrape with mode='html' instead.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `url` | body | `string` | yes | Url |
| `method` | body | `string` | no | Method |
| `headers` | body | `object` | no |  |
| `timeout` | body | `integer` | no | Timeout |
| `follow_redirects` | body | `boolean` | no | Follow Redirects |
| `force_refresh` | body | `boolean` | no | Force Refresh |
| `include_raw_html` | body | `boolean` | no | Include Raw Html |

## POST /api/v1/scrape/ocr

Scrape (OCR mode) [DEPRECATED]
**Deprecated**: Use POST /api/v1/scrape with mode='ocr' instead.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `url` | body | `string` | yes | Url |
| `language` | body | `string` | no | Language |
| `force_refresh` | body | `boolean` | no | Force Refresh |

## POST /api/v1/scrape/pdf

Scrape (PDF mode) [DEPRECATED]
**Deprecated**: Use POST /api/v1/scrape with mode='pdf' instead.

Authentication: `X-API-Key: <your key>`

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `url` | body | `string` | yes | Url |
| `format` | body | `string` | no | Format |
| `force_refresh` | body | `boolean` | no | Force Refresh |
