Quickstart
Get trading in under 5 minutes. You'll need an account and an API key.
1. Create an account
Sign up at devnet.v4.parcl.co. The onboarding flow mints test USDC on Solana, bridges it to Parcl Chain, and creates your margin account. Takes about 15 seconds.
After onboarding, go to Settings (top-right) and copy your Parcl Chain Public Key. You'll need this for API calls.
2. Get your account ID
curl https://v4-api.dev.parcllabs.com/v1/accounts/by-owner/0xYOUR_PUBKEY_HEXResponse:
{
"accountId": 12,
"owner": "0x35504e68...",
"collateral": "10000000000",
"positions": [],
"openOrders": []
}The accountId is what you use for placing orders.
3. Check available markets
curl https://v4-api.dev.parcllabs.com/v1/marketsReturns an array of markets. Real-estate markets and commodity markets share the same marketId space. Use the response to discover IDs at runtime rather than hardcoding them — the set grows as new markets ship.
4. Read the orderbook
curl https://v4-api.dev.parcllabs.com/v1/markets/0/orderbookReturns bids and asks with price and size at each level.
5. Place an order
The easiest way to trade programmatically is with an API key. Generate one from Settings in the trading UI, then submit orders with a single HTTP call:
curl -X POST \
-H "X-API-Key: prcl_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"transaction":{"PlaceOrder":{"account_id":12,"market_id":0,"side":"Long","order_type":"Market","price":0,"size":100000,"trigger_price":null,"reduce_only":false,"post_only":false,"time_in_force":"IOC","take_profit":null,"stop_loss":null}},"nonce":1713456789000,"timestamp":1713456789}' \
https://v4-rest-api.dev.parcllabs.com/tx/sign-and-submitNote the host: signing and auth go to v4-rest-api, public reads go to v4-api. The server signs the transaction via a secure enclave and submits it to the validator. No private key management needed.
For full auth details, see authentication.
6. Stream real-time data
Connect to the WebSocket for live orderbook updates, fills, and price changes:
const ws = new WebSocket("wss://v4-api.dev.parcllabs.com/v1/ws");
ws.onopen = () => {
ws.send(
JSON.stringify({
type: "subscribe",
channels: [
{ channel: "orderbook", market_id: 0 },
{ channel: "trades", market_id: 0 },
],
}),
);
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
console.log(msg.type, msg);
};See WebSocket reference for all channels and message formats.