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

# vaultWithdraw

Request a withdrawal from the Zyfai Vault. Withdrawals are asynchronous — after requesting, you must wait for processing and then claim.

## Signature

```typescript theme={null}
vaultWithdraw(
  shares?: string,
  chainId?: SupportedChainId
): Promise<VaultWithdrawResponse>
```

## Parameters

| Parameter | Type               | Required | Description                                                         |
| --------- | ------------------ | -------- | ------------------------------------------------------------------- |
| `shares`  | `string`           | ❌        | Amount of shares to redeem (defaults to all shares if not provided) |
| `chainId` | `SupportedChainId` | ❌        | Chain ID (default: `8453` - Base)                                   |

## Returns

Withdraw request result with a `withdrawKey` for tracking

## Return Type

```typescript theme={null}
interface VaultWithdrawResponse {
  success: boolean;
  txHash: string;
  withdrawKey: string;
  status: "claimable" | "pending";
}
```

## Example

```typescript theme={null}
// Request withdrawal of all shares
const result = await sdk.vaultWithdraw();
console.log("Withdraw key:", result.withdrawKey);
console.log("Status:", result.status);

// If already claimable, claim immediately
if (result.status === "claimable") {
  const claim = await sdk.vaultClaim(result.withdrawKey);
  console.log("Claimed:", claim.txHash);
}
```

### Partial Withdrawal

```typescript theme={null}
// Check your shares balance first
const shares = await sdk.getVaultShares();
console.log("Shares balance:", shares.shares);

// Withdraw specific amount of shares
const result = await sdk.vaultWithdraw("4994744"); // 4994744 shares
console.log("Withdraw key:", result.withdrawKey);
```

## Withdrawal Flow

```
1. vaultWithdraw()  →  Request withdrawal, get withdrawKey
2. Wait for processing  →  Check status in response
3. vaultClaim()  →  Claim your USDC when ready
```

## How It Works

1. **Gets max redeemable**: If no shares specified, retrieves your maximum redeemable amount
2. **Requests redeem**: Calls `requestRedeem` on the vault contract
3. **Gets withdraw key**: Returns a unique key to track and claim this withdrawal
4. **Checks status**: Returns whether the withdrawal is immediately claimable or pending

## Notes

* Wallet must be connected via `connectAccount()` before calling
* Withdrawals are not instant — there may be a processing period
* Save the `withdrawKey` to claim your funds later
* Use [vaultClaim](/docs/sdk/vault/vault-claim) to claim your USDC when the status is claimable
