---
title: "Cancel Order"
method: POST
path: "/v1/order/cancel"
tags: ["Orders"]
---

# Cancel Order

`POST /v1/order/cancel`

## Request

- Base URL: `https://api.gemini.com`
- URL: `https://api.gemini.com/v1/order/cancel`
- Auth: API key in header `X-GEMINI-APIKEY` and API key in header `X-GEMINI-SIGNATURE` and API key in header `X-GEMINI-PAYLOAD`

This will cancel an order. If the order is already canceled, the message will succeed but have no effect.

<div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
  <div class="flex">
     <svg
        view-box="0 0 24 24"
      >
        <path
          fill-rule="evenodd"
          clip-rule="evenodd"
          d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
        />
      </svg>
      Enabled for perpetuals accounts from July 10th, 0100hrs ET onwards.
  </div>
</div>

### Roles
The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles) for more information.

The OAuth scope must have `orders:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.

### All Cancellation Reasons
Under unique circumstances, orders may be automatically cancelled by the exchange. These scenarios are detailed in the table below:

| Cancel Reason | Description |
|---------------|-------------|
| `MakerOrCancelWouldTake` | Occurs when the "maker-or-cancel" execution option is included in the order request and any part of the requested order could be filled immediately. |
| `ExceedsPriceLimits` | Occurs when there is not sufficient liquidity on the order book to support the entered trade. Orders will be automatically cancelled when liquidity conditions are such that the order would move price +/- 5%. |
| `SelfCrossPrevented` | Occurs when a user enters a bid that is higher than that user's lowest open ask or enters an ask that is lower than their highest open bid on the same pair. |
| `ImmediateOrCancelWouldPost` | Occurs when the "immediate-or-cancel" execution option is included in the order request and the requested order cannot be fully filled immediately. This type of cancellation will only cancel the unfulfilled part of any impacted order. |
| `FillOrKillWouldNotFill` | Occurs when the "fill-or-kill" execution option is included in the new order request and the entire order cannot be filled immediately.<br><br>Unlike "immediate-or-cancel" orders, this execution option will result in the entire order being cancelled rather than just the unfulfilled portion. |
| `Requested` | Cancelled via user request to /v1/order/cancel endpoint. |
| `MarketClosed` | Occurs when an order is placed for a trading pair that is currently closed. |
| `TradingClosed` | Occurs when an order is placed while the exchange is closed for trading. |

## Headers

- `X-GEMINI-APIKEY` string, required
- `X-GEMINI-SIGNATURE` string, required
- `X-GEMINI-PAYLOAD` string, required
- `Content-Type` string
- `Content-Length` string
- `Cache-Control` string

## Request body

- CancelOrderRequest
  - `request` string, required: The literal string "/v1/order/cancel"
  - `nonce` union, required: timestamp
    - string: Gemini strongly recommends using milliseconds instead of seconds for timestamps. | Timestamp format | Example | Supported request type | |-----------------------|-----------------------|------------------------| | string (seconds) | `1495127793` | `POST` only | | string (milliseconds) | `1495127793000` | `POST` only |
    - integer: Gemini strongly recommends using milliseconds instead of seconds for timestamps. | Timestamp format | Example | Supported request type | |-----------------------------|---------------------------|------------------------| | whole number (seconds) | `1495127793` | `GET`, `POST` | | whole number (milliseconds) | `1495127793000` | `GET`, `POST` |
  - `order_id` integer, required: The order ID given by `/order/new`
  - `account` string: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to cancel the order. Only available for exchange accounts.

## Response `200`

Response will be the fields included in Order Status. If the order was already canceled, then the request will have no effect and the status will be returned. Note the *is_cancelled* node will have a value of 'true'

- CancelOrderResponse
  - `order_id` string, integer
  - `id` string, integer
  - `symbol` string
  - `exchange` string
  - `avg_execution_price` string, double
  - `side` 'buy' | 'sell'
  - `type` 'exchange limit' | 'exchange stop limit' | 'exchange market'
  - `timestamp` union: timestamp
    - string: Gemini strongly recommends using milliseconds instead of seconds for timestamps. | Timestamp format | Example | Supported request type | |-----------------------|-----------------------|------------------------| | string (seconds) | `1495127793` | `POST` only | | string (milliseconds) | `1495127793000` | `POST` only |
    - integer: Gemini strongly recommends using milliseconds instead of seconds for timestamps. | Timestamp format | Example | Supported request type | |-----------------------------|---------------------------|------------------------| | whole number (seconds) | `1495127793` | `GET`, `POST` | | whole number (milliseconds) | `1495127793000` | `GET`, `POST` |
  - `timestampms` union: timestamp
    - string: Gemini strongly recommends using milliseconds instead of seconds for timestamps. | Timestamp format | Example | Supported request type | |-----------------------|-----------------------|------------------------| | string (seconds) | `1495127793` | `POST` only | | string (milliseconds) | `1495127793000` | `POST` only |
    - integer: Gemini strongly recommends using milliseconds instead of seconds for timestamps. | Timestamp format | Example | Supported request type | |-----------------------------|---------------------------|------------------------| | whole number (seconds) | `1495127793` | `GET`, `POST` | | whole number (milliseconds) | `1495127793000` | `GET`, `POST` |
  - `is_live` boolean
  - `is_cancelled` boolean
  - `is_hidden` boolean
  - `was_forced` boolean
  - `executed_amount` string, double
  - `remaining_amount` string, double
  - `reason` 'MakerOrCancelWouldTake' | 'ExceedsPriceLimits' | 'SelfCrossPrevented' | 'ImmediateOrCancelWouldPost' | 'FillOrKillWouldNotFill' | 'Requested' | 'MarketClosed' | 'TradingClosed'
  - `options` string[]
  - `price` string, double
  - `original_amount` string, double

## Other responses

- `400`: Bad request - malformed request or invalid parameters
- `401`: Unauthorized - missing or invalid authentication
- `403`: ApiKey fails IP Filtering Check
- `404`: Resource not found
- `429`: Too many requests - you have exceeded the rate limit
- `500`: Internal server error

---

[API](https://skmtc.dev/gemini/apis/rest-api.md) - [All operations](https://skmtc.dev/gemini/apis/rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gemini/apis/rest-api/revisions/24979792d748?raw)
