
## Terminate a workflow

`DELETE /v1/workflows/:id`

Terminates a running workflow instance. By default it performs a soft termination — it waits for the current step to finish. With the `?force=true` parameter it forcibly aborts the process immediately.

## Parameters

| Parameter | In | Type | Required | Description |
|----------|---|-----|:-----:|---------|
| `id` | path | string | yes | Workflow instance identifier. Source: `GET /v1/workflows`, the `id` field |
| `force` | query | string | no | `true` — force termination without waiting for the current step |
| `status` | query | string | no | Termination reason — arbitrary text, passed through to Bitrix24 |

## Examples

### curl — personal key

```bash
curl -X DELETE https://vibecode.bitrix24.com/v1/workflows/69f0c2d5ade389.22457798 \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE https://vibecode.bitrix24.com/v1/workflows/69f0c2d5ade389.22457798 \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch(
  'https://vibecode.bitrix24.com/v1/workflows/69f0c2d5ade389.22457798',
  { method: 'DELETE', headers: { 'X-Api-Key': 'YOUR_API_KEY' } }
)
if (res.status === 204) {
  console.log('Workflow terminated')
}
```

### JavaScript — OAuth application

```javascript
const res = await fetch(
  'https://vibecode.bitrix24.com/v1/workflows/69f0c2d5ade389.22457798',
  {
    method: 'DELETE',
    headers: {
      'X-Api-Key': 'YOUR_APP_KEY',
      'Authorization': 'Bearer USER_SESSION_TOKEN',
    },
  }
)
if (res.status === 204) {
  console.log('Workflow terminated')
}
```

## Response

On success it returns HTTP status `204 No Content` with an empty body. The success signal is the response code, not the body.

## Response example

```
HTTP/1.1 204 No Content
```

## Error response example

404 — instance not found:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Workflow not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header was not provided |
| 401 | `INVALID_API_KEY` | Invalid or expired API key |
| 401 | `TOKEN_MISSING` | The key has no connected Bitrix24 tokens |
| 401 | `TOKEN_EXPIRED` | The OAuth user session expired — re-authorize via `/v1/oauth/authorize` |
| 403 | `SCOPE_DENIED` | The key is missing the `bizproc` scope |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access |
| 404 | `ENTITY_NOT_FOUND` | No workflow instance with the given `id` was found |
| 429 | `RATE_LIMITED` | Request limit exceeded. Retry in 1–2 seconds |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable |

Full list of common API errors — [Errors](/docs/errors).

## See also

- [List of running processes](/docs/automation/workflows/list)
- [Start a workflow](/docs/automation/workflows/start)
- [Workflows](/docs/automation/workflows)
