Requires an API key via the
X-API-Key header. See API Keys. mode field. For the concept behind direct vs swap and instant vs async, see Deposit modes.
Overview
POST /v2/actions/deposit/{opportunityId}
The endpoint returns an actionId and an ordered transactions array. The user signs and submits each transaction in sequence (for an ERC-20 deposit, typically an approve followed by a deposit).
Build the deposit
Pass the user’s address, the input token, the amount in the token’s smallest unit, and yourdistributorId. Use mode: "direct" to deposit the vault’s native token.
The opportunity to deposit into. Get it from Get Opportunities. IDs are UUIDs.
The user’s EVM wallet address. Any valid address works; the wallet needs no Turtle account. A sanctioned wallet is rejected (see Error Handling).
Address of the token being deposited. Must be supported on the opportunity’s chain. Cannot be the vault’s receipt token.
Your distributor ID. Embedded into the deposit calldata for automatic attribution.
direct deposits the vault’s native token. swap routes a different input token through a DEX first. See the swap-mode section below.Transaction Object
Each transaction in thetransactions array contains:
Optional metadata for swap transactions, including provider info, amount out, gas estimate, and route details.
Swap mode
When the user wants to deposit a token that is not the vault’s native deposit token, setmode to swap and pass that token as tokenIn. The API routes the swap through a DEX before depositing. Swap mode is available when swapRouteEnabled is true on the opportunity. See Deposit modes for the full availability matrix.
metadata (provider, amount out, route). The rest of the broadcast flow is identical.
Broadcast
Sign and submit each transaction in the returned order. Wait for each to confirm before sending the next, since a later transaction often depends on an earlier one (adeposit cannot land before its approve).
Verify the deposit
Attribution is automatic, so there is nothing to call to record it. If you want to confirm a specific deposit carried your tracking data, pass its transaction hash to the verify endpoint. That step has its own page: Verify Attribution. If the opportunity is async (complex settlement), the deposit will sit pending until you claim it. Handle that on Async Deposits.
Operational Notes
Amount is in the token's smallest unit
Amount is in the token's smallest unit
amount is in wei for the input token’s decimals. 1 USDC (6 decimals) is "1000000"; 1 DAI (18 decimals) is "1000000000000000000". Pass the raw integer string. Never send a human-readable decimal.Submit transactions in order
Submit transactions in order
The
transactions array is ordered. An ERC-20 deposit returns an approve then a deposit. Confirm each before broadcasting the next.Swap mode needs swapRouteEnabled
Swap mode needs swapRouteEnabled
mode: "swap" only works when the opportunity has swapRouteEnabled: true. Read availability off the opportunity object. See Deposit modes.Async vaults need a claim step
Async vaults need a claim step
For opportunities with
complex settlement (for example Mellow, Lagoon), the deposit queues and is not active until claimed. See Async Deposits.Error Handling
Wallet is sanctioned
Wallet is sanctioned
Status: 403 ForbiddenThe API screens
userAddress against the OFAC sanctions list on every request and builds no transactions for a sanctioned wallet.Solution: Do not retry with this wallet.Invalid wallet address
Invalid wallet address
Status: 400 Bad RequestSolution: Pass a valid EVM address as
userAddress.Distributor not found
Distributor not found
Status: 404 Not FoundSolution: Verify your distributor ID is correct and active.
Opportunity not found
Opportunity not found
Deposits disabled
Deposits disabled
Status: 400 Bad RequestSolution: Deposits are temporarily disabled for this opportunity. Try a different one.
Unsupported token
Unsupported token
Status: 400 Bad RequestSolution: Use a supported deposit token. Check the opportunity’s
depositTokens array.Insufficient token balance
Insufficient token balance
Status: 400 Bad RequestThe API reads the user’s on-chain balance of
tokenIn before building the transactions and rejects the request when the wallet holds less than amount. Native-token deposits are checked against the wallet’s native balance.Solution: Reduce amount to at most the wallet’s balance of tokenIn, or top the wallet up before retrying.
