---
title: "Cancel job execution"
method: DELETE
path: "/jobs/{jobId}/executions/{executionId}"
tags: ["jobs"]
---

# Cancel job execution

`DELETE /jobs/{jobId}/executions/{executionId}`

## Request

- Base URL: `https://api.blaxel.ai/v0`
- URL: `https://api.blaxel.ai/v0/jobs/{jobId}/executions/{executionId}`
- Auth: one of:
  - OAuth 2
    - Authorization code: `/oauth/authorize`
    - Client credentials
    - Token URL: `/oauth/token` scopes: `jobs:delete`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/blaxel/apis/blaxel-control-plane/docs/jobs/:jobId/executions/:executionId/delete.ts> (a function with typed inputs; its response is checked against the schema)

Cancels a running job execution. Tasks already in progress will complete, but no new tasks will be started. The execution status changes to 'cancelling' then 'cancelled'.

## Path parameters

- `jobId` string, required
- `executionId` string, required

## Response `200`

successful operation

- JobExecution: Job execution
  - `metadata` JobExecutionMetadata, required: Job execution metadata
    - `cluster` string: Cluster ID
    - `completedAt` string: Completion timestamp
    - `createdAt` string: Creation timestamp
    - `deletedAt` string: Deletion timestamp
    - `expiredAt` string: Expiration timestamp
    - `id` string: Execution ID
    - `job` string: Job name
    - `startedAt` string: Start timestamp
    - `updatedAt` string: Last update timestamp
    - `workspace` string: Workspace ID
  - `spec` JobExecutionSpec, required: Job execution specification
    - `envOverride` object: Environment variable overrides (if provided for this execution, values are masked with ***)
    - `memoryOverride` integer: Memory override in megabytes (if provided for this execution)
    - `parallelism` integer: Number of parallel tasks
    - `tasks` JobExecutionTask[]: List of execution tasks
      - `conditions` JobExecutionTaskCondition[]: Task conditions
        - `executionReason` string: Execution reason
        - `message` string: Condition message
        - `reason` string: Condition reason
        - `severity` string: Condition severity
        - `state` string: Condition state
        - `type` string: Condition type
      - `metadata` JobExecutionTaskMetadata: Job execution task metadata
        - `completedAt` string: Completion timestamp
        - `createdAt` string: Creation timestamp
        - `name` string: Task name
        - `scheduledAt` string: Scheduled timestamp
        - `startedAt` string: Start timestamp
        - `updatedAt` string: Last update timestamp
      - `spec` JobExecutionTaskSpec: Job execution task specification
        - `maxRetries` integer: Maximum number of retries
        - `timeout` string: Task timeout duration
      - `status` 'unspecified' | 'pending' | 'reconciling' | 'failed' | 'succeeded' | 'running' | 'cancelled': Job execution task status
    - `timeout` integer: Job timeout in seconds (captured at execution creation time)
  - `stats` JobExecutionStats: Job execution statistics
    - `cancelled` integer: Number of cancelled tasks
    - `failure` integer: Number of failed tasks
    - `retried` integer: Number of retried tasks
    - `running` integer: Number of running tasks
    - `success` integer: Number of successful tasks
    - `total` integer: Total number of tasks
  - `status` 'queued' | 'pending' | 'running' | 'cancelling' | 'cancelled' | 'failed' | 'succeeded' | 'timeout': Job execution status
  - `tasks` JobExecutionTask[]: List of execution tasks
    - `conditions` JobExecutionTaskCondition[]: Task conditions
      - `executionReason` string: Execution reason
      - `message` string: Condition message
      - `reason` string: Condition reason
      - `severity` string: Condition severity
      - `state` string: Condition state
      - `type` string: Condition type
    - `metadata` JobExecutionTaskMetadata: Job execution task metadata
      - `completedAt` string: Completion timestamp
      - `createdAt` string: Creation timestamp
      - `name` string: Task name
      - `scheduledAt` string: Scheduled timestamp
      - `startedAt` string: Start timestamp
      - `updatedAt` string: Last update timestamp
    - `spec` JobExecutionTaskSpec: Job execution task specification
      - `maxRetries` integer: Maximum number of retries
      - `timeout` string: Task timeout duration
    - `status` 'unspecified' | 'pending' | 'reconciling' | 'failed' | 'succeeded' | 'running' | 'cancelled': Job execution task status

## Other responses

- `400`: bad request
- `404`: execution not found
- `500`: internal server error

---

[API](https://skmtc.dev/blaxel/apis/blaxel-control-plane.md) - [All operations](https://skmtc.dev/blaxel/apis/blaxel-control-plane/llms.txt) - [OpenAPI document](https://skmtc.dev/blaxel/apis/blaxel-control-plane/revisions/dfa264bc72ee?raw)
