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

# Cancel order

> Cancel an order before it is fulfilled. VOIDED before payment, REVERSED after payment.

Cancels an order for the authenticated merchant. This is the server-to-server form of [Storefront cancel order](https://firespark.cloud/docs/storefront-api/orders/\[id]/cancel/post): the same validation, the same terminal status, and the same fulfillment interrupt.

Fire spark updates the order and fulfillment statuses, stops a running fulfillment workflow when one is in progress, and notifies connected integrations.

> [!NOTE]
>
> Requires an access token with the `orders:write` scope. See
> [Token](https://firespark.cloud/docs/admin-api/oauth/token/post.md) to obtain a token.

The resulting status follows whether payment has been captured:

| Payment | Order `status` | `fulfillment_status` |
| - | - | - |
| Not captured | `VOIDED` | `VOIDED` |
| Captured | `REVERSED` | `REVERSED` |

Unpaid tenders are voided, so `payment_status` becomes `CANCELLED`. Captured tenders are refunded, so `payment_status` becomes `REFUNDED`. `payment_status` itself is derived from the tenders.

> [!NOTE]
>
> The fulfillment next-states restriction is unchanged. A workflow advance to
> `VOIDED` stays refused when `VOIDED` is not among the current node's next
> states. Cancel selects `VOIDED` or `REVERSED` from the capture check above.

> [!WARNING]
>
> Cancel is rejected once the order is fulfilled. Refund a fulfilled order from
> the channel that placed it.

## Path parameters

| Parameter | Required | Description |
| - | - | - |
| `id` | Yes | External order identifier |

## Request

No body. The order id is the path parameter.

```bash theme={null}
curl -X POST "https://firespark.cloud/api/admin/v1/orders/ord-48291/cancel" \
  -H "Authorization: Bearer ACCESS_TOKEN"
```

## Response

Returns `200` with the cancelled order in `data`.

```json Cancelled before payment theme={null}
{
  "data": {
    "id": "ord-48291",
    "status": "VOIDED",
    "fulfillment_status": "VOIDED",
    "payment_status": "CANCELLED"
  }
}
```

```json Cancelled after payment theme={null}
{
  "data": {
    "id": "ord-48291",
    "status": "REVERSED",
    "fulfillment_status": "REVERSED",
    "payment_status": "REFUNDED"
  }
}
```

## Error responses

| Status | Description |
| - | - |
| `401` | Missing or invalid access token |
| `403` | Token is missing the `orders:write` scope |
| `404` | Order not found |
| `422` | Order is already fulfilled, or cannot be cancelled in its current state |


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