For AI agents: the documentation index is at /llms.txt, and this page is available as Markdown at /api/gateway/trading-rest.md.
Trading REST
Gateway API for the True Markets trading platform — unified order orchestration, quotes, transfers, and balance management across CeFi and DeFi venues. Recommended for most integrations.
Base URLs
| Environment | Base URL |
|---|---|
| Production | https://api.truemarkets.co/v1/gateway |
| UAT (sandbox) | https://api.uat.truemarkets.co/v1/gateway |
The legacy
/v1/conductorbase path continues to work for existing integrations but is deprecated — new integrations should use/v1/gateway.
UAT is the testing environment. It may require VPN/allowlist access for some integrations — contact [email protected] if requests time out from a public network.
Authentication
All endpoints require a JWT access token in the Authorization: Bearer <token> header.
Getting credentials
There are two ways in, and each uses its own keys.
Gateway (an organization trading for its users). Create an organization and an API key in the developer console, then mint a token with POST /v1/auth/api-key/token. An organization token lasts one hour and has no refresh token, so mint a new one before it expires. Sign each user's payloads with their signer key, not the organization API key.
Trading API (your own account).
- Create an account at https://www.truemarkets.co (passkey, email, magic link, or Sign in with Apple).
- Register an API key in your account's API Keys settings page. Generate an EC P-256 key pair locally and submit only the public key — the private key never leaves your machine. You'll receive a
key_id(UUID). The same key signs you in and signs your payloads. - Mint JWTs by calling
POST /v1/auth/api-key/tokenwithkey_id, a currenttimestamp(Unix seconds, within ±30s of server UTC time), andsignature— an ES256 (ECDSA P-256 + SHA-256) signature of the message{key_id}.{timestamp}, base64url-encoded. The response returnsaccess_tokenandrefresh_token. - Call the Gateway with
Authorization: Bearer <access_token>. - Refresh expired access tokens via
POST /v1/auth/token/refreshwith therefresh_token— no re-signing required.
Acting for a user
An organization trades for the users it created. Mint a token from an organization API key,
then add TM-On-Behalf-Of: <user_id> to any user route: the request reads and writes that
user's account. The header is declared on every route that accepts it, and organization-scoped
routes reject it.
Quick start
# Mint a JWT
curl -X POST https://api.truemarkets.co/v1/auth/api-key/token \
-H "Content-Type: application/json" \
-d '{"key_id":"<UUID>","timestamp":<UNIX_SECONDS>,"signature":"<BASE64URL_ES256_SIG>"}'
# Compute a quote
curl -X POST https://api.truemarkets.co/v1/gateway/quotes \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"base_asset":"BTC","quote_asset":"USD","qty":"1000","qty_unit":"quote","side":"buy"}'Need to trade on a CeFi venue directly? CeFi direct FIX/REST/WS is institutional only — see the CeFi Direct REST API reference. Retail traders reach CeFi via this Gateway, which proxies and signs the upstream HMAC for you.
Order lifecycle
Orders move through a small set of statuses. The path depends on whether the venue and order type require client-side signing.
- Create —
POST /orderswith your trade params. The response returns anorder_idand astatus. The exception is a DeFi order the account cannot fund (no on-chain balance and no CeFi balance to bridge): the response carries thequotewith anInsufficient balanceentry inquote.issues, an emptyorder_id, and nopayloads. The quote is informational so the client can still show the expected output, but no order is created and it cannot be executed. - Sign and execute — for DeFi orders and CeFi buy orders that need a funding bridge, the create response returns
status: initializedalong with an array of unsignedpayloads. Sign each payload locally with the key that controls the wallet (a Gateway user's signer key, or your own API key) and post the signatures toPOST /orders/{id}/execute. A CeFi buy then moves topending; a DeFi order settles synchronously tocomplete(immediate fill) oractive(a limit order resting on-chain). - Submitted directly — for CeFi sell orders and sufficiently funded CeFi buy orders, the create response already returns
status: pendingwith nopayloads. The execute step is skipped. In a paper-trading environment DeFi orders also take this path: they settle against the virtual ledger during create and return a terminalstatus(complete) with nopayloads, so clients must treat an emptypayloadsarray as "already submitted" rather than waiting to sign. - Settle — the order transitions out of
pendingto one of:complete— fully filled.active— limit order resting in the order book (can later move tocompleteorcanceled).canceled— canceled by the user or rejected by exchange/market conditions. A CeFi cancel first passes throughcancel_pendinguntil the exchange confirms.failed— rejected by the exchange or DeFi execution reverted.
Poll GET /orders/{id}/status (or list orders) to track progression. The payloads field in the create response is the signal: if it's non-empty, you need to sign and call execute. If it's empty or absent, the order is already submitted, unless order_id is empty and quote.issues reports an insufficient-balance problem, which means no order was created.
Support
Quotes
- Compute market quote:
POST /quotes
Orders
- List user orders:
GET /orders - Create new order:
POST /orders - Execute pending order:
POST /orders/{id}/execute - Cancel all open orders on a venue:
POST /orders/all/cancel - Cancel a limit or TP/SL order (CeFi or DeFi):
POST /orders/{id}/cancel - Execute a resting DeFi order cancellation:
POST /orders/{id}/cancel/execute - Prepare moving resting DeFi TP/SL orders to new trigger prices:
POST /orders/modify/{id}/prepare - Execute a prepared TP/SL modify:
POST /orders/modify/{id}/execute - Get a single order:
GET /orders/{id} - Modify an active limit order:
PATCH /orders/{id} - Get order status:
GET /orders/{id}/status
Transfers
- List user transfers:
GET /transfers - Create new transfer:
POST /transfers - Execute pending transfer:
POST /transfers/{id}/execute - Get transfer by ID:
GET /transfers/{id}
Ramps
- List user ramps:
GET /ramps - Create a ramp:
POST /ramps - Get ramp by ID:
GET /ramps/{id} - Execute a ramp's bridge plan:
POST /ramps/{id}/bridge/execute - Prepare a ramp's on-chain transfer:
POST /ramps/{id}/prepare - Execute a ramp's on-chain transfer:
POST /ramps/{id}/execute
Custody
- List allocations:
GET /custody/allocations - Allocate funds to CeFi:
POST /custody/allocations - Get allocation:
GET /custody/allocations/{id} - List releases:
GET /custody/releases - Release funds from CeFi:
POST /custody/releases - Get release:
GET /custody/releases/{id}
Paper Trading
- Add test funds (paper trading only):
POST /paper/deposits - Remove test funds (paper trading only):
POST /paper/withdrawals
Transactions
- List user transactions:
GET /transactions - List organization transactions:
GET /organizations/{organization_id}/transactions
Assets
- Get asset availability for the caller's country:
GET /assets/availability - List tradeable assets:
GET /assets - Get one asset by chain and address:
GET /assets/{chain}/{address}
Balances
- List balances:
GET /balances/unified - Get user balances:
GET /balances - Get the authenticated user's portfolio:
GET /portfolio
Positions
- List open positions:
GET /positions
Operations
- Compute market quote:
POST /quotes - List user orders:
GET /orders - Create new order:
POST /orders - Execute pending order:
POST /orders/{id}/execute - Cancel all open orders on a venue:
POST /orders/all/cancel - Cancel a limit or TP/SL order (CeFi or DeFi):
POST /orders/{id}/cancel - Execute a resting DeFi order cancellation:
POST /orders/{id}/cancel/execute - Prepare moving resting DeFi TP/SL orders to new trigger prices:
POST /orders/modify/{id}/prepare - Execute a prepared TP/SL modify:
POST /orders/modify/{id}/execute - Get a single order:
GET /orders/{id} - Modify an active limit order:
PATCH /orders/{id} - Get order status:
GET /orders/{id}/status - List user transfers:
GET /transfers - Create new transfer:
POST /transfers - Execute pending transfer:
POST /transfers/{id}/execute - Get transfer by ID:
GET /transfers/{id} - List user ramps:
GET /ramps - Create a ramp:
POST /ramps - Get ramp by ID:
GET /ramps/{id} - Execute a ramp's bridge plan:
POST /ramps/{id}/bridge/execute - Prepare a ramp's on-chain transfer:
POST /ramps/{id}/prepare - Execute a ramp's on-chain transfer:
POST /ramps/{id}/execute - List allocations:
GET /custody/allocations - Allocate funds to CeFi:
POST /custody/allocations - Get allocation:
GET /custody/allocations/{id} - List releases:
GET /custody/releases - Release funds from CeFi:
POST /custody/releases - Get release:
GET /custody/releases/{id} - Add test funds (paper trading only):
POST /paper/deposits - Remove test funds (paper trading only):
POST /paper/withdrawals - Get asset availability for the caller's country:
GET /assets/availability - List tradeable assets:
GET /assets - Get one asset by chain and address:
GET /assets/{chain}/{address} - List balances:
GET /balances/unified - Get user balances:
GET /balances - List open positions:
GET /positions - Get the authenticated user's portfolio:
GET /portfolio - List user transactions:
GET /transactions - List organization transactions:
GET /organizations/{organization_id}/transactions
- Need help? [email protected]
- Chat with us on Discord
- See what changed in the changelog