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

# Cancel Order


Cancel an `Order` by its ID. Note that this requires the `Order` ID, not the `OrderRequest` ID.
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 `Order` may still be executed
if the cancellation request is not received in time.

Check the status using the "Get Order by ID" endpoint to confirm whether the `Order` has 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
      },
      "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
      }
    },
    "responses": {
      "DEFAULT_ERROR": {
        "description": "Default error response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BaseOpenApiError"
            }
          }
        }
      }
    }
  },
  "paths": {
    "/api/v2/accounts/{account_id}/orders/{order_id}/cancel": {
      "post": {
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseOpenApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseOpenApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseOpenApiError"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/DEFAULT_ERROR"
          }
        },
        "tags": [
          "Orders"
        ],
        "summary": "Cancel Order",
        "description": "\nCancel an `Order` by its ID. Note that this requires the `Order` ID, not the `OrderRequest` ID.\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 `Order` may still be executed\nif the cancellation request is not received in time.\n\nCheck the status using the \"Get Order by ID\" endpoint to confirm whether the `Order` has been cancelled.\n",
        "operationId": "createOrderCancellation",
        "security": [
          {
            "ApiKeyId": [],
            "ApiSecretKey": []
          }
        ]
      },
      "parameters": [
        {
          "in": "path",
          "name": "account_id",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        },
        {
          "in": "path",
          "name": "order_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"
}
```