---
title: "Cancel an order"
method: POST
path: "/v1/orders/{id}/cancel"
tags: ["Orders"]
---

# Cancel an order

`POST /v1/orders/{id}/cancel`

## Request

- Base URL: `https://api.mystars.tg`
- URL: `https://api.mystars.tg/v1/orders/{id}/cancel`
- Auth: API key in header `X-Api-Key`

Cancel an order that is still `awaiting_payment`. Any other state returns
`409 conflict` (you can't cancel an order that's already paid or
processing); the `message` names the current status. Cancelling an
order that is already `cancelled` is a `409` too, so read
`GET /v1/orders/{id}` if you are unsure whether an earlier cancel landed.

Before cancelling, we check the chain for a payment to this order. If
one has arrived, the order moves on and the cancel answers `409`: a
buyer who paid seconds before is served, not reversed. If the chain
cannot be read right now, the cancel answers a retryable `503
unavailable` and the order stays `awaiting_payment`.

A cancel sends no callback. A payment that still arrives for a
cancelled order is reversed to its sender unless it is below the dust
threshold (see `reversal_tx` on the order). No `Idempotency-Key` is
needed.

## Path parameters

- `id` string, uuid, required

## Response `200`

Order cancelled.

- object
  - `order_id` string, uuid, required
  - `status` 'cancelled', required

## Other responses

- `401`: Missing or invalid `X-Api-Key`.
- `403`: The API key is valid, but the tenant is suspended (for example after `/api_revoke` — run `/api_rotate` in the bot to restore access) or banned, or the product (campaigns, giveaways) is not enabled for it. Products are enabled per tenant on request. A source address blocked at our edge gets `403 forbidden` with the message `source blocked`, whatever the key.
- `404`: No such resource for this tenant (another tenant's id is also `404`).
- `409`: The order is not in `awaiting_payment` and cannot be cancelled (`conflict`).
- `413`: The request body is larger than 256 KB (`bad_request`, `request body too large`).
- `415`: A request body was sent with a `Content-Type` other than `application/json` (a missing one included), or with an unsupported charset or `Content-Encoding` (`bad_request`). A POST without a body needs no `Content-Type`.
- `429`: A rate limit was reached (`rate_limited`). See **Rate limits** in the overview. Which `429`s carry headers: - **Per-minute buckets** — the general request budget, the order-lifecycle bucket, the pricing/recipient-check probe cap (60 req/min), the campaign bucket, and your giveaway read, write, quote and attestation buckets. Every answer metered by one carries `RateLimit-Policy`, `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds); a `429` adds `Retry-After` (seconds). - **Caps, no `Retry-After`** — the daily intake cap and the daily order cap on `POST /v1/orders` (UTC day), the per-recipient guard on unfinished orders to one `@username`, and the cap on live campaigns. These `429`s carry no `Retry-After`, but they do carry the `RateLimit-*` headers of the per-minute bucket the request passed (often with `RateLimit-Remaining` above zero): branch on `Retry-After`, never on `RateLimit-Remaining`. Back off; the daily intake and order caps clear at the next UTC midnight. - **The daily budget of ineligible-recipient refusals** on `POST /v1/orders` — its `429` carries `Retry-After` and `error.retry_after`, both the seconds until 00:00 UTC, when the budget resets, plus the `RateLimit-*` headers of the order bucket it passed. `error.retry_after` is what sets it apart from the other `429`s. While the budget's places are held only by your own checks still running, the create answers a short `429` instead: `Retry-After` of a few seconds and no `error.retry_after` — retry after `Retry-After`. - **The giveaway quote budget shared by all tenants** — its `429` carries `Retry-After` (seconds until the shared budget reopens) and the `RateLimit-*` headers of your own quote bucket, never figures for the shared budget. - **Edge throttle** — a coarse per-IP throttle in front of the API answers the same envelope with `Retry-After: 1` and no `RateLimit-*` headers.
- `503`: A required source was temporarily unavailable (`unavailable`): the price source, recipient eligibility that could not be verified right now, the payment check a cancel runs first, or (order create, rarely) no fulfilment capacity assigned to your tenant right now. The `message` is generic (`internal error`), so it does not say which: treat every `unavailable` as **retryable** — reuse the same `Idempotency-Key` and try again shortly. An app `503 unavailable` creates and cancels nothing and charges nothing. If `503 unavailable` on order create persists, contact support with the `X-Request-ID`. The edge's own `502`, `503` and `504` (the service restarting or timing out) answer the same envelope with `unavailable`, and may follow a request that did land: retry with the same `Idempotency-Key`, and an order create that landed is replayed, never duplicated. On the campaign, gift and giveaway routes a `503` may also be a gift catalog that cannot be read right now (`gift_catalog_unavailable` — retry later) or an option that is not enabled for your tenant yet (`prize_type_unavailable`, `partner_conditions_unavailable`, `antibot_enforce_unavailable`, `autopost_unavailable`, `series_unavailable` — do not retry, ask support); the `code` says which.

## Changes

- **2026-10-31** `9f589c4dd26b`: 124 warning, 48 info
  - added the new `antibot_enforce_unavailable` enum value to the `error/code` response property for the response status `401`
  - added the new `antibot_enforce_unavailable` enum value to the `error/code` response property for the response status `404`
  - added the new `antibot_enforce_unavailable` enum value to the `error/code` response property for the response status `409`
  - added the new `antibot_enforce_unavailable` enum value to the `error/code` response property for the response status `429`
  - …168 more

[Operation history](https://skmtc.dev/mystars/apis/mystars-faas-fulfilment-api/changes/v1/orders/:id/cancel/post.md)

---

[API](https://skmtc.dev/mystars/apis/mystars-faas-fulfilment-api.md) - [All operations](https://skmtc.dev/mystars/apis/mystars-faas-fulfilment-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mystars/apis/mystars-faas-fulfilment-api/revisions/b6cdc8aff8c2?raw)
