Developer Resources / API reference / GameLayer API

GameLayer API reference

Every endpoint your application calls at runtime: players, events, progress, prizes and leaderboards. Version 3.1.1, 57 endpoints.

Authentication. Send your Account API key in the api-key header and your account ID as the account parameter. New to GameLayer? Read Concepts first.

Introduction#

This is the API specification for GameLayer's gamification and rewards platform.

Authentication#

You authenticate to the GameLayer API by providing your secret API key in the request header api-key

GameLayer creates your account and its API key. An account admin finds the account ID and the API key on the account page in the GameLayer dashboard (https://app.gamelayer.co).

In case the account ID does not match with the API key, HTTP status 401, Not Authorized will be the response.

Errors#

The API uses standard HTTP status codes to indicate the success or failure of an API call. The body of the response will be JSON in the following format:

{
    "error": "Player 'player-520' exists for account 'docs-for-devs'",
    "errorCode": 22
}

Rate limits#

Writes and claims are limited per API key and account, in one-minute windows:

EndpointRequests a minute
POST /events/{id}/complete6,000
POST /players600
POST /quizzes/{id}/complete, POST /surveys/{id}/complete600 each
Claims on prizes, mystery boxes and raffles60 each

Over a limit, the response is HTTP status 429 with a Retry-After header in seconds and the body {"code": "RATE_LIMIT_EXCEEDED", "message": "…"}.

Reads have no per-key limit. Any one IP address is limited to 2,000 requests a minute across all endpoints, whatever the per-key limits allow; a single server can't go beyond this. Over it, requests get HTTP status 429 with an error message and no Retry-After header until the minute has passed: a 429 without Retry-After means wait for the next minute.

A separate 429 with error code 24 means another request is updating the same player. Wait for its Retry-After (1 second) and retry.

Retrying requests#

Event completions: send an Idempotency-Key. A request can reach GameLayer and count while its response is lost. Generate a key (a UUID v4) once per player action, send it in the Idempotency-Key header, and retry with the same key and the identical JSON body:

  • A retry of a request that succeeded gets the same response, with X-Idempotent-Replay: true, and counts nothing again.
  • A retry while the first request is still running gets 429 with error code 24 ("still being processed"); wait for Retry-After and try again. After a server stop this can last up to 60 seconds.
  • A retry after a 5xx either gets the stored outcome (if the event had counted, a replay with the body {"replayed": true, "bodyRetained": false}) or runs again. In rare cases a run again repeats rewards given before the failure.
  • A replay is returned even if the event or player has since been changed or deleted. After your API key is rotated, a retry gets 401, not the replay.
  • Keys are kept 24 hours. Retry for up to 23 hours; after that, drop the event (for example in an offline mobile app) rather than send it again, since it may already have counted.

Without a key, completing an event is not idempotent: a request that reached GameLayer but whose response was lost has already counted, and a retry counts the event again, with its rewards. Only an event's completion limit, once reached, stops further counting.

Other writes. Quiz and survey completions and claims take no idempotency key: read the player's state before you retry them. Reads are safe to retry.

Dual (Virtual) Currency System#

GameLayer uses two distinct virtual currencies:

CurrencyBehaviorPurpose
PointsAccumulate over time. Never decrease through player actions; an update (PATCH /players/{player}) can lower them, even below zero.Progression and ranking — points determine level advancement and leaderboard position.
CreditsSpendable balance. Increase when earned, decrease when redeemed.Economy — credits are spent on prizes, mystery boxes, and raffle tickets.

Both currencies can be awarded by events, missions, achievements, levels, streaks, quizzes, and surveys.

Requirements and Eligibility#

Most elements support a requirement block that acts as a prerequisite gate. A player must satisfy all specified conditions to be eligible:

  • Tags — player must have all listed tags.
  • Missions — player must have completed all listed missions.
  • Achievements — player must have completed all listed achievements.
  • Level — player must have reached at least the specified level (by ordinal).
  • Category — player must belong to the specified category.

Requirements are checked at the time of interaction (event completion, prize redemption, etc.). If a player does not meet the requirements, the element is hidden from listing or the action is denied.

Periods and Refresh Cycles#

Many elements operate on a period that determines how often they reset:

PeriodResets
dailyOnce per day
weeklyOnce per week
monthlyOnce per month
all-timeNever resets

When a period resets, completion counts and progress for that element start fresh. Progress toward a mission that isn't complete at the reset is lost, not carried over; rewards already given are kept.

Missions reset at midnight in the player's refreshOffset (see below): daily every day, weekly on Monday, monthly on the 1st. Streaks, prizes and mystery boxes reset at 00:00 UTC whatever the player's offset.

GameLayer has no webhooks. Progress is returned in the response of the call that caused it (for example an event completion's progress) and by the GET endpoints.

Refresh Offset#

Each player has a configurable refreshOffset (e.g., UTC+02:00) that determines when their daily/weekly/monthly missions roll over. This ensures fair timing regardless of the player's timezone. Offsets are whole hours from UTC-12:00 to UTC+14:00; UTC-00:00 is stored as UTC+00:00. If no refreshOffset has been provided, refresh will happen at UTC+00:00.

For example, a player on UTC+02:00 gets their weekly missions reset on Monday at 00:00 local time (Sunday 22:00 UTC), and their monthly missions on the 1st at 00:00 local time.

The offset is fixed: it doesn't follow daylight saving time. A player in Finland is UTC+02:00 in winter and UTC+03:00 in summer, so update the offset when the clocks change if the reset time matters.

The Progression Cascade#

When your application calls POST /events/{id}/complete, a single action can cascade through multiple elements automatically:

  1. Event completes — awards points, credits, and achievement steps.
  2. Rules evaluate — matching rules apply point multipliers.
  3. Missions progress — missions with this event in their objectives update. Completed missions grant their reward.
  4. Streaks update — if a completed mission is linked to a streak, the streak count increments or resets if the streak was not hit within its period.
  5. Achievements advance — steps from events, missions, and streaks are applied. Completed achievements grant their reward and may chain to other achievements.
  6. Levels check — if accumulated points, credits, or achievements meet the next level's objectives, the player levels up. Multiple level ups can occur in a single cascade if the player jumps multiple levels at once.
  7. Leaderboards update — player and team scores are updated.

The response includes a progress object summarizing everything that happened.

Servers#

  • https://api.gamelayer.co/api/v0

Achievements#

See Concepts for background.

Achievements are step-based milestones that players accumulate progress toward over time. Unlike missions, achievements have no period — they are always-on and progress is never reset.

Each achievement requires a set number of steps to complete. Steps are incremented automatically when players complete other elements — events, missions, quizzes, surveys, or other achievements. When the step target is reached, the achievement completes and grants its configured reward (points, credits, and/or steps toward other achievements).

Achievement chaining: An achievement's reward can include steps toward other achievements. For example, completing "Bronze Collector" could grant 1 step toward "Silver Collector".

Achievements support requirements (tags, missions, achievements, level, category) that gate eligibility. Requirements are checked when the achievement is first unlocked.

GET /achievements/{id}

Retrieves the achievement with the specified ID within the given account.

Achievements are step-based milestones with no period — progress is never reset. Steps are incremented when players complete other elements (events, missions, quizzes, surveys, or other achievements). When the step target is reached, the achievement completes. An achievement's reward can include steps toward other achievements (chaining).

Parameters

NameTypeDescription
id required
in path
string

ID of the achievement

account required
in query
string

ID of the account to use for the query

language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Achievement retrieved successfully
  • 404 Achievement not found or no elements matching the language filter.
Example response
{
  "description": "Game On! You unlocked the Game Addict badge!!",
  "category": "",
  "tags": [
    "gamer"
  ],
  "isAvailable": true,
  "steps": 10,
  "id": "game-addict",
  "name": "Game Addict",
  "imgUrl": "https://images.gamelayer.co/glimages/acme/badge1.png",
  "requirement": {
    "category": "",
    "tags": [],
    "missions": [],
    "achievements": [],
    "level": {
      "id": "",
      "ordinal": 0
    }
  },
  "reward": {
    "points": 10,
    "credits": 10,
    "achievements": []
  }
}

GET /achievements

Retrieves achievements based on provided query within the given account

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

player
in query
string

If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

tags
in query
string

Specifies the tags by which to filter results. You may specify a comma-separated list of all tags to include and/or exclude (preceding their ID mith a minus sign). Defaults to empty string, all tags are returned

availability
in query
string: all, true, false

Specifies the availability by which to filter results. Allowed values are:

  • all - return all results regardless of their availability status
  • true - return only available results)
  • false - return only unavailable results
sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

Responses

  • 200 Achievements retrieved successfully
  • 404 The player given as a filter does not exist (errorCode 3).
Example response
[
  {
    "description": "Game On! You unlocked the Game Addict badge!!",
    "category": "",
    "tags": [
      "gamer"
    ],
    "isAvailable": true,
    "steps": 10,
    "id": "game-addict",
    "name": "Game Addict",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/badge1.png",
    "requirement": {
      "category": "",
      "tags": [],
      "missions": [],
      "achievements": [],
      "level": {
        "id": "",
        "ordinal": 0
      }
    },
    "reward": {
      "points": 10,
      "credits": 10,
      "achievements": []
    }
  }
]

Analytics#

Analytics endpoints provide aggregate metrics on player interactions with gamification elements. Track completion counts for missions, achievements, events, levels, and other elements over time. Use the active players endpoint to query how many unique players have been active within a given date range. Analytics data helps identify engagement patterns and measure the effectiveness of your gamification configuration.

GET /analytics

Retrieves the account's lifetime totals: players, completions, points and credits awarded, prize and mystery box draws, API calls and more.

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

Responses

  • 200 Analytics retrieved successfully. Before the first analytics update every figure is 0.
  • 401 The API key does not match the account.
Example response
{
  "account": "acme",
  "objectType": 2,
  "players": 1520,
  "activePlayers": 342,
  "missions": 8410,
  "startedMissions": 12033,
  "points": 1284500,
  "credits": 96210,
  "achievements": 2310,
  "unlockedAchievements": 5402,
  "levelUps": 1890,
  "prizeDraws": 140,
  "mysteryBoxes": 612,
  "prizes": 980,
  "apiCalls": 2203411,
  "surveys": 410,
  "quizzes": 1220,
  "streaksStarted": 730,
  "streaksCompleted": 95,
  "ts": "2026-10-23T09:00:00.000Z"
}

GET /analytics/activeplayers

Retrieves active players for given account for given period. Only the date part of query parameters will be used and is required. Date is given in format YYYY-MM-DD. Example: 2022-09-01

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

startDate required
in query
string

Specifies the start date for the query.

endDate required
in query
string

Specifies the end date for the query.

Responses

  • 200 Active player data retrieved successfully
  • 400 Invalid request. Check start and end date in request.

Events#

See Concepts for background.

Events are the fundamental building blocks of GameLayer. An event represents a discrete player action that your application reports via POST /events/{id}/complete.

When an event completes, GameLayer awards the configured reward (points, credits, achievement steps) and triggers the progression cascade: missions progress toward their objectives, streaks update, achievements advance, levels are checked, leaderboard scores update, and rules evaluate for point multipliers.

Key properties:

  • Reward: Points, credits, and/or achievement steps awarded on completion.
  • Count limit: Optionally cap completions per player per period (daily/weekly/monthly/all-time).
  • Count parameter: Pass a count value to register multiple completions in a single call.
  • Mode: increment (add to count) or set (set count to a specific value, adjusting rewards accordingly).
  • Tags: Dynamic context tags can be passed at completion time.

POST /events/{id}/complete

Completes the defined event for the specified player within the given account. This is the primary integration endpoint — it triggers the full progression cascade:

  1. The event's configured reward (points, credits, achievement steps) is awarded.
  2. Rules are evaluated and point multipliers applied if conditions match.
  3. Missions with this event in their objectives have progress updated; completed missions grant their rewards.
  4. Streaks linked to completed missions are incremented (or reset if a period was missed).
  5. Achievements receiving steps are advanced; completed achievements grant their rewards and may chain.
  6. Level objectives are checked; the player levels up if thresholds are met.
  7. Leaderboard scores are updated for the player and their team.

The response includes a progress object summarizing all completed missions, started missions, completed/unlocked achievements, level changes, streak updates, and triggered rules.

Parameters:

  • count — number of completions to register (default: 1). Useful for batch actions (e.g., "walked 5000 steps").
  • tags — optional tags passed at completion time for dynamic context and requirement matching.

If a language property is provided in the body, the response will contain translated elements. In case no translations are found for the language, default texts will be used in the response.

Retrying safely with an Idempotency-Key. A request can reach GameLayer and count while its response is lost (a timeout, a dropped mobile connection). Send an Idempotency-Key header, generated once per player action, and retry with the same key and the identical JSON body until you get an answer:

  • The first request completes the event and stores its response for 24 hours.
  • A retry gets that same response, byte for byte, with X-Idempotent-Replay: true, and counts nothing again.
  • A retry while the first request is still running gets 429 ("still being processed"); wait for Retry-After and try again. After a server stop this can last up to 60 seconds.
  • The same key with a different body gets 422: a new action needs a new key.
  • Retry for up to 23 hours. After that, drop the event rather than send it again, since it may already have counted.

Without the header, the endpoint behaves as before: every request counts.

Parameters

NameTypeDescription
id required
in path
string

ID of the event

Idempotency-Key
in header
string

A key you generate once per player action and send again, unchanged, on every retry of that action. A UUID v4 is recommended. 1 to 255 printable ASCII characters (0x21 to 0x7E), sent once.

The first request with a key completes the event and its response is stored for 24 hours. A retry with the same key and the identical JSON body gets the stored response, with the header X-Idempotent-Replay: true, and counts nothing again. The same key with a different body gets 422. Keys are scoped to your account.

Request body

Event completion details

NameTypeDescription
account requiredstring

ID of the account for the operation

player requiredstring

ID of the player

countinteger

Amount of completions for the event. If event is limited, player can complete the event only the the amount of times specified by the event limitation

tagsarray of string

An array of tags

languagestring

ISO 639-1 language code for the requested language, like 'en'. If none is provided, texts for the main gamelayer element will be provided. If the given code is not in the list of currently supported languages or definitions for the specified language query do not exist, an HTTP error response is provided. List of supported languages is:

  • en - English
  • ar - Arabic
  • zh - Chinese
  • cs -Czech
  • fi - Finnish
  • fr - French
  • de - German
  • el - Greek
  • hi - Hindi
  • it - Italian
  • ja - Japanese
  • kk - Kazakh
  • pt - Portuguese
  • ru - Russian
  • es - Spanish
  • sv - Swedish
  • tr - Turkish
latnumber (double)

Player's current latitude (WGS84)

lonnumber (double)

Player's current longitude (WGS84)

{
  "player": "player-080277",
  "account": "docs-for-devs"
}

Responses

  • 200 Event completed. With an Idempotency-Key that was already used successfully, this is the stored response of the first request, with X-Idempotent-Replay: true. A replay whose response was not stored (larger than 256 kB, or the first request failed after the event had counted) has the body {"replayed": true, "bodyRetained": false}: the event counted once, so read the player to see their state.
  • 400 Invalid request. Check request data. An Idempotency-Key that is empty, longer than 255 characters, holds characters outside printable ASCII, or is sent more than once gets error code 110.
  • 404 Needed element not found (player, event).
  • 422 The Idempotency-Key was already used for a different request (another event, player or body). Nothing was counted. Use a new key for a new action.
  • 429 Player is currently being processed by another request. The client should wait and retry after the duration indicated by the Retry-After header (in seconds). This happens when concurrent requests attempt to complete events for the same player simultaneously, or when a request with the same Idempotency-Key is still being processed.
  • 503 The Idempotency-Key record could not be read or written. Nothing was counted. Retry with the same key after Retry-After seconds.
Example response
{
  "event": {
    "description": "",
    "category": "",
    "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
    "isAvailable": true,
    "limitCount": false,
    "id": "ev-2",
    "name": "ev-2",
    "reward": {
      "points": 1,
      "credits": 0,
      "achievements": []
    }
  },
  "player": {
    "name": "Str-2 Player",
    "points": 697,
    "credits": 0
  },
  "progress": {
    "points": {
      "before": 662,
      "earned": 35
    },
    "credits": {
      "before": 0,
      "earned": 0
    },
    "levels": {
      "completed": []
    },
    "missions": [
      {
        "id": "m-2",
        "name": "m-2",
        "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
        "description": "Mission driven by ev-2",
        "points": 25,
        "credits": 0
      }
    ],
    "startedMissions": [
      {
        "id": "m-2",
        "name": "m-2",
        "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
        "description": "Mission driven by ev-2"
      }
    ],
    "achievements": [],
    "unlockedAchievements": [],
    "rules": [],
    "completedStreaks": [
      {
        "id": "streak-1",
        "name": "Streak One",
        "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
        "description": "Streak One Description",
        "streakCount": 1,
        "points": 10,
        "credits": 0,
        "startedOn": "2024-04-08T02:34:33.870Z",
        "completedOn": "2024-04-08T02:34:33.870Z",
        "lastStreakOn": "2024-04-08T02:34:33.870Z"
      }
    ],
    "activeStreaks": [
      {
        "id": "streak-2",
        "name": "Streak Two",
        "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
        "description": "Streak Two Description",
        "streakCount": 2,
        "points": 0,
        "credits": 0,
        "startedOn": "2024-04-08T02:34:59.361Z",
        "lastStreakOn": "2024-04-09T06:34:59.361Z"
      }
    ]
  }
}

GET /events/{id}

Retrieves the event with the specified ID within the given account

Parameters

NameTypeDescription
id required
in path
string

ID of the event

account required
in query
string

ID of the account to use for the query

language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Event retrieved successfully
  • 404 Event not found or no elements matching the language filter.
Example response
{
  "description": "Use this event each time the player plays a game",
  "category": "",
  "tags": [],
  "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
  "isAvailable": true,
  "id": "play-game",
  "name": "Play Game",
  "reward": {
    "points": 0,
    "credits": 0,
    "achievements": []
  }
}

GET /events

Retrieves events specified by given query within the given account.

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

availability
in query
string: all, true, false

Specifies the availability by which to filter results. Allowed values are:

  • all - return all results regardless of their availability status
  • true - return only available results)
  • false - return only unavailable results
sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Events retrieved successfully
  • 401 The API key does not match the account.
Example response
[
  {
    "description": "Use this event each time the player plays a game",
    "category": "",
    "tags": [],
    "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
    "isAvailable": true,
    "id": "play-game",
    "name": "Play Game",
    "reward": {
      "points": 0,
      "credits": 0,
      "achievements": []
    }
  },
  {
    "description": "Use this event each time the player watches a video",
    "category": "",
    "tags": [],
    "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
    "isAvailable": true,
    "id": "watch-video",
    "name": "Video Player",
    "reward": {
      "points": 0,
      "credits": 0,
      "achievements": []
    }
  }
]

Journal#

The journal provides a complete audit trail of all point and credit transactions for each player. Every time points or credits are earned or spent through gamification elements — missions, achievements, events, prizes, and more — a journal entry is recorded. Use the journal to query a player's transaction history within a date range, or retrieve an aggregated summary of earned and spent totals.

GET /journal

Retrieves journal entries for a specific player within the given date range. Journal entries record all point and credit transactions (earned and spent) across gamification elements such as missions, achievements, events, and prizes.

Results are paginated and sortable. Use skip and limit for pagination.

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

player required
in query
string

ID of the player to use for the query

startDate required
in query
string

Specifies the start date for the query.

endDate required
in query
string

Specifies the end date for the query.

elementType
in query
string

Filter entries by the type of gamification element that generated the entry. Examples: mission, achievement, event, prize

action
in query
string: earn, spend, award, voucher-redeem

Filter entries by action type. Allowed values are:

  • earn - entries where points or credits were earned
  • spend - entries where points or credits were spent
  • award - a mission prize was awarded
  • voucher-redeem - a prize was claimed with a voucher code
limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

sort
in query
string: timestamp, points, credits, elementType, elementId, action

Field to sort by: timestamp (default), points, credits, elementType, elementId or action. Any other value answers 400.

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first

Responses

  • 200 Journal entries retrieved successfully
  • 400 Invalid query (errorCode 26): account, player, startDate or endDate is missing, a date is not in YYYY-MM-DD format, a parameter is given more than once or as an object, or sort is not one of the allowed fields.
  • 500 The journal could not be read (errorCode 1004)
Example response
{
  "account": "demo-account",
  "player": "player-1",
  "entries": [
    {
      "timestamp": "2025-01-15T10:30:00.000Z",
      "points": 250,
      "credits": 100,
      "elementType": "mission",
      "elementId": "daily-login",
      "action": "earn"
    },
    {
      "timestamp": "2025-01-15T11:00:00.000Z",
      "points": 0,
      "credits": 50,
      "elementType": "prize",
      "elementId": "coffee-voucher",
      "action": "spend"
    }
  ]
}

GET /journal/summary

Retrieves an aggregated summary of a player's journal entries within the given date range. The summary groups entries by action type (earn and spend) and provides totals for points, credits, and the number of transactions in each category. award and voucher-redeem entries are not included.

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

player required
in query
string

ID of the player to use for the query

startDate required
in query
string

Specifies the start date for the query.

endDate required
in query
string

Specifies the end date for the query.

Responses

  • 200 Journal summary retrieved successfully
  • 400 Invalid query (errorCode 26): account, player, startDate or endDate is missing, a date is not in YYYY-MM-DD format, or a parameter is given more than once or as an object.
  • 500 The journal could not be read (errorCode 1004)
Example response
{
  "account": "demo-account",
  "player": "player-1",
  "earned": {
    "points": 1500,
    "credits": 300,
    "count": 12
  },
  "spent": {
    "points": 0,
    "credits": 150,
    "count": 3
  }
}

Leaderboards#

See Concepts for background.

Leaderboards provide competitive rankings comparing players or teams based on accumulated points or credits.

Key properties:

  • Element: player (individual ranking), team (team aggregate scores), or teammembers (players ranked within a specific team).
  • Rank by: total (sum of scores) or average (average per team member — useful for fair team comparison regardless of team size).
  • Units: points or credits — which currency drives the score.
  • Driven by: Optional list of mission IDs. When set, only completions of those missions contribute to the leaderboard. When empty, all point/credit activity counts.
  • Period: daily, weekly, monthly, or all-time. Scores reset each period.

Scores update automatically as players earn points or credits. Rankings are computed dynamically with proper tie handling. Leaderboards support requirements for eligibility gating.

GET /leaderboards/{id}

Retrieves ranked score data for the specified leaderboard. Scores update automatically as players earn points or credits. Rankings are computed dynamically with proper tie handling.

The leaderboard's element type determines what is ranked: player (individuals), team (team aggregates), or teammembers (players within a specific team — requires the team parameter). For team leaderboards, rankBy controls scoring: total (sum of member scores) or average (average per member for fair comparison).

If the leaderboard has a drivenBy configuration, only completions of the specified missions contribute to scores. Otherwise, all point/credit activity counts.

If the leaderboard contains a partition, the partition value to query must be provided as a parameter.

Parameters

NameTypeDescription
id required
in path
string

ID of the leaderboard

account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

team
in query
string

Team for which to retrieve leaderboard scores. Required if the leaderboard is partitioned by team members vs team members, ignored otherwise

rankBy
in query
string: total, average

Specifies how team leaderboard data is compared. This is only relevant if element is set to team. Allowed values are:

  • total - total points for team
  • average - average points for team
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Leaderboard retrieved successfully
  • 404 Leaderboard not found or no elements matching the language filter.
Example response
{
  "leaderboard": {
    "name": "Hall of Fame",
    "description": "Can you become the Leader of the Pack?!",
    "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
    "period": "all-time",
    "id": "hall-of-fame"
  },
  "scores": {
    "totalPlayers": 2,
    "data": [
      {
        "player": "player5@test.com",
        "name": "Joe Doe",
        "scores": 108000,
        "points": 108000,
        "tags": [],
        "rank": 1
      },
      {
        "name": "Joe Bloggs",
        "scores": 26110,
        "points": 26110,
        "player": "player1@test.com",
        "tags": [],
        "rank": 2
      }
    ]
  }
}

GET /leaderboards

Retrieves all of the leaderboards within the given account

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

player
in query
string

If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

availability
in query
string: all, true, false

Specifies the availability by which to filter results. Allowed values are:

  • all - return all results regardless of their availability status
  • true - return only available results)
  • false - return only unavailable results
sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

Responses

  • 200 Leaderboards retrieved successfully
  • 401 The API key does not match the account.
Example response
[
  {
    "name": "Hall of Fame",
    "description": "Can you become the Leader of the Pack?!",
    "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "period": "all-time",
    "element": "player",
    "rankBy": "total",
    "units": "points",
    "id": "hall-of-fame",
    "active": {
      "from": "2021-12-31T22:00:00.000Z",
      "to": "2022-12-30T22:00:00.000Z"
    },
    "requirement": {
      "category": "",
      "tags": [],
      "missions": [],
      "achievements": [],
      "level": {
        "id": "",
        "ordinal": 0
      }
    }
  }
]

Levels#

See Concepts for background.

Levels represent a player's progression tier, forming an ordered ladder that players advance through sequentially.

Each level has an ordinal (position in the ladder, starting at 0) and objectives defining what the player must accumulate to reach it — points, credits, and/or specific achievements. A player must complete level N before reaching level N+1.

As players earn points and credits through events, missions, and other elements, the platform automatically checks whether they qualify for the next level. When a level is reached, its configured reward (points, credits, achievement steps) is granted.

Levels can be used in requirements to gate access to other elements (e.g., "must be level 3 to access premium missions").

GET /levels/{id}

Retrieves the level with the specified ID within the given account.

Levels form an ordered ladder defined by ordinal positions (starting at 0). Each level has objectives (points, credits, and/or achievements) that a player must accumulate to reach it. Advancement is sequential — a player must complete level N before reaching level N+1. Reaching a level grants its configured reward.

Parameters

NameTypeDescription
id required
in path
string

ID of the level

account required
in query
string

ID of the account to use for the query

language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Level retrieved successfully
  • 404 Level not found or no elements matching the language filter.
Example response
{
  "name": "Wookie Rookie",
  "description": "Level Up! Nice work .. You made the grade and became a Rookie!!",
  "imgUrl": "https://images.gamelayer.co/glimages/acme/3572830.png",
  "category": "",
  "tags": [],
  "isAvailable": true,
  "id": "level-2",
  "ordinal": 1,
  "objectives": {
    "points": 1000,
    "credits": 0,
    "achievements": []
  },
  "reward": {
    "points": 0,
    "credits": 0,
    "achievements": []
  }
}

GET /levels

Retrieves all of the levels within the given account

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

availability
in query
string: all, true, false

Specifies the availability by which to filter results. Allowed values are:

  • all - return all results regardless of their availability status
  • true - return only available results)
  • false - return only unavailable results
sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

Responses

  • 200 Levels retrieved successfully
  • 401 The API key does not match the account.
Example response
[
  {
    "name": "Total Noob",
    "description": "You have to start somewhere .. So start at the very beginning!",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/3572829.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "id": "level-1",
    "ordinal": 0,
    "objectives": {
      "points": 100,
      "credits": 0,
      "achievements": []
    },
    "reward": {
      "points": 0,
      "credits": 0,
      "achievements": []
    }
  },
  {
    "name": "Wookie Rookie",
    "description": "Level Up! Nice work .. You made the grade and became a Rookie!!",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/3572830.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "id": "level-2",
    "ordinal": 1,
    "objectives": {
      "points": 1000,
      "credits": 0,
      "achievements": []
    },
    "reward": {
      "points": 0,
      "credits": 0,
      "achievements": []
    }
  },
  {
    "name": "Grand Master",
    "description": "Level Up! You rock .. The hard work paid off and you made it to Master!!",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/3572831.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "id": "level-3",
    "ordinal": 2,
    "objectives": {
      "points": 5000,
      "credits": 0,
      "achievements": []
    },
    "reward": {
      "points": 0,
      "credits": 0,
      "achievements": []
    }
  }
]

Missions#

See Concepts for background.

Missions are goal-based challenges that require players to complete one or more objectives within a time period.

Lifecycle: available → started (first relevant event completed) → completed (all objectives met).

Key properties:

  • Objectives: Events with target counts (e.g., "complete event X 5 times"). Can also be driven by other missions, a quiz, or a survey.
  • Period: daily, weekly, monthly, or all-time. Progress resets each period.
  • Count limit: Cap how many times a player can complete the mission per period (default: once).
  • Time to complete: Optional time limit (in seconds) from when the mission starts.
  • Reward: Points, credits, and/or achievement steps awarded on completion.
  • Requirement: Prerequisites (tags, missions, achievements, level, category) the player must meet to be eligible.

Mission progress updates automatically as players complete events. When all objectives are met, the mission completes and grants its reward. Completed missions can drive streaks and contribute to leaderboard scores via the drivenBy mechanism.

GET /missions/{id}

Retrieves the mission with the specified ID within the given account.

Missions follow the lifecycle: available → started (first relevant event completed) → completed (all objectives met). The response includes the mission's objectives (events with target counts), period, count limit, reward, and requirement configuration. Use the player-specific mission progress endpoint to see a player's current objective counts.

Parameters

NameTypeDescription
id required
in path
string

ID of the mission

account required
in query
string

ID of the account to use for the query

language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Mission retrieved successfully
  • 404 Mission not found or no elements matching the language filter.
