durationSeconds; Flash converts it into the onchain deadline with a 60-second execution buffer. Optionally schedule the start with startTime, and bound execution with a limit price. For the concepts behind the parameters, see Placing Orders.
This page shows the full flow end to end (quote, sign, submit) as a runnable script for each chain. Both examples sell over one hour: WETH for USDC on Base, and WSOL for USDC on Solana. The signing and submit plumbing is identical to a market order; only the request fields differ.
TWAP parameters
Omit
startTime to begin immediately. A limit price is optional on a TWAP — supply at most one of the two bases; see Pricing basis.
TWAP orders do not accept expireTime (the duration sets expiry instead) or triggers. Progress is surfaced on the order status through twapBucketCount and completedFillCount.
End-to-end example
Prerequisites. EVM examples use
viem; Solana examples use @solana/web3.js, tweetnacl, and bs58. All requests go to https://flash.definitive.fi/v1 with your key in the x-definitive-api-key header. The public integrator key dpka_513a2bd7_57a2_46d2_927b_2a3857fe271b is safe for development. The onchain steps also need an RPC endpoint and the funder wallet’s key, supplied here through environment variables.EVM
EVM
Sell 5 WETH for USDC on Base, spread over one hour. On a sell,
qty is denominated in the target asset (WETH). If the spent token needs an allowance, the quote returns evm.approveTx (or evm.permitTypedData on the Permit2 path); handle whichever it returns, then sign the order payload and submit.SVM (Solana)
SVM (Solana)
Sell 5 WSOL for USDC, spread over one hour. On a sell,
qty is denominated in the target asset (WSOL). Before the first trade of a token the swap needs the funder’s token accounts (svm.ataSetupIxs) and a delegation (svm.delegateIx or a sponsor-paid svm.sponsoredDelegateTx). Run the onchain steps in order, then sign the order message offchain and submit.side to "buy" and denominate qty in the contra asset (for example "1000" USDC). Add twapBucketCount to control how many tranches the order is split into. To schedule the TWAP and cap its execution price, add startTime and a limit price to both the quote and the submit — for example startTime: "2026-05-12T00:00:00Z" with limitNotionalPrice: "4000" sells only at $4,000 per WETH or better, starting at that time. startTime and twapBucketCount must match the values used at quote time; durationSeconds is quote-time only.
To track fill progress after submit, poll
GET /orders or stream live updates over the Orders WebSocket. TWAP orders report completedFillCount against twapBucketCount.Trigger Orders
Stop, stop-loss, and take-profit orders.
Market Order
Execute immediately at the best price.
Bracket Orders
Attach a take-profit / stop-loss pair to this order at placement.