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

# Withdraw Spot Asset

> This endpoint allows users to withdraw a spot asset.

```http theme={null}
POST /api/v1/account/spot_asset/withdraw
```

The operation type for signing is `"withdraw_spot_asset"`.

#### Request Body

<table><thead><tr><th width="200">Field</th><th width="98">Type</th><th width="95">Need</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>`"account"`</td><td>string</td><td>required</td><td>User's wallet address</td><td>`42trU9A5...`</td></tr><tr><td>`"signature"`</td><td>string</td><td>required</td><td>Cryptographic signature</td><td>`5J3mBbAH...`</td></tr><tr><td>`"timestamp"`</td><td>integer</td><td>required</td><td>Current timestamp in milliseconds</td><td>`1716200000000`</td></tr><tr><td>`"symbol"`</td><td>string</td><td>required</td><td>Spot asset symbol</td><td>`SOL`</td></tr><tr><td>`"amount"`</td><td>string</td><td>required</td><td>Amount to withdraw</td><td>`1.00000000`</td></tr><tr><td>`"idempotency_key"`</td><td>string</td><td>optional</td><td>Full UUID string. Prevents duplicate withdrawals. Required when the account has two-factor authentication on</td><td>`550e8400-e29b-41d4-a716-446655440000`</td></tr><tr><td>`"agent_wallet"`</td><td>string</td><td>optional</td><td>Agent wallet address</td><td>`8zFqj1Kp...`</td></tr><tr><td>`"expiry_window"`</td><td>integer</td><td>optional</td><td>Signature expiry in milliseconds</td><td>`10000`</td></tr><tr><td>`"two_factor"`</td><td>object</td><td>conditional</td><td>Two-factor proof. Required when the account has two-factor authentication on. Not part of the signed payload. See below</td><td>`{"type": "totp", "code": "123456"}`</td></tr></tbody></table>

#### Two-factor authentication

If the account's owner has turned on two-factor authentication, every withdrawal needs a proof, including withdrawals that an agent wallet signs.

To turn it on or manage factors, see [Two-factor authentication](https://docs.pacifica.fi/api-documentation/api/rest-api/two-factor).

* Send an `idempotency_key`. A retry with the same key and the same request returns the first result, so a retry does not need a new code.
* Send the proof in `two_factor`, outside the signed `data`. For an authenticator app, use `{"type": "totp", "code": "123456"}`. Recovery keys do not authorize withdrawals.

| Status | Meaning |
| - | - |
| `428` | Proof required: send `two_factor` |
| `401` | Proof is wrong, expired, or already used |
| `429` | Too many proof attempts. Each signer gets 5 attempts per 5 minutes |
| `400` | `idempotency_key` is missing |
| `409` | The `idempotency_key` was used for a different request |
| `422` | The proof can't be used here, for example a recovery key |
| `503` | Two-factor checks are unavailable. Retry later |

#### Response

* Status 200: Successfully submitted withdrawal

```json theme={null}
{
  "success": true,
  "data": {
    "symbol": "SOL",
    "batch_nonce": 42,
    "requested_amount": "1.00000000",
    "fee_amount": "0.00100000"
  }
}
```

| Field | Type | Description |
| - | - | - |
| `'symbol'` | string | Spot asset symbol |
| `'batch_nonce'` | integer | Nonce of the withdrawal batch |
| `'requested_amount'` | decimal string | Amount requested for withdrawal |
| `'fee_amount'` | decimal string | Fee deducted from the withdrawal |

* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 409: `idempotency_key` already used for a different request. A retry of the same request returns the first result
* Status 500: Internal server error

#### Code Example (Python)

```python theme={null}
import requests

payload = {
    "account": "42trU9A5...",
    "signature": "5J3mBbAH...",
    "timestamp": 1716200000000,
    "symbol": "SOL",
    "amount": "1.00000000",
}

response = requests.post(
    "/api/v1/account/spot_asset/withdraw",
    json=payload,
    headers={"Accept": "*/*"},
)

data = response.json()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.