Referral Logs
Paginated query of the current user's referral operation history.
GET /referral/logs
Authorization: Bearer <token>
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | int | 1 | Page number (minimum 1) |
page_size | int | 20 | Items per page (1–100) |
action | string | — | Filter by action type (optional) |
Available Action Values
| Value | Description |
|---|---|
create_code | Created a referral code |
bind | Bound to a referral code |
rebind | Rebound to a different referral code |
unbind | Unbound from a referral code |
claim | Claimed off-chain earnings |
Response
{
"logs": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"action": "create_code",
"target_address": null,
"referral_code": "4DDDC2D4",
"amount": null,
"old_value": null,
"new_value": null,
"created_at": 1772010604000
},
{
"id": "550e8400-e29b-41d4-a716-446655440001",
"action": "bind",
"target_address": "0xabc...",
"referral_code": "4DDDC2D4",
"amount": null,
"old_value": null,
"new_value": null,
"created_at": 1772020000000
},
{
"id": "550e8400-e29b-41d4-a716-446655440002",
"action": "claim",
"target_address": null,
"referral_code": null,
"amount": "45.00",
"old_value": null,
"new_value": null,
"created_at": 1772100000000
}
],
"total": 3,
"page": 1,
"page_size": 20
}
Response Fields
| Field | Type | Description |
|---|---|---|
logs | array | List of log entries |
logs[].id | string | Unique log ID (UUID) |
logs[].action | string | Action type |
logs[].target_address | string | null | Related address (e.g., referee address for bind) |
logs[].referral_code | string | null | Related referral code |
logs[].amount | Decimal | null | Amount involved (e.g., claim amount in USDT) |
logs[].old_value | string | null | Previous value (for rebind: old referrer code) |
logs[].new_value | string | null | New value (for rebind: new referrer code) |
logs[].created_at | int64 | Timestamp (milliseconds) |
total | int64 | Total number of matching records |
page | int | Current page number |
page_size | int | Items per page |
Code Examples
Python
import requests
BASE_URL = "https://api.ztdx.io"
JWT_TOKEN = "your_jwt_token"
# Query referral logs with pagination and optional action filter
resp = requests.get(
f"{BASE_URL}/referral/logs",
headers={"Authorization": f"Bearer {JWT_TOKEN}"},
params={"page": 1, "page_size": 20, "action": "bind"},
)
data = resp.json()
print(f"Total: {data['total']} (Page {data['page']}/{(data['total'] - 1) // data['page_size'] + 1})")
for log in data["logs"]:
print(f" [{log['action']}] code={log['referral_code']} addr={log['target_address']} at={log['created_at']}")