Skip to Content
Scalar
Trading APIs

Submit an order

Creates an order in the matching engine after validating the user, client tag, instrument, price range, and request signature. `valid_till` must be at least 150 seconds in the future; the order is then matchable for `valid_till - now - valid_till_buffer`. `position_limit_exceeded` means the order would exceed the signed 64-bit outstanding size or effective position for this user and instrument. The nonce remains available for retry after exposure changes.

POST
/orders

Creates an order in the matching engine after validating the user, client tag, instrument, price range, and request signature.

valid_till must be at least 150 seconds in the future; the order is then matchable for valid_till - now - valid_till_buffer.

position_limit_exceeded means the order would exceed the signed 64-bit outstanding size or effective position for this user and instrument. The nonce remains available for retry after exposure changes.

Request Body

application/json
  1. body

Request body for POST /orders.

client_tag must use a current Unix-ms timestamp in its high 64 bits, zero reserved bits, and a user-unique value in its low 32 bits.

client_tag*string

Packed nonce bound to EIP-712 Order.nonce as uint128. Renaming or changing layout is signature-breaking. High 64 bits are a Unix timestamp in milliseconds; next 32 bits are reserved and must be zero; low 32 bits identify the user's request.

instrument*string

Instrument must belong to the product's currently active cycle.

price*number

Limit price in human dollars, on a two-decimal grid, 0 < price <= 10.

Formatdouble
quantity*integer

Order size in whole contracts, from 1 through 9223372036854775807.

Formatint64
Range0 <= value
side*Side

Which side of the book. Feeds the EIP-712 Order.isBid.

Value in"bid""ask"
signature*string
time_in_force*TimeInForce

Time-in-force for an order. Required on every order.

Value in"GTC""IOC"
valid_till*integer

Expiry as seconds since posix epoch. Must be more than 150 seconds (the venue's valid_till_buffer) in the future, and at most 7 days.

The order is matchable for valid_till - now - valid_till_buffer seconds. It then rests unmatchable for the final 150 seconds and is cancelled expired at valid_till.

Formatint64
user*string

Response Body

Order submitted

application/json
  1. response

Accepted orders only; rejections arrive as an error envelope, not this shape with blanked fields.

cancel_reason?|

Present only when the order terminated at insert time instead of resting: filled, ioc, self_trade, expired, cancelled.

client_tag*string

Client tag as 0x-prefixed lowercase hex

exchange_ts_micros*integer

Exchange timestamp in microseconds since the Unix epoch

Formatint64
instrument*string

Instrument identifier as 0x-prefixed lowercase hex

Example Request
curl -X POST 'https://testnet-api.scalar.market/orders' \
  -H 'Content-Type: application/json' \
  -d '{
  "client_tag": "string",
  "instrument": "string",
  "price": 0.1,
  "quantity": 0,
  "side": "bid",
  "signature": "string",
  "time_in_force": "GTC",
  "valid_till": 0,
  "user": "string"
}'
Example Response
{
  "cancel_reason": "string",
  "client_tag": "string",
  "exchange_ts_micros": 0,
  "instrument": "string"
}