OrdersService
Batch Cancel Orders
Cancel up to 50 orders by order ID or client order ID in one request. Returns per-item accept or reject results with aggregate counts.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/v1/orders/cancel-batch' \
--header 'Accept: */*' \
--header 'X-API-KEY-ID: YOUR_API_KEY_ID' \
--header 'X-API-TIMESTAMP: YOUR_API_TIMESTAMP' \
--header 'X-API-SIGNATURE: YOUR_API_SIGNATURE' \
--header 'Content-Type: application/json' \
--data '{
"items": [
{
"clientOrderId": "cli-ord-20250101-001",
"orderId": "5USXJZmk"
}
],
"requestId": "request_01J0EXAMPLE",
"subaccountId": "45LUmqjT"
}'Responses
{
"acceptedCount": 1,
"rejectedCount": 1,
"results": [
{
"clientOrderId": "cli-ord-20250101-001",
"code": "ORDER_NOT_FOUND",
"error": {
"code": "BAD_REQUEST",
"rateLimit": {
"limit": 100,
"operationId": "value",
"policyClass": "AUTH_PUBLIC",
"policyVersion": 1,
"reason": "QUOTA_EXCEEDED",
"refillModel": "CONTINUOUS",
"remaining": 1,
"retryAfterMs": 1,
"scope": "CLIENT_IP"
},
"violations": [
{
"fieldPath": "value",
"message": "value",
"ruleId": "value"
}
]
},
"orderId": "5USXJZmk",
"status": "ACCEPTED"
}
],
"ts": "2025-01-01T00:00:00Z",
"tsNs": "1735689600000000000"
}Orders to cancel (max 50).
Idempotency key (required).
Optional public subaccount ID. When omitted, subaccount-scoped API keys use their bound subaccount; other callers use their authenticated root account.
Number of requested cancellations that were accepted.
1Number of requested cancellations that were rejected.
1Echoed client order ID (when provided).
cli-ord-20250101-001Error code if rejected.
ORDER_NOT_FOUNDStable error code matching the REST problem+json "code" field.
BAD_REQUESTActive weighted quota. Present for quota-exhaustion responses.
100Stable operation identifier shared by all aliases of the same action.
valueMutable quota family used for the decision.
AUTH_PUBLICPolicy version used for the decision, when available.
1Machine-readable failure reason.
QUOTA_EXCEEDEDRefill behavior used by the active limiter.
CONTINUOUSWeighted capacity remaining when the request was rejected.
1Minimum relative delay before retrying, in milliseconds.
1Caller dimension that owns the exhausted capacity.
CLIENT_IPREST path of the request field the violation names, for example order.baseQty or items[2].limitGtc.price; when no choice of a one-of group was sent, the group, for example order.execution.
valueHuman-readable explanation of the violation.
valueStable validation rule identifier suitable for programmatic matching.
valueResolved order ID (populated on accept).
5USXJZmkPer-item cancellation outcome.
ACCEPTEDServer timestamp.
2025-01-01T00:00:00ZServer timestamp as epoch nanoseconds (for bots).
1735689600000000000| Key | HTTP status | Connect code | Error | When |
|---|---|---|---|---|
| unauthenticated | 401 | unauthenticated | Unauthenticated | Authentication required. |
| permission-denied | 403 | permission_denied | Permission Denied | Permission denied. |
| invalid-argument | 400 | invalid_argument | Invalid Argument | Invalid argument. |
| not-found | 404 | not_found | Not Found | Not found. |
| unavailable | 503 | unavailable | Unavailable | Service unavailable. |