GameLayer API reference
Every endpoint in the GameLayer gamification API, with parameters, request bodies and JSON examples. Generated from the OpenAPI 3.0.0 specification.
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
The API key will be provided when you sign up for a GameLayer account.
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
}
Dual (Virtual) Currency System
GameLayer uses two distinct virtual currencies:
| Currency | Behavior | Purpose | |----------|----------|---------| | Points | Accumulate over time. Never decrease through player actions. | Progression and ranking — points determine level advancement and leaderboard position. | | Credits | Spendable 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:
| Period | Resets | |--------|--------| | daily | Once per day | | weekly | Once per week | | monthly | Once per month | | all-time | Never resets |
When a period resets, completion counts and progress for that element start fresh.
Refresh Offset
Each player has a configurable refreshOffset (e.g., UTC+02:00) that determines when their daily/weekly/monthly periods roll over. This ensures fair timing regardless of the player's timezone. The valid range is UTC-12:00 to UTC+14:00. If no refreshOffset has been provided, refresh will happen at UTC+00:00.
The Progression Cascade
When your application calls POST /events/{id}/complete, a single action can cascade through multiple elements automatically:
- Event completes — awards points, credits, and achievement steps.
- Rules evaluate — matching rules apply point multipliers.
- Missions progress — missions with this event in their objectives update. Completed missions grant their reward.
- 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.
- Achievements advance — steps from events, missions, and streaks are applied. Completed achievements grant their reward and may chain to other achievements.
- 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.
- Leaderboards update — player and team scores are updated.
The response includes a progress object summarizing everything that happened.
Servers
https://api.dev.gamelayer.co/api/v0https://api.gamelayer.co/api/v0
Achievements
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 specified achievement data within the given account
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the achievement |
account requiredin query | string | ID of the account to use for the query |
languagein query | string | 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 |
Responses
200Achievement retrieved succesfully404Achievement 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/gltest/badge1.png",
"requirement": {
"category": "",
"tags": [],
"missions": [],
"achievements": [],
"level": {
"id": "",
"ordinal": 0
}
},
"reward": {
"points": 10,
"credits": 10,
"achievements": []
}
}GET /achievements
Retrieves all achievements within the given account
Retrieves achievements based on provided query within the given account
Parameters
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
playerin query | string | If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned |
categoryin 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 |
tagsin 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 |
availabilityin 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 |
sortin 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 |
orderin 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 |
languagein query | string | 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 |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
Responses
200Achievements retrieved succesfully404Theplayergiven 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/gltest/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 analytics for the given account.
Retrieves the account's lifetime totals: players, completions, points and credits awarded, prize and mystery box draws, API calls and more.
Parameters
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
Responses
200Analytics retrieved successfully. Before the first analytics update every figure is 0.401The 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.
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
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
startDate requiredin query | string | Specifies the start date for the query. |
endDate requiredin query | string | Specifies the end date for the query. |
Responses
200Active player data retrieved succesfully400Invalid request. Check start and end date in request.
Events
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
countvalue to register multiple completions in a single call. - Mode:
increment(add to count) orset(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 specified event for the specified player within the given account
Completes the defined event for the specified player within the given account. This is the primary integration endpoint — it triggers the full progression cascade:
- The event's configured reward (points, credits, achievement steps) is awarded.
- Rules are evaluated and point multipliers applied if conditions match.
- Missions with this event in their objectives have progress updated; completed missions grant their rewards.
- Streaks linked to completed missions are incremented (or reset if a period was missed).
- Achievements receiving steps are advanced; completed achievements grant their rewards and may chain.
- Level objectives are checked; the player levels up if thresholds are met.
- 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.
Parameters
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the event |
Request body
Event completion details
| Name | Type | Description |
|---|---|---|
account required | string | ID of the account for the operation |
player required | string | ID of the player |
count | integer | 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 |
tags | array of string | An array of tags |
language | string | 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 |
lat | number (double) | Player's current latitude (WGS84) |
lon | number (double) | Player's current longitude (WGS84) |
{
"player": "player-080277",
"account": "docs-for-devs"
}
Responses
200Event completed400Invalid request. Check request data.404Needed element not found (player, event).429Player is currently being processed by another request. The client should wait and retry after the duration indicated by theRetry-Afterheader (in seconds). This happens when concurrent requests attempt to complete events for the same player simultaneously.
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 specified event data within the given account
Retrieves the event with the specified ID within the given account
Parameters
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the event |
account requiredin query | string | ID of the account to use for the query |
languagein query | string | 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 |
Responses
200Event retrieved succesfully404Event 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 all events within the given account
Retrieves events specified by given query within the given account.
Parameters
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
categoryin 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 |
availabilityin 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 |
sortin 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 |
orderin 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 |
languagein query | string | 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 |
Responses
200Events retrieved succesfully401The 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 player within a date range
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
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
player requiredin query | string | ID of the player to use for the query |
startDate requiredin query | string | Specifies the start date for the query. |
endDate requiredin query | string | Specifies the end date for the query. |
elementTypein query | string | Filter entries by the type of gamification element that generated the entry. Examples: mission, achievement, event, prize |
actionin 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 |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
sortin 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. |
orderin 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
200Journal entries retrieved successfully400Invalid query (errorCode 26):account,player,startDateorendDateis missing, a date is not inYYYY-MM-DDformat, a parameter is given more than once or as an object, orsortis not one of the allowed fields.500The 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 journal summary for a player within a date range
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
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
player requiredin query | string | ID of the player to use for the query |
startDate requiredin query | string | Specifies the start date for the query. |
endDate requiredin query | string | Specifies the end date for the query. |
Responses
200Journal summary retrieved successfully400Invalid query (errorCode 26):account,player,startDateorendDateis missing, a date is not inYYYY-MM-DDformat, or a parameter is given more than once or as an object.500The 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
Leaderboards provide competitive rankings comparing players or teams based on accumulated points or credits.
Key properties:
- Element:
player(individual ranking),team(team aggregate scores), orteammembers(players ranked within a specific team). - Rank by:
total(sum of scores) oraverage(average per team member — useful for fair team comparison regardless of team size). - Units:
pointsorcredits— 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, orall-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 player score data for the specified leaderboard within the given account
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the leaderboard |
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
categoryin 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 |
teamin query | string | Team for which to retrieve leaderboard scores. Required if the leaderboard is partitioned by team members vs team members, ignored otherwise |
rankByin 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 |
languagein query | string | 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 |
Responses
200Leaderboard retrieved successfully404Leaderboard 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 leaderboards within the given account
Retrieves all of the leaderboards within the given account
Parameters
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
playerin query | string | If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned |
categoryin 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 |
availabilityin 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 |
sortin 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 |
orderin 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 |
languagein query | string | 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 |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
Responses
200Leaderboards retrieved succesfully401The 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
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 specified level data within the given account
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the level |
account requiredin query | string | ID of the account to use for the query |
languagein query | string | 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 |
Responses
200Level retrieved succesfully404Level 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/gltest/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 levels within the given account
Retrieves all of the levels within the given account
Parameters
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
categoryin 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 |
availabilityin 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 |
sortin 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 |
orderin 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 |
languagein query | string | 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 |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
Responses
200Levels retrieved succesfully401The 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/gltest/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/gltest/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/gltest/3572831.png",
"category": "",
"tags": [],
"isAvailable": true,
"id": "level-3",
"ordinal": 2,
"objectives": {
"points": 5000,
"credits": 0,
"achievements": []
},
"reward": {
"points": 0,
"credits": 0,
"achievements": []
}
}
]Missions
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, orall-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 specified mission data within the given account
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the mission |
account requiredin query | string | ID of the account to use for the query |
languagein query | string | 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 |
Responses
200Mission retrieved succesfully404Mission 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/gltest/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 missions within the given account
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
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
categoryin 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 |
tagsin 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 |
playerin query | string | If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned |
timeframein 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 |
availabilityin 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 |
sortin 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 |
orderin 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 |
languagein query | string | 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 |
latin 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. |
lonin query | number (double) | Player's current longitude (WGS84). Must be provided together with lat for location-based filtering to take effect. |
locationFilterin 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
200Missions retrieved successfully404Theplayergiven 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/gltest/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/gltest/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
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 specified mystery box data within the given account
Retrieves the mystery box with the specified ID within the given account
Parameters
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the mystery box |
account requiredin query | string | ID of the account to use for the query |
playerin query | string | If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned |
languagein query | string | 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 |
Responses
200Mystery box retrieved succesfully404Mystery 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/gltest/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
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the mystery box |
Request body
| Name | Type | Description |
|---|---|---|
player required | string | ID of the player for whom to perform the operation |
account required | string | ID of the account for the operation |
language | string | 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 |
lat | number (double) | Player's current latitude (WGS84) |
lon | number (double) | Player's current longitude (WGS84) |
{
"account": "gamelayer-test",
"player": "player-1"
}
Responses
200Mystery box redeemed succesfully404Mysterybox 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/gltest/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/gltest/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 mystery boxes within the given account
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
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
categoryin 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 |
tagsin 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 |
playerin query | string | If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned |
availabilityin 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 |
sortin 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 |
orderin 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 |
timeframein 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 |
stockin 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 |
languagein query | string | 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 |
latin 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. |
lonin query | number (double) | Player's current longitude (WGS84). Must be provided together with lat for location-based filtering to take effect. |
locationFilterin 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
200Mystery boxes retrieved successfully404Theplayergiven 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/gltest/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
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 specified player data within the given account
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
| Name | Type | Description |
|---|---|---|
player requiredin path | string | ID of the player |
account requiredin query | string | ID of the account to use for the query |
Responses
200Player retrieved succesfully404Player not found
Example response
{
"tags": [
"coder"
],
"category": "",
"imgUrl": "https://images.gamelayer.co/glimages/gltest/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": ""
}PATCH /players/{player}
Updates a player within the given account
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
| Name | Type | Description |
|---|---|---|
player requiredin path | string | ID of the player |
Request body
| Name | Type | Description |
|---|---|---|
account required | string | ID of the account for the operation |
player required | string | ID of the player for whom to perform the operation |
name | string | Name of the player |
tags | array of items | Tags to assign to the player as a comma-separated list |
category | string | Category for the player. By default, no category is assigned to the player |
imgUrl | string | URL of the player image |
team | string | 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. |
mode | string: 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 |
points | integer | Amount of points granted to the player |
credits | integer | Amount of credits granted to the player |
refreshOffset | 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. |
{
"account": "gltest",
"player": "player-42",
"name": "Mr Anderson",
"tags": [
"running",
"health"
],
"category": "",
"imgUrl": "",
"points": 300,
"credits": 30
}
Responses
200Player updated successfully400Bad request. Check request data.404Player or team not found
Example response
{
"tags": [
"coder"
],
"category": "",
"imgUrl": "https://images.gamelayer.co/glimages/gltest/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": ""
}DELETE /players/{player}
Deletes a player within the given account
Deletes the specified player from the given account
Parameters
| Name | Type | Description |
|---|---|---|
player requiredin path | string | ID of the player |
account requiredin query | string | ID of the account to use for the query |
Request body
| Name | Type | Description |
|---|---|---|
hardDelete | boolean | If set, all player records will also be deleted. Default is false. |
Responses
204Player deleted successfully404Player not found.
GET /players/{player}/achievements
Retrieves the player's achievements within the given account
Retrieves the unlocked and/or granted achievements for player with the specified ID within the given account
Parameters
| Name | Type | Description |
|---|---|---|
player requiredin path | string | ID of the player |
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
completionin 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 |
orderin 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 |
languagein query | string | 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 |
Responses
200Player achievements retrieved succesfully404Player 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/gltest/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/gltest/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 player's events within the given account
Retrieves the completed event actions for player with the specified ID within the given account
Parameters
| Name | Type | Description |
|---|---|---|
player requiredin path | string | ID of the player |
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
completionin 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 |
orderin 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 |
languagein query | string | 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 |
Responses
200Player events retrieved succesfully404Player 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 player's levels within the given account
Retrieves the completed level actions for player with the specified ID within the given account
Parameters
| Name | Type | Description |
|---|---|---|
player requiredin path | string | ID of the player |
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
completionin 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 |
orderin 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 |
languagein query | string | 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 |
Responses
200Player levels retrieved succesfully404Player 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/gltest/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 player's missions within the given account
Retrieves the started and/or completed missions for player with the specified ID within the given account
Parameters
| Name | Type | Description |
|---|---|---|
player requiredin path | string | ID of the player |
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
completionin 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 |
orderin 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 |
languagein query | string | 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 |
Responses
200Player missions retrieved succesfully404Player 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/gltest/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 player's mission progress
Retrieves the mission progress for a given player and mission with the specified ID within the given account.
Parameters
| Name | Type | Description |
|---|---|---|
player requiredin path | string | ID of the player |
id requiredin path | string | ID of the mission |
account requiredin query | string | ID of the account to use for the query |
Responses
200Progress retrieved succesfully404Player 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 player's prizes within the given account
Retrieves the redeemed prizes for player with the specified ID within the given account
Parameters
| Name | Type | Description |
|---|---|---|
player requiredin path | string | ID of the player |
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
completionin 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 |
orderin 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 |
languagein query | string | 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 |
Responses
200Player prizes retrieved succesfully404Player 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/gltest/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 player's ranking within the given account
Retrieves the given leaderboard ranking data for player with the specified ID within the given account
Parameters
| Name | Type | Description |
|---|---|---|
player requiredin path | string | ID of the player |
account requiredin query | string | ID of the account to use for the query |
languagein query | string | 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 |
Responses
200Player ranking retrieved succesfully404Player 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 the player's streaks within the given account
Retrieves active and/or completed streaks for player with the specified ID within the given account
Parameters
| Name | Type | Description |
|---|---|---|
player requiredin path | string | ID of the player |
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
completionin 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 |
orderin 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 |
languagein query | string | 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 |
Responses
200Player streaks retrieved succesfully404Player 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": "gltest",
"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": "gltest",
"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": "gltest",
"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
Retrieves all players within the given account.
Parameters
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
categoryin 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 |
tagsin 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 |
levelin 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) |
teamin 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) |
refreshOffsetin 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. |
sortin 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 |
orderin 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
200Players retrieved successfully404Account not found.
Example response
[
{
"tags": [
"coder"
],
"category": "",
"imgUrl": "https://images.gamelayer.co/glimages/gltest/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": ""
},
{
"tags": [
"gamer"
],
"category": "",
"imgUrl": "https://images.gamelayer.co/glimages/gltest/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": ""
}
]POST /players
Creates a player within the given account
Request body
| Name | Type | Description |
|---|---|---|
player required | string | ID of the player for whom to perform the operation |
account required | string | ID of the account for the operation |
name required | string | Name of the player |
imgUrl | string | URL of the player image |
category | string | Category for the player. By default, no category is assigned to the player |
tags | array of items | Tags to assign to the player as a comma-separated list |
team | string | Team for the player (team ID). By default, no team is assigned to the player |
level | string | Level for the player (level ID). By default, player is assigned to base level. |
points | integer | Amount of points granted to the player |
credits | integer | Amount of credits granted to the player |
refreshOffset | 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. |
{
"account": "gamelayer-test",
"player": "player-1",
"name": "Player One"
}
Responses
201Player created successfully created400Bad request. Check request data.404Required element (team) not found.409Player 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
Batch-create up to 1000 players
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
| Name | Type | Description |
|---|---|---|
account required | string | Account ID shared by all players in the batch |
players required | array 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
201Batch processed successfully400Validation 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 exceeded404Account not found or team not found
Example response
{
"created": [
"player-1"
],
"existing": [
"player-2"
]
}POST /players/batch-delete
Batch-delete up to 1000 players
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
| Name | Type | Description |
|---|---|---|
account required | string | Account ID |
players required | array of string | Array of player ID strings to delete |
hardDelete | boolean | 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
200Batch delete processed successfully400Validation error. Possible reasons: - Missing or empty players array - Players array exceeds 1000 items404Account not found
Example response
{
"deleted": 2,
"requested": 3
}Prizes
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, orall-timefor 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 Player 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 specified prize data within the given account
Retrieves the prize with the specified ID within the given account
Parameters
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the prize |
account requiredin query | string | ID of the account to use for the query |
languagein query | string | 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 |
Responses
200Prize retrieved succesfully404Prize 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/gltest/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
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the prize |
Request body
| Name | Type | Description |
|---|---|---|
player required | string | ID of the player for whom to perform the operation |
account required | string | ID of the account for the operation |
language | string | 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 |
lat | number (double) | Player's current latitude (WGS84) |
lon | number (double) | Player's current longitude (WGS84) |
voucherCode | string | 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
200Prize claimed succesfully404Prize 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/gltest/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 prizes within the given account
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
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
playerin query | string | If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned |
categoryin 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 |
tagsin 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 |
availabilityin 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 |
sortin 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 |
orderin 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 |
timeframein 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 |
stockin 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 |
languagein query | string | 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 |
latin 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. |
lonin query | number (double) | Player's current longitude (WGS84). Must be provided together with lat for location-based filtering to take effect. |
locationFilterin 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 |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
missionPrizein 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. |
useVouchersin 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
200Prizes retrieved successfully404Theplayergiven 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/gltest/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/gltest/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 (
singleormulti), 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.
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the quiz |
account requiredin query | string | ID of the account to use for the query |
Responses
200Quiz retrieved succesfully.404Quiz 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 quizzes within the given account
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
| Name | Type | Description |
|---|---|---|
playerin query | string | If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned |
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
categoryin 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 |
tagsin 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 |
availabilityin 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 |
sortin 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 |
orderin 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
200Quizzes retrieved successfully404Account 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 quiz results with specified ID within the given account for a player.
Retrieves results for the quiz with specified ID within the given account for a player.
Parameters
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the quiz |
account requiredin query | string | ID of the account to use for the query |
playerin query | string | ID of the player for which to retrieve the quiz result. |
Responses
200Quiz results retrieved succesfully.404Quiz 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.
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the quiz |
Request body
| Name | Type | Description |
|---|---|---|
account required | string | ID of the account for the operation |
player required | string | ID of the player for whom to perform the operation |
{
"account": "st-account",
"player": "st-player-1"
}
Responses
200Quiz started.400Quiz has not been started or answers are missing/invalid404Quiz 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.
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the quiz |
Request body
| Name | Type | Description |
|---|---|---|
account required | string | ID of the account for the operation |
player required | string | ID of the player for whom to perform the operation |
answers required | array 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
200Quiz completed.400Invalid request data or quiz not started in time.404Quiz 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
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 specified raffle ticket within the given account
Retrieves the raffle ticket with the specified ID within the given account
Parameters
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the raffle |
account requiredin query | string | ID of the account to use for the query |
languagein query | string | 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 |
Responses
200Raffle ticket retrieved succesfully404Raffle 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/gltest/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 raffles within the given account
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
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
playerin query | string | If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned |
categoryin 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 |
tagsin 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 |
availabilityin 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 |
sortin 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 |
orderin 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 |
timeframein 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 |
stockin 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 |
languagein query | string | 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 |
latin 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. |
lonin query | number (double) | Player's current longitude (WGS84). Must be provided together with lat for location-based filtering to take effect. |
locationFilterin 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 |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
Responses
200Raffles retrieved successfully404Theplayergiven 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/gltest/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
Claims a raffle ticket within the given account
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the raffle |
Request body
| Name | Type | Description |
|---|---|---|
player required | string | ID of the player for whom to perform the operation |
account required | string | ID of the account for the operation |
language | string | 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 |
lat | number (double) | Player's current latitude (WGS84) |
lon | number (double) | Player's current longitude (WGS84) |
{
"account": "gamelayer-test",
"player": "player-1"
}
Responses
200Raffle ticket claimed succesfully404Raffle 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/gltest/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
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 Player 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 the specified rule data within the given account
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the rule |
account requiredin query | string | ID of the account to use for the query |
Responses
200Rule retrieved succesfully404Rule 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
Retrieves all rules within the given account.
Parameters
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
sortin 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 |
orderin 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
200Rules retrieved successfully404Account not found.
Streaks
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) and they earn the streak reward. If they miss a period, the streak resets to zero.
Key properties:
- Objectives: Mission IDs driving the streak; completing any one of them counts for the period.
- Period:
daily,weekly, ormonthly. - 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 awarded per streak increment.
GET /streaks/{id}
Retrieves the specified streak data within the given account
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 and the streak reward is granted. 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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the streak |
account requiredin query | string | ID of the account to use for the query |
languagein query | string | 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 |
Responses
200Streak retrieved succesfully404Streak 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": "gltest"
}GET /streaks
Retrieves all streaks within the given account
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
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
categoryin 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 |
tagsin 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 |
timeframein 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 |
availabilityin 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 |
sortin 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 |
orderin 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 |
languagein query | string | 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 |
Responses
200Streaks retrieved successfully401The 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": "gltest"
}
]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 (
singleormulti), 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.
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the survey |
account requiredin query | string | ID of the account to use for the query |
Responses
200Survey retrieved succesfully.404Survey 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.
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
| Name | Type | Description |
|---|---|---|
playerin query | string | If specified, only the results for which the player is eligible, i.e. fulfills all requirements, will be returned |
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
categoryin 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 |
tagsin 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 |
availabilityin 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 |
sortin 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 |
orderin 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
200Surveys retrieved succesfully.404Account 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 survey results with specified ID within the given account for a player.
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the survey |
account requiredin query | string | ID of the account to use for the query |
playerin query | string | ID of the player for which to retrieve the survey result. |
Responses
200Survey results retrieved succesfully.404Survey 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.
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the survey |
Request body
| Name | Type | Description |
|---|---|---|
account required | string | ID of the account for the operation |
player required | string | ID of the player for whom to perform the operation |
answers required | array 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
200API response to survey completed request.400Invalid request data.404Survey 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 specified team data within the given account
Retrieves the team data with the specified ID within the given account
Parameters
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the team |
account requiredin query | string | ID of the account to use for the query |
Responses
200Team retrieved succesfully404Team not found.
Example response
{
"team": {
"description": "Home of the brave!",
"imgUrl": "https://images.gamelayer.co/glimages/gltest/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
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
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the team |
Request body
| Name | Type | Description |
|---|---|---|
account required | string | ID of the account for the operation |
id required | string | ID of the team |
name | string | Name of the team |
description | string | Team description |
imgUrl | string | URL of the team image |
category | string | Category for the team. By default, no category is assigned to the team |
tags | string | Tags to assign to the team as a comma-separated list |
mode | string: 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 |
points | integer | Amount of points to grant to the team |
credits | integer | Amount of credits to grant to the team |
isAvailable | boolean | 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
200Team updated successfully400Bad request. Check request data.404Team not found.
Example response
{
"description": "Home of the brave!",
"imgUrl": "https://images.gamelayer.co/glimages/gltest/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 a team within the given account
Deletes the specified team from the given account
Parameters
| Name | Type | Description |
|---|---|---|
id requiredin path | string | ID of the team |
account requiredin query | string | ID of the account to use for the query |
Responses
204Team deleted successfully404Team not found.
GET /teams
Retrieves all teams data within the given account
Retrieves all teams within the given account
Parameters
| Name | Type | Description |
|---|---|---|
account requiredin query | string | ID of the account to use for the query |
limitin 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. |
skipin query | integer | Number of results to skip from the beginning. Useful for pagination |
categoryin 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 |
tagsin 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 |
levelin 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) |
sortin 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 |
orderin 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
200All teams retrieved succesfully404Account not found.
Example response
[
{
"description": "Home of the brave!",
"imgUrl": "https://images.gamelayer.co/glimages/gltest/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/gltest/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
| Name | Type | Description |
|---|---|---|
id required | string | ID of the team |
account required | string | ID of the account for the operation |
name required | string | Name of the team |
description | string | Team description |
imgUrl | string | URL of the team image |
category | string | Category for the team. By default, no category is assigned to the team |
tags | string | Tags to assign to the team as a comma-separated list |
isAvailable | boolean | Specifies if the element is available for operations: - true - element is available - false - element is not available |
level | string | Level for the team (level ID). By default, team is assigned to base level. |
points | integer | Amount of points to grant to the team |
credits | integer | 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/gltest/team-one.png",
"category": "",
"tags": "",
"isAvailable": true,
"points": 0,
"credits": 0,
"level": ""
}
Responses
201Team successfully created400Bad request. Check request data.409Team not created. Team exists.
Example response
{
"description": "Team for the Sales & Marketing folks",
"imgUrl": "https://images.gamelayer.co/glimages/gltest/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"
}