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

# Cancel Buy Item (Self-Trade)

> Cancel a single undelivered item from a merchant self-trade buy (CS2 / Assetpay only).

# POST /secure/buy/{tradeId}/items/{itemId}/cancel

Merchant-facing equivalent of [`POST /client/trading/withdraw/{tradeId}/items/{itemId}/cancel`](/api-reference/trading/cancel-withdraw-item). Requests cancellation of a single undelivered item from one of your own **self-trade** buys. AssetPay asks the marketplace supplier to cancel the purchase; on success your merchant wallet is refunded automatically.

**Authentication:** Merchant API Key (`api-key` header)
**Scope:** `CORE_ACCESS`

<Note>
  CS2 (Assetpay) items only. Rust buys are fulfilled by a polling supplier with no cancel API and cannot be cancelled. Only **self-trade** buys (`source: "self"`) are cancellable through this endpoint.
</Note>

## Request

```http theme={null}
POST https://api.assetpay.gg/secure/buy/{tradeId}/items/{itemId}/cancel
api-key: ap_...
```

### Path Parameters

| Parameter | Type          | Required | Description                                                                          |
| --------- | ------------- | -------- | ------------------------------------------------------------------------------------ |
| `tradeId` | string        | Yes      | The buy trade's internal ID, or the `externalId` you supplied at creation.           |
| `itemId`  | string (uuid) | Yes      | The item's ID within that trade (the `id` of an entry in the trade's `items` array). |

## When an item can be cancelled

A cancel is only accepted when **all** of the following hold:

* The item belongs to a **self-trade** (`source: "self"`) **buy** owned by the authenticated merchant.
* The item is a **CS2 (Assetpay)** item.
* The item is **at least 30 minutes old** (measured from when it was created).
* The item is **not** already in a terminal state (`completed`, `failed`, `reverted`, `canceled`).

## Response

```json theme={null}
{
  "requestId": "...",
  "success": true,
  "data": {
    "tradeId": "trade-uuid",
    "itemId": "item-uuid",
    "status": "cancelled"
  }
}
```

A `200` only confirms the marketplace **accepted** the cancellation. AssetPay does **not** change the item state inline — the refund and the transition to `reverted` arrive asynchronously through the standard `trade.*` [callback](/guides/callbacks). Poll [`GET /secure/trades/{tradeId}`](/api-reference/secure/get-trade) or rely on callbacks for the final state.

## Rate Limits

| Merchant Status | Limit             |
| --------------- | ----------------- |
| Verified        | 60 requests / min |
| Unverified      | 10 requests / min |

## Errors

| Code | Key                     | When                                                                                                                             |
| ---- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| 27   | `TRADE_CANCEL_TOO_SOON` | The item is younger than 30 minutes. Retry after the 30-minute window.                                                           |
| 28   | `TRADE_NOT_CANCELLABLE` | Not cancellable: not a withdrawal, not a CS2/Assetpay item, already in a terminal state, or the marketplace rejected the cancel. |
| 1300 | `FORBIDDEN`             | The trade is not a self-trade owned by the authenticated merchant.                                                               |
| 2201 | `ITEM_NOT_FOUND`        | No item with that `itemId` exists under the given `tradeId`.                                                                     |
