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

# Crawl API Reference

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

## GET /api/v1/crawl

List crawls
Return a paginated list of the authenticated user's crawls. Merges in-progress crawls from Redis with completed crawls from the crawl_history table. Supports filtering by status, domain substring, and date range.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `limit` | query | `integer` | no | Max items to return |
| `offset` | query | `integer` | no | Number of items to skip |
| `status` | query | `string` | no | Filter by crawl status (discovering, scraping, completed, partial, failed, cancelled) |
| `domain` | query | `string` | no | Filter by domain substring (case-insensitive) |
| `date_from` | query | `string` | no | Filter: created_at >= this ISO date (YYYY-MM-DD) |
| `date_to` | query | `string` | no | Filter: created_at <= this ISO date (YYYY-MM-DD) |
| `sort` | query | `string` | no | Sort field (created_at or status) |
| `order` | query | `string` | no | Sort order (asc or desc) |

## POST /api/v1/crawl

Start a website crawl
Discover pages on a website via sitemap parsing and link extraction, then scrape them. Returns immediately with a crawl_id for polling. Supports depth crawling, URL pattern filtering, priority scoring, cost controls, change tracking, output connectors (S3/GCS/webhook), caching, custom headers, and webhook notifications.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `tag` | body | `string` | no |  |
| `url` | body | `string` | yes | Start URL for the crawl |
| `max_pages` | body | `integer` | no | Maximum number of pages to scrape (billing limits enforced separately) |
| `dry_run` | body | `boolean` | no | Return a free cost estimate (per-item predicted tier and cost, totals, predicted time, remaining-budget check) without dispatching, debiting or reserving anything. |
| `approval_id` | body | `string` | no |  |
| `max_depth` | body | `integer` | no | Maximum link-following depth from start URL (0 = start page only) |
| `include_patterns` | body | `string[]` | no |  |
| `exclude_patterns` | body | `string[]` | no |  |
| `sitemap` | body | `"include" \| "skip" \| "only"` | no | Sitemap discovery mode. "include" (default): discover sitemap from robots.txt and parse it, also extract links. "skip": skip sitemap entirely, only discover via link extraction from start URL. "only": crawl exclusively from sitemap URLs — no link extraction, no depth crawling. |
| `sitemap_path` | body | `string` | no |  |
| `budget` | body | `object` | no |  |
| `priority` | body | `object` | no | Content-aware URL prioritization — crawl high-value pages first. When configured, discovered URLs are scored (0.0-1.0) and enqueued in priority order (highest first). When ``max_pages`` is reached the lowest-scoring URLs are the ones dropped. |
| `max_concurrency` | body | `integer` | no | Maximum concurrent pages to scrape simultaneously per domain. The crawler auto-throttles below this limit when servers return 429/503 errors, and speeds up when responses are fast. |
| `headers` | body | `object` | no |  |
| `formats` | body | `string[]` | no |  |
| `extraction` | body | `string` | no |  |
| `extraction_schema` | body | `object` | 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 |  |
| `extraction_provider` | body | `"openai" \| "anthropic" \| "openrouter" \| "groq"` | no |  |
| `extraction_model` | body | `string` | no |  |
| `respect_robots` | body | `boolean` | no | Respect robots.txt rules for the target domain |
| `include_subdomains` | body | `boolean` | no | Include links to subdomains during discovery |
| `change_tracking` | body | `object` | no | Configuration for cross-crawl change detection. |
| `webhook_url` | body | `string` | no |  |
| `webhook` | body | `object` | no | Webhook configuration for crawl event notifications. When provided, the crawl will deliver real-time events to the specified URL. Supports per-event filtering, HMAC-SHA256 signing, custom headers, and metadata passthrough. |
| `advanced` | body | `object` | no | Advanced options applied to every page scraped during the crawl. |
| `cost_controls` | body | `object` | no | Cost controls for the entire crawl. |
| `output` | body | `object` | no | S3 output connector configuration. |
| `storage` | body | `"redis" \| "s3" \| "r2"` | no | Storage backend for crawl results. "redis" (default): results stored in Redis with 2h TTL, returned inline. "s3" or "r2": results uploaded to S3/R2 as JSONL on completion, status endpoint returns a presigned download URL. Cloud storage provides 30-day retention and handles large crawls (10k+ pages). |
| `cache` | body | `boolean` | no | Enable caching. When True, per-URL results may be returned from cache if available. |
| `cache_ttl` | body | `integer` | no |  |
| `force_refresh` | body | `boolean` | no | Force fresh fetch even if cache=True. Invalidates existing cache entries. |
| `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). |
| `list` | body | `object` | no | Paginated list crawl: fetch ``url_template`` page by page until the list is exhausted. |

## GET /api/v1/crawl/schedules

List Crawl Schedules
List user's crawl schedules.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `limit` | query | `integer` | no |  |
| `offset` | query | `integer` | no |  |
| `active_only` | query | `boolean` | no |  |

## POST /api/v1/crawl/schedules

Create Crawl Schedule
Create a new crawl schedule.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `X-Organization-Id` | header | `string` | no |  |
| `name` | body | `string` | yes | Name |
| `cron` | body | `string` | yes | Cron expression (5 fields), e.g. '0 6 * * *' |
| `timezone` | body | `string` | no | Timezone |
| `crawl_config` | body | `object` | yes | Frozen crawl configuration executed on each scheduled run. Mirrors the CrawlRequest fields (#39215) but stored as a JSON blob so the schedule is self-contained (no user input at execution time). Constraints shared with CrawlRequest (headers, budget) reuse its validators. |
| `max_runs` | body | `integer` | no |  |
| `max_credits_per_run` | body | `integer` | no |  |
| `enabled` | body | `boolean` | no | Enabled |

## DELETE /api/v1/crawl/schedules/{schedule_id}

Delete Crawl Schedule
Soft-delete a crawl schedule.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `schedule_id` | path | `string` | yes |  |

## GET /api/v1/crawl/schedules/{schedule_id}

Get Crawl Schedule
Get crawl schedule details.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `schedule_id` | path | `string` | yes |  |

## PATCH /api/v1/crawl/schedules/{schedule_id}

Update Crawl Schedule
Update a crawl schedule. Recomputes next_run_at if cron or timezone changes.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `schedule_id` | path | `string` | yes |  |
| `name` | body | `string` | no |  |
| `cron` | body | `string` | no |  |
| `timezone` | body | `string` | no |  |
| `crawl_config` | body | `object` | no | Frozen crawl configuration executed on each scheduled run. Mirrors the CrawlRequest fields (#39215) but stored as a JSON blob so the schedule is self-contained (no user input at execution time). Constraints shared with CrawlRequest (headers, budget) reuse its validators. |
| `max_runs` | body | `integer` | no |  |
| `max_credits_per_run` | body | `integer` | no |  |
| `enabled` | body | `boolean` | no |  |

## POST /api/v1/crawl/schedules/{schedule_id}/pause

Pause Crawl Schedule
Pause a crawl schedule.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `schedule_id` | path | `string` | yes |  |

## POST /api/v1/crawl/schedules/{schedule_id}/resume

Resume Crawl Schedule
Resume a paused crawl schedule. Recomputes next_run_at.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `schedule_id` | path | `string` | yes |  |

## POST /api/v1/crawl/schedules/{schedule_id}/run

Run Crawl Schedule Now
Manually trigger an immediate crawl run for a schedule. Executes the crawl outside its cron cadence. next_run_at is NOT advanced so the regular schedule is unaffected by the manual trigger. Works for both active and paused schedules.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `schedule_id` | path | `string` | yes |  |

## GET /api/v1/crawl/schedules/{schedule_id}/runs

List Crawl Schedule Runs
Get execution history for a crawl schedule.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `schedule_id` | path | `string` | yes |  |
| `limit` | query | `integer` | no |  |
| `offset` | query | `integer` | no |  |

## DELETE /api/v1/crawl/{crawl_id}

Cancel a crawl and refund credits
Cancel an active crawl. Pending and queued jobs are cancelled, and credits for unprocessed pages are automatically refunded. Already completed or in-progress jobs are not affected.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `crawl_id` | path | `string` | yes |  |

## GET /api/v1/crawl/{crawl_id}

Poll crawl status and results
Get the current status, progress, billing breakdown, and optionally per-page results of a crawl. Supports pagination (offset/limit) for large crawls and optional depth statistics. On completion, triggers automatic overpayment refund.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `crawl_id` | path | `string` | yes |  |
| `include_results` | query | `boolean` | no | Include per-page results |
| `limit` | query | `integer` | no | Max pages per response (default: all) |
| `offset` | query | `integer` | no | Pages to skip |
| `status` | query | `string` | no | Only pages with this status |
| `sort` | query | `string` | no | Page order: depth (discovery order), url, completed_at or credits |
| `include_depth_stats` | query | `boolean` | no | Include per-depth analytics (depth_stats) |

## GET /api/v1/crawl/{crawl_id}/export

Export crawl results
Download all crawl page results as a file. Supports CSV, JSON, JSONL and ZIP formats. Optionally filter by page status or select specific fields. Returns 404 if the crawl is not found or has expired (2h TTL).

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `crawl_id` | path | `string` | yes |  |
| `format` | query | `string` | no | Output format: json (array), jsonl (newline-delimited), csv, or zip (compressed pages.jsonl) |
| `status` | query | `string` | no | Filter pages by status. Use 'all' to include every page regardless of status. Valid statuses: succeeded, failed, rejected, expired, queued, processing, cancelled, all. |
| `fields` | query | `string` | no | Comma-separated list of fields to include in output (e.g. 'url,html,status'). Omit to include all fields. |

## POST /api/v1/crawl/{crawl_id}/resume

Resume a cancelled or failed crawl
Re-enqueue failed and/or cancelled jobs from a previous crawl without re-crawling pages that already succeeded. Optionally add new URLs. Credits are debited only for newly enqueued work.

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `crawl_id` | path | `string` | yes |  |
| `retry_failed` | body | `boolean` | no | Retry jobs that ended in 'failed' status |
| `retry_statuses` | body | `string[]` | no |  |
| `additional_urls` | body | `string[]` | no |  |
| `max_credits` | body | `integer` | no |  |

## GET /api/v1/crawl/{crawl_id}/stream

Stream Crawl
Stream crawl events in real-time via Server-Sent Events. Subscribes to the Redis Pub/Sub channel ``crawl:{crawl_id}:events`` and forwards events to the client as they arrive. This provides instant page results without polling — critical for AI agent workflows that process pages as they complete. **Event types**: - ``page.completed`` — A page was successfully scraped. - ``page.failed`` — A page scrape failed. - ``crawl.progress`` — Periodic progress summary. - ``crawl.completed`` — Crawl finished (connection closes after this). - ``heartbeat`` — Keep-alive ping (every 15 s). - ``timeout`` — Connection duration limit reached; reconnect to resume. The stream auto-closes when the crawl completes, the client disconnects, or the maximum connection duration (30 min) is reached. Clients can reconnect using the ``Last-Event-ID`` header to avoid duplicate processing on their side (event IDs are monotonically increasing integers). **Usage**:: curl -N -H "X-API-Key: sk_live_..." \ http://localhost/api/v1/crawl/{crawl_id}/stream Requires: read scope (via API key)

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

| Parameter | In | Type | Required | Description |
|-----------|----|------|----------|-------------|
| `crawl_id` | path | `string` | yes |  |
