> ## Documentation Index
> Fetch the complete documentation index at: https://jupiter-feat-ai-trading-mcp.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel Order

> Cancel an active recurring order and reclaim remaining funds.

The `POST /recurring/v1/cancelOrder` endpoint cancels an active recurring order and returns remaining funds to the user. The endpoint supports one cancellation per transaction. Retrieve order accounts via `/getRecurringOrders` first, then sign and submit the cancel transaction.

If you want to cancel order(s), you need to do these steps:

<Steps>
  <Step>
    Get a list of the order accounts you want to cancel via `/getRecurringOrders` endpoint.
  </Step>

  <Step>
    Choose the order account to cancel by making a post request to the `/cancelOrder` endpoint to get the transaction to cancel the order.
  </Step>

  <Step>
    Sign then send the transaction to the network either via `/execute` endpoint or by yourself.
  </Step>
</Steps>

<Note>
  **GET RECURRING ORDERS**

  [Refer to the `/getRecurringOrders` section](/recurring/get-recurring-orders) to prepare the list of order accounts you want to cancel.
</Note>

<Info>
  **NOTE**

  The `/cancelOrder` endpoint only supports 1 cancellation per transaction.
</Info>

<Warning>
  **CAUTION**

  Price-based orders via API is deprecated.
</Warning>

```js theme={null}
const cancelOrderResponse = await (
    await fetch('https://api.jup.ag/recurring/v1/cancelOrder', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'x-api-key': 'your-api-key',
        },
        body: JSON.stringify({
            order: "4DWzP4TdTsuwvYMaMWrRqzya4UTFKFoVjfUWNWh8zhzd",
            user: wallet.publicKey,
            recurringType: "time",
        }),
    })
).json();
```

## Cancel Order Response

**Success Example Response**

```json theme={null}
{
  "requestId": "36779346-ae51-41e9-97ce-8613c8c50553",
  "transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAgORL7cu4ZNuxh1wI9W7GVURyr3A06dH348HDpIQzcAJ4oZOZHXAukWalAX/odOiV55UZa1ePBg8d2tRKQyqCjV6C/H8IQcrfZR4QeOJFykenP3QJznc6vNpqe2D57HTD7Gd1R4MYi595YUO8ViNwpWb17+Q9DxkVcz5fWpSqjtDyiji2RfCl7yoUfzkV42QPexQNFjBK5/+pJhV8QuWShN6r9vLZM5XJNS670dgAgf7wC+wCLLIFWHgjgWx32LJMnJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADBkZv5SEXMv/srbpyw5vnvIzlu8X3EmssQ5s6QAAAAAabiFf+q4GE+2h/Y0YYwDXaxDncGus7VZig8AAAAAABBt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKmMlyWPTiSJ8bs9ECkUjg2DC1oTmdr/EIQEjnvY2+n4WbB1qAZjecpv43A3/wwo1VSm5NY22ehRjP5uuuk/Ujb+tSfUXWQOPsFfYV1bDiOlSpa4PwuCC/cGNfJDSsZAzATG+nrzvtutOj1l82qryXQxsbvkwtL24OR8pgIDRS9dYVCj/auTzJLgPke1v9c3puAy81rBYgsabmuLUTEQsZyVAwcABQL9WQEABwAJA0ANAwAAAAAADA0AAg0IAQQDBQYJCgsMCBYHIWKotyLz"
}
```

**Failed Example Response**

```json theme={null}
{
  "code": 400,
  "error": "Failed to deserialize account data: failed to fill whole buffer",
  "status": "Bad Request"
}
```

## Execute Cancel Order

To sign then send the transaction to the network to execute the cancellation, you can use the `/execute` endpoint or by yourself.

Refer to the [Execute Order](/recurring/execute-order) section for more details.
