GET /user/{pubkey}
Returns the account IDs and active sessions associated with a Solana public key.
Request
Path Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
pubkey | string | Yes | Base58-encoded Solana public key |
curl https://zo-mainnet.n1.xyz/user/YourBase58PubkeyHereResponse
{
"accountIds": [
1
],
"sessions": {
"pubkey": "…",
"expiry": "…"
}
}Response Fields
| Field | Type | Description |
|---|---|---|
accountIds | number[] | List of Nord account IDs owned by this user |
sessions | object | Map of active session public keys to session info |
Session Object
| Field | Type | Description |
|---|---|---|
pubkey | string | Session public key (Base58) |
expiry | string | Session expiration time (RFC3339/ISO 8601) |
Example: Python
import requests
from base58 import b58encode
API_URL = "https://zo-mainnet.n1.xyz"
def get_user_account_ids(user_pubkey: bytes) -> list[int]:
"""Get account IDs for a user public key."""
pubkey_b58 = b58encode(user_pubkey).decode()
resp = requests.get(f"{API_URL}/user/{pubkey_b58}")
if resp.status_code == 404:
return [] # User not found
data = resp.json()
return data["accountIds"]
# Get account IDs
account_ids = get_user_account_ids(user_pubkey)
print(f"Found {len(account_ids)} accounts: {account_ids}")
# Use the first account ID to fetch account details
if account_ids:
account_id = account_ids[0]
# See GET /account/{account_id} for fetching balances, positions, ordersError Responses
| Status | Description |
|---|---|
| 404 | User not found (no accounts for this pubkey) |
Related Endpoints
[!TIP] To get account balances, positions, and orders, use the account ID from this endpoint with:
GET /account/{account_id}- Account summaryGET /account/{account_id}/orders- Paginated orders
Last updated on