# Account transfers

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..."))
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pacifica.gitbook.io/docs/api-documentation/api/websocket/subscriptions/account-transfers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