Example response
{
  "timeToComplete": 0,
  "timeToRestart": 0,
  "limitTimeToRestart": false,
  "description": "Complete the game before the end of the month",
  "priority": 2,
  "category": "",
  "isAvailable": true,
  "limitCount": false,
  "countLimit": 1,
  "tags": [],
  "imgUrl": "https://images.gamelayer.co/glimages/acme/game2.png",
  "id": "play-me",
  "name": "Gaming is Life",
  "active": {
    "from": "2021-12-31T22:00:00.000Z",
    "to": "2022-12-30T22:00:00.000Z"
  },
  "period": "monthly",
  "objectives": {
    "events": [
      {
        "currentCount": 0,
        "id": "play-game",
        "count": 1
      }
    ],
    "missions": []
  },
  "requirement": {
    "category": "",
    "tags": [
      "gamer"
    ],
    "missions": [],
    "achievements": [],
    "level": {
      "id": "level-2",
      "ordinal": 1
    }
  },
  "reward": {
    "points": 250,
    "credits": 100,
    "achievements": [
      {
        "id": "game-addict",
        "steps": 1
      }
    ],
    "prizeId": "",
    "expireMissionOnZeroStock": false
  }
}

GET /missions

Retrieves all the missions within the given account. By default, the timeframe parameter is set to current, which returns only missions whose active window includes the current date. Use timeframe=all to include expired and upcoming missions, or timeframe=upcoming/timeframe=expired for specific windows.

When the player parameter is provided, results are filtered based on the player's eligibility (requirements and tags).

Results are sorted by active start date.

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

tags
in query
string

Specifies the tags by which to filter results. You may specify a comma-separated list of all tags to include and/or exclude (preceding their ID mith a minus sign). Defaults to empty string, all tags are returned

player
in query
string

If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned

timeframe
in query
string: expired, current, all

Specifies the timeframe by which to filter results. You may specify a comma-separated list of all allowed timeframes for the queried objects. Allowed values are:

  • expired - objects with an active end date in the past
  • current - objects currently active
  • upcoming - objects with an active start date in the future
  • all - all objects, regardless of their active period
availability
in query
string: all, true, false

Specifies the availability by which to filter results. Allowed values are:

  • all - return all results regardless of their availability status
  • true - return only available results)
  • false - return only unavailable results
sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

lat
in query
number (double)

Player's current latitude (WGS84). When provided together with lon, results are filtered based on the player's proximity to location-aware elements. Non-location-aware elements are always included regardless of this parameter.

lon
in query
number (double)

Player's current longitude (WGS84). Must be provided together with lat for location-based filtering to take effect.

locationFilter
in query
string: actionable, viewable

Specifies which location zone to use for filtering when lat and lon are provided.

  • actionable - return elements where the player is within the actionable zone (default)
  • viewable - return elements where the player is within the viewable zone

Responses

  • 200 Missions retrieved successfully
  • 404 The player given as a filter does not exist (errorCode 3).
Example response
[
  {
    "timeToComplete": 0,
    "timeToRestart": 0,
    "limitTimeToRestart": false,
    "description": "Complete five coding exercises this week",
    "priority": 1,
    "category": "Programming",
    "isAvailable": true,
    "limitCount": false,
    "countLimit": 1,
    "tags": [],
    "imgUrl": "https://images.gamelayer.co/glimages/acme/code1.png",
    "id": "code-me",
    "name": "Stay Calm and Code",
    "active": {
      "from": "2021-12-31T22:00:00.000Z",
      "to": "2022-12-30T22:00:00.000Z"
    },
    "period": "weekly",
    "objectives": {
      "events": [
        {
          "currentCount": 0,
          "id": "write-code",
          "count": 5
        }
      ],
      "missions": []
    },
    "requirement": {
      "category": "",
      "tags": [
        "coder"
      ],
      "missions": [],
      "achievements": [],
      "level": {
        "id": "level-2",
        "ordinal": 1
      }
    },
    "reward": {
      "points": 100,
      "credits": 10,
      "achievements": [
        {
          "id": "king-of-code",
          "steps": 1
        }
      ],
      "prizeId": "",
      "expireMissionOnZeroStock": false
    }
  },
  {
    "timeToComplete": 0,
    "timeToRestart": 0,
    "limitTimeToRestart": false,
    "description": "Complete the game before the end of the month",
    "priority": 2,
    "category": "",
    "isAvailable": true,
    "limitCount": false,
    "countLimit": 1,
    "tags": [],
    "imgUrl": "https://images.gamelayer.co/glimages/acme/game2.png",
    "id": "play-me",
    "name": "Gaming is Life",
    "active": {
      "from": "2021-12-31T22:00:00.000Z",
      "to": "2022-12-30T22:00:00.000Z"
    },
    "period": "monthly",
    "objectives": {
      "events": [
        {
          "currentCount": 0,
          "id": "play-game",
          "count": 1
        }
      ],
      "missions": []
    },
    "requirement": {
      "category": "",
      "tags": [
        "gamer"
      ],
      "missions": [],
      "achievements": [],
      "level": {
        "id": "level-2",
        "ordinal": 1
      }
    },
    "reward": {
      "points": 250,
      "credits": 100,
      "achievements": [
        {
          "id": "game-addict",
          "steps": 1
        }
      ],
      "prizeId": "",
      "expireMissionOnZeroStock": false
    }
  }
]

Mystery Boxes#

See Concepts for background.

Mystery boxes are credit-based containers that award one randomly selected prize from a pool.

A mystery box holds multiple prizes, each with a quantity allocation that determines its selection probability — prizes with higher allocations have proportionally higher chances. The player pays the mystery box’s credit cost (not the individual prize cost). Total stock is computed from the sum of all prize allocations.

Key properties:

  • Credits: Cost to open the mystery box.
  • Prizes: Pool of prizes with quantity allocations determining selection probability.
  • Count limit: Cap on openings per player per period.
  • Requirement: Prerequisites the player must meet to be eligible.

GET /mysteryboxes/{id}

Retrieves the mystery box with the specified ID within the given account

Parameters

NameTypeDescription
id required
in path
string

ID of the mystery box

account required
in query
string

ID of the account to use for the query

player
in query
string

If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned

language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Mystery box retrieved successfully
  • 404 Mystery box not found, player not found or no elements matching the language filter.
Example response
{
  "stock": {
    "redeemed": 0,
    "available": 60,
    "count": 60
  },
  "name": "Daily Mystery Box",
  "description": "Come back every day and open the Mystery Box for great prizes!",
  "imgUrl": "https://images.gamelayer.co/glimages/acme/prize.png",
  "category": "",
  "tags": [],
  "isAvailable": true,
  "credits": 1,
  "countLimit": 5,
  "limitCount": false,
  "id": "daily-reward",
  "active": {
    "from": "2021-12-31T22:00:00.000Z",
    "to": "2022-12-30T22:00:00.000Z"
  },
  "period": "daily",
  "requirement": {
    "category": "",
    "tags": [],
    "missions": [],
    "achievements": [],
    "level": {
      "id": "",
      "ordinal": 0
    }
  }
}

POST /mysteryboxes/{id}/claim

Claims a mystery box within the given account for the given player. The player pays the mystery box's credit cost and receives one randomly selected prize from the pool. Each prize's selection probability is proportional to its quantity allocation within the box.

Redemption outcomes (returned in the response):

  • REDEEMED — success. Credits are deducted and a random prize is awarded.
  • NOT_ENOUGH_CREDITS — the player's credit balance is less than the mystery box cost.
  • OUT_OF_STOCK — all prizes in the mystery box have been claimed.
  • COUNT_EXCEEDED — the player has reached their redemption limit for this period.

If a language property is provided in the body, the response will contain translated elements. In case no translations are found for the language, default texts will be used in the response.

Parameters

NameTypeDescription
id required
in path
string

ID of the mystery box

Request body

NameTypeDescription
player requiredstring

ID of the player for whom to perform the operation

account requiredstring

ID of the account for the operation

languagestring

ISO 639-1 language code for the requested language, like 'en'. If none is provided, texts for the main gamelayer element will be provided. If the given code is not in the list of currently supported languages or definitions for the specified language query do not exist, an HTTP error response is provided. List of supported languages is:

  • en - English
  • ar - Arabic
  • zh - Chinese
  • cs -Czech
  • fi - Finnish
  • fr - French
  • de - German
  • el - Greek
  • hi - Hindi
  • it - Italian
  • ja - Japanese
  • kk - Kazakh
  • pt - Portuguese
  • ru - Russian
  • es - Spanish
  • sv - Swedish
  • tr - Turkish
latnumber (double)

Player's current latitude (WGS84)

lonnumber (double)

Player's current longitude (WGS84)

{
  "account": "gamelayer-test",
  "player": "player-1"
}

Responses

  • 200 Mystery box redeemed successfully
  • 404 Mysterybox or player not found
Example response
{
  "code": 1,
  "message": "Prize cup-coffee claimed from mysterybox",
  "mysterybox": {
    "id": "daily-reward",
    "name": "Daily Mystery Box",
    "description": "Come back every day and open the Mystery Box for great prizes!",
    "stock": {
      "redeemed": 6,
      "available": 100029,
      "count": 100030
    },
    "imgUrl": "https://images.gamelayer.co/glimages/acme/prize.png",
    "category": "",
    "isAvailable": true,
    "credits": 1
  },
  "prize": {
    "stock": {
      "redeemed": 8,
      "available": 86,
      "count": 100
    },
    "name": "Coffee",
    "description": "Treat yourself to a hot cup of (house) coffee :)",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/coffee.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "credits": 10,
    "limitCount": false,
    "countLimit": 1,
    "limitStock": true,
    "stockCount": 100,
    "id": "cup-coffee",
    "active": {
      "from": "2021-12-31T22:00:00.000Z",
      "to": "2022-12-30T22:00:00.000Z"
    },
    "period": "monthly",
    "requirement": {
      "category": "",
      "tags": [],
      "missions": [],
      "achievements": [],
      "level": {
        "id": "level-1",
        "ordinal": 0
      }
    },
    "account": "docs-for-devs"
  },
  "player": {
    "name": "Susan Smith",
    "points": 962,
    "credits": 100155
  }
}

GET /mysteryboxes

Retrieves all the mystery boxes within the given account. If a player name is specified in the parameters, only those mystery boxes the player can currently afford will be returned. By default, the response will contain all available mystery boxes at the time of the request. That includes mystery boxes that have been explicitly set as available and have stock available, if applicable

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

tags
in query
string

Specifies the tags by which to filter results. You may specify a comma-separated list of all tags to include and/or exclude (preceding their ID mith a minus sign). Defaults to empty string, all tags are returned

player
in query
string

If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned

availability
in query
string: all, true, false

Specifies the availability by which to filter results. Allowed values are:

  • all - return all results regardless of their availability status
  • true - return only available results)
  • false - return only unavailable results
sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
timeframe
in query
string: expired, current, all

Specifies the timeframe by which to filter results. You may specify a comma-separated list of all allowed timeframes for the queried objects. Allowed values are:

  • expired - objects with an active end date in the past
  • current - objects currently active
  • upcoming - objects with an active start date in the future
  • all - all objects, regardless of their active period
stock
in query
string: all, true, false

Specifies the stock availability by which to filter prizes. Allowed values are:

  • all - return all prizes regardless of their stock availability
  • true - return only prizes where, if stock has been limited, there is more stock available
  • false - return only prizes that are out of stock, i.e. fully redeemed
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

lat
in query
number (double)

Player's current latitude (WGS84). When provided together with lon, results are filtered based on the player's proximity to location-aware elements. Non-location-aware elements are always included regardless of this parameter.

lon
in query
number (double)

Player's current longitude (WGS84). Must be provided together with lat for location-based filtering to take effect.

locationFilter
in query
string: actionable, viewable

Specifies which location zone to use for filtering when lat and lon are provided.

  • actionable - return elements where the player is within the actionable zone (default)
  • viewable - return elements where the player is within the viewable zone

Responses

  • 200 Mystery boxes retrieved successfully
  • 404 The player given as a filter does not exist (errorCode 3).
Example response
[
  {
    "stock": {
      "redeemed": 0,
      "available": 60,
      "count": 60
    },
    "name": "Daily Mystery Box",
    "description": "Come back every day and open the Mystery Box for great prizes!",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/prize.png",
    "priority": 0,
    "category": "",
    "tags": [],
    "isAvailable": true,
    "credits": 1,
    "countLimit": 5,
    "limitCount": false,
    "id": "daily-reward",
    "active": {
      "from": "2021-12-31T22:00:00.000Z",
      "to": "2022-12-30T22:00:00.000Z"
    },
    "period": "daily",
    "requirement": {
      "category": "",
      "tags": [],
      "missions": [],
      "achievements": [],
      "level": {
        "id": "",
        "ordinal": 0
      }
    }
  }
]

Players#

See Concepts for background.

Players are the user entities in GameLayer. Each player has a unique ID, a dual-currency balance (points and credits), an optional level, team assignment, category, and tags.

Dual currency system:

  • Points: Accumulate over time and never decrease through player actions. Used for progression (level advancement) and leaderboard ranking.
  • Credits: A spendable balance that increases when earned and decreases when redeemed on prizes, mystery boxes, or raffle tickets.

Players can be created, updated (including upsert), and deleted via the API. Each player has a configurable refreshOffset (e.g., UTC+02:00) that determines when their daily/weekly/monthly periods roll over, ensuring fair timing across timezones.

Player progress endpoints provide views into started/completed missions, achievements, levels, streaks, redeemed prizes, and leaderboard rankings.

GET /players/{player}

Retrieves the basic data of the player with the specified ID within the given account.

The response includes the player's dual-currency balances (points and credits), current level, team assignment, category, tags, and refresh offset. Points accumulate over time and drive level advancement and leaderboard ranking. Credits are a spendable balance used for prizes, mystery boxes, and raffle tickets. The refreshOffset (e.g., UTC+02:00) determines when the player's daily/weekly/monthly periods roll over.

Parameters

NameTypeDescription
player required
in path
string

ID of the player

account required
in query
string

ID of the account to use for the query

Responses

  • 200 Player retrieved successfully
  • 404 Player not found
Example response
{
  "tags": [
    "coder"
  ],
  "category": "",
  "imgUrl": "https://images.gamelayer.co/glimages/acme/girl1.png",
  "isAvailable": true,
  "points": 0,
  "credits": 998,
  "team": "a-team",
  "level": {
    "id": "",
    "name": "",
    "description": "",
    "imgUrl": "",
    "ordinal": 0
  },
  "player": "player-080277",
  "name": "Jane Doe",
  "createdOn": "2022-03-03T05:58:16.622Z",
  "refreshOffset": null
}

PATCH /players/{player}

Updates a player within the given account (partial update). Partial data update allows you to specify only certain field to be updated, i.e. if a field is not present in the request, it will not be modified on the updated document

Parameters

