For the complete documentation index, see llms.txt. This page is also available as Markdown.

Place & Cancel Orders

Build order calldata

POST /api/v1/orders/calldata
Field
Type
Required
Description

stockAddress

string

Yes

Stock token address (EVM).

side

string

Yes

Buy or Sell.

type

string

Yes

Market or Limit.

quantity

string / number

Conditional

Limit orders; market sells.

notional

string / number

Conditional

Market buys.

price

string / number

Conditional

Limit orders.

timeInForce

string

Conditional

Limit orders. See enums.

deadline

number

Yes

Tx deadline (Unix seconds).

Market buy

{
  "stockAddress": "0x0000000000000000000000000000000000000001",
  "side": "Buy",
  "type": "Market",
  "notional": "10",
  "deadline": 1893456000
}

Limit sell

Limit buy

Limit orders (buy and sell) use quantity + price; notional is only for market buys. Production limit orders accept only timeInForce: "DAY" — other values revert on-chain.

Response data:

Field
Type
Description

chainId

number

Chain ID.

productType

string

Product type.

toAddress

string

Router address.

value

string

Native value ("0").

callData

string

Encoded calldata.

method

string

placeMarketOrder or placeLimitOrder.

Submit toAddress + callData on-chain, then record via order-status-and-history.md.

One Click place order

Same body as /calldata, plus optional gasLimit (set a buffer — the API broadcasts through OneClickRouter and pays gas). Requires One Click enabled and API key userAddress configured.

The response is the order-tx mapping, not calldata: { id, chainId, productType, operationType, orderId, txHash, status, ... }. orderId is null until the indexer backfills it — poll GET /orders/tx/{txHash} or GET /orders/{orderId} (once populated).

Build Order-With-Deposit Calldata

Use this endpoint when the order transaction should also use StockRouter as the approved spender before placing the order. For buys, StockRouter transfers the cash token to Cashier; for sells, it transfers the stock token to Stock.

Field
Type
Required
Description

stockAddress

string

Yes

Stock token address.

depositAmount

string / number

Yes

Human-readable deposit amount. For buys, this is cash token amount. For sells, this is stock token amount.

depositTokenAddress

string

Conditional

Cash token address. Required for buy orders.

side

string

Yes

Buy or Sell.

type

string

Yes

Market or Limit.

quantity

string / number

Conditional

Limit orders; market sells.

notional

string / number

Conditional

Market buys.

price

string / number

Conditional

Limit orders.

timeInForce

string

Conditional

Limit orders.

deadline

number

Yes

Tx deadline (Unix seconds).

For buy orders, the cash token must be approved for StockRouter, and the cash deposit must be eligible for instant deposit; otherwise the combined transaction reverts. For sell orders, the wallet stock token must be approved for StockRouter.

Market buy with deposit

Market sell with stock deposit

One Click Order With Deposit

Same body as /with-deposit/calldata, plus optional gasLimit. Requires One Click enabled and API key userAddress configured.

Cancel limit order

Self-submit cancel calldata

Use the orderId exactly as returned by the API — a 0x-prefixed 32-byte hex string (66 characters), e.g. 0x00000000000049fb0001000049d0d92daa26b7f121276e7034af17aed9e4c71e. Put it in the path as-is: DELETE /api/v1/orders/0x00000000000049fb0001000049d0d92daa26b7f121276e7034af17aed9e4c71e/calldata?deadline=1893456000

One Click cancel

Returns uuid and txHash.

Cancel rules

  • Order belongs to current API key

  • Order is open

  • Limit orders only

  • No pending cancel in flight

  • API key userAddress matches order user

Last updated