Skip to main content
POST
/
accounts
/
{external_id}
/
plan
/
withdraw
Plan Withdraw
curl --request POST \
  --url https://api.example.com/accounts/{external_id}/plan/withdraw

Plan Withdraw

Creates a plan to withdraw assets from a DeFi yield position. Returns a plan ID and EIP-712 digest for signing.

Request

POST /accounts/:external_id/plan/withdraw

Body parameters

ParameterTypeRequiredDescription
amountstringYesAmount to withdraw in the asset’s smallest unit
assetstringYesAsset symbol (e.g., "USDC")
networkstringYesNetwork to withdraw from
protocolstringYesProtocol to withdraw from (e.g., "compound")

Examples

curl -X POST https://prime-api.legend.xyz/accounts/acc_2o0yiljtp378/plan/withdraw \
  -H "Authorization: Bearer $LEGEND_QUERY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "500000",
    "asset": "USDC",
    "network": "base",
    "protocol": "compound"
  }'
Response (201 Created)
{
  "plan_id": "pln_w8k3m2n5p1q7",
  "chart": {
    "quark_operation_actions": [...],
    "eip712_data": {
      "digest": "0x5d2e...a1f3"
    }
  },
  "expires_at": "2025-06-15T10:32:00Z"
}
The response format is identical to Plan Earn. Sign the digest and call Execute Plan to proceed.