# Start a crawl

Returns immediately. Check the progress with `GET /v1/crawls/{id}`.

Reserves `max_pages` tokens, or fewer when you have fewer. Unused tokens return when the crawl ends.

`POST https://api.seoscraper.io/v1/crawls`

## Request body

- `url` string: Start address. Without a scheme, https:// is added.
- `source` string? (auto, sitemap, links): auto: sitemap URLs, or links when there is no sitemap. sitemap: sitemap only. links: links only.
- `max_pages` integer?: Page limit.
- `max_depth` integer?: Clicks from the start page. Ignored for sitemaps.
- `concurrency` integer?: Pages fetched at the same time.
- `delay_ms` integer?: Pause between requests in milliseconds.
- `include_subdomains` boolean?: Visit subdomains too.
- `respect_robots` boolean?: Obey robots.txt, including Crawl-delay.
- `follow_nofollow` boolean?: Follow nofollow links too.
- `ignore_query` boolean?: Treat /a?x=1 and /a as the same page.
- `include_html` boolean?: Save raw HTML in the result file.
- `include_paths` string[]?: Crawl only these paths. Matches the beginning of the path, like in robots.txt. `*` is any text, `$` is the end.
- `exclude_paths` string[]?: Skip these paths. Matches the beginning of the path, like in robots.txt. `*` is any text, `$` is the end.

## Response 202

- `id` string: Crawl identifier.
- `status` string (queued, running, completed, canceled, failed):
- `url` string: Start address.
- `options` object: Options the crawl was started with.
  - `url` string: Start address. Without a scheme, https:// is added.
  - `source` string? (auto, sitemap, links): auto: sitemap URLs, or links when there is no sitemap. sitemap: sitemap only. links: links only.
  - `max_pages` integer?: Page limit.
  - `max_depth` integer?: Clicks from the start page. Ignored for sitemaps.
  - `concurrency` integer?: Pages fetched at the same time.
  - `delay_ms` integer?: Pause between requests in milliseconds.
  - `include_subdomains` boolean?: Visit subdomains too.
  - `respect_robots` boolean?: Obey robots.txt, including Crawl-delay.
  - `follow_nofollow` boolean?: Follow nofollow links too.
  - `ignore_query` boolean?: Treat /a?x=1 and /a as the same page.
  - `include_html` boolean?: Save raw HTML in the result file.
  - `include_paths` string[]?: Crawl only these paths. Matches the beginning of the path, like in robots.txt. `*` is any text, `$` is the end.
  - `exclude_paths` string[]?: Skip these paths. Matches the beginning of the path, like in robots.txt. `*` is any text, `$` is the end.
- `mode` string | null (sitemap, links): Where the URLs come from. null until the crawl starts.
- `pages_done` integer: Visited pages.
- `pages_failed` integer: Pages without a response. Included in pages_done.
- `pages_found` integer: Visited pages and pages waiting in the queue.
- `recent` object[]: Recently visited pages.
  - `url` string:
  - `status` integer | null: null when the page could not be fetched.
  - `error` string | null: Error code when the page could not be fetched.
- `stop_reason` string | null (finished, max_pages, no_tokens, max_time, throttled, canceled, interrupted): Why the crawl ended. null until then.
- `error` string | null: Error code of a failed crawl.
- `summary` object | null: Ready when the crawl ends.
  - `avg_duration_ms` integer | null: Average fetch time in milliseconds.
  - `issues` object: Number of pages with each issue. Keys are values of the issue parameter.
- `file_size` integer | null: Size of the compressed SQLite file in bytes.
- `page_limit` integer: Reserved tokens. Less than max_pages when you had fewer tokens.
- `throttle` object | null: Set when the site answered 429 and the crawl slowed down.
  - `count` integer: Number of pauses.
  - `delay_ms` integer: Pause between requests after slowing down, in milliseconds.
  - `resume_at` string: End of the latest pause. In the future: the crawl is waiting.
- `retry_of` string | null: Crawl whose pages this one fetches again. null for a regular crawl.
- `created_at` string: When the crawl was added to the queue.
- `started_at` string | null: When the crawl left the queue.
- `finished_at` string | null: When the crawl ended.

## Errors

- 401: unauthorized
- 403: forbidden
- 422: invalid_request
- 429: rate_limited, no_tokens, too_many_crawls
- 503: unavailable

## Example

```bash
curl -X POST "https://api.seoscraper.io/v1/crawls" \
  -H "Authorization: Bearer ssk_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://books.toscrape.com","max_pages":50}'
```

```json
{
  "id": "7c1f0a52-3f0e-4f0b-9c53-2f6f1f1d7a10",
  "status": "queued",
  "url": "https://books.toscrape.com",
  "options": {
    "url": "https://books.toscrape.com",
    "source": "auto",
    "max_pages": 50,
    "max_depth": 5,
    "concurrency": 5,
    "delay_ms": 0,
    "include_subdomains": false,
    "respect_robots": true,
    "follow_nofollow": false,
    "ignore_query": false,
    "include_html": true,
    "include_paths": [],
    "exclude_paths": []
  },
  "mode": null,
  "pages_done": 0,
  "pages_failed": 0,
  "pages_found": 0,
  "recent": [],
  "stop_reason": null,
  "error": null,
  "summary": null,
  "file_size": null,
  "page_limit": 50,
  "throttle": null,
  "retry_of": null,
  "created_at": "2026-11-25T08:00:00Z",
  "started_at": null,
  "finished_at": null
}
```
