Skip to content

Authentication

GamifyHost uses two types of API keys. Each key type grants access to a different set of endpoints.

Used by the embeddable widget and mobile SDKs. Safe to include in client-side code.

HeaderFormatExample
X-API-Keypk_test_* / pk_live_*pk_live_4e1baec9e705789eebc174f4eabc875a

Grants access to:

  • GET /v1/games
  • GET /v1/games/:gameType/config
  • POST /v1/games/play
  • GET /v1/leaderboard
  • GET /v1/users/:userId/sdk-balance
  • GET /v1/users/:userId/plays

Used for backend-to-backend integration. Never expose in client-side code.

HeaderFormatExample
X-API-Secretsk_test_* / sk_live_*sk_live_a3b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2

Grants access to:

  • POST /v1/points/award
  • GET /v1/users/:userId/balance
  • GET /v1/users/:userId/history

The key prefix determines the environment:

PrefixEnvironmentDescription
pk_test_ / sk_test_TESTSandbox data, no real rewards
pk_live_ / sk_live_LIVEProduction data, real rewards

Test and live data are fully isolated. A test key cannot access live data and vice versa.

All authentication errors follow the standard envelope:

{
"message": "Missing X-API-Key header",
"code": 401,
"status": "error"
}
CodeMessage
401Missing X-API-Key / X-API-Secret header
401Invalid API key
403API key has been revoked
403Application is not active
403Partner account not found

All API responses use a standard envelope:

{
"message": "Description of the result",
"code": 200,
"status": "success",
"data": { },
"meta": { }
}
FieldTypeDescription
messagestringHuman-readable result description
codeintegerHTTP status code
statusstring"success" or "error"
dataobject or arrayResponse payload (absent on errors)
metaobjectPagination info (only on paginated endpoints)

Paginated endpoints accept page (default 1) and limit (default 20) query parameters and return:

{
"meta": {
"page": 1,
"limit": 20,
"total": 156,
"totalPages": 8
}
}