# Cancel Order

<EndpointPage
  breadcrumbs={[
    { label: "Trading", href: "/trading/trading" },
    { label: "Orders", href: "/trading/rest-api/orders" },
    { label: "Cancel Order" },
  ]}
  title="Cancel Order"
  method="POST"
  url="https://api.gemini.com/v1/order/cancel"
  description="This will cancel an order. If the order is already canceled, the message will succeed but have no effect."
  note={{
    title: "Note",
    children: <p style={{ margin: 0 }}>Enabled for perpetuals accounts from July 10th, 0100hrs ET onwards.</p>
  }}
  example={{
    request: {
      method: "POST",
      url: "https://api.gemini.com/v1/order/cancel",
      headers: [
        { name: "X-GEMINI-APIKEY", value: "<string>" },
        { name: "X-GEMINI-PAYLOAD", value: "<string>" },
        { name: "X-GEMINI-SIGNATURE", value: "<string>" },
      ],
      body: {
        request: "/v1/order/cancel",
        nonce: "<nonce>",
        order_id: 106817811,
      },
    },
  }}
  sections={[
    {
      heading: "Roles",
      children: (
        <>
          <p style={{ margin: "0 0 2px" }}>The API key you use to access this endpoint must have the Trader role assigned. See <a href="https://docs.gemini.com/roles#roles" style={{ color: "inherit", textDecorationLine: "underline" }}>Roles</a> for more information.</p>
          <p style={{ margin: 0 }}>The OAuth scope must have <InlineBadge>orders:create</InlineBadge> assigned to access this endpoint. See <a href="/authentication/oauth#oauth-scopes" style={{ color: "inherit", textDecorationLine: "underline" }}>OAuth Scopes</a> for more information.</p>
        </>
      ),
    },
    {
      heading: "All Cancellation Reasons",
      children: (
        <>
          <p style={{ margin: "0 0 16px" }}>Under unique circumstances, orders may be automatically cancelled by the exchange. These scenarios are detailed in the table below:</p>
          <div style={{ border: "1px solid var(--card-border-outlined-enabled, #e6e6e6)", borderRadius: 12, overflow: "hidden" }}>
            <div style={{ display: "flex", gap: 12, padding: "0 16px", borderBottom: "1px solid var(--card-border-outlined-enabled, #e6e6e6)" }}>
              <div style={{ width: 220, padding: "8px 0", fontFamily: "Geist, sans-serif", fontSize: 14, lineHeight: "20px", color: "var(--content-primary, #010304)", flexShrink: 0 }}>Cancel Reason</div>
              <div style={{ flex: 1, padding: "8px 0", fontFamily: "Geist, sans-serif", fontSize: 14, lineHeight: "20px", color: "var(--content-primary, #010304)" }}>Description</div>
            </div>
            <div style={{ display: "flex", gap: 12, padding: "0 16px", borderBottom: "1px solid var(--card-border-outlined-enabled, #e6e6e6)", alignItems: "flex-start" }}>
              <div style={{ width: 220, padding: "8px 0", flexShrink: 0 }}><TableBadge style={{ fontSize: 12, height: 18 }}>MakerOrCancelWouldTake</TableBadge></div>
              <div style={{ flex: 1, padding: "8px 0", fontFamily: "Geist, sans-serif", fontSize: 14, lineHeight: "20px", color: "var(--content-secondary, rgba(1,3,4,0.6))" }}>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.</div>
            </div>
            <div style={{ display: "flex", gap: 12, padding: "0 16px", borderBottom: "1px solid var(--card-border-outlined-enabled, #e6e6e6)", alignItems: "flex-start" }}>
              <div style={{ width: 220, padding: "8px 0", flexShrink: 0 }}><TableBadge style={{ fontSize: 12, height: 18 }}>ExceedsPriceLimits</TableBadge></div>
              <div style={{ flex: 1, padding: "8px 0", fontFamily: "Geist, sans-serif", fontSize: 14, lineHeight: "20px", color: "var(--content-secondary, rgba(1,3,4,0.6))" }}>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%.</div>
            </div>
            <div style={{ display: "flex", gap: 12, padding: "0 16px", borderBottom: "1px solid var(--card-border-outlined-enabled, #e6e6e6)", alignItems: "flex-start" }}>
              <div style={{ width: 220, padding: "8px 0", flexShrink: 0 }}><TableBadge style={{ fontSize: 12, height: 18 }}>SelfCrossPrevented</TableBadge></div>
              <div style={{ flex: 1, padding: "8px 0", fontFamily: "Geist, sans-serif", fontSize: 14, lineHeight: "20px", color: "var(--content-secondary, rgba(1,3,4,0.6))" }}>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.</div>
            </div>
            <div style={{ display: "flex", gap: 12, padding: "0 16px", borderBottom: "1px solid var(--card-border-outlined-enabled, #e6e6e6)", alignItems: "flex-start" }}>
              <div style={{ width: 220, padding: "8px 0", flexShrink: 0 }}><TableBadge style={{ fontSize: 12, height: 18 }}>ImmediateOrCancelWouldPost</TableBadge></div>
              <div style={{ flex: 1, padding: "8px 0", fontFamily: "Geist, sans-serif", fontSize: 14, lineHeight: "20px", color: "var(--content-secondary, rgba(1,3,4,0.6))" }}>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.</div>
            </div>
            <div style={{ display: "flex", gap: 12, padding: "0 16px", borderBottom: "1px solid var(--card-border-outlined-enabled, #e6e6e6)", alignItems: "flex-start" }}>
              <div style={{ width: 220, padding: "8px 0", flexShrink: 0 }}><TableBadge style={{ fontSize: 12, height: 18 }}>FillOrKillWouldNotFill</TableBadge></div>
              <div style={{ flex: 1, padding: "8px 0", fontFamily: "Geist, sans-serif", fontSize: 14, lineHeight: "20px", color: "var(--content-secondary, rgba(1,3,4,0.6))" }}>Occurs when the "fill-or-kill" execution option is included in the new order request and the entire order cannot be filled immediately. Unlike "immediate-or-cancel" orders, this execution option will result in the entire order being cancelled rather than just the unfulfilled portion.</div>
            </div>
            <div style={{ display: "flex", gap: 12, padding: "0 16px", borderBottom: "1px solid var(--card-border-outlined-enabled, #e6e6e6)", alignItems: "flex-start" }}>
              <div style={{ width: 220, padding: "8px 0", flexShrink: 0 }}><TableBadge style={{ fontSize: 12, height: 18 }}>Requested</TableBadge></div>
              <div style={{ flex: 1, padding: "8px 0", fontFamily: "Geist, sans-serif", fontSize: 14, lineHeight: "20px", color: "var(--content-secondary, rgba(1,3,4,0.6))" }}>Cancelled via user request to /v1/order/cancel endpoint.</div>
            </div>
            <div style={{ display: "flex", gap: 12, padding: "0 16px", borderBottom: "1px solid var(--card-border-outlined-enabled, #e6e6e6)", alignItems: "flex-start" }}>
              <div style={{ width: 220, padding: "8px 0", flexShrink: 0 }}><TableBadge style={{ fontSize: 12, height: 18 }}>MarketClosed</TableBadge></div>
              <div style={{ flex: 1, padding: "8px 0", fontFamily: "Geist, sans-serif", fontSize: 14, lineHeight: "20px", color: "var(--content-secondary, rgba(1,3,4,0.6))" }}>Occurs when an order is placed for a trading pair that is currently closed.</div>
            </div>
            <div style={{ display: "flex", gap: 12, padding: "0 16px", alignItems: "flex-start" }}>
              <div style={{ width: 220, padding: "8px 0", flexShrink: 0 }}><TableBadge style={{ fontSize: 12, height: 18 }}>TradingClosed</TableBadge></div>
              <div style={{ flex: 1, padding: "8px 0", fontFamily: "Geist, sans-serif", fontSize: 14, lineHeight: "20px", color: "var(--content-secondary, rgba(1,3,4,0.6))" }}>Occurs when an order is placed while the exchange is closed for trading.</div>
            </div>
          </div>
        </>
      ),
    },
    {
      heading: "Headers",
      children: <SpecHeaders operationId="cancelOrder" />,
    },
    {
      heading: "Request Body",
      children: <SpecParams operationId="cancelOrder" />,
    },
    {
      heading: "Responses",
      children: <SpecResponses operationId="cancelOrder" />,
    },
  ]}
/>

<PageNavigation
  prev={{ label: "Create New Order", href: "/trading/rest-api/orders/create-new-order" }}
  next={{ label: "Cancel All Active Orders", href: "/trading/rest-api/orders/cancel-all-active-orders" }}
/>
