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

# Cancel Job

> Cancel a running job. Only jobs with status 'pending' or 'in_progress' can be cancelled.

Cancels a running scraping job and stops further processing.

## Path Parameters

| Parameter | Type   | Description           |
| --------- | ------ | --------------------- |
| `job_id`  | string | Unique job identifier |

## Example Request

```javascript theme={null}
const cancelJob = async (jobId) => {
  const response = await fetch(`https://api.skop.dev/scrape/${jobId}`, {
    method: 'DELETE',
    headers: {
      'Authorization': 'Bearer sk-your-api-key'
    }
  })
  
  return await response.json()
}
```

## Response (200 OK)

```json theme={null}
{
  "message": "Job job_123456789 cancelled successfully",
  "status": "cancelled"
}
```

### Response Fields

| Field     | Type   | Description                         |
| --------- | ------ | ----------------------------------- |
| `message` | string | Confirmation message with job ID    |
| `status`  | string | New job status (always "cancelled") |

## Error Responses

| Status | Description                    |
| ------ | ------------------------------ |
| `404`  | Job not found or access denied |
| `500`  | Internal server error          |

## Use Cases

* **Resource Management**: Cancel jobs that are taking too long
* **Cost Control**: Stop jobs to avoid unnecessary charges
* **Queue Management**: Cancel queued jobs that are no longer needed
* **Error Recovery**: Cancel stuck or problematic jobs

<Note>
  Once cancelled, a job cannot be restarted. You'll need to create a new job if you want to retry the same scraping task.
</Note>


## OpenAPI

````yaml DELETE /scrape/{job_id}
openapi: 3.1.0
info:
  title: Skop PDF Scraper API
  description: >-
    AI-powered document discovery and extraction from websites using natural
    language prompts
  version: 1.0.0
  contact:
    email: support@skop.dev
  license:
    name: MIT
servers:
  - url: https://api.skop.dev
    description: Production server
security:
  - bearerAuth: []
paths:
  /scrape/{job_id}:
    delete:
      summary: Cancel Job
      description: >-
        Cancel a running job. Only jobs with status 'pending' or 'in_progress'
        can be cancelled.
      operationId: cancelJob
      parameters:
        - name: job_id
          in: path
          required: true
          description: Unique job identifier
          schema:
            type: string
            pattern: ^job_[a-z0-9]+$
      responses:
        '200':
          description: Job cancelled successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobCancelResponse'
        '400':
          description: Cannot cancel job (already completed)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Job not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    JobCancelResponse:
      type: object
      properties:
        job_id:
          type: string
          pattern: ^job_[a-z0-9]+$
          description: Job identifier
        status:
          type: string
          enum:
            - cancelled
          description: New job status (cancelled)
        message:
          type: string
          example: Job cancelled successfully
          description: Confirmation message
        cancelled_at:
          type: string
          format: date-time
          description: ISO 8601 cancellation timestamp
    ErrorResponse:
      type: object
      properties:
        error:
          type: boolean
          example: true
          description: Indicates this is an error response
        message:
          type: string
          description: Human-readable error message
        status_code:
          type: integer
          description: HTTP status code
        path:
          type: string
          description: API path that generated the error
        timestamp:
          type: string
          format: date-time
          description: ISO 8601 error timestamp
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key in format 'sk-xxxxxxxxxxxxx' or 'sk_xxxxxxxxxxxxx'

````