Requires an API key via the
X-API-Key header. See API Keys. The user must be a registered Turtle member before you can deposit on their behalf. A non-member request fails (see Error Handling).
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.
uuid
required
The opportunity to deposit into. Get it from Get Opportunities. IDs are UUIDs.
string
required
The user’s EVM wallet address. Must belong to a registered Turtle member.
string
required
Address of the token being deposited. Must be supported on the opportunity’s chain. Cannot be the vault’s receipt token.
string
required
Deposit amount in the token’s smallest unit (wei). Must be greater than 0.
string
required
Your distributor ID. Embedded into the deposit calldata for automatic attribution.
string
default:"direct"
direct deposits the vault’s native token. swap routes a different input token through a DEX first. See the swap-mode section below.integer
default:"50"
Maximum acceptable slippage in basis points, applied in
swap mode. 50 = 0.5%.string
Optional referral code for deposit attribution.
Transaction Object
Each transaction in thetransactions array contains:
string
required
Transaction type, e.g.
approve, deposit, withdraw, claimDeposit, cancelDeposit.object
required
The raw transaction data to sign and submit.
string
required
Target contract address.
string
required
Encoded calldata (hex string with
0x prefix).string
required
Value in wei. Usually
"0" for token interactions; non-zero for native token deposits.string
required
Estimated gas limit.
integer
required
Chain ID for the transaction.
string
required
Human-readable description of what this transaction does.
object
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.Membership is required
Membership is required
The user must be a registered Turtle member. Complete the membership flow first.
Error Handling
User is not a Turtle member
User is not a Turtle member
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.
