User Profile
Fetch the currently authenticated user's profile in a single call: identity, role, group, remaining quota, request count, affiliate state, and sidebar permissions. The response is a deliberately whitelisted projection of the user record, not the raw database row.
quota integer alongside the human-readable group.
Authentication
This endpoint sits behind the standard user-auth middleware and requires both headers:
| Header | Notes |
|---|---|
Authorization: <ACCESS_TOKEN> | Raw access token. The Bearer prefix is accepted but not required. A session cookie also satisfies this check when the request originates from the BUZZ web console. |
Buzz-User: <user_id> | Mandatory. Must equal the authenticated user's id. Mismatch or omission returns HTTP 401. |
Buzz-User header is missing, the gateway returns the legacy text "Unauthorized, New-Api-User header not provided". The header the server actually reads is Buzz-User — the New-Api-User string is a leftover from the upstream project. Send Buzz-User.
Example request
curl -s 'https://buzzai.cc/api/user/self' \
-H "Authorization: Bearer $BUZZ_ACCESS_TOKEN" \
-H "Buzz-User: 1"import os, requests
resp = requests.get(
"https://buzzai.cc/api/user/self",
headers={
"Authorization": f"Bearer {os.environ['BUZZ_ACCESS_TOKEN']}",
"Buzz-User": "1",
},
timeout=10,
)
resp.raise_for_status()
profile = resp.json()["data"]
print(profile["username"], profile["group"], profile["quota"])const resp = await fetch("https://buzzai.cc/api/user/self", {
headers: {
Authorization: `Bearer ${process.env.BUZZ_ACCESS_TOKEN}`,
"Buzz-User": "1",
},
});
const { data } = await resp.json();
console.log(data.username, data.group, data.quota);Response (live, redacted)
{
"success": true,
"message": "",
"data": {
"id": 1,
"username": "buzz666",
"display_name": "buzz666",
"role": 100,
"status": 1,
"email": "",
"github_id": "<REDACTED_NUMERIC_ID>",
"discord_id": "",
"oidc_id": "",
"wechat_id": "",
"telegram_id": "",
"linux_do_id": "",
"group": "enterprise",
"quota": 29214128,
"used_quota": 588097249,
"request_count": 398916,
"aff_code": "tYxh",
"aff_count": 0,
"aff_quota": 0,
"aff_history_quota": 0,
"inviter_id": 0,
"setting": "{\"notify_type\":\"email\",\"quota_warning_threshold\":100000,\"gotify_priority\":0,\"record_ip_log\":true}",
"stripe_customer": "",
"sidebar_modules": "",
"permissions": {
"sidebar_modules": {},
"sidebar_settings": false
}
}
}
Verified live against buzzai.cc on 2026-05-26.
Response envelope
| Field | Type | Description |
|---|---|---|
| success | boolean | Always true on a 200. Errors flip this to false and populate message. |
| message | string | Empty on success; human-readable error string otherwise. |
| data | object | The user-profile projection (see below). |
data fields
The response is a hand-crafted whitelist, not a serialised user row. Sensitive columns such as password, access_token, verification_code, and admin-only remark are deliberately stripped before serialisation.
| Field | Type | Description |
|---|---|---|
| id | integer | User numeric id. Must match the Buzz-User header. |
| username | string | Login name. |
| display_name | string | Display name shown in the console. |
| role | integer | 1 = common user · 10 = admin · 100 = root. |
| status | integer | 1 = enabled · 2 = disabled. |
| string | Email address. Empty when not bound. | |
| github_id | string | GitHub numeric id. Empty when not bound. |
| discord_id | string | Discord id. Empty when not bound. |
| oidc_id | string | Generic OIDC subject. Empty when not bound. |
| wechat_id | string | WeChat openid. Empty when not bound. |
| telegram_id | string | Telegram numeric id. Empty when not bound. |
| linux_do_id | string | Linux.Do forum id. Empty when not bound. |
| group | string | Pricing/permission group name (e.g. default, enterprise). Determines which channels and prices apply. |
| quota | integer | Remaining quota in raw billing units. Convert to currency via the site's quota-display setting (see the Billing endpoints). |
| used_quota | integer | Lifetime consumed quota in raw units. |
| request_count | integer | Lifetime number of API requests this user has made. |
| aff_code | string | Affiliate / referral code unique to this user. |
| aff_count | integer | Number of users who signed up using this affiliate code. |
| aff_quota | integer | Affiliate quota currently available to redeem. |
| aff_history_quota | integer | Lifetime affiliate quota earned (already redeemed plus pending). |
| inviter_id | integer | User id of whoever invited this account, or 0 if direct signup. |
| setting | string | JSON-encoded user preferences. Parse it client-side; common keys include notify_type, quota_warning_threshold, record_ip_log. |
| stripe_customer | string | Stripe customer id when the account has used Stripe checkout, otherwise empty. |
| sidebar_modules | string | Per-user sidebar override extracted from setting.sidebar_modules. Empty means use the site default. |
| permissions | object | { sidebar_settings: bool, sidebar_modules: object }. Drives which modules render in the console UI. |
Fields deliberately excluded
The handler explicitly enumerates the fields above instead of serialising the user row, so the following columns are never included in the response, even for the root account:
password,original_password— credentialsaccess_token— the user's own access token (you already have it; the API never echoes it back)verification_code— transient signup/email coderemark— admin-only note, cleared server-side before any caller sees itdeleted_at,created_at,last_login_at,last_active_at— internal lifecycle timestamps
Errors
| HTTP | Body | Cause |
|---|---|---|
| 401 | {"success":false,"message":"Unauthorized, ..."} | Missing or invalid Authorization; missing or mismatched Buzz-User header; account disabled. |
| 429 | Rate-limit envelope | Global API rate limit hit. Respect retry-after. |
| 500 | {"success":false,"message":"..."} | Internal error fetching the user record. Retry with backoff. |
See also
- Billing endpoints — convert
quotato currency, fetch usage GET /api/token/— managesk-API tokens- Authentication guide — access tokens vs. user tokens