NameTypeDescription
player required
in path
string

ID of the player

Request body

NameTypeDescription
account requiredstring

ID of the account for the operation

player requiredstring

ID of the player for whom to perform the operation

namestring

Name of the player

tagsarray of items

Tags to assign to the player as a comma-separated list

categorystring

Category for the player. By default, no category is assigned to the player

imgUrlstring

URL of the player image

teamstring

ID of an available team to move the player to. An empty string removes the player from their team. Points and credits the team has collected stay with the team.

modestring: set, increment

Mode to use for the trigger:

  • set - player or team count is set to the specified value, setting rewards (points, credits, etc) accordingly
  • increment - the player or team count is incremented by the amount specified in the request
pointsinteger

Amount of points granted to the player

creditsinteger

Amount of credits granted to the player

refreshOffsetstring

Specifies the refresh offset when a refresh will be done. Offset is provided in format UTC+02:00. Valid range is UTC-12:00 to UTC+14:00.

{
  "account": "acme",
  "player": "player-42",
  "name": "Mr Anderson",
  "tags": [
    "running",
    "health"
  ],
  "category": "",
  "imgUrl": "",
  "points": 300,
  "credits": 30
}

Responses

  • 200 Player updated successfully
  • 400 Bad request. Check request data.
  • 404 Player or team not found
Example response
{
  "tags": [
    "coder"
  ],
  "category": "",
  "imgUrl": "https://images.gamelayer.co/glimages/acme/girl1.png",
  "isAvailable": true,
  "points": 0,
  "credits": 998,
  "team": "a-team",
  "level": {
    "id": "",
    "name": "",
    "description": "",
    "imgUrl": "",
    "ordinal": 0
  },
  "player": "player-080277",
  "name": "Jane Doe",
  "createdOn": "2022-03-03T05:58:16.622Z",
  "refreshOffset": null
}

DELETE /players/{player}

Deletes the specified player from the given account

Parameters

NameTypeDescription
player required
in path
string

ID of the player

account required
in query
string

ID of the account to use for the query

Request body

NameTypeDescription
hardDeleteboolean

If set, all player records will also be deleted. Default is false.

Responses

  • 204 Player deleted successfully
  • 404 Player not found.

GET /players/{player}/achievements

Retrieves the unlocked and/or granted achievements for player with the specified ID within the given account

Parameters

NameTypeDescription
player required
in path
string

ID of the player

account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

completion
in query
string: started, completed, all

Specifies the completion status by which to filter results. Allowed values are:

  • started - e.g. started missions waiting for completion, unlocked achievements,
  • completed - e.g. completed missions, granted achievements, redeemed prizes
  • all - all results, regardless of completion status
order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Player achievements retrieved successfully
  • 404 Player not found (errorCode 3).
Example response
{
  "player": {
    "points": 0,
    "credits": 5,
    "name": "Susan Smith"
  },
  "achievements": {
    "started": [
      {
        "description": "Game On! You unlocked the Game Addict badge!!",
        "category": "",
        "tags": [
          "gamer"
        ],
        "isAvailable": true,
        "steps": 10,
        "status": "started",
        "count": 2,
        "actions": {
          "startedOn": "2022-03-05T08:51:24.000Z"
        },
        "id": "game-addict",
        "name": "Game Addict",
        "imgUrl": "https://images.gamelayer.co/glimages/acme/badge1.png",
        "requirement": {
          "category": "",
          "tags": [],
          "missions": [],
          "achievements": [],
          "level": {
            "id": "",
            "ordinal": 0
          }
        },
        "reward": {
          "points": 10,
          "credits": 10,
          "achievements": []
        }
      }
    ],
    "completed": [
      {
        "id": "first-login",
        "name": "First Login",
        "description": "You logged in for the first time!",
        "imgUrl": "https://images.gamelayer.co/glimages/acme/badge2.png",
        "category": "",
        "tags": [
          "starter"
        ],
        "reward": {
          "points": 5,
          "credits": 0,
          "achievements": []
        },
        "actions": {
          "startedOn": "2022-03-05T08:51:24.000Z",
          "completedOn": "2022-03-05T08:52:10.000Z",
          "firstCompletedOn": "2022-03-05T08:52:10.000Z",
          "count": 1
        }
      }
    ]
  }
}

GET /players/{player}/events

Retrieves the completed event actions for player with the specified ID within the given account

Parameters

NameTypeDescription
player required
in path
string

ID of the player

account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

completion
in query
string: started, completed, all

Specifies the completion status by which to filter results. Allowed values are:

  • started - e.g. started missions waiting for completion, unlocked achievements,
  • completed - e.g. completed missions, granted achievements, redeemed prizes
  • all - all results, regardless of completion status
order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Player events retrieved successfully
  • 404 Player not found (errorCode 3).
Example response
{
  "player": {
    "points": 0,
    "credits": 5,
    "name": "Susan Smith"
  },
  "events": [
    {
      "description": "Use this event each time the player plays a game",
      "name": "Play Game",
      "isAvailable": true,
      "id": "play-game",
      "reward": {
        "points": 0,
        "credits": 0,
        "achievements": []
      },
      "actions": {
        "count": 5,
        "firstCompletedOn": "2022-03-05T08:49:07.319Z",
        "completedOn": "2022-03-05T08:51:33.366Z"
      }
    }
  ]
}

GET /players/{player}/levels

Retrieves the completed level actions for player with the specified ID within the given account

Parameters

NameTypeDescription
player required
in path
string

ID of the player

account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

completion
in query
string: started, completed, all

Specifies the completion status by which to filter results. Allowed values are:

  • started - e.g. started missions waiting for completion, unlocked achievements,
  • completed - e.g. completed missions, granted achievements, redeemed prizes
  • all - all results, regardless of completion status
order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Player levels retrieved successfully
  • 404 Player not found (errorCode 3).
Example response
{
  "player": {
    "name": "Susan Smith",
    "points": 0,
    "credits": 5
  },
  "levels": {
    "started": {
      "id": "level-3",
      "description": "Level Up! You rock .. The hard work paid off and you made it to Master!!",
      "name": "Grand Master",
      "imgUrl": "https://images.gamelayer.co/glimages/acme/3572831.png",
      "ordinal": 2,
      "started": true,
      "completed": false,
      "reward": {
        "points": 0,
        "credits": 0,
        "achievements": []
      },
      "actions": {
        "startedOn": "2022-03-05T08:49:07.000Z"
      }
    },
    "completed": []
  }
}

GET /players/{player}/missions

Retrieves the started and/or completed missions for player with the specified ID within the given account

Parameters

NameTypeDescription
player required
in path
string

ID of the player

account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

completion
in query
string: started, completed, all

Specifies the completion status by which to filter results. Allowed values are:

  • started - e.g. started missions waiting for completion, unlocked achievements,
  • completed - e.g. completed missions, granted achievements, redeemed prizes
  • all - all results, regardless of completion status
order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Player missions retrieved successfully
  • 404 Player not found (errorCode 3).
Example response
{
  "player": {
    "points": 460,
    "credits": 107,
    "name": "Susan Smith"
  },
  "missions": {
    "started": [],
    "completed": [
      {
        "description": "Complete the game before the end of the month",
        "priority": 2,
        "category": "",
        "isAvailable": true,
        "countLimit": 1,
        "tags": [
          "games"
        ],
        "imgUrl": "https://images.gamelayer.co/glimages/acme/game2.png",
        "actions": {
          "startedOn": "2022-03-11T03:43:52.000Z",
          "completedOn": "2022-03-11T03:43:52.000Z"
        },
        "id": "play-me",
        "name": "Gaming is Life",
        "period": "monthly",
        "objectives": {
          "events": [
            {
              "currentCount": 1,
              "id": "play-game",
              "count": 1
            }
          ],
          "missions": []
        },
        "reward": {
          "points": 250,
          "credits": 100,
          "achievements": [
            {
              "id": "game-addict",
              "steps": 1
            }
          ]
        },
        "status": "completed"
      }
    ]
  }
}

GET /players/{player}/missions/{id}

Retrieves the mission progress for a given player and mission with the specified ID within the given account.

Parameters

NameTypeDescription
player required
in path
string

ID of the player

id required
in path
string

ID of the mission

account required
in query
string

ID of the account to use for the query

Responses

  • 200 Progress retrieved successfully
  • 404 Player or mission not found.
Example response
{
  "player": {
    "points": 2867,
    "credits": 0,
    "name": "Str-2 Player"
  },
  "progress": {
    "totalAverage": 0.5,
    "nextRefresh": "2024-04-22T21:00:00.000Z",
    "period": "daily",
    "state": "started",
    "actions": {
      "startedOn": "2024-04-22T02:39:29.000Z"
    },
    "events": [
      {
        "id": "ev-2",
        "count": 10,
        "currentCount": 5,
        "average": 0.5,
        "name": "ev-2",
        "description": "",
        "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png"
      }
    ]
  }
}

GET /players/{player}/prizes

Retrieves the redeemed prizes for player with the specified ID within the given account

Parameters

NameTypeDescription
player required
in path
string

ID of the player

account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

completion
in query
string: started, completed, all

Specifies the completion status by which to filter results. Allowed values are:

  • started - e.g. started missions waiting for completion, unlocked achievements,
  • completed - e.g. completed missions, granted achievements, redeemed prizes
  • all - all results, regardless of completion status
order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Player prizes retrieved successfully
  • 404 Player not found (errorCode 3).
Example response
{
  "player": {
    "name": "Susan Smith",
    "points": 460,
    "credits": 107
  },
  "prizes": [
    {
      "description": "Treat yourself to a hot cup of (house) coffee :)",
      "name": "Coffee",
      "imgUrl": "https://images.gamelayer.co/glimages/acme/coffee.png",
      "credits": 10,
      "countLimit": 1,
      "id": "cup-coffee",
      "actions": {
        "count": 1,
        "firstCompletedOn": "2022-03-08T03:43:24.206Z",
        "completedOn": "2022-03-08T03:43:24.206Z"
      }
    }
  ]
}

GET /players/{player}/ranking

Retrieves the given leaderboard ranking data for player with the specified ID within the given account

Parameters

NameTypeDescription
player required
in path
string

ID of the player

account required
in query
string

ID of the account to use for the query

language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Player ranking retrieved successfully
  • 404 Player not found (errorCode 3).
Example response
{
  "player": {
    "points": 460,
    "credits": 107,
    "name": "Susan Smith"
  },
  "ranking": [
    {
      "leaderboard": {
        "id": "hall-of-fame",
        "name": "Hall of Fame",
        "description": "",
        "imgUrl": "",
        "period": "all-time",
        "element": "player",
        "rankBy": "total"
      },
      "rank": 4,
      "scores": 250,
      "count": 10,
      "totalPlayers": 50
    }
  ]
}

GET /players/{player}/streaks

Retrieves active and/or completed streaks for player with the specified ID within the given account

Parameters

NameTypeDescription
player required
in path
string

ID of the player

account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

completion
in query
string: started, completed, all

Specifies the completion status by which to filter results. Allowed values are:

  • started - e.g. started missions waiting for completion, unlocked achievements,
  • completed - e.g. completed missions, granted achievements, redeemed prizes
  • all - all results, regardless of completion status
order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Player streaks retrieved successfully
  • 404 Player not found (errorCode 3).
Example response
{
  "player": {
    "points": 2054,
    "credits": 0,
    "name": "Str-2 Player"
  },
  "streaks": {
    "started": [
      {
        "limitCount": false,
        "countLimit": 1,
        "objectives": [
          "m-2"
        ],
        "id": "streak-4",
        "account": "acme",
        "period": "weekly",
        "reward": {
          "points": 0,
          "credits": 0,
          "achievements": []
        },
        "actions": {
          "startedOn": "2024-04-12T02:59:14.410Z",
          "lastStreakOn": "2024-04-12T02:59:14.410Z",
          "count": 1
        },
        "name": "Streak Four",
        "description": "Unlimited streak for testing",
        "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
        "priority": 0,
        "category": "",
        "tags": []
      },
      {
        "limitCount": true,
        "countLimit": 5,
        "objectives": [
          "m-2"
        ],
        "id": "streak-2",
        "account": "acme",
        "period": "daily",
        "reward": {
          "points": 1,
          "credits": 0,
          "achievements": []
        },
        "actions": {
          "startedOn": "2024-04-11T02:59:14.318Z",
          "lastStreakOn": "2024-04-12T03:01:52.174Z",
          "count": 2
        },
        "name": "Streak Two",
        "description": "Streak Two Description",
        "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
        "priority": 0,
        "category": "",
        "tags": []
      }
    ],
    "completed": [
      {
        "account": "acme",
        "id": "streak-1",
        "actions": {
          "completedOn": "2024-04-12T02:56:17.679Z",
          "count": 1,
          "firstCompletedOn": "2024-04-12T02:56:17.679Z",
          "startedOn": "2024-04-12T02:56:17.456Z"
        },
        "objectives": [
          "m-1"
        ],
        "reward": {
          "points": 10,
          "credits": 0,
          "achievements": []
        },
        "name": "Streak One",
        "description": "Streak One Description",
        "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
        "priority": 0,
        "category": "",
        "tags": [],
        "period": "daily",
        "limitCount": false,
        "countLimit": 1
      }
    ]
  }
}

GET /players

Retrieves all players within the given account.

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

tags
in query
string

Specifies the tags by which to filter results. You may specify a comma-separated list of all tags to include and/or exclude (preceding their ID mith a minus sign). Defaults to empty string, all tags are returned

level
in query
string

Specifies the levels by which to filter results. You may specify a comma-separated list of all levels to include and/or exclude (preceding their ID mith a minus sign)

team
in query
string

Specifies the teams by which to filter results. You may specify a comma-separated list of all teams to include and/or exclude (preceding their ID mith a minus sign)

refreshOffset
in query
string

Specifies the refresh offset when a refresh will be done. Offset is provided in format UTC+02:00. Valid range is UTC-12:00 to UTC+14:00. The URI must be encoded if refreshOffset is provided.

sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first

Responses

  • 200 Players retrieved successfully
  • 404 Account not found.
Example response
[
  {
    "tags": [
      "coder"
    ],
    "category": "",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/girl1.png",
    "isAvailable": true,
    "points": 0,
    "credits": 998,
    "team": "a-team",
    "level": {
      "id": "",
      "name": "",
      "description": "",
      "imgUrl": "",
      "ordinal": 0
    },
    "player": "player-080277",
    "name": "Jane Doe",
    "createdOn": "2022-03-03T05:58:16.622Z",
    "refreshOffset": null
  },
  {
    "tags": [
      "gamer"
    ],
    "category": "",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/girl2.png",
    "isAvailable": true,
    "points": 0,
    "credits": 5,
    "team": "a-team",
    "level": {
      "id": "",
      "name": "",
      "description": "",
      "imgUrl": "",
      "ordinal": 0
    },
    "player": "player-200701",
    "name": "Susan Smith",
    "createdOn": "2022-03-03T05:59:24.752Z",
    "refreshOffset": null
  }
]

