post https://{BASE_URL_PROD}/v4/order/private/cancel
Cancel an open order. Returns a success message if the target order was canceled as a result.
This is a private
route, so the api-key
parameter should be sent in the header.
Data dictionary
Name | Type | Parameter type | Required | Range | Description |
---|---|---|---|---|---|
orderId | string | BODY | YES | - | Should be a unique order id. For example, c7fc5b2b-bd9d-48c1-a458-a83412669cf4 |
Exemplary request
First you will need to create a new order using Create a new order endpoint.
Send the UUID of the created order in the body of the cancel request {{baseURL}}/v4/order/private/cancel
:
{
"orderId": "{{OPEN_ORDER_ID}}"
}
Response structure
In case the order is closed successfully, you will receive a JSON with data
object, structured like this example:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"success": true
}
Errors
Status | Error code | Message | Parameter | Description |
---|---|---|---|---|
500 | WrongRequestException | orderId must be a UUID | orderId | The order id should match UUID pattern, for example, c7fc5b2b-bd9d-48c1-a458-a83412669cf4 |
500 | Internal Server Error | Invalid JSON | - | Expected a valid JSON in the body of request, but received something else. Recommend checking the structure, e.g. key-value pairs, quotes, etc. |
400 | BAD_REQUEST | Order with status Closed can't be canceled | - | The order you tried to cancel has already been closed/traded |
400 | BAD_REQUEST | Order with status Canceled can't be canceled | - | The order you tried to cancel has already been canceled |
500 | CANCEL_ORDER_FAILED | Order with id: {id} already has been processed or canceled. Check status again and if not status not changed, please contact support | - | The order cannot be canceled at this time. It may have already been cancelled or there was an error in cancelling it. |