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": "0.005"
},
"takeProfit": {
"child": {
"marketIoc": {}
},
"triggerPrice": "0.005"
}
},
"baseQty": "100000",
"clientOrderId": "cli-ord-20250101-001",
"feeAsset": "QUOTE",
"marketIoc": {
"clientRefPrice": "0.005",
"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": 1,
"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 replays the original per-item results and timestamp. Reusing it with a different payload during that window returns CONFLICT_IDEMPOTENCY_KEY_REUSE.
Target sub-account numeric ID. When omitted, uses caller's 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.
1Trigger 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.
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.
Protobuf field path relative to the request, using canonical field names.
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 | Status | Error | When |
|---|---|---|---|
| unauthenticated | 401 | Unauthenticated | Authentication required. |
| permission-denied | 403 | Permission Denied | Permission denied. |
| invalid-argument | 400 | Invalid Argument | Invalid argument. |
| not-found | 404 | Not Found | Not found. |
| unavailable | 503 | Unavailable | Service unavailable. |