POST /players

Creates a player within the given account

Request body

NameTypeDescription
player requiredstring

ID of the player for whom to perform the operation

account requiredstring

ID of the account for the operation

name requiredstring

Name of the player

imgUrlstring

URL of the player image

categorystring

Category for the player. By default, no category is assigned to the player

tagsarray of items

Tags to assign to the player as a comma-separated list

teamstring

Team for the player (team ID). By default, no team is assigned to the player

levelstring

Level for the player (level ID). By default, player is assigned to base level.

pointsinteger

Amount of points granted to the player

creditsinteger

Amount of credits granted to the player

refreshOffsetstring

Specifies the refresh offset when a refresh will be done. Offset is provided in format UTC+02:00. Valid range is UTC-12:00 to UTC+14:00.

{
  "account": "gamelayer-test",
  "player": "player-1",
  "name": "Player One"
}

Responses

  • 201 Player created successfully created
  • 400 Bad request. Check request data.
  • 404 Required element (team) not found.
  • 409 Player is not created. Player already exists.
Example response
{
  "tags": [],
  "category": "",
  "imgUrl": "",
  "isAvailable": true,
  "points": 0,
  "credits": 0,
  "team": "",
  "level": {
    "id": "",
    "name": "",
    "description": "",
    "imgUrl": "",
    "ordinal": 0
  },
  "player": "player-421",
  "name": "Mr Pete",
  "createdOn": "2022-03-11T04:41:39.880Z"
}

POST /players/batch

Creates multiple players in a single request. Silently skips players that already exist for the given account. Returns which players were created and which already existed.

Request body

NameTypeDescription
account requiredstring

Account ID shared by all players in the batch

players requiredarray of object

Array of player objects to create

{
  "account": "my-account",
  "players": [
    {
      "player": "player-1",
      "name": "Player One",
      "category": "sales",
      "tags": [
        "vip"
      ]
    },
    {
      "player": "player-2",
      "name": "Player Two",
      "points": 100
    }
  ]
}

Responses

  • 201 Batch processed successfully
  • 400 Validation error. Possible reasons: - Missing or empty players array - Players array exceeds 1000 items - A player entry is missing required fields (player, name) - Invalid refreshOffset value - Account player limit exceeded
  • 404 Account not found or team not found
Example response
{
  "created": [
    "player-1"
  ],
  "existing": [
    "player-2"
  ]
}

POST /players/batch-delete

Deletes multiple players in a single request. Players that do not exist are silently ignored — the response reports how many were actually deleted versus how many were requested.

When hardDelete is set to true, all related player data is cascade-deleted across all collections (events, missions, achievements, streaks, levels, prizes, claims, quizzes, leaderboard scores, and journal entries). Without hardDelete, only the player documents are removed and related data is left intact.

Request body

NameTypeDescription
account requiredstring

Account ID

players requiredarray of string

Array of player ID strings to delete

hardDeleteboolean

When true, cascade-deletes all related player records across all collections (events, missions, achievements, streaks, levels, prizes, claims, quizzes, leaderboard scores, journal entries). When false, only the player documents are removed.

{
  "account": "my-account",
  "players": [
    "player-1",
    "player-2",
    "player-3"
  ],
  "hardDelete": true
}

Responses

  • 200 Batch delete processed successfully
  • 400 Validation error. Possible reasons: - Missing or empty players array - Players array exceeds 1000 items
  • 404 Account not found
Example response
{
  "deleted": 2,
  "requested": 3
}

Prizes#

See Concepts for background.

Prizes are items in a reward shop that players redeem using credits.

When a player claims a prize, the platform verifies sufficient credits, requirement eligibility, and stock availability. Redemption outcomes:

  • REDEEMED — success, credits deducted and prize granted.
  • NOT_ENOUGH_CREDITS — insufficient credit balance.
  • OUT_OF_STOCK — no stock remaining.
  • COUNT_EXCEEDED — player has reached their redemption limit for this period.
  • VOUCHER_INVALID — voucher code is invalid or has already been used.

Key properties:

  • Credits: Cost to redeem the prize.
  • Stock: Optional finite stock. When all units are redeemed, the prize shows as out of stock.
  • Count limit: Cap how many times a player can redeem per period.
  • Period: daily, weekly, monthly, or all-time for count limit tracking.
  • Requirement: Prerequisites the player must meet.

Voucher codes: Prizes support voucher codes that allow players to claim a prize by providing a valid code instead of paying the credit cost. Requirements, location, stock and claim count limits still apply. Players use a code by including voucherCode in the claim request. Voucher codes are added, listed and deleted in the GameLayer dashboard or through the Admin API; the GameLayer API has no voucher management operations (removed in 3.0.0, since anyone holding the API key could list, add and delete codes).

GET /prizes/{id}

Retrieves the prize with the specified ID within the given account

Parameters

NameTypeDescription
id required
in path
string

ID of the prize

account required
in query
string

ID of the account to use for the query

language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Prize retrieved successfully
  • 404 Prize not found or no elements matching the language filter.
Example response
{
  "stock": {
    "redeemed": 2,
    "available": 98,
    "count": 100
  },
  "name": "Coffee",
  "description": "Treat yourself to a hot cup of (house) coffee :)",
  "imgUrl": "https://images.gamelayer.co/glimages/acme/coffee.png",
  "category": "",
  "tags": [],
  "isAvailable": true,
  "credits": 10,
  "countLimit": 1,
  "limitCount": false,
  "id": "cup-coffee",
  "missionPrize": false,
  "active": {
    "from": "2021-12-31T22:00:00.000Z",
    "to": "2022-12-30T22:00:00.000Z"
  },
  "period": "monthly",
  "requirement": {
    "category": "",
    "tags": [],
    "missions": [],
    "achievements": [],
    "level": {
      "id": "level-1",
      "ordinal": 0
    }
  }
}

POST /prizes/{id}/claim

Claims a prize within the given account for the given player. The platform verifies that the player has sufficient credits, meets any requirement prerequisites, and that stock is available.

Redemption outcomes (returned in the response):

  • REDEEMED — success. Credits are deducted and the prize is granted.
  • NOT_ENOUGH_CREDITS — the player's credit balance is less than the prize cost.
  • OUT_OF_STOCK — no stock remaining for this prize.
  • COUNT_EXCEEDED — the player has reached their redemption limit for this period.
  • VOUCHER_INVALID — the voucher code is invalid or has already been used.
  • VOUCHER_REQUIRED — the prize requires a voucher code but none was provided.

Voucher code redemption: If a voucherCode is provided in the request body, the credit cost is waived — no credits are deducted. All other checks (stock limits, claim count limits, location) are still enforced. Single-use codes are marked as used after a successful claim and cannot be reused. Multi-use codes remain active and can be used by multiple players.

Enforce voucher code: If useVouchers is enabled on the prize, a valid voucher code must always be provided. Requests without a voucher code will be rejected with VOUCHER_REQUIRED.

If a language property is provided in the body, the response will contain translated elements. In case no translations are found for the language, default texts will be used in the response.

Parameters

NameTypeDescription
id required
in path
string

ID of the prize

Request body

NameTypeDescription
player requiredstring

ID of the player for whom to perform the operation

account requiredstring

ID of the account for the operation

languagestring

ISO 639-1 language code for the requested language, like 'en'. If none is provided, texts for the main gamelayer element will be provided. If the given code is not in the list of currently supported languages or definitions for the specified language query do not exist, an HTTP error response is provided. List of supported languages is:

  • en - English
  • ar - Arabic
  • zh - Chinese
  • cs -Czech
  • fi - Finnish
  • fr - French
  • de - German
  • el - Greek
  • hi - Hindi
  • it - Italian
  • ja - Japanese
  • kk - Kazakh
  • pt - Portuguese
  • ru - Russian
  • es - Spanish
  • sv - Swedish
  • tr - Turkish
latnumber (double)

Player's current latitude (WGS84)

lonnumber (double)

Player's current longitude (WGS84)

voucherCodestring

Optional voucher code. When provided, the credit cost is waived — no credits are deducted from the player. All other checks (stock limits, claim count limits, location) are still enforced. Single-use codes are marked as used after a successful claim. Multi-use codes remain active. Required when the prize has useVouchers enabled — omitting the code will return a VOUCHER_REQUIRED error.

{
  "account": "gamelayer-test",
  "player": "player-1"
}

Responses

  • 200 Prize claimed successfully
  • 404 Prize or player not found.
Example response
{
  "code": 2,
  "prize": {
    "id": "cup-coffee",
    "name": "Coffee",
    "description": "Treat yourself to a hot cup of (house) coffee :)",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/coffee.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "active": {
      "from": "2021-12-31T22:00:00.000Z",
      "to": "2022-12-30T22:00:00.000Z"
    },
    "credits": 10,
    "countLimit": 1,
    "limitCount": false,
    "missionPrize": false,
    "period": "monthly",
    "stock": {
      "redeemed": 7,
      "available": 93,
      "count": 100
    },
    "requirement": {
      "category": "",
      "tags": [],
      "missions": [],
      "achievements": [],
      "level": {
        "id": "level-1",
        "ordinal": 0
      }
    }
  },
  "player": {
    "name": "Susan Smith",
    "points": 811,
    "credits": 162
  }
}

GET /prizes

Retrieves all the prizes within the given account. If a player name is specified in the parameters, only those prizes the player can currently afford will be returned. By default, the response will contain all available prizes at the time of the request. That includes prizes that have been explicitly set as available and have stock available, if applicable.

Mission prizes are excluded by default. Use the missionPrize query parameter to include or filter for mission prizes.

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

player
in query
string

If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

tags
in query
string

Specifies the tags by which to filter results. You may specify a comma-separated list of all tags to include and/or exclude (preceding their ID mith a minus sign). Defaults to empty string, all tags are returned

availability
in query
string: all, true, false

Specifies the availability by which to filter results. Allowed values are:

  • all - return all results regardless of their availability status
  • true - return only available results)
  • false - return only unavailable results
sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
timeframe
in query
string: expired, current, all

Specifies the timeframe by which to filter results. You may specify a comma-separated list of all allowed timeframes for the queried objects. Allowed values are:

  • expired - objects with an active end date in the past
  • current - objects currently active
  • upcoming - objects with an active start date in the future
  • all - all objects, regardless of their active period
stock
in query
string: all, true, false

Specifies the stock availability by which to filter prizes. Allowed values are:

  • all - return all prizes regardless of their stock availability
  • true - return only prizes where, if stock has been limited, there is more stock available
  • false - return only prizes that are out of stock, i.e. fully redeemed
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

lat
in query
number (double)

Player's current latitude (WGS84). When provided together with lon, results are filtered based on the player's proximity to location-aware elements. Non-location-aware elements are always included regardless of this parameter.

lon
in query
number (double)

Player's current longitude (WGS84). Must be provided together with lat for location-based filtering to take effect.

locationFilter
in query
string: actionable, viewable

Specifies which location zone to use for filtering when lat and lon are provided.

  • actionable - return elements where the player is within the actionable zone (default)
  • viewable - return elements where the player is within the viewable zone
limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

missionPrize
in query
string: true, false, all

Filter by mission prize status. Default excludes mission prizes. Use 'true' to query only mission prizes, 'all' to include all.

useVouchers
in query
string: true, false

Filter by voucher enforcement. Use 'true' to return only prizes that require a voucher code, 'false' to exclude them. Omit to return all.

Responses

  • 200 Prizes retrieved successfully
  • 404 The player given as a filter does not exist (errorCode 3).
Example response
[
  {
    "stock": {
      "redeemed": 2,
      "available": 98,
      "count": 100
    },
    "name": "Coffee",
    "description": "Treat yourself to a hot cup of (house) coffee :)",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/coffee.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "credits": 10,
    "countLimit": 1,
    "limitCount": false,
    "id": "cup-coffee",
    "missionPrize": false,
    "active": {
      "from": "2021-12-31T22:00:00.000Z",
      "to": "2022-12-30T22:00:00.000Z"
    },
    "period": "monthly",
    "requirement": {
      "category": "",
      "tags": [],
      "missions": [],
      "achievements": [],
      "level": {
        "id": "level-1",
        "ordinal": 0
      }
    }
  },
  {
    "stock": {
      "redeemed": 1,
      "available": 49,
      "count": 50
    },
    "name": "Ice Cream",
    "description": "I scream, You scream, We all scream for Ice Cream :)",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/icecream.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "credits": 100,
    "countLimit": 1,
    "limitCount": false,
    "id": "ice-cream",
    "missionPrize": false,
    "active": {
      "from": "2021-12-31T22:00:00.000Z",
      "to": "2022-12-30T22:00:00.000Z"
    },
    "period": "monthly",
    "requirement": {
      "category": "",
      "tags": [],
      "missions": [],
      "achievements": [],
      "level": {
        "id": "level-2",
        "ordinal": 1
      }
    }
  }
]

Quizzes#

Quizzes are scored assessments where players answer questions and receive rewards for passing.

Types:

  • basic — all questions answered before scoring. Results available after submission.
  • immediate — scored question-by-question with immediate feedback.

Flow: Start quiz → receive questions → submit answers → platform scores against correct answers → pass/fail determined by required pass rate.

Key properties:

  • Questions: Each has a type (single or multi), text, optional image, weighted score, and answer choices with correct answers marked.
  • Required pass rate: Percentage of maximum score needed to pass (0–100).
  • Timing: Optional time limit in seconds from when the player starts.
  • Shuffle: Optionally randomize question order per player.
  • Reward: Points, credits, and/or achievement steps — awarded only if the quiz is passed.

Quizzes can drive missions — when a player passes the quiz, the linked mission is automatically completed.

GET /quizzes/{id}

Retrieves quiz with specified ID within the given account.

Quizzes have two types: basic (all questions scored after submission) and immediate (scored question-by-question with instant feedback). The response includes the quiz configuration, questions count, maximum score, required pass rate, and timing constraints. Use the start endpoint to begin a quiz attempt.

Parameters

NameTypeDescription
id required
in path
string

ID of the quiz

account required
in query
string

ID of the account to use for the query

Responses

  • 200 Quiz retrieved successfully.
  • 404 Quiz not found.
Example response
{
  "name": "Master Quiz - 1",
  "description": "System test quiz. No strict mode",
  "imgUrl": "",
  "category": "test",
  "isAvailable": true,
  "requiredPassRate": 100,
  "passMessage": "Congratulations. You passed the quiz!",
  "failMessage": "You did not pass the quiz.",
  "isShuffleRequired": false,
  "id": "st-quiz-1",
  "reward": {
    "points": 100,
    "credits": 1,
    "achievements": []
  },
  "timing": {
    "maxSecondsToComplete": 120
  },
  "maxScore": 7,
  "tags": [
    "tag1"
  ]
}

