Developer setup
This page covers your credentials, authentication, testing and where to go next. Your account admin has the account ID and Account API key from the dashboard.
What you need#
| You need | Where it comes from |
|---|---|
| Account ID | A short lowercase name, such as acme. Your account admin finds it on the Accounts page in the dashboard. |
| Account API key | In the account's Account Settings, on the same page. Your account admin shares it with you securely. See where to find it. |
| A trial account | Request one through the trial form. See Environments and testing. |
| At least one event | Configured in the dashboard, or built by Claude. The Quickstart lists what its examples use. |
Authentication#
Every GameLayer API request sends two things:
| What | Where | Example |
|---|---|---|
| Account API key | api-key header | api-key: your-account-api-key |
| Account ID | account query parameter for GET and DELETE, body field for POST and PATCH | account=acme |
curl "https://api.gamelayer.co/api/v0/events?account=acme" \
-H "api-key: $GAMELAYER_API_KEY"If the account ID doesn't match the key, the API answers 401 Unauthorized.
Keep the key on your servers#
Anyone who has the Account API key can call every GameLayer API operation for your account, not only the ones your app uses. That includes completing events and claiming prizes for any player, deleting players and setting leaderboard scores. The key doesn't give access to the Admin API.
- Call GameLayer from your backend, and keep the key in a server-side secret such as an environment variable or a key vault.
- Never put the key in a web page, a mobile app or a public repository.
- If you think it has been exposed, contact developer@gamelayer.co straight away.
For a web or mobile app, give it a small endpoint on your backend that adds the key. See Never ship the key in an app.
Environments and testing#
There's one environment, production: the API is at https://api.gamelayer.co/api/v0 and the dashboard at app.gamelayer.co.
To test, use a separate trial account, so test players and events never mix with your live data. Request one through the trial form on gamelayer.io. A trial account works exactly like a live one, except that it has a limit on the number of players (error code 22 when you reach it).
Rate limits#
There are two kinds of limit, counted per minute: one per Account API key, and one per IP address.
Per key#
Writes and claims are limited per Account API key and account:
| Endpoint | Limit per minute |
|---|---|
POST /events/{id}/complete | 6,000 |
POST /players | 600 |
POST /quizzes/{id}/complete | 600 |
POST /surveys/{id}/complete | 600 |
| Claims on prizes, mystery boxes and raffles | 60 each |
- Over a limit, the API answers
429with aRetry-Afterheader and"code": "RATE_LIMIT_EXCEEDED". Wait that long, then retry. POST /playersonly creates players: for an existing player it answers409with error code21. Updates (PUTorPATCH /players/{player}) and reads have no per-key limit.- A
429with error code24is different: another request is updating the same player. Wait 1 second and retry.
Per IP address#
Any single IP address can send at most 2,000 requests a minute, across all endpoints. This applies whatever the per-key limits allow, so it's the real ceiling for one server: one server can't reach 6,000 event completions a minute.
- Over it, requests get
429with anerrormessage and noRetry-Afterheader. A429withoutRetry-Aftermeans: wait for the next minute, then retry. - If one server needs more, contact developer@gamelayer.co.
See When to retry for what's safe to send again.
The two APIs#
| GameLayer API | Admin API | |
|---|---|---|
| What it does | Runs the game: players, completed events, progress, prize claims | Builds the game: events, missions, achievements, levels, streaks, quizzes, surveys, leaderboards and prizes |
| Base URL | https://api.gamelayer.co/api/v0 | https://api.gamelayer.co/admin/v0 |
| Authentication | api-key header with the Account API key | Authorization: Bearer glak.… with an Agent Key |
| Typical caller | Your backend, many times a second | The dashboard, Claude, or your own agent or script |
| Reference | GameLayer API · Try it | Admin API · Try it |
GameLayer API
- What it does
- Runs the game: players, completed events, progress, prize claims
- Base URL
https://api.gamelayer.co/api/v0- Authentication
api-keyheader with the Account API key- Typical caller
- Your backend, many times a second
- Reference
- GameLayer API · Try it
Admin API
- What it does
- Builds the game: events, missions, achievements, levels, streaks, quizzes, surveys, leaderboards and prizes
- Base URL
https://api.gamelayer.co/admin/v0- Authentication
Authorization: Bearer glak.…with an Agent Key- Typical caller
- The dashboard, Claude, or your own agent or script
- Reference
- Admin API · Try it
The Account API key can't reach the Admin API, and an Agent Key can't call the GameLayer API. Most integrations only need the GameLayer API: you configure the game in the dashboard or with Claude. See Admin API and agents for scripting your configuration.
Developer kit#
One download with ready-to-run material:
- Postman collection with a Getting Started folder that discovers your element IDs, creates a player, completes an event and claims a prize
- Example clients in JavaScript, Python and C#, each with a runnable quickstart and a helper that retries event completions safely. They're examples to copy and adapt, not versioned packages.
- curl script that runs the core flow
- The guides on this site, as Markdown
Download the developer kit (.zip)
Where next#
- Quickstart: create a player, complete an event and claim a prize in about 10 minutes.
- Concepts: points and credits, requirements, periods and the progression cascade.
- Integration guide: patterns for production.
- Error codes: what each error means and what to do.
Questions: developer@gamelayer.co.