> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prefetch.io/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /crawl

> Crawl a site, or a section of it, and get every page as markdown. Free to submit, then 1 credit per page.

Starts a crawl and returns `202` with a crawl id. Read the pages with [`GET /crawl/{id}`](https://docs.prefetch.io/api-reference/endpoint/crawl-status).

**Free to submit.** 1 credit per page returned, 4 with `summary`, `json` or `check_prompt_injection`. Failed requests are never charged.

> [card] [Guide: Crawl a site](https://docs.prefetch.io/web-data/crawl.md)
>
> Scope, sitemap seeding, politeness, webhooks and examples.


## OpenAPI

````yaml POST /crawl
openapi: 3.1.0
info:
  title: Prefetch API
  description: >-
    Extract brand identity, company data, screenshots, IAB classifications, and
    clean page content from any URL.
  version: 1.0.0
  contact:
    email: support@prefetch.io
servers:
  - url: https://api.prefetch.io
    description: Production
security:
  - apiKey: []
tags:
  - name: Endpoints
    description: Data extraction endpoints. All require authentication and consume credits.
  - name: Health
    description: Health and readiness probes. No authentication required.
paths:
  /crawl:
    post:
      tags:
        - Endpoints
      summary: Start a crawl
      description: >-
        Queues a breadth-first crawl and returns its id immediately. Crawls run
        for minutes, so nothing waits on this request — poll `GET /crawl/{id}`
        for progress and results.


        **Credit cost: nothing to submit, 1 per page the crawl returns (4 when
        `scrape_options` asks for `summary`, `json` or
        `check_prompt_injection`).** Pages are charged as they complete, so you
        pay for what was fetched rather than for the `limit` you asked for.
      operationId: startCrawl
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CrawlRequest'
      responses:
        '202':
          description: Crawl accepted and queued.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    $ref: '#/components/schemas/CrawlJobData'
                  meta:
                    $ref: '#/components/schemas/Meta'
                required:
                  - success
                  - data
                  - meta
              example:
                success: true
                data:
                  id: crw_9f2c1a7b4e0d4c3a8b1e5f7d2c9a0b3e
                  status: pending
                  url: https://docs.stripe.com
                  limit: 50
                  max_depth: 2
                  created_at: '2026-08-20T09:14:03.221Z'
                  expires_at: '2026-08-21T09:14:03.221Z'
                meta:
                  requestId: c5f4e3d2-9b8c-4d5e-af3a-2b4c6d8e0f21
                  durationMs: 84
        '400':
          description: Invalid or missing parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Revoked key, expired key, credit limit, or blocklisted URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: The URL hostname could not be resolved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Service temporarily busy. Retry shortly.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '504':
          description: Request timed out.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CrawlRequest:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          description: Where the crawl starts.
          example: https://docs.stripe.com
        limit:
          type: integer
          minimum: 1
          maximum: 500
          default: 25
          description: Maximum pages to crawl.
        max_depth:
          type: integer
          minimum: 0
          maximum: 5
          default: 2
          description: >-
            How many links deep to follow from the start URL. Sitemap-seeded
            pages sit at depth 0, so `max_depth: 0` with `use_sitemap: true`
            crawls exactly what the sitemap lists and follows nothing.
        include_paths:
          type: array
          items:
            type: string
          description: >-
            Regular expressions matched against a URL's path and query. A URL
            must match at least one to be crawled.
          example:
            - ^/docs/
        exclude_paths:
          type: array
          items:
            type: string
          description: >-
            Regular expressions. A URL matching any of them is skipped.
            Exclusions win over inclusions.
          example:
            - ^/docs/changelog/
        allow_subdomains:
          type: boolean
          default: false
          description: Follow links onto subdomains of the start URL.
        allow_external_links:
          type: boolean
          default: false
          description: Follow links onto other sites.
        ignore_query_params:
          type: boolean
          default: true
          description: Treat URLs that differ only by query string as one page.
        respect_robots_txt:
          type: boolean
          default: true
          description: >-
            Obey the rules in `robots.txt` — Disallow and Crawl-delay. Sitemap
            discovery happens either way.
        use_sitemap:
          type: boolean
          default: true
          description: Seed the crawl from the site's sitemap as well as from links.
        crawl_entire_domain:
          type: boolean
          default: false
          description: >-
            Follow links anywhere on the site. By default a crawl stays at or
            below the path it starts from: one started at `/docs/` crawls
            `/docs/…` only. A crawl from the root covers the whole site either
            way.
        webhook:
          description: >-
            Where to send progress: an https URL, or an object. Events:
            `crawl.started`, `crawl.page` (one per page), `crawl.completed`,
            `crawl.failed`. Each delivery is signed — `X-Prefetch-Signature:
            t=<unix>,v1=<hex>`, HMAC-SHA256 of `<t>.<raw body>` with the
            `secret` returned when the crawl is created — the same scheme as
            monitor webhooks.
          oneOf:
            - type: string
              example: https://example.com/hooks/prefetch
            - type: object
              required:
                - url
              properties:
                url:
                  type: string
                events:
                  type: array
                  items:
                    type: string
                    enum:
                      - started
                      - page
                      - completed
                      - failed
                headers:
                  type: object
                  additionalProperties:
                    type: string
                metadata:
                  type: object
                  description: Echoed back in every payload (up to 4 KB).
        delay_ms:
          type: integer
          minimum: 0
          maximum: 30000
          default: 0
          description: >-
            Politeness delay between pages. A larger `Crawl-delay` in robots.txt
            wins.
        concurrency:
          type: integer
          minimum: 1
          maximum: 5
          default: 2
          description: Pages fetched in parallel.
        scrape_options:
          $ref: '#/components/schemas/CrawlScrapeOptions'
    CrawlJobData:
      type: object
      properties:
        id:
          type: string
          example: crw_9f2c1a7b4e0d4c3a8b1e5f7d2c9a0b3e
        status:
          type: string
          enum:
            - pending
            - running
            - completed
            - failed
            - cancelled
        url:
          type: string
        limit:
          type: integer
        max_depth:
          type: integer
        created_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time
          description: After this, the crawl and its pages are no longer readable.
        webhook:
          type: object
          description: Present when the request set `webhook`.
          properties:
            url:
              type: string
            events:
              type: array
              items:
                type: string
            secret:
              type: string
              description: >-
                Verifies the `X-Prefetch-Signature` on each delivery. Shown only
                here — store it.
    Meta:
      type: object
      properties:
        requestId:
          type: string
          format: uuid
          description: Unique identifier for this request.
          example: a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d
        durationMs:
          type: integer
          nullable: true
          description: Time taken to process the request in milliseconds.
          example: 1842
      required:
        - requestId
        - durationMs
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
          description: >-
            Always false. Absent, like `meta`, on authentication and rate-limit
            errors, which are answered before a request is processed.
        error:
          type: string
          description: >-
            Human-readable error message. The wording can change: branch on
            `error_code`.
          example: Credit limit exceeded
        error_code:
          type: string
          enum:
            - INVALID_REQUEST
            - PAYLOAD_TOO_LARGE
            - NOT_FOUND
            - CONFLICT
            - UNAUTHORIZED
            - FORBIDDEN
            - CREDITS_EXHAUSTED
            - RATE_LIMITED
            - CONCURRENCY_LIMITED
            - URL_BLOCKED
            - URL_NOT_PERMITTED
            - DNS_RESOLUTION_FAILED
            - TARGET_BLOCKED
            - TARGET_CONNECTION_FAILED
            - TARGET_TIMEOUT
            - TARGET_SSL_ERROR
            - TARGET_SERVER_ERROR
            - TARGET_CLIENT_ERROR
            - TARGET_NOT_A_PAGE
            - NO_LINKS_FOUND
            - TARGET_UNLOADABLE
            - RESEARCH_INCONCLUSIVE
            - TIMEOUT
            - SERVICE_BUSY
            - SERVICE_UNAVAILABLE
            - INTERNAL_ERROR
          description: >-
            What went wrong, for machines. Stable: a code keeps its meaning once
            published. See [Error handling](/concepts/errors).
          example: CREDITS_EXHAUSTED
        retryable:
          type: boolean
          description: >-
            Whether the same request can succeed if sent again after a short
            wait (honour `Retry-After` when present). False for problems with
            the request or the target.
          example: false
        retryAfterSeconds:
          type: integer
          description: 'On `RATE_LIMITED`: seconds until a request will be accepted.'
        limit:
          type: integer
          description: >-
            On `CONCURRENCY_LIMITED`: how many requests this key may have in
            flight.
        meta:
          $ref: '#/components/schemas/Meta'
      required:
        - error
        - error_code
        - retryable
    CrawlScrapeOptions:
      type: object
      description: >-
        How each crawled page is fetched and rendered. The same options `GET
        /scrape` takes.
      properties:
        formats:
          type: array
          items:
            type: string
            enum:
              - markdown
              - summary
              - html
              - raw_html
              - links
              - images
              - json
              - screenshot
          default:
            - markdown
        only_main_content:
          type: boolean
          default: true
        include_links:
          type: boolean
          default: true
        include_images:
          type: boolean
          default: true
        include_base64_images:
          type: boolean
          default: false
        include_selectors:
          type: array
          items:
            type: string
        exclude_selectors:
          type: array
          items:
            type: string
        json_prompt:
          type: string
        json_schema:
          type: object
        summary_max_words:
          type: integer
          minimum: 20
          maximum: 400
          default: 120
        screenshot_full_page:
          type: boolean
          default: false
        screenshot_format:
          type: string
          enum:
            - jpeg
            - png
            - webp
          default: jpeg
        wait_for:
          type: integer
          minimum: 0
          maximum: 30000
        wait_for_selector:
          type: string
        headers:
          type: object
          additionalProperties:
            type: string
          description: >-
            Sent with every page request. Pages fetched with headers are never
            cached.
        mobile:
          type: boolean
          default: false
        max_age:
          type: integer
          minimum: 0
          maximum: 2592000000
          default: 0
          description: >-
            Accept stored copies of pages fetched at most this many milliseconds
            ago.
        store_in_cache:
          type: boolean
          default: true
        check_prompt_injection:
          type: boolean
          default: false
          description: >-
            Check each page for prompt injection, as on `/scrape`. Adds the AI
            surcharge to every page.
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your Prefetch API key. Obtain one from the dashboard.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.