> ## Documentation Index
> Fetch the complete documentation index at: https://docs.legend.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Plan Withdraw

> Create a plan to withdraw assets from a DeFi protocol

# 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/:account_id/plan/withdraw
```

### Body parameters

| Parameter  | Type   | Required | Description                                     |
| ---------- | ------ | -------- | ----------------------------------------------- |
| `amount`   | string | Yes      | Amount to withdraw in the asset's smallest unit |
| `asset`    | string | Yes      | Asset symbol (e.g., `"USDC"`)                   |
| `network`  | string | Yes      | Network to withdraw from                        |
| `protocol` | string | Yes      | Protocol to withdraw from (e.g., `"compound"`)  |

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  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"
    }'
  ```

  ```typescript TypeScript theme={null}
  const plan = await client.plan.withdraw("acc_2o0yiljtp378", {
    amount: "500000",
    asset: "USDC",
    network: "base",
    protocol: "compound",
  });
  ```

  ```python Python theme={null}
  plan = await client.plan.withdraw(
      "acc_2o0yiljtp378",
      amount="500000",
      asset="USDC",
      network="base",
      protocol="compound",
  )
  ```

  ```rust Rust theme={null}
  use legend_client::WithdrawParams;

  let plan = client.plan.withdraw("acc_2o0yiljtp378", &WithdrawParams {
      amount: "500000".into(),
      asset: "USDC".into(),
      network: "base".into(),
      protocol: "compound".into(),
      market: None,
  }).await?;
  ```
</CodeGroup>

```json Response (201 Created) theme={null}
{
  "plan_id": "pln_w8k3m2n5p1q7",
  "details": {
    "quark_operation_actions": [...],
    "eip712_data": {
      "digest": "0x5d2e...a1f3"
    }
  },
  "expires_at": "2025-06-15T10:32:00Z"
}
```

The response format is identical to [Plan Earn](/api-reference/plan-earn). Sign the `digest` and call [Execute Plan](/api-reference/plan-execute) to proceed.
