Skip to content

Make a Request

Now that authentication is covered, this page shows you how to put it into practice with actual API calls.

Every authenticated API request consists of four components:

HTTP Method + Full URL + Headers + Body

Example:

POST https://trade-uk.sandbox.zodiamarkets.com/api/3/account
Headers: Rest-Key, Rest-Sign, Content-Type
Body: {"tonce": 1737552000000000}

Header Value Required
Rest-Key Your API key ✅ Always
Rest-Sign Generated signature ✅ Always
Content-Type application/json ✅ Always

All request bodies must include:

{
"tonce": 1737552000000000,
// ... other parameters
}

The tonce is automatically added when you use the signature generation functions from the authentication page.


Retrieve your account details and balances.

Python
# Using the make_api_request function from the Authentication page
account = make_api_request('POST', 'api/3/account', {})
print(f"Account UUID: {account['accountGroupUuid']}")
print(f"User: {account['userUuid']}")

Required before connecting to WebSocket API for price streaming.

Python
token_response = make_api_request('POST', 'api/3/zm/rest/auth/token', {})
ws_token = token_response['token']
print(f"WebSocket Token: {ws_token}")

Query your transaction history with filtering.

Python
transactions = make_api_request('POST', 'api/3/transaction/list', {
'transactionClass': 'RFSTRADE',
'accountGroupUuid': 'afe6280e-163a-4652-a795-34e963063b06',
'limit': 50
})
for tx in transactions['transactions']:
print(f"{tx['timestampMillis']}: {tx['amount']} {tx['ccy']}")

Python
import requests
def safe_api_request(method, path, body=None):
"""Make API request with error handling"""
try:
response = make_api_request(method, path, body)
return {'success': True, 'data': response}
except requests.exceptions.HTTPError as e:
error_data = e.response.json() if e.response.text else {}
return {
'success': False,
'error': error_data.get('error', 'UNKNOWN_ERROR'),
'message': error_data.get('message', str(e)),
'status_code': e.response.status_code
}
except Exception as e:
return {
'success': False,
'error': 'REQUEST_FAILED',
'message': str(e)
}
# Usage
result = safe_api_request('POST', 'api/3/account', {})
if result['success']:
print(f"Account: {result['data']['accountGroup']}")
else:
print(f"Error {result['status_code']}: {result['message']}")