Quickstart: First API Trade
This guide walks through the smallest API flow for a partner integration:
Discover a tradable stock.
Confirm
mUSD.Deposit if needed.
Place a market buy.
Record and track the transaction.
Confirm the portfolio changed after settlement.
Use this as the smoke test before adding limit orders, withdrawals, or One Click.
Flow
1. Configure Request Context
Every request must include:
x-api-key
Partner API key
x-api-ts
Current Unix milliseconds
x-api-nonce
UUID
x-api-sign
HMAC-SHA256 authentication value
x-api-chain-id
8453, 143, 1, or target chain
x-api-p
Anchored for the Anchored API
Use the exact /api/v1/... path in the HMAC payload. Do not include the domain or /rwa/trading.
2. Discover a Tradable Stock
Pick an item where tradable is true. Relevant response fields:
symbol
Symbol and quote lookup
contractAddress
stockAddress for order requests
price
Quote context
Optional quote refresh:
3. Check Portfolio
For a plain market buy, check mUsdBalance, the API field for mUSD. Wallet USDC is not buying power until it is deposited into mUSD. If the cash token is approved and instant deposit is available, /api/v1/orders/with-deposit/calldata can deposit and place the buy in one transaction.
4. Deposit Cash If Needed
First check allowance:
If allowance is too low, have the user approve the spender from cash/deposits.md.
Then build deposit calldata:
Example body:
Submit the returned toAddress, value, and callData on-chain. Then record:
Poll deposit detail until operationStatus is settled or mUsdBalance is updated.
5. Place a Market Buy
Build order calldata:
Example body:
Submit the returned StockRouter transaction with your wallet client.
6. Record and Track the Order
Record the self-submitted tx:
Example:
Then track:
The transaction can be mined before execution and settlement are final. Treat the order as final only after it moves into history and portfolio balances reflect the settlement.
7. Confirm Portfolio
After settlement:
Expected result:
mUsdBalancedecreases by filled notional plus fees, with unspentmUSDrefunded.The bought stock appears as
exchangeBalance.Order detail shows settlement fields such as
settlePrice,settlePay, andsettleReceive.
Next Steps
viem implementation
Debug failures
Understand statuses
Add One Click
Last updated

