Skip to main content
POST
/
api
/
v1
/
orders
/
{orderId}
/
cancel
curl -X POST "https://api.roxom.com/api/v1/orders/01234567-89ab-7def-8123-456789abcdea/cancel" \
  -H "X-API-Key: your_api_key_here" \
  -H "X-API-Signature: your_rsa_signature_here" \
  -H "Content-Type: application/json"
{
  "data": {
    "success": true
  }
}

Cancel Single Order

Cancel an existing active order by order ID.

Endpoint

POST /api/v1/orders/{orderId}/cancel

Parameters

orderId
string
required
Order ID to cancel (UUID v7)
X-API-Key
string
required
RSA public key identifier for authentication
X-API-Signature
string
required
Base64-encoded RSA signature of the request payload. Payload format: POST:/api/v1/orders/{orderId}/cancel

Example Request

curl -X POST "https://api.roxom.com/api/v1/orders/01234567-89ab-7def-8123-456789abcdea/cancel" \
  -H "X-API-Key: your_api_key_here" \
  -H "X-API-Signature: your_rsa_signature_here" \
  -H "Content-Type: application/json"

Response

{
  "data": {
    "success": true
  }
}
data
object
Cancellation confirmation details

Cancel All Orders

Cancel all active orders for the authenticated account.

Endpoint

POST /api/v1/orders/cancel-all

Parameters

X-API-Key
string
required
API key for authentication

Example Request

curl -X POST "https://api.roxom.com/api/v1/orders/cancel-all" \
  -H "X-API-Key: your_api_key_here" \
  -H "X-API-Signature: your_rsa_signature_here" \
  -H "Content-Type: application/json"

Response

{
  "data": {
    "cancelledOrderIds": [
      "01234567-89ab-7def-8123-456789abcdef",
      "98765432-10fe-dcba-9876-543210fedcba"
    ]
  },
  "error": false
}
data
object
Bulk cancellation results

Cancellation States

Immediate Cancellation: Order was successfully removed from the order book
  • Order is no longer active
  • No further executions will occur
  • Locked funds are released immediately
Delayed Cancellation: Cancel request is being processed
  • Order may still receive fills while cancellation is pending
  • Common during high market activity
  • Status will change to “CANCELED” once confirmed
Orders that cannot be canceled:
  • Already filled orders (FILLED)
  • Already canceled orders (CANCELED)
  • Market orders that are executing (PENDING)
  • Expired orders (EXPIRED)

Error Handling

{
  "error": {
    "code": 404,
    "message": "Order not found",
    "details": "Order 'order_invalid' does not exist"
  },
  "timestamp": "2024-01-15T10:30:00Z",
  "requestId": "req_abc123"
}
{
  "error": {
    "code": 400,
    "message": "Cannot cancel order",
    "details": "Order is already filled"
  },
  "timestamp": "2024-01-15T10:30:00Z",
  "requestId": "req_def456"
}

Emergency Cancellation

For urgent situations, use the “Cancel All” endpoint to quickly close all positions:
def emergency_cancel_all():
    """Emergency function to cancel all active orders."""
    
    try:
        response = requests.post(
            'https://api.roxom.com/api/v1/orders/cancel-all',
            headers=headers,
            timeout=5
        )
        
        if response.status_code == 200:
            result = response.json()
            print(f"Emergency cancel: {len(result['data']['cancelledOrderIds'])} orders canceled")
            return True
        else:
            print(f"Emergency cancel failed: {response.status_code}")
            return False
            
    except Exception as e:
        print(f"Emergency cancel error: {e}")
        return False

Best Practices

  • Cancel stale orders: Remove orders that are no longer relevant
  • Track order IDs: Keep track of order IDs for cancellation
  • Monitor partial fills: Be aware that partially filled orders may continue executing
  • Quick response: Cancel orders immediately when market conditions change
  • Bulk operations: Use bulk cancel for efficient order management
  • Emergency procedures: Have a plan for quickly canceling all orders
  • Handle PENDING_CANCEL: Account for delayed cancellations in your logic
  • Verify cancellation: Check order status after cancellation requests
I