Gamers Lab Docs

API Keys

Section 4 — API & Game Key Management

Section 4 — API & Game Key Management

Gamers Lab uses two distinct kinds of keys. They exist for different trust boundaries and must never be confused or merged.

Key Types — Side-by-Side

AspectTenant API KeysGame Auth Keys
Tablebus_tenant_api_keysbus_game_auth_keys
HeaderX-API-KeyX-Game-Key
Primary useRead dataWrite data
Used byExternal servicesGame servers / clients
DirectionRead-onlyWrite / ingest
Trust levelLowHigh
Granular flagsYes (flags + profiles)No (implicit by purpose)
Rate limitingPer-key minute/hour (Lua)Per-key minute/hour (Lua)
Quota enforcementNoYes (approximate hard-stop)
EnvironmentNot applicabledev / prod
Typical consumerBI tools, dashboardsUnity / Unreal / backend
Compromise impactData leakageData poisoning

Endpoints must enforce:

  • Tenant API Keys cannot hit write endpoints, except for the explicit allowAuth hosted-auth POST allowlist.
  • Game Auth Keys cannot hit read/analytics endpoints.

If a key works on both paths, the design is wrong.

Both key types record per-request usage to a durable Postgres ledger (bus_api_key_usage, bus_game_key_usage). Each row captures request count, bytes, status code, and billing classification. Game key usage is rolled into hourly summaries for analytics, while quota rollup workers process API key and game key usage for quota evaluation and alerts.

Sections

On this page