---
updatedAt: 2026-04-20T21:43:36.000Z
agentTools:
  projectIndex: https://docs.dinari.com/llms.txt
---

# Cancel Orders


Cancel multiple `Orders` by their IDs in a single request. Note that this requires the `Order` IDs, not the `OrderRequest` IDs.
Once you submit a cancellation request, it cannot be undone. Be advised that orders with a
status of PENDING_FILL, PENDING_ESCROW, FILLED, REJECTED, or CANCELLED cannot be cancelled.

`Order` cancellation is not guaranteed nor is it immediate. The `Orders` may still be executed
if the cancellation request is not received in time.

The response will indicate which orders were successfully queued to cancel and which failed to queue.
Check the status using the "Get Order by ID" endpoint to confirm whether individual `Orders` have been cancelled.


# OpenAPI definition

```json
{
  "info": {
    "description": "**Dinari API for enterprise usage.**\n\nDinari's dShares let businesses offer tokenized access to stocks to their customers through an easy-to-use API.\nIntegrate Dinari's API and offer over a hundred stocks and ETFs to your customers.\n",
    "contact": {
      "email": "hello@dinari.com"
    },
    "license": {
      "name": "Contact us"
    },
    "termsOfService": "https://dinari.com/terms",
    "title": "Dinari Enterprise API",
    "version": "v20261009-833c33c"
  },
  "servers": [
    {
      "url": "https://api-enterprise.sbt.dinari.com",
      "description": "Production"
    },
    {
      "url": "https://api-enterprise.sandbox.dinari.com",
      "description": "Sandbox"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyId": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key-Id",
        "description": "The API key ID provided on the [Partners Dashboard](https://partners.dinari.com)."
      },
      "ApiSecretKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Secret-Key",
        "description": "API Secret Key that is only shown once at API Key creation."
      }
    },
    "schemas": {
      "BaseOpenApiError": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP status code"
          },
          "message": {
            "type": "string",
            "description": "Human-readable message"
          },
          "error_id": {
            "type": "string",
            "description": "Reference Id for Dinari support"
          },
          "error": {
            "description": "Additional context and information"
          }
        },
        "required": [
          "error_id",
          "message",
          "status"
        ],
        "additionalProperties": false
      },
      "BaseOpenApiFieldError": {
        "type": "object",
        "properties": {
          "field_name": {
            "type": "string",
            "description": "Name of field with error"
          },
          "field_error": {
            "type": "string",
            "description": "Description of error"
          }
        },
        "required": [
          "field_error",
          "field_name"
        ],
        "additionalProperties": false
      },
      "BaseOpenApiBodyError": {
        "type": "object",
        "properties": {
          "field_errors": {
            "type": "array",
            "description": "Contains list of field-specific errors",
            "items": {
              "$ref": "#/components/schemas/BaseOpenApiFieldError"
            }
          },
          "body_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Description of body-specific error (ex. JSON issues)"
          }
        },
        "required": [
          "field_errors"
        ],
        "additionalProperties": false
      },
      "BaseOpenApi422Error": {
        "type": "object",
        "properties": {
          "status": {
            "default": 422,
            "enum": [
              422
            ],
            "description": "HTTP status code"
          },
          "message": {
            "default": "Unprocessable Entity",
            "enum": [
              "Unprocessable Entity"
            ],
            "description": "Human-readable message"
          },
          "error_id": {
            "type": "string",
            "description": "Reference Id for Dinari support"
          },
          "error": {
            "description": "Additional context and information",
            "$ref": "#/components/schemas/BaseOpenApiBodyError"
          }
        },
        "required": [
          "error",
          "error_id"
        ],
        "additionalProperties": false
      },
      "ChainId": {
        "type": "string",
        "enum": [
          "eip155:1",
          "eip155:42161",
          "eip155:8453",
          "eip155:81457",
          "eip155:98866",
          "eip155:999",
          "eip155:43114",
          "eip155:56",
          "eip155:5042",
          "eip155:11155111",
          "eip155:421614",
          "eip155:84532",
          "eip155:168587773",
          "eip155:98867",
          "eip155:998",
          "eip155:43113",
          "eip155:97",
          "eip155:5042002",
          "eip155:202110",
          "eip155:179205",
          "eip155:179202",
          "eip155:98865",
          "eip155:7887"
        ]
      },
      "BrokerageOrderStatus": {
        "type": "string",
        "enum": [
          "PENDING_SUBMIT",
          "PENDING_CANCEL",
          "PENDING_ESCROW",
          "PENDING_FILL",
          "ESCROWED",
          "SUBMITTED",
          "CANCELLED",
          "PARTIALLY_FILLED",
          "FILLED",
          "REJECTED",
          "REQUIRING_CONTACT",
          "ERROR"
        ]
      },
      "OrderSide": {
        "type": "string",
        "enum": [
          "BUY",
          "SELL"
        ]
      },
      "OrderType": {
        "type": "string",
        "enum": [
          "MARKET",
          "LIMIT"
        ]
      },
      "OrderTif": {
        "type": "string",
        "enum": [
          "DAY",
          "GTC",
          "IOC",
          "FOK"
        ]
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the `Order`."
          },
          "status": {
            "description": "Status of the `Order`.",
            "$ref": "#/components/schemas/BrokerageOrderStatus"
          },
          "chain_id": {
            "enum": [
              "eip155:1",
              "eip155:42161",
              "eip155:8453",
              "eip155:81457",
              "eip155:98866",
              "eip155:999",
              "eip155:43114",
              "eip155:56",
              "eip155:5042",
              "eip155:202110"
            ],
            "description": "CAIP-2 formatted chain ID of the blockchain that the `Order` transaction was run on.",
            "$ref": "#/components/schemas/ChainId"
          },
          "order_contract_address": {
            "type": "string",
            "format": "eth_address",
            "description": "Smart contract address that `Order` was created from."
          },
          "order_transaction_hash": {
            "type": "string",
            "format": "hex_string",
            "pattern": "0x[a-fA-F0-9]+",
            "description": "Transaction hash for the `Order` creation."
          },
          "order_side": {
            "description": "Indicates whether `Order` is a buy or sell.",
            "$ref": "#/components/schemas/OrderSide"
          },
          "order_type": {
            "description": "Type of `Order`.",
            "$ref": "#/components/schemas/OrderType"
          },
          "order_tif": {
            "description": "Time in force. Indicates how long `Order` is valid for.",
            "$ref": "#/components/schemas/OrderTif"
          },
          "payment_token": {
            "type": "string",
            "format": "eth_address",
            "description": "The payment token (stablecoin) address."
          },
          "created_dt": {
            "type": "string",
            "format": "date-time",
            "description": "Datetime at which the `Order` was created. ISO 8601 timestamp."
          },
          "stock_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The `Stock` ID associated with the `Order`"
          },
          "alloy_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The `Alloy` ID associated with the `Order`"
          },
          "asset_token": {
            "type": [
              "string",
              "null"
            ],
            "format": "eth_address",
            "description": "The dShare asset token address."
          },
          "asset_token_quantity": {
            "type": [
              "number",
              "null"
            ],
            "description": "Total amount of assets involved."
          },
          "payment_token_quantity": {
            "type": [
              "number",
              "null"
            ],
            "description": "Total amount of payment involved."
          },
          "limit_price": {
            "type": [
              "number",
              "null"
            ],
            "description": "For limit `Orders`, the price per asset, specified in the `Stock`'s native currency (USD for US equities and ETFs)."
          },
          "fee": {
            "type": [
              "number",
              "null"
            ],
            "description": "Fee amount associated with `Order`."
          },
          "cancel_transaction_hash": {
            "type": [
              "string",
              "null"
            ],
            "format": "hex_string",
            "pattern": "0x[a-fA-F0-9]+",
            "description": "Transaction hash for cancellation of `Order`, if the `Order` was cancelled."
          },
          "order_request_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Order Request ID for the `Order`"
          },
          "client_order_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Customer-supplied unique identifier to map this `Order` to an order in the customer's systems."
          }
        },
        "required": [
          "chain_id",
          "created_dt",
          "id",
          "order_contract_address",
          "order_side",
          "order_tif",
          "order_transaction_hash",
          "order_type",
          "payment_token",
          "status"
        ],
        "additionalProperties": false
      },
      "BatchCancelOrderInput": {
        "type": "object",
        "properties": {
          "order_ids": {
            "type": "array",
            "description": "List of `Order` IDs to cancel",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": [
          "order_ids"
        ],
        "description": "Input parameters for requesting `Order` cancellations from a list of `Order` IDs."
      },
      "BatchCancelOrderResponse": {
        "type": "object",
        "properties": {
          "cancel_queued_orders": {
            "type": "array",
            "description": "Orders that were queued to cancel.",
            "items": {
              "$ref": "#/components/schemas/Order"
            }
          },
          "failed_to_cancel_orders": {
            "type": "array",
            "description": "Orders that could not be queued to cancel.",
            "items": {
              "$ref": "#/components/schemas/Order"
            }
          }
        },
        "required": [
          "cancel_queued_orders",
          "failed_to_cancel_orders"
        ],
        "additionalProperties": false
      }
    },
    "responses": {
      "UNPROCESSABLE_ENTITY": {
        "description": "Unprocessable Entity",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BaseOpenApi422Error"
            }
          }
        }
      },
      "DEFAULT_ERROR": {
        "description": "Default error response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BaseOpenApiError"
            }
          }
        }
      }
    }
  },
  "paths": {
    "/api/v2/accounts/{account_id}/orders/cancel": {
      "post": {
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchCancelOrderResponse"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/UNPROCESSABLE_ENTITY"
          },
          "default": {
            "$ref": "#/components/responses/DEFAULT_ERROR"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchCancelOrderInput"
              }
            }
          }
        },
        "tags": [
          "Orders"
        ],
        "summary": "Cancel Orders",
        "description": "\nCancel multiple `Orders` by their IDs in a single request. Note that this requires the `Order` IDs, not the `OrderRequest` IDs.\nOnce you submit a cancellation request, it cannot be undone. Be advised that orders with a\nstatus of PENDING_FILL, PENDING_ESCROW, FILLED, REJECTED, or CANCELLED cannot be cancelled.\n\n`Order` cancellation is not guaranteed nor is it immediate. The `Orders` may still be executed\nif the cancellation request is not received in time.\n\nThe response will indicate which orders were successfully queued to cancel and which failed to queue.\nCheck the status using the \"Get Order by ID\" endpoint to confirm whether individual `Orders` have been cancelled.\n",
        "operationId": "createBatchOrderCancellation",
        "security": [
          {
            "ApiKeyId": [],
            "ApiSecretKey": []
          }
        ]
      },
      "parameters": [
        {
          "in": "path",
          "name": "account_id",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ]
    }
  },
  "tags": [
    {
      "name": "Orders",
      "description": "**`Orders` represent the buying and selling of assets under an `Account`.**\n\nFor `Accounts` using self-custodied `Wallets`, `Orders` are created and fulfilled by making calls to Dinari's smart contracts, or using the *Proxied Orders* methods.\n\nFor `Accounts` using managed `Wallets`, `Orders` are created and fulfilled by using the `Managed Orders` methods, which then create the corresponding transactions on the blockchain.\n"
    }
  ],
  "openapi": "3.1.0"
}
```