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

# Withdrawals

> Withdraw crypto or USD from an account to a trusted destination or another account, track each withdrawal, and cancel one that hasn't gone out.

A withdrawal moves funds out of an account to a [trusted destination](https://docs.anchorage.com/knowledge-base/platform/developers/caas/caas-trusted-destinations.md) or into another account in your organization. One call can start several withdrawals, and each one reports its own result.

## What's available

| Action | Status | Notes |
| :- | :- | :- |
| Create withdrawals to another account | Available for testing | In final testing |
| Create withdrawals to a trusted destination | Available for testing | In final testing. The request is accepted and tracked, and the transfer itself is being finished. |
| List, get, and cancel withdrawals | Available for testing | In final testing |

## How it works

**1. Have somewhere to send the funds**

A trusted destination that reads `ACTIVE`, or the ID of another account in your organization.

**2. Create the withdrawal**

`POST /v4/accounts/{accountId}/withdrawals` with a list of items, each naming the asset, the quantity, and where it goes. The `202` response carries a result per item.

**3. Track it to completion**

Each withdrawal starts `PENDING` and ends `COMPLETE`, `CANCELED`, or `FAILED`. Poll `GET /v4/accounts/{accountId}/withdrawals/{withdrawalId}`, or watch for the matching `WITHDRAWAL` entry in [transactions](https://docs.anchorage.com/knowledge-base/platform/developers/caas/caas-transactions.md). Webhooks are coming soon.

A withdrawal from a frozen or closed account is refused. [Policies](https://docs.anchorage.com/knowledge-base/platform/developers/caas/caas-policies.md) will govern withdrawals once enforcement is connected; today a withdrawal isn't held or refused by a policy.

## Withdrawal status

| Status | Meaning |
| :- | :- |
| `PENDING` | Created and being processed. The only status you can cancel from. |
| `COMPLETE` | Done |
| `CANCELED` | Canceled before it completed |
| `FAILED` | The transfer failed |

Once a withdrawal is processed it carries a `transactionId`, the ID of the matching `WITHDRAWAL` transaction. Use it to reconcile against [balances](https://docs.anchorage.com/knowledge-base/platform/developers/caas/caas-balances.md) and [transactions](https://docs.anchorage.com/knowledge-base/platform/developers/caas/caas-transactions.md).

***

## Integration steps

### Step 1: Create withdrawals

**`POST /v4/accounts/{accountId}/withdrawals`**

The body is a list. Each item:

| Field | Required | Description |
| :- | :- | :- |
| `assetType` | Yes | The asset, such as `BTC` or `USD`, from `GET /v4/asset-types` |
| `quantity` | Yes | A positive decimal as a string |
| `info` | Yes | Where the funds go: `{ "destinationId": ... }` for a trusted destination, or `{ "accountId": ... }` for another account in your organization |

```bash Request theme={null}
curl --request POST \
     --url https://api.anchorage-staging.com/v4/accounts/cb80459c-a930-444e-8f17-69ba9d0e122f/withdrawals \
     --header 'Api-Access-Key: {API Key}' \
     --header 'accept: application/json' \
     --header 'Api-Signature: {signature}' \
     --header 'Api-Timestamp: {unix epoch seconds}' \
     --header 'Idempotency-Key: 4f8a2c6e-1b3d-4e5a-9c7b-2d4f6a8b0c1e' \
     --header 'content-type: application/json' \
     --data '[
  {
    "assetType": "BTC",
    "quantity": "0.25",
    "info": { "destinationId": "7c9e6679-7425-40de-944b-e07fc1f90ae7" }
  },
  {
    "assetType": "USD",
    "quantity": "10000.00",
    "info": { "accountId": "2a4c6e8f-1b3d-4f5a-9c7e-2d4f6a8b0c1e" }
  }
]'
```

```json Response (202) theme={null}
{
  "data": [
    { "index": 0, "id": "a94c8d75-6c9d-4903-95f3-5b0893e76cb7", "status": "SUCCESS" },
    { "index": 1, "id": "b21f6e83-4d5a-4b7c-9e1d-8a0f2c3b4d5e", "status": "SUCCESS" }
  ]
}
```

Check every item. The `202` means the batch was accepted. An item that failed comes back as `status: ERROR` with the reason in `error`, while the other items may still have succeeded. Only treat the `id` of a `SUCCESS` item as a created withdrawal.

> [!NOTE]
>
> Timed out? Retry with the same `Idempotency-Key`. You get the original result back instead of a second withdrawal.

### Step 2: Get a withdrawal

**`GET /v4/accounts/{accountId}/withdrawals/{withdrawalId}`**

```bash Request theme={null}
curl --request GET \
     --url https://api.anchorage-staging.com/v4/accounts/cb80459c-a930-444e-8f17-69ba9d0e122f/withdrawals/a94c8d75-6c9d-4903-95f3-5b0893e76cb7 \
     --header 'Api-Access-Key: {API Key}' \
     --header 'accept: application/json'
```

```json Response (200) theme={null}
{
  "data": {
    "id": "a94c8d75-6c9d-4903-95f3-5b0893e76cb7",
    "assetType": "BTC",
    "quantity": "0.25",
    "info": { "destinationId": "7c9e6679-7425-40de-944b-e07fc1f90ae7" },
    "status": "COMPLETE",
    "transactionId": "c4c4652f0c07472ca7f8955fbe07775d"
  }
}
```

### Step 3: List withdrawals

**`GET /v4/accounts/{accountId}/withdrawals`** lists an account's withdrawals, most recent first. Filter with `status`, `assetType`, or `quantity`. Page with `limit` and `after`.

```bash theme={null}
curl --request GET \
     --url 'https://api.anchorage-staging.com/v4/accounts/cb80459c-a930-444e-8f17-69ba9d0e122f/withdrawals?status=PENDING&limit=50' \
     --header 'Api-Access-Key: {API Key}' \
     --header 'accept: application/json'
```

### Step 4: Cancel a withdrawal

**`POST /v4/accounts/{accountId}/withdrawals/{withdrawalId}/cancel`**

Only a `PENDING` withdrawal can be canceled. Anything else returns `409 Conflict`. The `202` response returns the withdrawal. Poll it until `status` reads `CANCELED`.

```bash Request theme={null}
curl --request POST \
     --url https://api.anchorage-staging.com/v4/accounts/cb80459c-a930-444e-8f17-69ba9d0e122f/withdrawals/b21f6e83-4d5a-4b7c-9e1d-8a0f2c3b4d5e/cancel \
     --header 'Api-Access-Key: {API Key}' \
     --header 'accept: application/json' \
     --header 'Api-Signature: {signature}' \
     --header 'Api-Timestamp: {unix epoch seconds}' \
     --header 'Idempotency-Key: 8c2d1e0f-9a8b-4c6d-b5e4-f3a2b1c0d9e8'
```

```json Response (202) theme={null}
{
  "data": {
    "id": "b21f6e83-4d5a-4b7c-9e1d-8a0f2c3b4d5e",
    "assetType": "USD",
    "quantity": "10000.00",
    "info": { "accountId": "2a4c6e8f-1b3d-4f5a-9c7e-2d4f6a8b0c1e" },
    "status": "CANCELED"
  }
}
```


## Related topics

- [Withdrawals](https://docs.anchorage.com/knowledge-base/porto/assets/withdrawals.md)
- [Cancel a withdrawal](https://docs.anchorage.com/knowledge-base/api-reference/v4/withdrawals/cancel-a-withdrawal.md)
- [Get a withdrawal](https://docs.anchorage.com/knowledge-base/api-reference/v4/withdrawals/get-a-withdrawal.md)
- [Transfers and withdrawals](https://docs.anchorage.com/knowledge-base/porto/developers/move-money/transfers-vs-withdrawals.md)
