Affiliate Program
A read-only HTTP API for pulling your referred users' wagered and XP totals programmatically — no login required, just an API key. Separate from the affiliate dashboard, which is session-based and meant for a browser.
Every request must include your affiliate API key as a header:
X-API-Key: <your api key>
Your key is issued when your affiliate code is created. If it's ever compromised, contact the site owner to have it rotated — the old key stops working immediately.
401 Unauthorized:
{ "detail": "invalid API key" }
Returns every user who signed up through your affiliate code, paginated 100 users per page, each with wagered amount and XP gained over four time windows: last 24 hours, last 7 days, last 30 days, and all time.
| Parameter | Type | Default | Description |
|---|---|---|---|
| page | integer | 1 | 1-indexed page number. |
# cents in the response — divide by 100 for dollars
curl -H "X-API-Key: <your api key>" \
"https://rustprofit.com/api/affiliate/users?page=1"
# pip install requests
import requests
API_KEY = "<your api key>"
BASE_URL = "https://rustprofit.com/api/affiliate/users"
def get_all_referred_users():
users = []
page = 1
while True:
resp = requests.get(BASE_URL, headers={"X-API-Key": API_KEY}, params={"page": page})
resp.raise_for_status()
data = resp.json()
users.extend(data["users"])
if page >= data["total_pages"]:
break
page += 1
return users
for user in get_all_referred_users():
print(user["steamid"], user["wagered"]["all_time"])
// Node 18+ or browser — fetch is built in
const API_KEY = "<your api key>";
const BASE_URL = "https://rustprofit.com/api/affiliate/users";
async function getAllReferredUsers() {
const users = [];
let page = 1;
while (true) {
const res = await fetch(`${BASE_URL}?page=${page}`, { headers: { "X-API-Key": API_KEY } });
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
users.push(...data.users);
if (page >= data.total_pages) break;
page++;
}
return users;
}
const users = await getAllReferredUsers();
for (const user of users) {
console.log(user.steamid, user.wagered.all_time);
}
{
"affiliate_code": "summer2026",
"page": 1,
"per_page": 100,
"total_users": 243,
"total_pages": 3,
"users": [
{
"steamid": "76561198000000000",
"username": "SomePlayer",
"joined_at": "2026-06-01T12:34:56.000000",
"wagered": { "24h": 500, "7d": 4200, "30d": 18300, "all_time": 92150 },
"xp_gained": { "24h": 120, "7d": 900, "30d": 4100, "all_time": 21000 }
}
]
}
| Field | Type | Description |
|---|---|---|
| affiliate_code | string | Your affiliate's code, for convenience. |
| page | integer | The page you requested. |
| per_page | integer | Always 100. |
| total_users | integer | Total number of users you've referred, across all pages. |
| total_pages | integer | Total number of pages available. |
| users | array | The users on this page — see below. |
Each entry in users:
| Field | Type | Description |
|---|---|---|
| steamid | string | The user's SteamID64. |
| username | string | null | Their current display name. |
| joined_at | string (ISO 8601) | When they linked your affiliate code. |
| wagered | object | Total amount wagered, in cents, by time window. |
| xp_gained | object | Total XP earned, by time window. |
wagered and xp_gained share the same shape:
{ "24h": 0, "7d": 0, "30d": 0, "all_time": 0 }
24h / 7d / 30d are rolling windows measured from the moment of the request — not calendar-aligned.all_time is the user's lifetime total, independent of when they joined.wagered amounts are in cents.
Users are returned in a stable order (the order they signed up), so paging through with
?page=1, ?page=2, etc. never skips or repeats a user, even if new
signups land in between requests.
Requesting a page beyond total_pages returns 400 Bad Request:
{ "detail": "page 3 is out of range — only 2 page(s) available" }
This endpoint is rate-limited per IP address. If you're polling on a schedule, every 5–10 minutes is more than sufficient — the underlying data doesn't change faster than that.