OrdersService
Batch Create Orders
Create up to 20 orders in a single request with accepted or rejected outcomes for each item. Supports mixed symbols and attached risk payloads.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/v1/orders/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": [
{
"attachedRisk": {
"oco": false,
"stopLoss": {
"child": {
"marketIoc": {}
},
"triggerPrice": "61000.25",
"triggerPriceSource": "LAST_PRICE"
},
"takeProfit": {
"child": {
"marketIoc": {}
},
"triggerPrice": "61000.25",
"triggerPriceSource": "LAST_PRICE"
}
},
"baseQty": "0.001",
"clientOrderId": "cli-ord-20250101-001",
"feeAsset": "QUOTE",
"marketIoc": {
"clientRefPrice": "61000.25",
"maxSlippageTicks": 1
},
"selfTradePreventionMode": "EXPIRE_MAKER",
"side": "BUY",
"symbol": "BTC-USDT"
}
],
"requestId": "request_01J0EXAMPLE",
"subaccountId": "45LUmqjT"
}'Responses
{
"acceptedCount": 1,
"rejectedCount": 1,
"results": [
{
"accepted": {
"orderId": "5USXJZmk",
"resolvedBaseQtyScaled": 100000,
"stopLossTriggerId": "59VD7Lar",
"submittedMaxQuoteDebitScaled": 100000000,
"takeProfitTriggerId": "59VD7Lar",
"trailingStopTriggerId": "59VD7Lar"
},
"clientOrderId": "cli-ord-20250101-001"
}
],
"ts": "2025-01-01T00:00:00Z",
"tsNs": "1735689600000000000"
}Orders to create (max 20). client_order_id is optional per item. For a new request_id, a reused client_order_id rejects only that item with CONFLICT_DUPLICATE_CLIENT_ORDER_ID; other valid items continue.
Required account-scoped idempotency key for the entire ordered batch. Reusing it with the same payload within 15 minutes returns each decided item's original result and result time, and retries the items still unresolved, never admitting an already admitted item again. Reusing it with a different payload during that window returns CONFLICT_IDEMPOTENCY_KEY_REUSE. After 15 minutes the ID is free: a repeat is a new request and can place its orders again, so read the items back instead of repeating an older batch.
Optional public subaccount ID. When omitted, subaccount-scoped API keys use their bound subaccount; other callers use their authenticated root account.
Number of requested orders that were accepted.
1Number of requested orders that were rejected.
1Assigned order ID.
5USXJZmkGross base quantity as a scaled integer. Batch results preserve the canonical scaled value because one batch can contain multiple symbols; use the corresponding request item's symbol base quantity scale to decode it.
100000Trigger ID for attached stop-loss (when accepted and configured).
59VD7LarSubmitted hard all-in quote debit limit, scaled by the pair's quote_quantity_scale from GetSpotConfig. Present only when submitted.
100000000Trigger ID for attached take-profit (when accepted and configured).
59VD7LarTrigger ID for attached trailing stop (when accepted and configured).
59VD7LarEchoed client order ID.
cli-ord-20250101-001Stable error code matching the REST problem+json "code" field.
Public order ID holding this account's client order ID for a duplicate rejection; omitted when no existing holder is known.
Active weighted quota. Present for quota-exhaustion responses.
Stable operation identifier shared by all aliases of the same action.
Mutable quota family used for the decision.
Policy version used for the decision, when available.
Machine-readable failure reason.
Refill behavior used by the active limiter.
Weighted capacity remaining when the request was rejected.
Minimum relative delay before retrying, in milliseconds.
Caller dimension that owns the exhausted capacity.
REST 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.
Human-readable explanation of the violation.
Stable validation rule identifier suitable for programmatic matching.
Server 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. |