Skip to content

POST /token — Create a scoped API token

POST https://api.sandbox-gameye.gameye.net/token

Section titled “POST https://api.sandbox-gameye.gameye.net/token”

Creates a new API token with a specified set of scopes and optional expiry. The calling token can only grant scopes it already holds — it cannot create a token with broader permissions than itself.

Requires the token:write scope on the calling token.

FieldTypeRequiredDescriptionExample
namestringYesA human-readable name for this token. Must be unique within your account."match-server-token"
scopesarrayYesThe list of permission scopes to assign to the new token.["session:start", "session:read"]
expires_afterstringNoHow long until the token expires. Valid time units are m and h, e.g. "30m", "1h", "2h30m". Values under a minute are rounded up. Omit for a non-expiring token."2h"
ScopeDescription
session:startStart new game sessions
session:readList and describe sessions
session:stopStop running sessions
artifact:readDownload session artifacts
logs:readStream session logs
regions:readList regions and check tag availability
token:writeCreate new tokens (delegation)
application:readList applications and registry tags
application:writeCreate and modify applications
cURL
curl -X POST 'https://api.sandbox-gameye.gameye.net/token' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"name": "match-server-token",
"scopes": ["session:start", "session:read"],
"expires_after": "2h"
}'
JavaScript
const response = await fetch('https://api.sandbox-gameye.gameye.net/token', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'match-server-token',
scopes: ['session:start', 'session:read'],
expires_after: '2h',
}),
});
const { token } = await response.json();
Python
import requests
response = requests.post(
'https://api.sandbox-gameye.gameye.net/token',
headers={
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json',
},
json={
'name': 'match-server-token',
'scopes': ['session:start', 'session:read'],
'expires_after': '2h',
},
)
token = response.json()['token']

A new API token was successfully created.

FieldTypeRequired
tokenstringYes
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Invalid request body, duration format, or scope name.

You are not authorized. Make sure your bearer token is correct.

The calling token does not hold one or more of the requested scopes and cannot delegate them.

A token with the given name already exists.

The request body exceeds 64 KiB.

Bad request. The given request has invalid syntax.