GET /quizzes

Retrieves all the quizzes within the given account. If a player name is specified in the parameters, only those quizzes the player is eligible for will be returned. By default, the response will contain all available quizzes at the time of the request. That includes quizzes that have been explicitly set as available.

Parameters

NameTypeDescription
player
in query
string

If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned

account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

tags
in query
string

Specifies the tags by which to filter results. You may specify a comma-separated list of all tags to include and/or exclude (preceding their ID mith a minus sign). Defaults to empty string, all tags are returned

availability
in query
string: all, true, false

Specifies the availability by which to filter results. Allowed values are:

  • all - return all results regardless of their availability status
  • true - return only available results)
  • false - return only unavailable results
sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first

Responses

  • 200 Quizzes retrieved successfully
  • 404 Account not found.
Example response
[
  {
    "name": "Master Quiz - 1",
    "description": "System test quiz. No strict mode",
    "imgUrl": "",
    "category": "test",
    "isAvailable": true,
    "requiredPassRate": 100,
    "passMessage": "Congratulations. You passed the quiz!",
    "failMessage": "You did not pass the quiz.",
    "isShuffleRequired": false,
    "id": "st-quiz-1",
    "reward": {
      "points": 100,
      "credits": 1,
      "achievements": []
    },
    "timing": {
      "maxSecondsToComplete": 120
    },
    "maxScore": 7,
    "tags": [
      "tag1"
    ]
  },
  {
    "name": "Master Quiz - 1",
    "description": "System test quiz. Strict mode",
    "imgUrl": "",
    "category": "",
    "isAvailable": true,
    "requiredPassRate": 100,
    "passMessage": "Congratulations. You passed the quiz!",
    "failMessage": "You did not pass the quiz.",
    "isShuffleRequired": false,
    "id": "st-quiz-2",
    "reward": {
      "points": 100,
      "credits": 1,
      "achievements": []
    },
    "timing": {
      "maxSecondsToComplete": 120
    },
    "maxScore": 8,
    "tags": []
  }
]

GET /quizzes/{id}/result

Retrieves results for the quiz with specified ID within the given account for a player.

Parameters

NameTypeDescription
id required
in path
string

ID of the quiz

account required
in query
string

ID of the account to use for the query

player
in query
string

ID of the player for which to retrieve the quiz result.

Responses

  • 200 Quiz results retrieved successfully.
  • 404 Quiz or player not found.
Example response
{
  "quiz": {
    "name": "Master Quiz - 1",
    "description": "System test quiz. No strict mode",
    "imgUrl": "",
    "category": "test",
    "isAvailable": true,
    "requiredPassRate": 100,
    "passMessage": "Congratulations. You passed the quiz!",
    "failMessage": "You did not pass the quiz.",
    "isShuffleRequired": false,
    "id": "st-quiz-1",
    "reward": {
      "points": 100,
      "credits": 1,
      "achievements": []
    },
    "timing": {
      "maxSecondsToComplete": 120
    },
    "maxScore": 7,
    "tags": [],
    "createdOn": "2023-02-05T08:37:23.923Z",
    "updatedOn": "2023-02-05T08:37:23.923Z"
  },
  "player": {
    "name": "John Doe",
    "points": 100,
    "credits": 1
  },
  "actions": {
    "count": 2,
    "lastScore": 7,
    "passed": true,
    "startedOn": "2023-02-05T08:58:47.940Z",
    "completedOn": "2023-02-05T08:58:50.789Z"
  },
  "results": [
    {
      "answers": [
        "6ae91e77"
      ],
      "score": 4,
      "question": {
        "type": "single",
        "imgUrl": "",
        "weight": 4,
        "strictMode": true,
        "choices": [
          {
            "imgUrl": "",
            "text": "Be good",
            "correctAnswer": false,
            "id": "5fc5fb82"
          },
          {
            "imgUrl": "",
            "text": "Be bad",
            "correctAnswer": true,
            "id": "6ae91e77"
          }
        ],
        "text": "What is the meaning of life",
        "id": "d1327ed1"
      }
    },
    {
      "answers": [
        "fe566d5d"
      ],
      "score": 1,
      "question": {
        "type": "single",
        "imgUrl": "",
        "weight": 1,
        "strictMode": true,
        "choices": [
          {
            "imgUrl": "",
            "text": "Be good - 2",
            "correctAnswer": true,
            "id": "fe566d5d"
          },
          {
            "imgUrl": "",
            "text": "Be bad - 2",
            "correctAnswer": false,
            "id": "f42f82a8"
          }
        ],
        "text": "What is the meaning of life - 2",
        "id": "a9c1ca84"
      }
    },
    {
      "answers": [
        "64d3368c"
      ],
      "score": 2,
      "question": {
        "type": "single",
        "imgUrl": "",
        "weight": 2,
        "strictMode": true,
        "choices": [
          {
            "imgUrl": "",
            "text": "Be good - 3",
            "correctAnswer": true,
            "id": "64d3368c"
          },
          {
            "imgUrl": "",
            "text": "Be bad - 3",
            "correctAnswer": false,
            "id": "48bb3fdd"
          }
        ],
        "text": "What is the meaning of life - 3",
        "id": "74a9269f"
      }
    }
  ]
}

POST /quizzes/{id}/start

Starts given quiz with specified ID within the given account for the given player. This begins the quiz attempt and starts the timer (if the quiz has a time limit configured). The response returns the quiz questions with their answer choices.

If a quiz is already started and active for the player, no action will be taken (i.e. no quiz re-start). Current quiz questions for the player will be returned in the response. Questions may be shuffled if the quiz has shuffle enabled.

Parameters

NameTypeDescription
id required
in path
string

ID of the quiz

Request body

NameTypeDescription
account requiredstring

ID of the account for the operation

player requiredstring

ID of the player for whom to perform the operation

{
  "account": "st-account",
  "player": "st-player-1"
}

Responses

  • 200 Quiz started.
  • 400 Quiz has not been started or answers are missing/invalid
  • 404 Quiz or player not found.
Example response
{
  "quiz": {
    "id": "st-quiz-1",
    "name": "Master Quiz - 1",
    "description": "System test quiz. No strict mode",
    "imgUrl": "",
    "category": "test",
    "isAvailable": true,
    "maxScore": 7,
    "requiredPassRate": 100,
    "passMessage": "Congratulations. You passed the quiz!",
    "failMessage": "You did not pass the quiz.",
    "isShuffleRequired": false,
    "timing": {
      "maxSecondsToComplete": 120
    },
    "reward": {
      "points": 100,
      "credits": 1,
      "achievements": []
    },
    "tags": []
  },
  "actions": {
    "count": 0,
    "lastScore": 0,
    "passed": false,
    "startedOn": "2023-02-05T08:44:50.425Z"
  },
  "questions": [
    {
      "type": "single",
      "imgUrl": "",
      "weight": 4,
      "strictMode": true,
      "text": "What is the meaning of life",
      "choices": [
        {
          "imgUrl": "",
          "text": "Be good",
          "correctAnswer": false,
          "id": "5fc5fb82"
        },
        {
          "imgUrl": "",
          "text": "Be bad",
          "correctAnswer": true,
          "id": "6ae91e77"
        }
      ],
      "id": "d1327ed1"
    },
    {
      "type": "single",
      "imgUrl": "",
      "weight": 1,
      "strictMode": true,
      "text": "What is the meaning of life - 2",
      "choices": [
        {
          "imgUrl": "",
          "text": "Be good - 2",
          "correctAnswer": true,
          "id": "fe566d5d"
        },
        {
          "imgUrl": "",
          "text": "Be bad - 2",
          "correctAnswer": false,
          "id": "f42f82a8"
        }
      ],
      "id": "a9c1ca84"
    },
    {
      "type": "single",
      "imgUrl": "",
      "weight": 2,
      "strictMode": true,
      "text": "What is the meaning of life - 3",
      "choices": [
        {
          "imgUrl": "",
          "text": "Be good - 3",
          "correctAnswer": true,
          "id": "64d3368c"
        },
        {
          "imgUrl": "",
          "text": "Be bad - 3",
          "correctAnswer": false,
          "id": "48bb3fdd"
        }
      ],
      "id": "74a9269f"
    }
  ],
  "player": {
    "name": "John Doe",
    "points": 0,
    "credits": 0
  }
}

POST /quizzes/{id}/complete

Completes given quiz with specified ID within the given account for the given player. Submits the player's answers for scoring. The platform scores responses against correct answers and determines pass/fail based on the required pass rate.

The response includes the player's score, maximum possible score, pass/fail status, and the configured pass/fail message. If the player passes, the quiz's reward (points, credits, achievement steps) is granted. If the quiz drives a mission, the linked mission is also completed on pass.

When the quiz has isQuestionScoringEnabled set to true, every question answered fully correctly additionally awards its points value, summed across questions and returned as questionPointsAwarded. These question points are credited on every completion (pass or fail), whereas reward.points/reward.credits remain pass-gated. The pointsAwarded field reports the total points credited for this completion (questionPointsAwarded plus reward.points when passed).

Parameters

NameTypeDescription
id required
in path
string

ID of the quiz

Request body

NameTypeDescription
account requiredstring

ID of the account for the operation

player requiredstring

ID of the player for whom to perform the operation

answers requiredarray of object

Answers to the questions given upon completing the quiz/survey in JSON format. Answers should be an array of objects.

{
  "account": "account-id",
  "player": "player-id",
  "answers": [
    {
      "questionId": "d1327ed1",
      "answerIds": [
        "6ae91e77"
      ]
    },
    {
      "questionId": "a9c1ca84",
      "answerIds": [
        "fe566d5d"
      ]
    },
    {
      "questionId": "74a9269f",
      "answerIds": [
        "64d3368c"
      ]
    }
  ]
}

Responses

  • 200 Quiz completed.
  • 400 Invalid request data or quiz not started in time.
  • 404 Quiz or player not found.
Example response
{
  "quiz": {
    "id": "st-quiz-1",
    "name": "Master Quiz - 1",
    "description": "System test quiz. No strict mode",
    "imgUrl": "",
    "category": "test",
    "isAvailable": true,
    "maxScore": 7,
    "requiredPassRate": 100,
    "passMessage": "Congratulations. You passed the quiz!",
    "failMessage": "You did not pass the quiz.",
    "isShuffleRequired": false,
    "timing": {
      "maxSecondsToComplete": 120
    },
    "reward": {
      "points": 100,
      "credits": 1,
      "achievements": []
    },
    "tags": []
  },
  "actions": {
    "count": 2,
    "lastScore": 7,
    "passed": true,
    "startedOn": "2023-02-05T08:58:47.940Z",
    "completedOn": "2023-02-05T08:58:50.789Z"
  },
  "player": {
    "name": "John Doe",
    "points": 100,
    "credits": 1
  },
  "results": [
    {
      "answers": [
        "6ae91e77"
      ],
      "score": 4,
      "question": {
        "type": "single",
        "imgUrl": "",
        "weight": 4,
        "strictMode": true,
        "text": "What is the meaning of life",
        "choices": [
          {
            "imgUrl": "",
            "text": "Be good",
            "correctAnswer": false,
            "id": "5fc5fb82"
          },
          {
            "imgUrl": "",
            "text": "Be bad",
            "correctAnswer": true,
            "id": "6ae91e77"
          }
        ],
        "id": "d1327ed1"
      }
    },
    {
      "answers": [
        "fe566d5d"
      ],
      "score": 1,
      "question": {
        "type": "single",
        "imgUrl": "",
        "weight": 1,
        "strictMode": true,
        "text": "What is the meaning of life - 2",
        "choices": [
          {
            "imgUrl": "",
            "text": "Be good - 2",
            "correctAnswer": true,
            "id": "fe566d5d"
          },
          {
            "imgUrl": "",
            "text": "Be bad - 2",
            "correctAnswer": false,
            "id": "f42f82a8"
          }
        ],
        "id": "a9c1ca84"
      }
    },
    {
      "answers": [
        "64d3368c"
      ],
      "score": 2,
      "question": {
        "type": "single",
        "imgUrl": "",
        "weight": 2,
        "strictMode": true,
        "text": "What is the meaning of life - 3",
        "choices": [
          {
            "imgUrl": "",
            "text": "Be good - 3",
            "correctAnswer": true,
            "id": "64d3368c"
          },
          {
            "imgUrl": "",
            "text": "Be bad - 3",
            "correctAnswer": false,
            "id": "48bb3fdd"
          }
        ],
        "id": "74a9269f"
      }
    }
  ],
  "progress": {
    "points": {
      "before": 0,
      "earned": 100
    },
    "credits": {
      "before": 0,
      "earned": 1
    },
    "levels": {
      "completed": [
        {
          "id": "st-level-2",
          "name": "Test Level Two",
          "description": "Objectives - 5 points",
          "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
          "ordinal": 1
        },
        {
          "id": "st-level-3",
          "name": "Test Level Three",
          "description": "Objectives - 10 points",
          "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
          "ordinal": 2
        }
      ],
      "started": {}
    },
    "missions": [],
    "achievements": []
  },
  "questionPointsAwarded": 0,
  "pointsAwarded": 100
}

Raffles#

See Concepts for background.

Raffles are ticket-based prize draws. Players spend credits to purchase tickets, and winners are selected at a scheduled draw time.

Each ticket purchase is one entry into the draw. Players can purchase multiple tickets (up to the configured count limit) to increase their chances. At the configured draw time, winners are selected and prizes are distributed.

Key properties:

  • Credits: Cost per ticket.
  • Draw time: Scheduled date and time for the prize draw.
  • Prizes: Pool of prizes available in the draw.
  • Count limit: Maximum tickets a player can purchase per period.
  • Active window: Date range during which tickets can be purchased.
  • Requirement: Prerequisites the player must meet.

GET /raffles/{id}

Retrieves the raffle ticket with the specified ID within the given account

Parameters

NameTypeDescription
id required
in path
string

ID of the raffle

account required
in query
string

ID of the account to use for the query

language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Raffle ticket retrieved successfully
  • 404 Raffle not found or no elements matching the language filter.
Example response
{
  "stock": {
    "redeemed": 0,
    "available": 30,
    "count": 30
  },
  "name": "Weekly Prize Draw",
  "description": "Enter the weekly draw for a chance to win great prizes! Draw takes place every Sunday at 19:00!",
  "imgUrl": "https://images.gamelayer.co/glimages/acme/raffle.png",
  "priority": 0,
  "category": "",
  "tags": [],
  "isAvailable": true,
  "active": {
    "from": "2021-12-31T22:00:00.000Z",
    "to": "2022-12-30T22:00:00.000Z"
  },
  "drawTime": "2022-01-09T19:00:00.000Z",
  "credits": 1,
  "countLimit": 5,
  "limitCount": false,
  "period": "weekly",
  "requirement": {
    "category": "",
    "tags": [],
    "missions": [],
    "achievements": [],
    "level": {
      "id": "",
      "ordinal": 0
    }
  },
  "id": "weekly-raffle"
}

