> For the complete documentation index, see [llms.txt](https://acilia.gitbook.io/acilia-nft-swap-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://acilia.gitbook.io/acilia-nft-swap-api/quick-start/getting-started-guides/cancel-a-listed-nft.md).

# Cancel a listed NFT

This guide is a continuation of the [Listing](/acilia-nft-swap-api/quick-start/getting-started-guides/list-an-nft-on-polygon.md) example.

As a maker, you can always cancel a listing (or any other order) - the Acilia NFT Swap API makes this trivial.

{% hint style="info" %}
Any order created from the Acilia NFT Swap API can be filled or cancelled without the need to the same API. The orders generated by this API are simple 0x orders and can be cancelled by interacting with the smart contracts directly or with Trader SDK libraries.&#x20;
{% endhint %}

### Step 1: Request cancellation call-data

Pass in the AciliaID from the previous Listing request

```python
payload = json.dumps({
  "aciliaId": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcm..."
})
headers = {
  'Authorization': f'Bearer {api_token}',
  'Content-Type': 'application/json'
}

response = requests.request(
  "POST",
  f"https://{acilia_api_domain}/v1/order/cancel",
  headers=headers,
  data=payload
)

response = response.json()
```

Below is the sample response coming from the API 👇 - which will contain the following

* `order` contains the deserialized order
* `cancelOrderTransaction` is an Ethereum transaction that can be used to cancel that order. The order must be send by the maker, of course.

You are always encouraged to review call-data before before you submit it on-chain.

```
{
  "aciliaId": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV...",
  "order": {
    "erc721Token": "0x26970ceb166b71db3480b7464387f793a570259a",
    "erc721TokenId": "2",
    "direction": "SELL",
    "erc20Token": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "erc20TokenAmount": "20000000000000000000",
    "maker": "0x26970ceb166b71db3480b7464387f793a570259a",
    "erc721TokenProperties": [],
    "fees": [],
    "expiry": "1846785190",
    "nonce": "100131415900000000000000000000000000000275088661344072499795790248876436988724",
    "taker": "0x0000000000000000000000000000000000000000",
    "chain": "POLYGON"
  },
  "cancelOrderTransaction": {
    "from": "0x26970ceb166b71db3480b7464387f793a570259a",
    "to": "0xDef1C0ded9bec7F1a1670819833240f027b25EfF",
    "value": "0",
    "data": "0xbe167b9ddd605f7d554cc445cede96d76a0..."
  }
}
```

### Step 2: Cancel the order on-chain

```
# Using the same `send_transaction` code in the previous examples.
# This example assumes that Bob's address is 0x26970ceb166b71db3480b7464387f793a570259a
send_transaction(operation['transaction'], BOB_PK)
```

### Step 3: Ensure the transaction succeeds

Ensure the transaction is correctly mined - and check the transaction logs to ensure the cancellation is successful.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://acilia.gitbook.io/acilia-nft-swap-api/quick-start/getting-started-guides/cancel-a-listed-nft.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
