Skip to main content
Cancels an active trading order via WebSocket API. You can cancel by order ID or external ID.

Request

id
string
required
Unique request identifier for correlation
method
string
required
WebSocket API method. Must be order.cancel
params
object
required
Request parameters containing authentication and order cancellation details
You must provide either id or external_id in the params, but not both. The order must be active (open or partially executed) to be canceled.

Response

id
string
Request identifier for correlation
status
integer
HTTP status code (200 for success)
result
object
Canceled order details object

Error Response

id
string
Request identifier for correlation
status
integer
HTTP error status code
result
null
Always null for error responses
error
object
Error details object

Examples

{
  "id": "req-003",
  "method": "order.cancel",
  "params": {
    "api_token": "your-api-token",
    "timestamp": 1634567890000,
    "signature": "calculated-signature",
    "id": "7155ED34-9EC4-4733-8B32-1E4319CB662F"
  }
}

Success Response Example

{
  "id": "req-003",
  "status": 200,
  "result": {
    "id": "7155ED34-9EC4-4733-8B32-1E4319CB662F",
    "create_date": "2024-03-27T13:27:19.853Z",
    "update_date": "2024-03-27T13:30:45.123Z",
    "executed_amount": 0,
    "remaining_amount": 0.001,
    "remaining_value": 100,
    "requested_amount": 0.001,
    "requested_value": 100,
    "total_value": 100,
    "status": "canceled",
    "type": "limit",
    "price": 100000,
    "pair": "BTC_BRL",
    "external_id": "my-order-123"
  }
}

Error Response Examples

Order Not Found

{
  "id": "req-003",
  "status": 404,
  "result": null,
  "error": {
    "error_code": 40401,
    "message": "Order not found."
  }
}

Order Already Canceled or Fully Executed

{
  "id": "req-003",
  "status": 400,
  "result": null,
  "error": {
    "error_code": 40408,
    "message": "Cannot cancel an already canceled or fully executed order."
  }
}

Usage Notes

  • Order ID vs External ID: Provide either the internal order ID returned from order creation or the external ID you assigned when creating the order. Do not provide both.
  • Order Status: Only active orders (status open or executed_partially) can be canceled.
  • Already Canceled Orders: Attempting to cancel an already canceled or fully executed order will result in an error.
  • Execution Guarantee: If part of the order was already executed before cancellation, you will receive the executed amount in the response.
  • Request Correlation: Always use a unique id in each request for proper correlation with responses.

Common Error Codes

Error CodeMessageDescription
40401Order not foundThe order ID or external ID does not exist
40408Cannot cancel an already canceled or fully executed orderThe order is no longer active
40011Invalid signatureThe signature is invalid or timestamp is expired
40010Missing required parametersRequired parameters are missing from the request