Hercle
REST
POST/api/v1/orders

Place 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

NameTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
Content-TypestringYesContent type of the request body
Client-IdstringNoUnique 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 quote
side*:string(buy | sell)
// Order side - buy or sell
slippage*: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

FieldTypeDescription
tradeIdstringUnique identifier for the trade
sidestring
Order side
Allowed values:
buy
sell
pairstringTrading pair (e.g., BTCUSD)
pricenumberOrder price
sizenumberOrder size in base currency
notionalnumberTotal value in quote currency
statusnumber
Current status of the order
0→ Created
1→ Executed
2→ Cancelled
3→ Pending
baseCurrencystringBase currency of the pair
quoteCurrencystringQuote currency of the pair
timestampstringISO 8601 timestamp of order creation
statusErrorstringError message if order failed

Responses

Order placed successfully

200 application/json
{
  "tradeId": "987e6543-e21b-12d3-a456-426614174000",
  "side": "buy",
  "pair": "BTCUSD",
  "price": 45000,
  "size": 0.1,
  "notional": 4500,
  "status": 1,
  "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