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

# Extract from a crawl

> Runs a new `transformInstruction` on every page a finished crawl saved, without visiting the site again, and returns a new `jobId`. Poll it with [Get a crawl](/api-reference/crawling/crawl-status). The original crawl isn't changed.

Use it to pull different data from pages you've already crawled. The new job shows in [List crawls](/api-reference/crawling/crawl-history) with `source_job_id` set to the original crawl.

**Credits:** only the AI tokens used, about 1 credit per 3,300 input tokens or 400 output tokens, rounded up. 1 credit per page is held while it runs, and the difference comes back.

**Rate limits:** 60 requests a minute, shared with `POST /crawl` and page retries. It counts toward your 5 unfinished crawls.




## OpenAPI

````yaml POST /crawl/{jobId}/extract
openapi: 3.1.0
info:
  title: Spidra API
  version: 1.0.0
  description: >-
    Public API endpoints for web scraping via Spidra. Authenticate with
    `Authorization: Bearer YOUR_API_KEY`.
servers:
  - url: https://api.spidra.io/api
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /crawl/{jobId}/extract:
    post:
      tags:
        - Crawling
      summary: Extract from a crawl
      description: >
        Runs a new `transformInstruction` on every page a finished crawl saved,
        without visiting the site again, and returns a new `jobId`. Poll it with
        [Get a crawl](/api-reference/crawling/crawl-status). The original crawl
        isn't changed.


        Use it to pull different data from pages you've already crawled. The new
        job shows in [List crawls](/api-reference/crawling/crawl-history) with
        `source_job_id` set to the original crawl.


        **Credits:** only the AI tokens used, about 1 credit per 3,300 input
        tokens or 400 output tokens, rounded up. 1 credit per page is held while
        it runs, and the difference comes back.


        **Rate limits:** 60 requests a minute, shared with `POST /crawl` and
        page retries. It counts toward your 5 unfinished crawls.
      parameters:
        - name: jobId
          in: path
          required: true
          description: The `jobId` of a completed crawl.
          schema:
            type: string
            format: uuid
          example: e303fb87-846e-4a30-8aa5-bfca457a5357
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - transformInstruction
              properties:
                transformInstruction:
                  type: string
                  maxLength: 5000
                  description: What to extract from each page, in plain English.
            examples:
              extract:
                summary: New fields from the same pages
                value:
                  transformInstruction: Return the book's title and whether it is in stock
      responses:
        '202':
          description: >-
            The extraction was queued. Poll `GET /crawl/{jobId}` with the new
            `jobId`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - queued
                  jobId:
                    type: string
                    format: uuid
                    description: The new extraction job's ID. Not the crawl's ID.
                  message:
                    type: string
                    description: Where to poll for the result.
              example:
                status: queued
                jobId: 1b4dc02b-f146-404e-9fd2-3e444f1e01cc
                message: >-
                  Extraction job queued. Poll
                  /api/crawl/1b4dc02b-f146-404e-9fd2-3e444f1e01cc for results.
        '400':
          description: >-
            The crawl hasn't completed, so it has no saved pages to extract
            from. Wait for it to finish.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CrawlErrorResponse'
              example:
                status: error
                message: Source crawl job has not completed successfully
                error: Source crawl job has not completed successfully
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: >-
            The account's payment is overdue. Update the payment method in the
            dashboard to continue.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: >-
                  Your payment is overdue. Please update your payment method to
                  continue.
                code: PAYMENT_OVERDUE
        '403':
          description: >-
            Your account doesn't have enough credits to hold 1 per page. Top up
            or upgrade, then try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CrawlErrorResponse'
              example:
                status: error
                message: You have exceeded your monthly credit limit.
                error: You have exceeded your monthly credit limit.
        '404':
          description: There's no crawl with this ID on your account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CrawlErrorResponse'
              example:
                status: error
                message: Source crawl job not found
                error: Source crawl job not found
        '422':
          description: '`transformInstruction` is missing or longer than 5,000 characters.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                missing:
                  summary: No instruction
                  value:
                    status: error
                    message: 'Missing required field: transformInstruction'
                    errors:
                      - 'Missing required field: transformInstruction'
                too_long:
                  summary: Instruction too long
                  value:
                    status: error
                    message: transformInstruction must be 5000 characters or fewer
                    errors:
                      - transformInstruction must be 5000 characters or fewer
        '429':
          description: >-
            Too many requests. Either more than 60 crawl requests in a minute,
            or 5 crawls already unfinished. Wait, then try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                rate_limit:
                  summary: More than 60 a minute
                  value:
                    status: error
                    message: >-
                      Too many job submissions. Please slow down and try again
                      shortly.
                pending:
                  summary: 5 crawls still running
                  value:
                    status: error
                    message: >-
                      You have too many pending crawl jobs. Please wait for some
                      to complete before submitting more.
                    code: TOO_MANY_PENDING_JOBS
        '500':
          description: >-
            The extraction couldn't be created. Any credits held for it were
            returned. Try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CrawlErrorResponse'
              example:
                status: error
                message: Failed to create extract job
                error: Failed to create extract job
        '503':
          description: Crawling is at capacity. Wait `retry_after` seconds, then try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: >-
                  The crawling service is currently at capacity. Please retry in
                  a few minutes.
                code: SERVICE_BUSY
                retry_after: 60
components:
  schemas:
    CrawlErrorResponse:
      description: >-
        Most crawl endpoints add an `error` field that repeats `message`, kept
        for older clients. Read `message`.
      allOf:
        - $ref: '#/components/schemas/ErrorResponse'
        - type: object
          properties:
            error:
              type: string
              description: The same text as `message`.
    ErrorResponse:
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - error
        message:
          type: string
          description: What went wrong, as a sentence you can show to a person.
        code:
          type: string
          description: >-
            A stable code for the error, when there is one, such as
            `JOB_NOT_FOUND` or `SERVICE_BUSY`. Branch on this rather than on
            `message`.
        errors:
          description: >-
            On validation errors (`422`), every problem with the request.
            Scrape, batch, crawl, map and search return a list of sentences.
            Templates, presets and monitors return `{ field, message }` objects.
          oneOf:
            - type: array
              items:
                type: string
            - type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
        retry_after:
          type: integer
          description: >-
            On `503 SERVICE_BUSY`, how many seconds to wait before sending the
            request again.
  responses:
    Unauthorized:
      description: The API key is missing, wrong, or turned off.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing:
              summary: No key sent
              value:
                status: error
                message: Missing authentication
            invalid:
              summary: Wrong or turned-off key
              value:
                status: error
                message: Invalid token or API key
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

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