GET /raffles

Retrieves all the raffles within the given account. If a player name is specified in the parameters, only those raffles the player can currently afford will be returned. By default, the response will contain all available raffles at the time of the request. That includes raffles that have been explicitly set as available and have stock available, if applicable

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

player
in query
string

If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

tags
in query
string

Specifies the tags by which to filter results. You may specify a comma-separated list of all tags to include and/or exclude (preceding their ID mith a minus sign). Defaults to empty string, all tags are returned

availability
in query
string: all, true, false

Specifies the availability by which to filter results. Allowed values are:

  • all - return all results regardless of their availability status
  • true - return only available results)
  • false - return only unavailable results
sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
timeframe
in query
string: expired, current, all

Specifies the timeframe by which to filter results. You may specify a comma-separated list of all allowed timeframes for the queried objects. Allowed values are:

  • expired - objects with an active end date in the past
  • current - objects currently active
  • upcoming - objects with an active start date in the future
  • all - all objects, regardless of their active period
stock
in query
string: all, true, false

Specifies the stock availability by which to filter prizes. Allowed values are:

  • all - return all prizes regardless of their stock availability
  • true - return only prizes where, if stock has been limited, there is more stock available
  • false - return only prizes that are out of stock, i.e. fully redeemed
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

lat
in query
number (double)

Player's current latitude (WGS84). When provided together with lon, results are filtered based on the player's proximity to location-aware elements. Non-location-aware elements are always included regardless of this parameter.

lon
in query
number (double)

Player's current longitude (WGS84). Must be provided together with lat for location-based filtering to take effect.

locationFilter
in query
string: actionable, viewable

Specifies which location zone to use for filtering when lat and lon are provided.

  • actionable - return elements where the player is within the actionable zone (default)
  • viewable - return elements where the player is within the viewable zone
limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

Responses

  • 200 Raffles retrieved successfully
  • 404 The player given as a filter does not exist (errorCode 3).
Example response
[
  {
    "stock": {
      "redeemed": 0,
      "available": 30,
      "count": 30
    },
    "name": "Weekly Prize Draw",
    "description": "Enter the weekly draw for a chance to win great prizes! Draw takes place every Sunday at 19:00!",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/raffle.png",
    "priority": 0,
    "category": "",
    "tags": [],
    "isAvailable": true,
    "active": {
      "from": "2021-12-31T22:00:00.000Z",
      "to": "2022-12-30T22:00:00.000Z"
    },
    "drawTime": "2022-01-09T19:00:00.000Z",
    "credits": 1,
    "countLimit": 5,
    "limitCount": false,
    "period": "weekly",
    "requirement": {
      "category": "",
      "tags": [],
      "missions": [],
      "achievements": [],
      "level": {
        "id": "",
        "ordinal": 0
      }
    },
    "id": "weekly-raffle"
  }
]

POST /raffles/{id}/claim

Purchases a raffle ticket within the given account for the given player. Each purchase is one entry into the prize draw. The player can buy multiple tickets (up to the configured count limit) to increase their chances. Winners are selected at the scheduled draw time.

Redemption outcomes (returned in the response):

  • REDEEMED — success. Credits are deducted and a ticket is issued.
  • NOT_ENOUGH_CREDITS — the player's credit balance is less than the ticket cost.
  • COUNT_EXCEEDED — the player has reached their ticket purchase limit for this period.

If a language property is provided in the body, the response will contain translated elements. In case no translations are found for the language, default texts will be used in the response.

Parameters

NameTypeDescription
id required
in path
string

ID of the raffle

Request body

NameTypeDescription
player requiredstring

ID of the player for whom to perform the operation

account requiredstring

ID of the account for the operation

languagestring

ISO 639-1 language code for the requested language, like 'en'. If none is provided, texts for the main gamelayer element will be provided. If the given code is not in the list of currently supported languages or definitions for the specified language query do not exist, an HTTP error response is provided. List of supported languages is:

  • en - English
  • ar - Arabic
  • zh - Chinese
  • cs -Czech
  • fi - Finnish
  • fr - French
  • de - German
  • el - Greek
  • hi - Hindi
  • it - Italian
  • ja - Japanese
  • kk - Kazakh
  • pt - Portuguese
  • ru - Russian
  • es - Spanish
  • sv - Swedish
  • tr - Turkish
latnumber (double)

Player's current latitude (WGS84)

lonnumber (double)

Player's current longitude (WGS84)

{
  "account": "gamelayer-test",
  "player": "player-1"
}

Responses

  • 200 Raffle ticket claimed successfully
  • 404 Raffle or player not found.
Example response
{
  "code": 1,
  "message": "Raffle ticket redeemed successfully",
  "raffle": {
    "id": "weekly-raffle",
    "name": "Weekly Prize Draw",
    "description": "Enter the weekly draw for a chance to win great prizes! Draw takes place every Sunday at 19:00!",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/raffle.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "credits": 1,
    "active": {
      "from": "2021-12-31T22:00:00.000Z",
      "to": "2022-12-30T22:00:00.000Z"
    },
    "drawTime": "2022-01-09T19:00:00.000Z",
    "period": "weekly"
  },
  "player": {
    "name": "Susan Smith",
    "points": 811,
    "credits": 182
  }
}

Rules#

See Concepts for background.

Rules are condition-action automations that modify reward calculations. They evaluate player state and apply bonuses (e.g., point multipliers) when conditions are met.

Rules are evaluated automatically whenever a player earns points (e.g., on event completion). Each rule has a condition (e.g., "player created within N days"), an action (e.g., "multiply earned points by 2x"), and a priority (lower number = higher priority, default: 100). If breakOnEval is true, no further rules are evaluated after this one matches.

Available conditions: Player created within date range, start date range, player created before a date. Available actions: Multiply earned points by a given factor. Multiple rules can stack multipliers.

The GameLayer API reads rules only. Rules are created and changed in the GameLayer dashboard (PATCH /rules/{id} was removed in 2.0.0: it let anyone holding the API key change rule settings).

GET /rules/{id}

Retrieves information of given rule ID.

Rules are condition-action automations evaluated whenever a player earns points. Each rule has a condition (e.g., "player created within N days"), an action (e.g., "multiply earned points by 2x"), and a priority (lower = higher priority, default: 100). Rules are processed in priority order; if breakOnEval is true, evaluation stops after this rule matches.

Parameters

NameTypeDescription
id required
in path
string

ID of the rule

account required
in query
string

ID of the account to use for the query

Responses

  • 200 Rule retrieved successfully
  • 404 Rule not found
Example response
{
  "name": "New rule name",
  "description": "Rock'n roll",
  "imgUrl": "",
  "isAvailable": true,
  "priority": 100,
  "breakOnEval": false,
  "id": "rule-1",
  "conditionId": "startDateOrCreatedOnRange",
  "actionId": "actionMultiplyGainedPoints",
  "conditionParams": {
    "minDays": {
      "value": 8
    },
    "maxDays": {
      "value": 10
    },
    "days": {
      "value": 10
    },
    "startDate": {
      "value": "2023-09-04"
    }
  },
  "actionParams": {
    "multiplier": {
      "value": 4
    }
  },
  "createdOn": "2023-09-04T02:32:16.487Z",
  "updatedOn": "2023-09-04T02:32:16.518Z"
}

GET /rules

Retrieves all rules within the given account.

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first

Responses

  • 200 Rules retrieved successfully
  • 404 Account not found.

Streaks#

See Concepts for background.

Streaks reward players for consecutive mission completions across periods. They track how many periods in a row a player completes a specific mission.

A streak is linked to one or more missions and a period (daily, weekly, or monthly — all-time is not supported). Each period, if the player completes one of the linked missions, their streak count increments (at most once per period). If they miss a period, the streak resets to zero. With a count limit, the reward is earned once, when the limit is reached; without one, it is earned at every increment.

Key properties:

  • Objectives: Mission IDs driving the streak; completing any one of them counts for the period.
  • Period: daily, weekly, or monthly.
  • Count limit: Optional maximum streak count (e.g., "7-day streak"). A streak is complete when the count limit is reached. NOTE! This is the only way to complete a streak — there is no "infinite" streak type.
  • Reward: Points, credits, and/or achievement steps. A streak with a count limit awards them once, on completion; one without awards them per increment.

GET /streaks/{id}

Retrieves the streak with the specified ID within the given account.

Streaks track consecutive mission completions across periods (daily, weekly, or monthly). Each period, if the player completes one of the linked missions, the streak count increments. With a count limit, the streak reward is granted once, when the limit is reached; without one, it is granted at every increment. If a period passes without the mission being completed, the streak resets to zero. The all-time period is not supported for streaks. A streak can list several missions; completing any one of them counts for the period, and the count increments at most once per period.

Parameters

NameTypeDescription
id required
in path
string

ID of the streak

account required
in query
string

ID of the account to use for the query

language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Streak retrieved successfully
  • 404 Streak not found or no elements matching the language filter.
Example response
{
  "isAvailable": true,
  "description": "Streak One Description",
  "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
  "tags": [],
  "category": "",
  "limitCount": true,
  "countLimit": 5,
  "priority": 0,
  "objectives": [
    "run-mission"
  ],
  "id": "streak-1",
  "name": "Streak One",
  "active": {
    "from": "2024-03-24T07:25:09.000Z",
    "to": "2024-06-30T06:25:09.000Z"
  },
  "period": "weekly",
  "reward": {
    "multiplier": 1,
    "points": 1,
    "credits": 0,
    "achievements": []
  },
  "account": "acme"
}

GET /streaks

Retrieves all the streaks within the given account. By default, the request returns all active streaks at the time of the request. If the showAll parameter is set to true all streaks defined in the account, regardless of their active period, will be returned instead. More advanced queries can be specified with the timeframe query.

Results are sorted by active start date.

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

tags
in query
string

Specifies the tags by which to filter results. You may specify a comma-separated list of all tags to include and/or exclude (preceding their ID mith a minus sign). Defaults to empty string, all tags are returned

timeframe
in query
string: expired, current, all

Specifies the timeframe by which to filter results. You may specify a comma-separated list of all allowed timeframes for the queried objects. Allowed values are:

  • expired - objects with an active end date in the past
  • current - objects currently active
  • upcoming - objects with an active start date in the future
  • all - all objects, regardless of their active period
availability
in query
string: all, true, false

Specifies the availability by which to filter results. Allowed values are:

  • all - return all results regardless of their availability status
  • true - return only available results)
  • false - return only unavailable results
sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first
language
in query
string

ISO 639-1 code of the language to return names and descriptions in, like fr. Without it, the account's default texts are returned. When an element has no translation for the code, its default text is returned with status 200; the code itself is not checked. Leaderboards are the exception: a leaderboard with no translation for the code returns status 404 with error code 100.

Translations exist only for the languages the account has chosen in the GameLayer dashboard, from these codes: en English, es Spanish, fr French, de German, it Italian, pt Portuguese, nl Dutch, sv Swedish, fi Finnish, da Danish, no Norwegian, pl Polish, ru Russian, tr Turkish, ar Arabic, zh Chinese, ja Japanese, ko Korean.

Responses

  • 200 Streaks retrieved successfully
  • 401 The API key does not match the account.
Example response
[
  {
    "isAvailable": true,
    "description": "Streak One Description",
    "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
    "tags": [],
    "category": "",
    "limitCount": true,
    "countLimit": 5,
    "priority": 0,
    "objectives": [
      "run-mission"
    ],
    "id": "streak-1",
    "name": "Streak One",
    "active": {
      "from": "2024-03-24T07:25:09.000Z",
      "to": "2024-06-30T06:25:09.000Z"
    },
    "period": "weekly",
    "reward": {
      "multiplier": 1,
      "points": 1,
      "credits": 0,
      "achievements": []
    },
    "account": "acme"
  }
]

Surveys#

Surveys collect player feedback through questions with no correct answers and no scoring.

Unlike quizzes, completing a survey always triggers the configured reward — there is no pass/fail. Responses are aggregated across all players and queryable via the result endpoint.

Key properties:

  • Questions: Each has a type (single or multi), text, optional image, and answer choices (no correct answers).
  • Shuffle: Optionally randomize question order.
  • Reward: Points, credits, and/or achievement steps — always awarded on completion.

Surveys can drive missions, just like quizzes. Completing the survey auto-completes the linked mission.

GET /surveys/{id}

Retrieves a survey with specified ID within the given account.

Unlike quizzes, surveys have no correct answers and no scoring. Completing a survey always grants the configured reward. The response includes the survey's questions and answer choices.

Parameters

NameTypeDescription
id required
in path
string

ID of the survey

account required
in query
string

ID of the account to use for the query

Responses

  • 200 Survey retrieved successfully.
  • 404 Survey not found.
Example response
{
  "name": "Survey Two",
  "description": "",
  "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
  "category": "",
  "tags": [],
  "isAvailable": true,
  "isShuffleRequired": true,
  "isResponseScoringEnabled": true,
  "id": "st-survey-2",
  "questions": [
    {
      "type": "single",
      "imgUrl": "",
      "id": "t_ldfjzfw8_qwhfa15ki",
      "text": "q1",
      "choices": [
        {
          "imgUrl": "",
          "text": "r1-1",
          "id": "s_ldfk0icu_qigk0ctdr",
          "points": 5
        },
        {
          "imgUrl": "",
          "text": "r1-2",
          "id": "r_ldfjzpog_lfmcn095v",
          "points": 10
        },
        {
          "imgUrl": "",
          "text": "r1-3",
          "id": "d_ldfjzv4g_4g8xht4f0",
          "points": 0
        }
      ]
    },
    {
      "type": "single",
      "imgUrl": "",
      "id": "h_ldfk02s4_8syju702w",
      "text": "q2",
      "choices": [
        {
          "imgUrl": "",
          "text": "r2-1",
          "id": "r_ldfk0icu_374txinmb"
        },
        {
          "imgUrl": "",
          "text": "r2-2",
          "id": "k_ldfk09na_bkpawnwse"
        },
        {
          "imgUrl": "",
          "text": "r2-3",
          "id": "w_ldfk0d10_wt6v0j6sg"
        }
      ]
    }
  ],
  "reward": {
    "points": 0,
    "credits": 0,
    "achievements": []
  },
  "createdOn": "2023-01-28T06:10:25.116Z",
  "updatedOn": "2023-01-28T06:10:25.116Z"
}

GET /surveys

Retrieves all surveys within the given account. If a player name is specified in the parameters, only those surveys the player is eligible for will be returned. By default, the response will contain all available surveys at the time of the request. That includes surveys that have been explicitly set as available.

Parameters

NameTypeDescription
player
in query
string

If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned

account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

tags
in query
string

