Skip to content

Authentication

The API uses Bearer token API keys for authentication. No cookies, no sessions, no CSRF tokens.

Keys follow the format:

wpg_sk_{32 random hex characters}

Example: wpg_sk_a1b2c3d4e5f67890abcdef1234567890

The full key is shown once at creation and is never stored on the server (only an argon2 hash is kept). Store it securely.

  1. Go to Dashboard > Settings > API Keys
  2. Click Create API Key
  3. Enter a name (e.g., “My Bot”, “CI Pipeline”)
  4. Select the scopes you need
  5. Optionally set an expiry date
  6. Copy the full key — it will not be shown again

Register and receive an API key in one step:

Terminal window
curl -X POST https://app.weplaytestgames.com/api/v1/auth/register/api-key \
-H "Content-Type: application/json" \
-d '{
"email": "dev@example.com",
"password": "securepassword123",
"role": "game_owner",
"name": "My API Key"
}'

The key is issued immediately but inactive until email is verified. Any API call with an unverified key returns 403 Forbidden with error code EMAIL_NOT_VERIFIED.

Include your key in the Authorization header as a Bearer token:

Terminal window
curl -H "Authorization: Bearer wpg_sk_a1b2c3d4..." \
https://app.weplaytestgames.com/api/v1/auth/me

Each API key has one or more scopes that control which endpoint groups it can access:

ScopeGrants Access To
game_ownerGames, playtests, submissions, slots, dashboard stats
billingRead-only financial data: credit balance, payment history, invoices
chatChat contacts, conversations, messages
notificationsNotification listing, mark-as-read
  • billing is a read-only scope for accountants/finance tools — it can view balances, payment history, and download invoices, but cannot purchase credit or order playtests
  • Endpoints marked “any” in the endpoint tables require at least one valid scope but no specific scope
  • Public/unauthenticated endpoints (/api/v1/public/*, /api/v1/auth/register) require no key at all
MethodPathDescription
GET/auth/api-keysList your API keys (name, prefix, scopes, last used)
POST/auth/api-keysCreate a new API key
PATCH/auth/api-keys/:idUpdate key name or scopes
DELETE/auth/api-keys/:idRevoke an API key

These endpoints use cookie-based auth (the dashboard session), not API key auth.

  • Never commit API keys to version control
  • Use the minimum scopes needed for your use case
  • Set an expiry for keys used in temporary or CI environments
  • Rotate keys regularly — create a new key, update your app, then revoke the old one
  • Use separate keys for different applications or environments
  • Keys are only accepted over HTTPS — plain HTTP requests are rejected
StatusCodeWhen
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENValid key but insufficient scope
403EMAIL_NOT_VERIFIEDKey exists but account email not verified