Home Β· Events

πŸ“š API Documentation

Public API reference for xb.live / Insignia Stats. Most routes are anonymous; a few require a valid Insignia session (noted per endpoint).

Table of Contents

Base URL

All endpoints are relative to your site (e.g. https://insigniastats.live).

Note: For game endpoints you can use either title ID (hex, e.g. 4d530064) or game name (URL-encoded where used in paths). Title IDs are stable identifiers across the platform.

Authentication (Insignia Auth)

Insignia Stats uses a separate auth service for login. To sign in on the website, use the Login page. Your account and password are managed by the Insignia auth service; the stats site does not store your password.

InsigniaAuth SDK

For integrating login into your own pages or apps, include the client SDK and use the InsigniaAuth class. The SDK persists the session in localStorage and exposes login, logout, and user data methods.

Include the script:
<script src="https://insigniastats.live/insignia-auth.js"></script>
Constructor:
Option Description
apiUrlAuth API base URL (default: https://auth.insigniastats.live/api)
storageKeylocalStorage key for session (default: insignia_auth)
Methods:
MethodDescription
login(email, password)Log in; returns { success, user, sessionKey }. Emits login event.
logout()Log out and clear session. Emits logout event.
getUser()Returns current user { username, email } or null.
isLoggedIn()Returns true if a session key exists (does not verify server-side).
verifySession()Verifies the session with the auth server; returns boolean.
getFriends()Returns cached friends: { friends: [{ gamertag, status, isOnline, game?, duration?, lastSeen? }], lastUpdated, count }. When online: game, duration; when offline: lastSeen.
getGames()Returns cached My Games Played: { games: [{ title, lastPlayed, iconUrl }], lastUpdated, count }. lastPlayed is e.g. "10 minutes ago".
getProfile()Returns cached profile: { isOnline, status, game?, timeOnline?, gamesPlayed: [{ title, lastPlayed, iconUrl }], lastUpdated, count }.
refreshFriends()Refreshes friends from Insignia; returns updated friends data.
refreshGames()Refreshes games (from profile My Games Played); returns updated games data.
refreshProfile()Refreshes profile from Insignia; returns updated profile.
getMutes()Deprecated. Mutes no longer available from Insignia; returns empty list.
startAutoVerify(intervalMs)Periodically re-verifies the session (e.g. every 5 minutes).
Events: on('login', fn), on('logout', fn), on('error', fn).
Example:
const auth = new InsigniaAuth({ apiUrl: 'https://auth.insigniastats.live/api' });
if (auth.isLoggedIn()) {
  const user = await auth.getUser();
  console.log('Logged in as', user.username);
} else {
  await auth.login(email, password);
}

Public profiles

Per-user profile data for the site. :username is the Insignia site username (URL-encode when needed). These GET routes are public.

GET
/api/profile/:username
Full profile bundle for the dashboard / profile page: display fields, play-time summary, achievement score and count, recent new unlocks, leaderboard presence, and linked gamertag flags.
Response (shape):
{
  "username": "PlayerOne",
  "profile": {
    "avatar_url": "...",
    "discord_profile_url": "...",
    "display_name_override": null,
    "linked_gamertag": "...",
    "xbox_verified": false,
    "bio": "...",
    "social_links": []
  },
  "playTime": { "totalMinutes": 0, "lastState": "offline", "currentGame": null, ... },
  "achievementScore": 1200,
  "achievementCount": 5,
  "newUnlocks": [],
  "leaderboardPlayerName": "GamertagOrUsername",
  "leaderboardStats": { "leaderboardsOn": 0, "top10Count": 0 },
  "usesExplicitXboxLiveGamertag": false
}
GET
/api/profile/:username/achievements
Evaluates achievements for the user, then returns score, unlocked achievements with details, and grouped layout for the UI. Hidden achievements show placeholder name/description until unlocked; after unlock, the group list uses the revealed title and description.
Response:
{
  "score": 1200,
  "achievements": [ ... ],
  "groups": [ ... ]
}
GET
/api/profile/:username/games-played
Games played summary (play-time and/or leaderboard-derived rows).
Response:
{
  "games": [ ... ],
  "leaderboardSupplement": false,
  "hasPlayTimeTracking": true
}
GET
/api/profile/:username/top-scores
Top leaderboard entries for the user’s resolved gamertag (linked Xbox gamertag when set, otherwise site username).
Query Parameters:
ParameterTypeDefaultDescription
limitinteger10Max entries (1–50)
Response:
{
  "playerName": "...",
  "explicitXboxLiveGamertag": null,
  "usingSiteUsernameFallback": true,
  "scores": [ ... ]
}

Update your profile (session)

Changing bio, avatar, linked gamertag, etc. requires a valid Insignia session. Send X-Session-Key as a header, or sessionKey in the JSON body.

PATCH
/api/me/profile
Updates the signed-in user’s profile. Writable fields: avatar_url, avatar_hue, discord_profile_url, display_name_override, linked_gamertag, bio, sync_avatar_from_discord. Optional social_links (normalized list) when Discord is linked per server rules. Discord URL changes may trigger avatar/name sync from Discord.
Auth / errors: 400 β€” missing sessionKey, invalid social links, or bad Discord URL; 401 β€” invalid session; 403 β€” social links without verified Discord; 502 β€” Discord lookup failure in some cases.

Reputation (player feedback)

Star ratings and optional comments left on user profiles. The displayed average uses a Bayesian-style prior (equivalent to 10 ratings at 5β˜…) so new profiles stay near 5 until real feedback arrives.

GET
/api/profile/:username/reputation
Public reputation stats and recent feedback. If the caller is signed in and has rated this profile, viewer contains their stars/comment (omit X-Session-Key for anonymous).
Query Parameters:
ParameterTypeDefaultDescription
feedbackLimitinteger12Recent feedback rows (max 30)

Optional session: header X-Session-Key or query sessionKey β€” used only to populate viewer when the signed-in user has already submitted feedback.

Response:
{
  "average": 4.85,
  "ratingCount": 3,
  "effectiveVotes": 13,
  "priorOnly": false,
  "feedback": [
    { "raterUsername": "...", "stars": 5, "comment": null, "createdAt": "..." }
  ],
  "viewer": null
}

When signed in and you have rated this profile, viewer is an object with stars, comment, createdAt; otherwise null.

POST
/api/profile/:username/reputation
Submit or update your rating for another user. You cannot rate yourself.
Body (JSON):
FieldTypeDescription
sessionKeystringRequired unless using X-Session-Key header
starsinteger1–5
commentstringOptional; trimmed, max 500 characters
Errors: 400 β€” missing session key, invalid username, self-rating, or invalid stars; 401 β€” invalid session.
Response:
{
  "success": true,
  "reputation": { "average": 4.9, "ratingCount": 4, ... },
  "viewer": { "stars": 5, "comment": null, "createdAt": "..." }
}

Gamerscore

Site-wide achievement catalog and leaderboards (points total and recent unlocks).

GET
/api/achievements/catalog
Full list of achievements plus a grouped layout for the UI. Some entries may include is_hidden; the public catalog never exposes revealed_name / revealed_description (those appear only on a profile after the user unlocks the achievement).
Response:
{
  "achievements": [ ... ],
  "groups": [ ... ],
  "stats": {
    "maxGamerscore": 12345,
    "totalAchievements": 400,
    "playersWithAchievements": 1200
  }
}
GET
/api/achievements/leaderboard
Top users by total gamerscore.
Query Parameters:
ParameterTypeDefaultDescription
limitinteger25Max rows (1–100)
Response:
{ "leaderboard": [ { "rank": 1, "username": "...", "totalScore": 1200, "achievementCount": 5 } ] }
GET
/api/achievements/recent
Most recent achievement unlocks across the site. Each achievementName includes the game label (e.g. Insignia Tourist β€” XBL Core or Be a WORM β€” Worms 4: Mayhem). Hidden achievements use the title Hidden Achievement with no spoiler details (no spoiler).
Query Parameters:
ParameterTypeDefaultDescription
limitinteger10Max rows (1–100)
Response:
{ "recent": [ { "username": "...", "unlockedAt": "...", "achievementId": 1, "achievementKey": "...", "achievementName": "...", "gameName": "...", "points": 10 } ] }

Insignia Stats

Site-wide stats scraped from the Insignia.live homepage.

GET
/api/insignia-stats/daily-registered
Daily snapshot of total registered users on Insignia (for charts).
Query Parameters:
Parameter Type Default Description
days integer 30 Number of days of history (1–365)
Response:
[
  { "date": "2025-02-01", "registered_count": 30028 },
  { "date": "2025-02-02", "registered_count": 30105 }
]
GET
/api/insignia-stats/online-24h
Five-minute snapshots of "Users Online Now" from the Insignia.live homepage. Data is retained for 30 days.
Query Parameters:
Parameter Type Default Description
days integer 1 Number of days of history: 1 (last 24 hours) or 7 (last 7 days), up to 30
Response:
[
  { "recorded_at": "2025-02-13 12:00:00", "online_count": 48 },
  { "recorded_at": "2025-02-13 12:05:00", "online_count": 52 }
]
GET
/api/insignia-stats/lobbies-24h
Five-minute snapshots of total lobby count across all games (from match data). Data is retained for 30 days.
Query Parameters:
Parameter Type Default Description
days integer 1 Number of days of history: 1 (last 24 hours) or 7 (last 7 days), up to 30
Response:
[
  { "recorded_at": "2025-02-13 12:00:00", "lobby_count": 12 },
  { "recorded_at": "2025-02-13 12:05:00", "lobby_count": 14 }
]

Online & site activity

Live per-game online counts, historical series, and a compact summary for β€œall stats” style widgets.

GET
/api/stats/summary
Aggregated peaks and activity for the last 24 hours or last 7 days (homepage / charts).
Query Parameters:
ParameterTypeDefaultDescription
periodstringtodaytoday β†’ last 24h; 7d β†’ last 168h
Response:
{
  "period": "today",
  "peakOnline": 48,
  "peakOnlineAt": "...",
  "peakLobbies": 12,
  "peakLobbiesAt": "...",
  "mostPlayedGame": { "name": "...", "titleId": "...", "peak": 42 },
  "gamesWithActivityCount": 15,
  "totalSnapshotCount": 288
}
GET
/api/online-users
Current online user counts for all tracked games.
Response:
{
  "Game Name One": {
    "name": "Game Name One",
    "online": 42,
    "titleId": "4d53006e",
    "image": "https://...",
    "publisher": "Microsoft Game Studios"
  },
  "Game Name Two": { ... }
}
GET
/api/title/:titleId/online-users/history
Historical online user data for a game by title ID.
URL Parameters:
Parameter Type Description
titleId string Game title ID (e.g. 4d530064)
Query Parameters:
Parameter Type Default Description
hours integer 48 Hours of history to retrieve
Example:
GET /api/title/4d530064/online-users/history?hours=24
GET
/api/online-users/history/:gameName
Historical online user data for a game by name. gameName is URL-encoded (e.g. Halo%202).

Game Data

GET
/api/title/:titleId
Game metadata by title ID.
Response:
{
  "titleId": "4d530064",
  "name": "Halo 2",
  "title": "Halo 2",
  "image": "https://...",
  "publisher": "Microsoft Game Studios",
  "releaseDate": "2004-11-09"
}
GET
/api/game/:gameName
Game metadata by game name. gameName is URL-encoded.

Game Statistics

GET
/api/title/:titleId/stats
Aggregate leaderboard statistics for a game by title ID.
Response:
{
  "titleId": "4d530064",
  "gameName": "Halo 2",
  "leaderboard_count": 120,
  "total_entries": 500000,
  "time_entries": 300000,
  "score_entries": 200000
}
GET
/api/game/:gameName/stats
Aggregate leaderboard statistics for a game by name.
GET
/api/title/:titleId/daily-stats
Daily stats (lobby count, peak players, etc.) for a game by title ID.

Leaderboards

GET
/api/title/:titleId/leaderboards
List of all leaderboards for a game by title ID.
Response:
[
  {
    "id": 42,
    "name": "Leaderboard Name",
    "titleId": "4d530064",
    "gameName": "Halo 2"
  }
]
GET
/api/game/:gameName/leaderboards
List of all leaderboards for a game by name.
GET
/api/title/:titleId/leaderboard/:id
All entries for a specific leaderboard (by title ID and leaderboard ID).
Response:
{
  "titleId": "4d530064",
  "gameName": "Halo 2",
  "leaderboardId": "42",
  "name": "Leaderboard Name",
  "entries": [
    {
      "rank": "1",
      "name": "PlayerName",
      "rating": "1000000",
      "timeMs": 120000,
      "timeFormatted": "2:00.000",
      "isTime": true
    }
  ]
}
GET
/api/game/:gameName/leaderboard/:id
All entries for a specific leaderboard (by game name and leaderboard ID).

Latest Changes

Recent leaderboard entry changes (new, updated, or removed).

GET
/api/changes
Latest changes across all games.
Query Parameters:
Parameter Type Description
limit integer Max number of changes to return
offset integer Offset for pagination
game string Filter by game name
GET
/api/changes/games
List of game names that have at least one change (for filter dropdowns).
Response:
["Halo 2", "Project Gotham Racing 2", ...]
GET
/api/title/:titleId/changes
Latest changes for a single game by title ID.
GET
/api/changes/by-date
Daily counts of leaderboard changes (for charts). Query: days (1–365, default 30).
GET
/api/changes/sync-runs
Per–sync-run change stats. Query: days (default 30), optional limit to cap rows.

Matches

GET
/api/title/:titleId/matches
Latest active matches for a game (e.g. last hour) by title ID.
Response:
{
  "titleId": "4d53004b",
  "gameName": "Project Gotham Racing 2",
  "matches": [
    {
      "hostName": "PlayerName",
      "currentPlayers": 8,
      "maxPlayers": 8,
      "timestamp": "2025-02-13 12:00:00"
    }
  ]
}
GET
/api/game/:titleId/matches
Live match notifications from the match database (richer fields than /api/title/:titleId/matches). Path uses the same hex title ID as other /api/title/... routes.
GET
/api/title/:titleId/matches/history
Match history for a game. Query: hours (default 24).
GET
/api/title/:titleId/matches/stats
Match statistics for a game (e.g. last 24 hours): total matches, peak players, unique hosts.
GET
/api/game/:gameName/matches
Legacy: latest matches by URL-encoded game name. Prefer /api/title/:titleId/matches or /api/game/:titleId/matches.
GET
/api/game/:gameName/matches/history
Legacy: match history by game name. Query: hours. Prefer /api/title/:titleId/matches/history.
GET
/api/game/:gameName/matches/stats
Legacy: match statistics by game name. Prefer /api/title/:titleId/matches/stats.

Events

GET
/api/events
List of upcoming and recent events.
GET
/api/events/:id
Single event by ID.
GET
/api/events/:id/summary
Public summary for an event (e.g. registration/payout aggregates when applicable).
GET
/api/paid-events
List of paid events.
GET
/api/paid-events/summary
Summary of paid events.

Error Responses

Endpoints may return:

{
  "error": "Error message description"
}

Common HTTP status codes:

Rate Limiting

There are no rate limits on the public API. Please use it responsibly.