Exit Position
Generate the transactions needed to exit (withdraw from) a yield position using the Yield.xyz Actions API. This skill covers unstaking, withdrawing from lending protocols, exiting vaults, and handling cooldown periods.When to Use
Activate this skill when the user asks to:- Unstake tokens (e.g., “Unstake my ETH from Lido”)
- Withdraw from a lending protocol (e.g., “Withdraw USDC from Aave”)
- Exit a vault position
- Remove liquidity
- Stop earning yield on a position
- Claim unstaked/unlocked tokens
Authentication
Base URL
Step-by-Step Instructions
Step 1: Verify the Yield Supports Exits
status.exit is true. Check metadata.cooldownPeriod for any withdrawal waiting period.
Step 2: Check Current Balance (Recommended)
Before exiting, verify the user has a position:Step 3: Create the Exit Action
Endpoint:POST /v1/actions/exit
Request Body (CreateActionDto):
useMaxAmount:
Step 4: Sign and Submit Each Transaction
For each transaction in thetransactions array, in order:
- Sign the
unsignedTransactionusing the user’s wallet - Broadcast the signed transaction to the blockchain
- Submit the hash to Yield.xyz:
Step 5: Handle Cooldown Periods
Many staking yields have cooldown periods after unstaking:| Network / Protocol | Typical Cooldown |
|---|---|
| Ethereum native staking | Variable (exit queue, ~1-5 days) |
| Cosmos (ATOM) | 21 days |
| Polkadot (DOT) | 28 days |
| Solana (SOL) | ~2-3 days (1 epoch) |
| Avalanche (AVAX) | 14 days (delegator) |
| Lido (stETH) | Up to ~4 days |
| Lending protocols (Aave, Compound) | Instant |
| ERC-4626 vaults | Usually instant |
manage-position skill.
Step 6: Verify Action Completion
Exit Action Types
| Type | Description |
|---|---|
UNSTAKE | Initiate unstaking (may trigger cooldown) |
WITHDRAW | Direct withdrawal (lending, vaults) |
WITHDRAW_ALL | Withdraw entire position |
REVOKE | Revoke delegation (some networks) |
Error Handling
| Status Code | Meaning | Action |
|---|---|---|
| 400 | Invalid parameters | Check amount doesn’t exceed balance; verify arguments |
| 401 | Unauthorized | Verify API key |
| 403 | Geoblocked | User’s region is restricted |
| 404 | Yield not found | Verify yield ID |
| 429 | Rate limited | Wait and retry |
Edge Cases
- Partial exits: Most yields support partial withdrawals. Specify the exact amount to withdraw.
- Cooldown in progress: If the user already has an unstaking request in cooldown, some protocols allow additional unstake requests while others don’t. Check balances for
unstakingbalance types. - WETH unwrapping: Some ERC-4626 vault exits with WETH as the underlying token will automatically unwrap to ETH.
- Price per share: Vault withdrawals convert the user’s share amount using the current price-per-share, which may differ from the deposit amount due to yield accrual.
- Minimum withdrawal: Some protocols have minimum withdrawal amounts.
- Instant vs delayed: Lending protocols and most vaults process withdrawals instantly. Native staking typically has a cooldown period.
- Claim after cooldown: After a staking cooldown completes, use the
manage-positionskill withCLAIM_UNSTAKEDaction to claim the tokens.