Specifies the tags by which to filter results. You may specify a comma-separated list of all tags to include and/or exclude (preceding their ID mith a minus sign). Defaults to empty string, all tags are returned

availability
in query
string: all, true, false

Specifies the availability by which to filter results. Allowed values are:

  • all - return all results regardless of their availability status
  • true - return only available results)
  • false - return only unavailable results
sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first

Responses

  • 200 Surveys retrieved successfully.
  • 404 Account not found.
Example response
[
  {
    "name": "st-survey-1",
    "description": "",
    "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "isShuffleRequired": true,
    "isResponseScoringEnabled": false,
    "id": "st-survey-1",
    "reward": {
      "points": 0,
      "credits": 0,
      "achievements": []
    },
    "createdOn": "2023-01-25T05:58:17.834Z",
    "updatedOn": "2023-01-25T05:58:17.835Z"
  },
  {
    "name": "Survey Two",
    "description": "",
    "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "isShuffleRequired": true,
    "isResponseScoringEnabled": false,
    "id": "st-survey-2",
    "reward": {
      "points": 0,
      "credits": 0,
      "achievements": []
    },
    "createdOn": "2023-01-28T06:10:25.116Z",
    "updatedOn": "2023-01-28T06:10:25.116Z"
  }
]

GET /surveys/{id}/result

Retrieves results for the survey with specified ID within the given account. If player is provided, player details with player answers will be provided.

Parameters

NameTypeDescription
id required
in path
string

ID of the survey

account required
in query
string

ID of the account to use for the query

player
in query
string

ID of the player for which to retrieve the survey result.

Responses

  • 200 Survey results retrieved successfully.
  • 404 Survey or player not found.
Example response
{
  "survey": {
    "id": "st-survey-2",
    "name": "Survey Two",
    "description": "",
    "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
    "category": "",
    "isAvailable": true,
    "isShuffleRequired": true,
    "isResponseScoringEnabled": false,
    "tags": [],
    "questions": [],
    "reward": {
      "points": 0,
      "credits": 0,
      "achievements": []
    },
    "createdOn": "2023-01-28T06:10:25.116Z",
    "updatedOn": "2023-01-28T06:10:25.116Z"
  },
  "results": {
    "questions": [
      {
        "id": "t_ldfjzfw8_qwhfa15ki",
        "text": "q1",
        "imgUrl": "",
        "type": "single",
        "choices": [
          {
            "id": "r_ldfjzpog_lfmcn095v",
            "value": 4,
            "rank": 1,
            "percent": 100,
            "text": "r1-2",
            "imgUrl": ""
          },
          {
            "id": "s_ldfk0icu_qigk0ctdr",
            "value": 0,
            "rank": 2,
            "percent": 0,
            "text": "r1-1",
            "imgUrl": ""
          },
          {
            "id": "d_ldfjzv4g_4g8xht4f0",
            "value": 0,
            "rank": 3,
            "percent": 0,
            "text": "r1-3",
            "imgUrl": ""
          }
        ]
      },
      {
        "id": "h_ldfk02s4_8syju702w",
        "text": "q2",
        "imgUrl": "",
        "type": "single",
        "choices": [
          {
            "id": "r_ldfk0icu_374txinmb",
            "value": 4,
            "rank": 1,
            "percent": 100,
            "text": "r2-1",
            "imgUrl": ""
          },
          {
            "id": "w_ldfk0d10_wt6v0j6sg",
            "value": 1,
            "rank": 2,
            "percent": 25,
            "text": "r2-3",
            "imgUrl": ""
          },
          {
            "id": "k_ldfk09na_bkpawnwse",
            "value": 0,
            "rank": 3,
            "percent": 0,
            "text": "r2-2",
            "imgUrl": ""
          }
        ]
      }
    ]
  }
}

POST /surveys/{id}/complete

Completes given survey with specified ID within the given account for the given player. Submits the player's answers. Since surveys have no scoring, the configured reward (points, credits, achievement steps) is always granted on completion.

Responses are aggregated across all players and can be queried via the survey result endpoint. If the survey drives a mission, the linked mission is also completed.

Parameters

NameTypeDescription
id required
in path
string

ID of the survey

Request body

NameTypeDescription
account requiredstring

ID of the account for the operation

player requiredstring

ID of the player for whom to perform the operation

answers requiredarray of object

Answers to the questions given upon completing the quiz/survey in JSON format. Answers should be an array of objects.

{
  "account": "st-account",
  "player": "st-player-1",
  "answers": [
    {
      "questionId": "t_ldfjzfw8_qwhfa15ki",
      "answerIds": [
        "r_ldfjzpog_lfmcn095v"
      ]
    },
    {
      "questionId": "h_ldfk02s4_8syju702w",
      "answerIds": [
        "r_ldfk0icu_374txinmb"
      ]
    }
  ]
}

Responses

  • 200 API response to survey completed request.
  • 400 Invalid request data.
  • 404 Survey or player not found.
Example response
{
  "survey": {
    "id": "st-survey-2",
    "name": "Survey Two",
    "description": "",
    "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
    "category": "",
    "isAvailable": true,
    "isShuffleRequired": true,
    "isResponseScoringEnabled": false,
    "tags": [],
    "questions": [],
    "reward": {
      "points": 0,
      "credits": 0,
      "achievements": []
    },
    "createdOn": "2023-01-28T06:10:25.116Z",
    "updatedOn": "2023-01-28T06:10:25.116Z"
  },
  "actions": {
    "count": 1,
    "startedOn": "2023-02-05T07:40:46.813Z",
    "completedOn": "2023-02-05T07:40:46.814Z",
    "firstCompletedOn": "2023-02-05T07:40:46.814Z"
  },
  "player": {
    "name": "John Doe",
    "points": 10,
    "credits": 0
  },
  "results": [
    {
      "question": {
        "id": "t_ldfjzfw8_qwhfa15ki",
        "text": "q1",
        "imgUrl": "",
        "type": "single",
        "choices": [
          {
            "id": "r_ldfjzpog_lfmcn095v",
            "value": 5,
            "rank": 1,
            "percent": 100,
            "text": "r1-2",
            "imgUrl": ""
          },
          {
            "id": "s_ldfk0icu_qigk0ctdr",
            "value": 0,
            "rank": 2,
            "percent": 0,
            "text": "r1-1",
            "imgUrl": ""
          },
          {
            "id": "d_ldfjzv4g_4g8xht4f0",
            "value": 0,
            "rank": 3,
            "percent": 0,
            "text": "r1-3",
            "imgUrl": ""
          }
        ]
      },
      "answer": [
        "r_ldfjzpog_lfmcn095v"
      ]
    },
    {
      "question": {
        "id": "h_ldfk02s4_8syju702w",
        "text": "q2",
        "imgUrl": "",
        "type": "single",
        "choices": [
          {
            "id": "r_ldfk0icu_374txinmb",
            "value": 5,
            "rank": 1,
            "percent": 100,
            "text": "r2-1",
            "imgUrl": ""
          },
          {
            "id": "w_ldfk0d10_wt6v0j6sg",
            "value": 1,
            "rank": 2,
            "percent": 20,
            "text": "r2-3",
            "imgUrl": ""
          },
          {
            "id": "k_ldfk09na_bkpawnwse",
            "value": 0,
            "rank": 3,
            "percent": 0,
            "text": "r2-2",
            "imgUrl": ""
          }
        ]
      },
      "answer": [
        "r_ldfk0icu_374txinmb"
      ]
    }
  ],
  "progress": {
    "points": {
      "before": 0,
      "earned": 10
    },
    "credits": {
      "before": 0,
      "earned": 0
    },
    "levels": {
      "completed": [
        {
          "id": "st-level-1",
          "name": "Test Level One",
          "description": "Objectives - none (all start here)",
          "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
          "ordinal": 0
        }
      ],
      "started": {
        "id": "st-level-2",
        "name": "Test Level Two",
        "description": "Objectives - 5 points",
        "imgUrl": "https://images.gamelayer.co/glimages/default/defaultimg.png",
        "ordinal": 1,
        "startedOn": "2023-02-05T09:40:46+02:00"
      }
    },
    "missions": [],
    "achievements": []
  },
  "pointsAwarded": 10
}

Teams#

Teams are groups of players that can compete together and aggregate scores. A player belongs to at most one team.

When a player earns points or credits, those scores also accumulate on their team. Teams can participate in team leaderboards (using element: team or element: teammembers) and have their own level progression.

Key properties:

  • Category: Segment teams into groups.
  • Tags: Label teams for filtering and requirement matching.
  • Level: Teams can be assigned to levels, similar to players.
  • Points / Credits: Aggregated from team members' activity.

GET /teams/{id}

Retrieves the team data with the specified ID within the given account

Parameters

NameTypeDescription
id required
in path
string

ID of the team

account required
in query
string

ID of the account to use for the query

Responses

  • 200 Team retrieved successfully
  • 404 Team not found.
Example response
{
  "team": {
    "description": "Home of the brave!",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/team1.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "points": 1521,
    "credits": 178,
    "level": "",
    "id": "a-team",
    "name": "The A-Team",
    "createdOn": "2022-03-03T06:00:00.825Z"
  },
  "players": [
    {
      "tags": [
        "coder"
      ],
      "category": "",
      "points": 0,
      "credits": 998,
      "player": "player-080277",
      "name": "Jane Doe",
      "createdOn": "2022-03-03T05:58:16.622Z"
    },
    {
      "tags": [
        "running",
        "health"
      ],
      "category": "",
      "points": 811,
      "credits": 172,
      "player": "player-200701",
      "name": "Susan Smith",
      "createdOn": "2022-03-03T05:59:24.752Z"
    }
  ]
}

PATCH /teams/{id}

Updates a team within the given account (partial update). Partial data update allows you to specify only certain field to be updated, i.e. if a field is not present in the request, it will not be modified on the updated document

Parameters

NameTypeDescription
id required
in path
string

ID of the team

Request body

NameTypeDescription
account requiredstring

ID of the account for the operation

id requiredstring

ID of the team

namestring

Name of the team

descriptionstring

Team description

imgUrlstring

URL of the team image

categorystring

Category for the team. By default, no category is assigned to the team

tagsstring

Tags to assign to the team as a comma-separated list

modestring: set, increment

Mode to use for the trigger:

  • set - player or team count is set to the specified value, setting rewards (points, credits, etc) accordingly
  • increment - the player or team count is incremented by the amount specified in the request
pointsinteger

Amount of points to grant to the team

creditsinteger

Amount of credits to grant to the team

isAvailableboolean

Specifies if the element is available for operations:

  • true - element is available
  • false - element is not available
{
  "id": "a-team",
  "name": "A-team",
  "category": "",
  "tags": "running",
  "points": 100,
  "credits": 0,
  "account": "docs-for-devs"
}

Responses

  • 200 Team updated successfully
  • 400 Bad request. Check request data.
  • 404 Team not found.
Example response
{
  "description": "Home of the brave!",
  "imgUrl": "https://images.gamelayer.co/glimages/acme/team1.png",
  "category": "",
  "tags": [],
  "isAvailable": true,
  "points": 100,
  "credits": 0,
  "level": "",
  "id": "a-team",
  "name": "A-team",
  "createdOn": "2022-03-03T06:00:00.825Z"
}

DELETE /teams/{id}

Deletes the specified team from the given account

Parameters

NameTypeDescription
id required
in path
string

ID of the team

account required
in query
string

ID of the account to use for the query

Responses

  • 204 Team deleted successfully
  • 404 Team not found.

GET /teams

Retrieves all teams within the given account

Parameters

NameTypeDescription
account required
in query
string

ID of the account to use for the query

limit
in query
integer

Number of results to return in the response, 1 to 1000. Useful for pagination. Values below 1 or not a number use the default; values above 1000 return 1000.

skip
in query
integer

Number of results to skip from the beginning. Useful for pagination

category
in query
string

Specifies the category by which to filter results. You may specifiy a comma-separated list of all allowed categories. Defaults to empty string, all categories will be returned

tags
in query
string

Specifies the tags by which to filter results. You may specify a comma-separated list of all tags to include and/or exclude (preceding their ID mith a minus sign). Defaults to empty string, all tags are returned

level
in query
string

Specifies the levels by which to filter results. You may specify a comma-separated list of all levels to include and/or exclude (preceding their ID mith a minus sign)

sort
in query
string

Specifies the field by which to order results. You may specify the sort criterion for queried results. Results are sorted in descending order, i.e. most recent and highest values first, unless otherwise specified in the order parameter. Defaults to nothing, i.e. results are returned unsorted

order
in query
string: asc, desc

Specifies the sort order to use for the sorted queries. Allowed values are:

  • asc - ascending order, i.e. lowest or oldest first
  • desc - descending order, i.e. highest or most recent first

Responses

  • 200 All teams retrieved successfully
  • 404 Account not found.
Example response
[
  {
    "description": "Home of the brave!",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/team1.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "points": 1521,
    "credits": 178,
    "level": "",
    "id": "a-team",
    "name": "The A-Team",
    "createdOn": "2022-03-03T06:00:00.825Z"
  },
  {
    "description": "We are the champions!",
    "imgUrl": "https://images.gamelayer.co/glimages/acme/team2.png",
    "category": "",
    "tags": [],
    "isAvailable": true,
    "points": 3,
    "credits": 0,
    "level": "",
    "id": "b-team",
    "name": "The B-Squad",
    "createdOn": "2022-03-03T06:00:16.892Z"
  }
]

POST /teams

Creates a team within the given account

Request body

NameTypeDescription
id requiredstring

ID of the team

account requiredstring

ID of the account for the operation

name requiredstring

Name of the team

descriptionstring

Team description

imgUrlstring

URL of the team image

categorystring

Category for the team. By default, no category is assigned to the team

tagsstring

Tags to assign to the team as a comma-separated list

isAvailableboolean

Specifies if the element is available for operations:

  • true - element is available
  • false - element is not available
levelstring

Level for the team (level ID). By default, team is assigned to base level.

pointsinteger

Amount of points to grant to the team

creditsinteger

Amount of credits to grant to the team

{
  "id": "team-sm",
  "account": "docs-for-devs",
  "name": "Sales & Marketing",
  "description": "Team for the Sales & Marketing folks",
  "imgUrl": "https://images.gamelayer.co/glimages/acme/team-one.png",
  "category": "",
  "tags": "",
  "isAvailable": true,
  "points": 0,
  "credits": 0,
  "level": ""
}

Responses

  • 201 Team successfully created
  • 400 Bad request. Check request data.
  • 409 Team not created. Team exists.
Example response
{
  "description": "Team for the Sales & Marketing folks",
  "imgUrl": "https://images.gamelayer.co/glimages/acme/team-one.png",
  "category": "",
  "tags": [],
  "isAvailable": true,
  "points": 0,
  "credits": 0,
  "level": "",
  "id": "team-sm",
  "name": "Sales & Marketing",
  "createdOn": "2022-03-03T06:00:00.825Z"
}