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

# Cancel Crawl

> Stop a crawl. Pages already read are billed; the rest of the reservation is given back.

Stop a running crawl. The pages read before the cancel stay available, and you pay only for them.


## OpenAPI

````yaml /api-reference/openapi.json DELETE /crawl/{id}
openapi: 3.1.0
info:
  title: ScreenshotRender API
  version: v1
  description: >-
    Screenshot any website, search the web, and turn any page or document into
    clean Markdown or structured data.
servers:
  - url: https://www.screenshotrender.com/api/v1
security:
  - bearerAuth: []
paths:
  /crawl/{id}:
    delete:
      tags:
        - Crawl
      summary: Cancel Crawl
      description: >-
        Stop a crawl. Pages already read are billed; the rest of the reservation
        is given back.
      operationId: cancelCrawl
      parameters:
        - $ref: '#/components/parameters/CrawlId'
      responses:
        '200':
          description: The crawl's status after the request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  status:
                    type: string
                    enum:
                      - cancelled
                      - completed
                      - failed
                    description: >-
                      `cancelled` when this request stopped it; `completed` when
                      it had already finished.
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '404':
          $ref: '#/components/responses/NotFound'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >-
            curl -s -X DELETE
            "https://www.screenshotrender.com/api/v1/crawl/YOUR_CRAWL_ID" \
              -H "Authorization: Bearer $SCREENSHOTRENDER_API_KEY"
        - lang: javascript
          label: Node
          source: >-
            import ScreenshotRender from "screenshotrender";


            const screenshotrender = new ScreenshotRender({ apiKey:
            "sr-YOUR-API-KEY" });


            const stopped = await screenshotrender.cancelCrawl("YOUR_CRAWL_ID");

            console.log(stopped); // false when the crawl had already finished
        - lang: python
          label: Python
          source: |-
            from screenshotrender import ScreenshotRender

            screenshotrender = ScreenshotRender(api_key="sr-YOUR-API-KEY")

            stopped = screenshotrender.cancel_crawl("YOUR_CRAWL_ID")
            print(stopped)  # False when the crawl had already finished
components:
  parameters:
    CrawlId:
      name: id
      in: path
      required: true
      description: The crawl's id, from `POST /crawl`.
      schema:
        type: string
  responses:
    InvalidApiKey:
      description: The API key doesn't match an account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: Invalid API key.
            code: invalid_api_key
    NotFound:
      description: No crawl with this id on your account, or its results have expired.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: No crawl found with this id.
            code: not_found
  schemas:
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          description: What went wrong, in words.
        code:
          type: string
          description: A stable code to branch on, such as `invalid_request`.
        field:
          type: string
          description: The request field the error is about, when there is one.
      required:
        - success
        - error
        - code
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your API key from the dashboard. It starts with `sr-`.

````