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

# Withdraw from Earn Vault

Builds the transactions that withdraw shares from an Earn vault, either instantly from the vault's reserves or through the withdrawal queue.

* **`instant`** redeems shares straight from the vault's reserves in one step, paying the vault's fast-withdrawal cut. Payout is in the vault's underlying unless `mint` picks another token entry, and it only succeeds while that token's reserve holds enough.
* **`queued`** opens a withdrawal request for the shares. Once the request is filled, [claim it](/api-reference/transactions/earn/claim-withdrawal) to receive the tokens, or [cancel it](/api-reference/transactions/earn/cancel-withdrawal) before then to get the shares back.

Check the vault's `instantEnabled` and `queueEnabled` flags on [Get Earn Vault](/api-reference/data/earn/get-earn-vault) before offering a mode.

Sign and send `txBase64s` in order as one Jito bundle, as described in [Sending Earn transactions](/api-reference/transactions/earn/deposit#sending-earn-transactions). A queued request transaction comes partially signed by the new request account; keep that signature when you add the wallet's.

## Body

<ParamField body="address" type="string" required>
  Earn vault address.
</ParamField>

<ParamField body="wallet" type="string" required>
  Wallet that owns the shares. It pays fees and signs the transactions.
</ParamField>

<ParamField body="shares" type="string | integer" required>
  Shares to withdraw, in LP base units.
</ParamField>

<ParamField body="mode" type="string" required>
  `instant` or `queued`.
</ParamField>

<ParamField body="mint" type="string">
  Instant mode only. Token to receive, which must be one of the vault's token entries. Defaults to the vault's underlying (`acceptedAssetMint`). Queued requests can't choose: they pay out in whatever tokens the vault fills them with, so passing `mint` with `queued` is an error.
</ParamField>

<ParamField body="providerKind" type="string" default="exponent">
  Vault provider. Only `exponent` is supported today.
</ParamField>

## Response

Same shape as [Deposit to Earn Vault](/api-reference/transactions/earn/deposit#response), plus:

<ResponseField name="action" type="string">
  `withdrawRequestInstant` or `withdrawRequestQueued`.
</ResponseField>

<ResponseField name="requestId" type="string">
  Queued mode only. Address of the new withdrawal request account. Pass it to Claim or Cancel. It is also returned later as `onChainRequestAddr` by [Get Earn Position](/api-reference/data/earn/get-earn-position).
</ResponseField>

<ResponseField name="signers" type="string[]">
  Queued mode only. Contains `requestId`, which has already signed the transaction.
</ResponseField>

<RequestExample>
  ```bash Queued theme={null}
  curl -X POST https://tars.loopscale.com/v1/pandora/earn/vaults/withdraw_request/tx \
    -H "Content-Type: application/json" \
    -d '{
      "address": "EsTx9ToYW2k1DsTw6ccpmP3RrXQriod114hcM7U5ZKaR",
      "wallet": "<WALLET>",
      "shares": "500000",
      "mode": "queued"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "providerKind": "exponent",
    "action": "withdrawRequestQueued",
    "vault": "EsTx9ToYW2k1DsTw6ccpmP3RrXQriod114hcM7U5ZKaR",
    "user": "<WALLET>",
    "requestId": "<REQUEST_ACCOUNT>",
    "signers": ["<REQUEST_ACCOUNT>"],
    "txBase64": "<WITHDRAW_REQUEST_TX>",
    "txBase64s": ["<AUM_REFRESH_TX>", "<WITHDRAW_REQUEST_TX>"]
  }
  ```
</ResponseExample>
