# Cancel an intent

> Cancel an intent before execution starts.

`POST /v1/agent-api/intents/{intentId}/cancel`

## Path parameters

| Field      | Type   | Required | Description |
| ---------- | ------ | -------- | ----------- |
| `intentId` | string | Yes      |             |

## Responses

| Status | Description                                                                                                                                                                                                                                   |
| ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `200`  | Full intent state after cancellation. Repeating the request for an already-cancelled intent returns the same successful projection. Cancellation is only available before execution starts and cannot stop or reverse work already executing. |
| `404`  | Intent missing or not owned by the authenticated agent (`intent_not_found`)                                                                                                                                                                   |
| `409`  | Intent is not eligible for cancellation (`intent_not_cancellable`)                                                                                                                                                                            |

## Response fields

| Field               | Type                                                                                                                                  | Required | Description                                                                                                                                                                                  |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                | string                                                                                                                                | Yes      |                                                                                                                                                                                              |
| `accountId`         | string                                                                                                                                |          | Resolved source account, pinned when the intent was created. Omitted for actions without an account.                                                                                         |
| `type`              | `"send"` \| `"transfer"` \| `"create_counterparty"` \| `"request_counterparty_details"` \| `"x402"` \| `"mpp"` \| `"policy_override"` | Yes      |                                                                                                                                                                                              |
| `status`            | `"pending"` \| `"processing"` \| `"completed"` \| `"blocked"` \| `"failed"`                                                           | Yes      |                                                                                                                                                                                              |
| `resolution`        | `"completed"` \| `"blocked"` \| `"denied"` \| `"expired"` \| `"failed"` \| `"cancelled"` or string or null                            | Yes      | Exact terminal outcome, or null while the intent is nonterminal. Known values are completed, blocked, denied, expired, failed, and cancelled; clients must preserve future nonblank strings. |
| `reasons`           | array of string                                                                                                                       | Yes      |                                                                                                                                                                                              |
| `expiresAt`         | string or null                                                                                                                        | Yes      |                                                                                                                                                                                              |
| `movement`          | object                                                                                                                                |          |                                                                                                                                                                                              |
| `movement.planId`   | string                                                                                                                                | Yes      |                                                                                                                                                                                              |
| `movement.nextStep` | `"wait"` \| `"done"` \| `"blocked"`                                                                                                   | Yes      |                                                                                                                                                                                              |
| `data`              | object or null                                                                                                                        | Yes      |                                                                                                                                                                                              |
| `metadata`          | object                                                                                                                                | Yes      |                                                                                                                                                                                              |
| `metadata.dataUrl`  | string or null                                                                                                                        | Yes      |                                                                                                                                                                                              |

## Example

### SDK

```ts
import { createCatenaClient } from "@catena/sdk"

// Reads CATENA_SECRET_KEY
const client = createCatenaClient()

const intent = await client.cancelIntent("int_01JC3B2K7W9D4F6H8J1M3P5R7T")
```

### CLI

```sh
catena intents cancel int_01JC3B2K7W9D4F6H8J1M3P5R7T
```

### Response `200`

```json
{
  "id": "int_01JC3B2K7W9D4F6H8J1M3P5R7T",
  "accountId": "acct_01JC2Y6ZQ8R4M7N9P3S5T6V8WX",
  "type": "send",
  "status": "blocked",
  "resolution": "cancelled",
  "reasons": [],
  "expiresAt": null,
  "data": null,
  "metadata": {
    "dataUrl": null
  }
}
```
