REST
POST
/api/v1/ordersPlace OTC Order
Place a new OTC order based on the price update id.
Auth:Bearer <api_key>
Tags:OrdersIdempotent
Request
cURL
curl -X POST https://publicapi.sandbox.hercle.financial/api/v1/orders \
-H "Authorization: Bearer eyJhb..." \
-H "Content-Type: application/json" \
-d '{"key": "value"}'Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token for authentication |
| Content-Type | string | Yes | Content type of the request body |
| Client-Id | string | No | ⚠️ Sandbox only. Unique idempotency key for the request. If a request with the same Client-Id is received within 6 hours, the original response is returned. |
Request Body
Schema
object
priceId*:string
// Unique identifier for the price quoteside*:string(buy | sell)
// Order side - buy or sellslippage*:number
// Maximum price slippage accepted in case of sudden price change (1.0 equals to 1%)Example
{
"priceId": "123e4567-e89b-12d3-a456-426614174000",
"side": "buy",
"slippage": 1
}Response
Success Response Schema
Order placed successfully
| Field | Type | Description |
|---|---|---|
tradeId | string | Unique identifier for the trade |
side | string | Order side Allowed values: buysell |
pair | string | Trading pair (e.g., BTCUSD) |
price | number | Order price |
size | number | Order size in base currency |
notional | number | Total value in quote currency |
status | number | Current status of the order 0→ Created1→ Executed2→ Cancelled3→ Pending |
baseCurrency | string | Base currency of the pair |
quoteCurrency | string | Quote currency of the pair |
timestamp | string | ISO 8601 timestamp of order creation |
statusError | string | Error message if order failed |
Responses
Order placed successfully
201 application/json
{
"tradeId": "987e6543-e21b-12d3-a456-426614174000",
"side": "buy",
"pair": "BTCUSD",
"price": 45000,
"size": 0.1,
"notional": 4500,
"status": 0,
"baseCurrency": "BTC",
"quoteCurrency": "USD",
"timestamp": "2024-06-01T12:00:00Z",
"statusError": ""
}API Tester
Test this endpoint directly against the sandbox environment
Get your API key from Hercle Sandbox
https://publicapi.sandbox.hercle.financial/api/v1/orders