Skip to main content
Requires an API key via the X-API-Key header. See API Keys.

Overview

POST /v2/actions/withdraw/{opportunityId} The withdraw endpoint generates transactions to redeem shares from a vault/opportunity. The typical flow is:
1

Create withdraw action

Call the endpoint to generate the transactions.
2

Sign & submit transactions

The user signs and submits each transaction in order (e.g., approve + withdraw). No further action needed.
All action endpoints require the user to be a Turtle member. Make sure the user has completed the membership flow before calling these endpoints.

Create Withdraw

Generate the transactions needed to withdraw from an opportunity. The response contains an ordered list of transactions the user must sign and submit (e.g., approve + withdraw).
Path Parameters
uuid
required
The unique identifier of the opportunity to withdraw from. Get this from the Opportunities API.
Body Parameters
string
required
The user’s EVM wallet address. Must belong to a registered Turtle member.
string
required
The number of shares to redeem in the smallest unit. Must be greater than 0.
string
required
Your distributor ID for attribution tracking.
string
The address of the token to receive after withdrawal. Required for some providers (e.g., Midas, Mellow, Veda). If not provided, the vault’s default withdraw token is used.
integer
Slippage tolerance in basis points. For example, 50 = 0.5% slippage. Only applied to opportunities that require it.
Response

Transaction Object

Each transaction in the transactions 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.

Complete Example

Here’s a full withdraw flow from start to finish:

Operational Notes

amount is the number of vault shares to redeem, expressed in the share token’s smallest unit. Pass the raw integer string. Never send a human-readable decimal.
The transactions array is ordered. A withdrawal typically returns an approve then a withdraw. Confirm each before broadcasting the next.
tokenOut sets the token the user receives. It is required for some providers (e.g., Midas, Mellow, Veda). If not provided, the vault’s default withdraw token is used.
slippageBps is the slippage tolerance in basis points (50 = 0.5%). It is only applied to opportunities that require it.
The user must be a registered Turtle member. Complete the membership flow first.

Error Handling

Status Code: 403 Forbidden
Solution: Complete the membership flow before calling action endpoints.
Status Code: 404 Not Found
Solution: Verify your distributor ID is correct and active.
Status Code: 404 Not Found
Solution: Check the opportunity ID using the Opportunities API.
Status Code: 400 Bad Request
Solution: Provide a valid EVM address for the tokenOut field.
Status Code: 400 Bad Request
The API reads the user’s on-chain share balance before building the withdraw transactions and rejects the request when the wallet holds fewer shares than amount.Solution: Lower amount to at most the wallet’s current share balance for the opportunity.