How to debug the error -2011 Unknown order sent when trying to cancel an open order

status: 400, error code: -2011, error message: Unknown order sent

This is a common error when calling this API endpoint to cancel an open order:

DELETE /api/v3/order

There are various reasons that can cause this; There is a checklist that may be helpful to understand the issue:

  • API key and account
    • Is the API key the correct one that has the order you like to cancel?
    • Some users may use Key A to cancel othe rder in Key B, it won’t work.
  • Testnet
    • If your key is from testnet, you can’t user it to cancel order in production.
  • Order lookup
    • If the order does not exist, it will fail
    • If the order id is not under that symbol, it will fail, e.g.:
      • if you have an order Id = 1234 in symbol BTCUSDT, you can not cancel it with symbol ETHUSDT unelss the order id 1234 can be found in ETHUSDT and is available to be cancelled.
  • Order status
    • The order only can be cancelled if it’s status is NEW or PARTIALLY_FILLED
    • The order in other status like FILLED, CANCELED, etc can NOT be cancelled.