# Cancel Batch Orders

<EndpointPage
  breadcrumbs={[
    { label: "REST APIs", href: "/rest-api/rest-api" },
    { label: "Prediction Markets", href: "/rest-api/rest-api#prediction-markets" },
    { label: "Order Management", href: "/rest-api/prediction-markets/order-management" },
    { label: "Cancel Batch Orders" },
  ]}
  title="Cancel Batch Orders"
  method="POST"
  url="https://api.gemini.com/v1/prediction-markets/order/batch/cancel"
  description="Cancel 1 to 20 prediction market orders in one authenticated request. The batch is synchronous and non-atomic: invalid IDs reject the entire batch before cancellation begins, while exchange cancellation errors are returned per entry and do not stop later entries."
  example={{
    request: {
      method: "POST",
      url: "https://api.gemini.com/v1/prediction-markets/order/batch/cancel",
      headers: [
        { name: "X-GEMINI-APIKEY", value: "<string>" },
        { name: "X-GEMINI-PAYLOAD", value: "<string>" },
        { name: "X-GEMINI-SIGNATURE", value: "<string>" },
      ],
      body: {
        orderIds: [12345678, "12345679"],
      },
    },
  }}
  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: "Batch Behavior",
      children: (
        <ul style={{ margin: 0, paddingLeft: 20 }}>
          <li>The complete <code>{`{"orderIds":[...]}`}</code> payload is encoded and signed once.</li>
          <li>Each order ID may be a JSON integer or a quoted numeric string.</li>
          <li>Gemini validates every ID before attempting any cancellation. An invalid ID, an empty batch, or more than 20 entries rejects the entire request.</li>
          <li>After validation, cancellations are attempted sequentially and results remain aligned with request order.</li>
          <li>An exchange rejection such as <code>OrderNotFound</code> is returned in that entry's result. Other valid cancellations continue to be attempted.</li>
        </ul>
      ),
    },
    {
      heading: "Headers",
      children: <PMSpecHeaders />,
    },
    {
      heading: "Request Body",
      children: <PMSpecParams operationId="cancelOrderBatch" />,
    },
    {
      heading: "Responses",
      children: <PMSpecResponses operationId="cancelOrderBatch" />,
    },
  ]}
/>

<PageNavigation
  prev={{ label: "Cancel Order", href: "/rest-api/prediction-markets/order-management/cancel-order" }}
  next={{ label: "Get Active Orders", href: "/rest-api/prediction-markets/order-management/get-active-orders" }}
/>
