GET /v1/admin/referrals/users/{user_id} — Operator view of a user
https://api.triport.io/v1/admin/referrals/users/3f8c2a1e-9b4d-4c7a-8e21-6f0a1b2c3d4eOperator-only lookup that returns a single user's full referral state — tier, code, paid-invitee count, balance, and their most recent attribution audit rows — in one call.
GET /v1/admin/referrals/users/{user_id} is the operator (support/back-office)
view of a single user's referral standing. It combines the user's referral
overview — tier, label, commission rate, primary code, optional custom slug,
paid-invitee count, and earnings balance — with the tail of their attribution
audit log, so an operator can see both where the user stands now and how they
got there in a single response.
This is an admin-surface endpoint: it is gated by a shared X-Admin-Token
header rather than a user session cookie or an API key. There is no per-user
authentication — the token authorizes the operator to read any user by id.
Keep the token server-side; never ship it to a browser.
The recent_attributions array carries up to 50 of the most recent
Attribution rows for the user (signup, first-paid, rejected, and
tier-changed events). Monetary fields in balance are integers in
micro-units (millionths of the account currency) — divide by 1,000,000 for
the display value.
Parameters
Path parameters
user_idstring (UUID)required400 invalid_user_id.Response
When the user has no custom slug, custom_slug is null. When the user has no
attribution history, recent_attributions is an empty array ([]), never
null.
user_idstring (UUID)tierintegertier_labelstringtier (e.g. "Silver").rate_bpsintegerprimary_codestringcustom_slugstring | nullnull if none is set.paid_invitees_infointegerbalanceobjectbalance.pending_microintegerbalance.available_microintegerbalance.lifetime_microintegerrecent_attributionsarrayErrors
| Code | Meaning | When it happens |
|---|---|---|
401 | admin_token_unset | The server has no operator token configured; the admin surface is disabled. |
401 | admin_token_invalid | The X-Admin-Token header is missing or does not match the configured token. |
400 | invalid_user_id | The {user_id} path segment is not a valid UUID. |
405 | method_not_allowed | A non-GET method was used on this exact path. |
500 | internal | An unexpected server-side error occurred while loading the overview or attribution rows. |
See errors.md for the full error envelope and shared conventions.
Examples
JavaScript (fetch)
const userId = "3f8c2a1e-9b4d-4c7a-8e21-6f0a1b2c3d4e";
const res = await fetch(
`https://api.triport.io/v1/admin/referrals/users/${userId}`,
{
headers: {
"X-Admin-Token": process.env.TRIPORT_ADMIN_TOKEN,
"Content-Type": "application/json",
},
},
);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const view = await res.json();
console.log(view.tier_label, view.balance.available_micro);
console.log(`${view.recent_attributions.length} recent events`);TypeScript SDK (@triport/sdk)
import { TriportAdmin } from "@triport/sdk";
const admin = new TriportAdmin({
baseUrl: "https://api.triport.io",
adminToken: process.env.TRIPORT_ADMIN_TOKEN!,
});
const view = await admin.referrals.getUser(
"3f8c2a1e-9b4d-4c7a-8e21-6f0a1b2c3d4e",
);
console.log(view.tierLabel, view.paidInviteesInfo);Python (triport-sdk)
import os
from triport import TriportAdmin
admin = TriportAdmin(
base_url="https://api.triport.io",
admin_token=os.environ["TRIPORT_ADMIN_TOKEN"],
)
view = admin.referrals.get_user("3f8c2a1e-9b4d-4c7a-8e21-6f0a1b2c3d4e")
print(view["tier_label"], view["balance"]["available_micro"])
for att in view["recent_attributions"]:
print(att["Event"], att["CreatedAt"])Notes
- Admin surface, not user surface. This route lives under
/v1/admin/referrals/*and is authorized solely byX-Admin-Token. It is not callable with a user session cookie or aBearerAPI key. Keep the token server-side. - Attribution field casing.
recent_attributionsrows use Go-style PascalCase keys (ID,UserID,Event, …), unlike the snake_case used elsewhere in this response. Match them exactly when parsing. - Fixed page size. The attribution tail is capped at 50 rows and is not paginated; it is intended as a quick audit context, not a full history export.
- Micro-units. Every
*_microfield is an integer in millionths. Format for display asvalue / 1_000_000. - Related operator endpoints. Set a user's tier with
POST /v1/admin/referrals/users/{user_id}/tier, and drive payout lifecycle withPOST /v1/admin/referrals/payouts/{id}/sentand.../failed. The retiredPOST /v1/admin/referrals/simulate-paidnow returns410 Gone.