Prerequisites
Signing deposit transactions requires@solana/web3.js:
End-to-End Flow
Step 1: Get Your Vault
Retrieve your vault, or register one if this is your first time. The vault is a Privy-managed custodial account that holds deposits for your orders.Step 2: Craft a Deposit Transaction
The deposit endpoint builds an unsigned transaction that transfers tokens from your wallet to your vault.orderSubType to match the price order you will create:
Response:
The vault address is automatically resolved from your JWT. You do not specify it in the request. You also do not pass
inputTokenAccount or outputTokenAccount into POST /trigger/v2/orders/price; the API stores those accounts against the deposit requestId.orderSubType: "otoco", the response also includes outputTokenAccount for the output token account used by the conditional OCO pair.
Step 3: Sign the Deposit Transaction
Step 4: Create the Order
Submit the signed deposit alongside your order parameters. The order type determines which fields are required.Single Order (Limit)
A single order triggers when the price oftriggerMint crosses above or below the target price.
OCO Order (One-Cancels-Other)
An OCO order creates a take-profit and stop-loss pair sharing one deposit. When one side fills, the other cancels automatically.The take-profit price must be greater than the stop-loss price.
OTOCO Order (One-Triggers-One-Cancels-Other)
An OTOCO order has a parent trigger that executes first. Once filled, it automatically activates a TP/SL pair (OCO) on the output tokens.Order Parameters Reference
Common Fields (All Order Types)
Single Order Fields
OCO Order Fields
OTOCO Order Fields
Default Slippage
If slippage is not specified, defaults vary by order type and trigger condition:
Stop-loss orders use a higher default because execution certainty is more important than price precision when cutting losses.
Validation Rules
- Minimum order size: 10 USD
- Input and output mints must be different
- Slippage: 0-10000 basis points
expiresAtis required and must be a future timestamp (milliseconds)- OCO/OTOCO: take-profit price must be greater than stop-loss price
Unlike V1 where orders could exist indefinitely, V2 requires an expiration on every order. Adding a TTL allows the system to prune orders that are unlikely to fill, improving execution quality for active orders. For long-lived orders, use a far-future timestamp (e.g. 30 days).
Response
txSignature confirms the deposit transaction landed on-chain. The order is now active and will execute when price conditions are met.