> For the complete documentation index, see [llms.txt](https://pacifica.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pacifica.gitbook.io/docs/api-documentation/api/websocket/subscriptions/account-transfers.md).

# Account transfers

Streams deposit, withdrawal, and transfer events for an account.

Refer to [Websocket](/docs/api-documentation/api/websocket.md) for establishing the websocket connection.

## Account transfers

### Params

```json
{
    "method": "subscribe",
    "params": {
        "source": "account_transfers",
        "account": "42trU9A5..."
    }
}
```

### Stream

```json
{
    "channel": "account_transfers",
    "data": {
        "u": "42trU9A5...",
        "e": "deposit",
        "a": "USDC",
        "am": "1000.000000",
        "t": 1716200000000,
        "tx": "5xGk...",
        "s": null,
        "r": null,
        "bn": 42,
        "ra": "1000.000000",
        "f": "0.500000"
    }
}
```

| Field  | Type            | Description                                                                                         |
| ------ | --------------- | --------------------------------------------------------------------------------------------------- |
| `'u'`  | string          | Account address                                                                                     |
| `'e'`  | string          | Transfer event type: `deposit`, `subaccount_transfer`, `withdrawal_pending`, `withdrawal_confirmed` |
| `'a'`  | string          | Asset symbol                                                                                        |
| `'am'` | string          | Transfer amount                                                                                     |
| `'t'`  | number          | Timestamp in milliseconds                                                                           |
| `'tx'` | string or null  | Transaction ID (if applicable)                                                                      |
| `'s'`  | string or null  | Source address (if applicable)                                                                      |
| `'r'`  | string or null  | Receiver address (if applicable)                                                                    |
| `'bn'` | integer or null | Batch nonce (for withdrawals)                                                                       |
| `'ra'` | string or null  | Requested amount (before fees)                                                                      |
| `'f'`  | string or null  | Fee amount                                                                                          |

#### Code Example (Python)

```python
import asyncio
import json
import websockets

async def subscribe_account_transfers(account: str):
    uri = "wss://<exchange-ws-url>"
    async with websockets.connect(uri) as ws:
        await ws.send(json.dumps({
            "method": "subscribe",
            "params": {
                "source": "account_transfers",
                "account": account,
            },
        }))
        async for message in ws:
            data = json.loads(message)
            print(data)

asyncio.run(subscribe_account_transfers("42trU9A5..."))
```
