# Withdraw (Custodial Wallet)

> Coming soon, upon request — this feature is turned on for your tenant by the Aurea team. [Contact us](https://www.aureahub.com/contact)

Withdraw EUR.e from the lending pool back to the user's custodial wallet — an amount, or the whole position with its interest.

## Overview

- `weiAmount`: digits only, in the smallest unit, or `"max"` for everything. The chain and the wallet are picked as for a supply ([Chain and Wallet](https://docs.aureahub.com/docs/guide-lending.md)); without a wallet whose key the platform holds for your tenant, `400` — use [Prepare a Withdrawal](https://docs.aureahub.com/docs/lending-prepare-withdraw.md).
- The answer is the withdrawal's `txHash`, after its receipt. The wallet needs the native coin for gas.

> Note: **Institutional tenants only.** For a tenant on the institutional security profile, this route needs an `Idempotency-Key`, and the tenant's policy decides before anything is signed or handed out to sign. A rule that asks for an approval holds the operation: the route answers `202` with the operation to follow (the **202** tab below), and nothing is signed or sent until the rule's approvers approve it — [Approvals](https://docs.aureahub.com/docs/guide-approvals.md). The policy's other refusals: [Policy Sets](https://docs.aureahub.com/docs/guide-policy-sets.md). Every other tenant gets the answers below, unchanged.

> Note: **Your institution callback** [Coming soon, upon request](https://docs.aureahub.com/docs/feature-availability.md): before anything is signed or handed out to sign, your own endpoint is asked, and its refusals answer here — `403` `INSTITUTION_CALLBACK_REJECTED` or `INSTITUTION_CALLBACK_ANSWER_INVALID`, `503` `INSTITUTION_CALLBACK_UNAVAILABLE`. Its `RETRY` holds the operation of a tenant on the institutional security profile — `202`, `PENDING_AUTHORIZATION` `awaiting_callback`, the **Held for your callback** tab below — until it approves (then, for a client-side or MPC wallet, read what to sign with [Get Its Callback](https://docs.aureahub.com/docs/operation-callback.md)), and answers any other tenant `409` `INSTITUTION_CALLBACK_PENDING`: [Institution Callback & Co-Signer](https://docs.aureahub.com/docs/guide-institution-callback.md).

## Endpoint

### `POST /v1/lending/withdraw`

Authentication: bearer token required.

Withdraws EUR.e to the user's custodial wallet. Needs the user's access token and the tenant signature (or a server token).

**Headers**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | no | Optional — required for a tenant on the institutional security profile (`400` `IDEMPOTENCY_KEY_REQUIRED` without it). Up to 255 letters, digits, - or _. The same key with the same request answers with the first answer (`idempotency-replayed: true`) instead of running it again; see [Idempotency](https://docs.aureahub.com/docs/idempotency.md) |
| `X-External-Tx-Id` | string | no | Optional — your own id for the operation this call starts: 1 to 255 letters, digits, `_`, `.`, `:` or `-`, unique in your tenant for ever. Read where your tenant has operation records [Coming soon, upon request](https://docs.aureahub.com/docs/feature-availability.md); otherwise it is not read. An id another operation of your tenant holds answers `409` `EXTERNAL_TX_ID_REUSED` before anything is signed or sent; see [Idempotency](https://docs.aureahub.com/docs/idempotency.md) › Your Own Operation Id |

**Request body**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `weiAmount` | string | yes | Digits only, in the smallest unit, or `max` |
| `isTestnet` | boolean | yes | `true` testnet, `false` mainnet |

**Responses**

`200` Withdrawn

```json
{
  "txHash": "0x2b71…09de"
}
```

`202` Held for approval

```json
{
  "operationId": "1d7a3c52-8e4b-4f19-a0c6-2b9e7d5f3a18",
  "state": "PENDING_AUTHORIZATION",
  "subState": "awaiting_approval",
  "approval": {
    "id": "c3e1a9f4-6b2d-4e8a-9f17-5d0c2b8e4a63",
    "ruleId": "e2b6d9f1-7a3c-4c58-8b0e-5f1a4d2c9b73",
    "ruleName": "Large transfers need two approvers",
    "threshold": 2,
    "expiresAt": null
  }
}
```

`202` Held for your callback

```json
{
  "operationId": "1d7a3c52-8e4b-4f19-a0c6-2b9e7d5f3a18",
  "state": "PENDING_AUTHORIZATION",
  "subState": "awaiting_callback",
  "callback": {
    "requestId": "8a3e5c71-2d9b-4f06-b1e8-4c7a9d2f6e15",
    "nextPollAt": "2026-10-14T09:21:00.000Z",
    "deadlineAt": "2026-10-16T09:20:00.000Z"
  }
}
```

**Example request**

```bash
curl -X POST https://api.aureahub.com/v1/lending/withdraw \
  -H "Authorization: Bearer USER_ACCESS_TOKEN" \
  -H "x-tenant-api-key: YOUR_API_KEY" \
  -H "x-timestamp: UNIX_SECONDS" \
  -H "x-signature: HMAC_SHA256_HEX" \
  -H "Content-Type: application/json" \
  -d '{"weiAmount": "max", "isTestnet": false}'
```

---

Web version: https://docs.aureahub.com/#lending-withdraw
