# Canceling and Claiming Orders

Orders can be permissionlessly canceled and claimed at any time.  This can be done in batches or individually.

### Why must orders be claimed?

When orders are executed, they are burned in the afterSwap hook and held in the PoolManager for the creator of the limit order to then claim. &#x20;

The reason we do not do the transfer to the user immediately upon execution is that transfers of tokens are extremely gas costly, and so we separated out the transfer of tokens in a separate claim function to avoid overburdening the swap with additional gas fees.

<figure><img src="/files/4hCV1OOtn1d8WWrqogMm" alt=""><figcaption></figcaption></figure>

Once you open a position, so long as it remains open, you can cancel the order at any time.

<figure><img src="/files/ljHv84T403ge9Yq9Miwz" alt=""><figcaption></figcaption></figure>

Once an order has been executed, you can claim the order directly on the Executed Orders tab.


---

# Agent Instructions: 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:

```
GET https://docs.gamma.xyz/gamma/limitorderhook/canceling-and-claiming-orders.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
