---
title: "Cancel a run"
---

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

# Cancel a run

Path: Simplcron API › Runs

`POST /v1/runs/{runId}/cancel`

Cancel a scheduled, queued, waiting or retrying run. Running work may already have affected your application.

## Authentication

Requires one of the following:

- `bearerAuth`, http bearer, header `Authorization`
- `browserSession`, apiKey, in cookie
- `localBrowserSession`, apiKey, in cookie

## Path parameters

- `runId` (`cancelRun.path.runId`; string, required) — ID returned at submission.
  - pattern: `^run_[a-f0-9]{32}$`

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/v1/runs/<runId>/cancel' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = '<base-url>/v1/runs/<runId>/cancel';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/v1/runs/<runId>/cancel"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.text)
```

## Responses

### 200

Cancelled run

#### Example

```json
{
  "id": "string",
  "runId": "string",
  "task": "string",
  "taskName": "string",
  "status": "scheduled",
  "source": "string",
  "attempt": 5,
  "maxAttempts": 3,
  "payload": {},
  "output": null,
  "error": "string",
  "createdAt": "2019-08-24T14:15:22Z",
  "startedAt": "2019-08-24T14:15:22Z",
  "finishedAt": "2019-08-24T14:15:22Z",
  "runAt": "2019-08-24T14:15:22Z",
  "nextAttemptAt": "2019-08-24T14:15:22Z",
  "waitUntil": "2019-08-24T14:15:22Z",
  "waitStartedAt": "2019-08-24T14:15:22Z",
  "waitResumedAt": "2019-08-24T14:15:22Z",
  "replyTimeoutSeconds": 5,
  "waitOutcome": "reply",
  "reply": {
    "receivedAt": "2019-08-24T14:15:22Z",
    "payload": {}
  },
  "durationMs": 0,
  "previousRunId": "string"
}
```

- `id` (`cancelRun.response.200.id`; string, required)
- `task` (`cancelRun.response.200.task`; string, required)
  - maxLength: `64` · pattern: `^[a-z0-9]+(?:-[a-z0-9]+)*$`
- `status` (`cancelRun.response.200.status`; string, required)
  - one of `"scheduled"`, `"queued"`, `"waiting"`, `"running"`, `"retrying"`, `"succeeded"`, `"failed"`, `"cancelled"`
- `attempt` (`cancelRun.response.200.attempt`; integer, required)
  - maximum: `5` · minimum: `0`
- `maxAttempts` (`cancelRun.response.200.maxAttempts`; integer, required)
  - maximum: `5` · minimum: `1` · default: `3`
- `createdAt` (`cancelRun.response.200.createdAt`; string, required)
  - format: `date-time`
- `runId` (`cancelRun.response.200.runId`; string, optional)
- `taskName` (`cancelRun.response.200.taskName`; string, optional)
- `source` (`cancelRun.response.200.source`; string, optional)
- `payload` (`cancelRun.response.200.payload`; object, optional)
- `output` (`cancelRun.response.200.output`; unknown, optional)
- `error` (`cancelRun.response.200.error`; any of, optional)
  - any of the following: `string`, `null`
- `startedAt` (`cancelRun.response.200.startedAt`; any of, optional)
  - any of the following: `string`, `null`
- `finishedAt` (`cancelRun.response.200.finishedAt`; any of, optional)
  - any of the following: `string`, `null`
- `runAt` (`cancelRun.response.200.runAt`; any of, optional)
  - any of the following: `string`, `null`
- `nextAttemptAt` (`cancelRun.response.200.nextAttemptAt`; any of, optional)
  - any of the following: `string`, `null`
- `waitUntil` (`cancelRun.response.200.waitUntil`; string, optional) — Planned resume time for Wait Until or the reply deadline for Wait for Reply.
  - format: `date-time`
- `waitStartedAt` (`cancelRun.response.200.waitStartedAt`; string | null, optional) — Time when a wait run entered its pause, or null until it has paused.
  - format: `date-time`
- `waitResumedAt` (`cancelRun.response.200.waitResumedAt`; string | null, optional) — Time when a wait run resumed, or null before resumption.
  - format: `date-time`
- `replyTimeoutSeconds` (`cancelRun.response.200.replyTimeoutSeconds`; integer, optional) — Timeout applied to this Wait for Reply run.
  - maximum: `2592000` · minimum: `5`
- `waitOutcome` (`cancelRun.response.200.waitOutcome`; string | null, optional) — Outcome of a Wait for Reply run. Null until the run resumes.
  - one of `"reply"`, `"timeout"`, `null`
- `reply` (`cancelRun.response.200.reply`; object | null, optional) — The accepted reply on a full Wait for Reply run record. Null while there is no accepted reply, including after timeout. Run summaries omit this field.
  - `receivedAt` (`cancelRun.response.200.reply.receivedAt`; string, required)
    - format: `date-time`
  - `payload` (`cancelRun.response.200.reply.payload`; object, required)
- `durationMs` (`cancelRun.response.200.durationMs`; any of, optional)
  - any of the following: `number`, `null`
- `previousRunId` (`cancelRun.response.200.previousRunId`; any of, optional)
  - any of the following: `string`, `null`

### 401

Authentication is required

#### Example

```json
{
  "error": "string"
}
```

- `error` (`cancelRun.response.401.error`; string, required)

### 403

The credential lacks permission

#### Example

```json
{
  "error": "string"
}
```

- `error` (`cancelRun.response.403.error`; string, required)

### 404

Resource not found in this environment

#### Example

```json
{
  "error": "string"
}
```

- `error` (`cancelRun.response.404.error`; string, required)

### 409

This operation conflicts with the current state

#### Example

```json
{
  "error": "string"
}
```

- `error` (`cancelRun.response.409.error`; string, required)


Source: https://simplcron.dev/docs/api/cancel-run/index.md
