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

# TWAP Cancel

## Endpoint

```text theme={null}
POST /exchange
```

## Request Body

| Parameter              | Type   | Description                         |
| ---------------------- | ------ | ----------------------------------- |
| `action`\*             | object | See below                           |
| `action.type`\*        | string | Must be `"twapCancel"`              |
| `action.twapOrderId`\* | string | TWAP order id to cancel             |
| `nonce`\*              | number | Replay-protection nonce             |
| `expiresAfter`         | number | Optional expiration timestamp in ms |
| `signature`\*          | object | EIP-712 signature                   |

## Response

```json theme={null}
{
  "status": "ok",
  "response": {
    "type": "twapCancel",
    "data": {
      "status": "canceled",
      "twapOrderId": "0x1a2b3c..."
    }
  }
}
```

### Response Fields

| Field                       | Type                       | Description                                                      |
| --------------------------- | -------------------------- | ---------------------------------------------------------------- |
| `response.data.status`      | `"canceled"` \| `"failed"` | `canceled` means the cancel request was committed                |
| `response.data.twapOrderId` | string \| undefined        | TWAP id associated with the cancel result                        |
| `response.data.error`       | string \| undefined        | Failure reason when the cancel request is rejected after parsing |

## Example Request

```bash theme={null}
curl -X POST https://api.notional.xyz/exchange \
  -H "Content-Type: application/json" \
  -d '{
    "action": {
      "type": "twapCancel",
      "twapOrderId": "0x1a2b3c4d5e6f7890..."
    },
    "nonce": 1701234567890,
    "signature": {
      "r": "0x1234...",
      "s": "0x5678...",
      "v": 27
    }
  }'
```

## Notes

<Note>
  * Only TWAPs in `pending` or `active` status are cancelable. - Ownership is enforced: the
    authenticated signer must resolve to the TWAP owner. - A successful cancel returns `status:
      "canceled"` immediately; subsequent reads show the TWAP as terminal with `canceledAt` populated.
</Note>
