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

# Cancel a swarm

> Request asynchronous cancellation and cleanup of a swarm’s unfinished members.

## Authentication

Send your scoped bearer token in the `Authorization: Bearer <BEAD_TOKEN>` header, or send your API key in `X-API-Key`.

## Parameters

**id** `string` *required*

UUID of the swarm job. Format: `uuid`.

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl --request POST \
  --url "https://api.bead.run/swarms/$SWARM_ID/cancel" \
  --header "X-API-Key: $BEAD_API_KEY"
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
# swarm is returned by Swarm.run.
swarm.cancel()
```

```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
// swarm is returned by Swarm.run.
await swarm.cancel();
```

## Response

### 200

Cancellation requested; poll status until terminal cleanup completes.

**id** `string` *required*

Swarm UUID.

**cancellation\_requested** `boolean` *required*

True after cancellation has been requested.

## Errors

| Status | Meaning |
| - | - |
| 400 | Invalid resource UUID or request parameters. |
| 401 | Authentication credential is missing or rejected. |
| 403 | The credential lacks the required scope. |
| 404 | The requested resource does not exist or is outside your organization. |
| 429 | Request or resource admission limit exceeded (`admission_limit`; trial capacity can return `free_capacity_full`). Follow limit.next\_action and Retry-After when present. |
| 503 | Service or persistence is temporarily unavailable. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.