Skip to content

4. Start with the API

In production, your backend or matchmaker starts every session through the Gameye API. This page takes you from an API token to a running session and back.

You need an application with at least one tag loaded on nodes. Create it in the Admin Panel or with the create application endpoint.

For every endpoint and field, see the API V2 overview and the OpenAPI specification.


Create a token in the Admin Panel under Users → API tokens, or with the create token endpoint. Give it the scopes this guide uses:

ScopeUsed for
regions:readFinding the regions where your image can run
session:startStarting sessions
session:readListing and inspecting sessions
session:stopStopping sessions

Send it as a bearer token. The examples below assume it is in $GAMEYE_TOKEN:

Terminal window
export GAMEYE_TOKEN="<your API token>"

A session’s location is a region name, such as eu-west-1. Ask which regions can run your application right now, using its application name:

Terminal window
curl https://api.production-gameye.gameye.net/available-location/my-game \
-H "Authorization: Bearer $GAMEYE_TOKEN"

The response lists each region’s id and the IP addresses clients can ping to measure latency. See Get locations.

Terminal window
curl -X POST https://api.production-gameye.gameye.net/session \
-H "Authorization: Bearer $GAMEYE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"id": "f7965a22-e327-4541-a30e-8262890d3a29",
"image": "my-game",
"location": "eu-west-1",
"ttl": "1h",
"args": ["--max-players=8"],
"env": { "MATCH_MODE": "ranked" },
"labels": { "match": "1234" }
}'

Only image (your application name) and location are required:

FieldMeaning
idYour identifier for the session. Use a UUID. If you leave it out, Gameye generates one.
versionThe image tag to run. If you leave it out, Gameye runs the newest loaded tag.
ttlHow long the session may live before Gameye stops it, in minutes or hours ("30m", "2h").
args, env, labelsCommand-line arguments, environment variables and labels for this session.
restartRestart the container automatically if it crashes.

A successful call returns 201 Created with the address players connect to:

{
"id": "f7965a22-e327-4541-a30e-8262890d3a29",
"host": "203.0.113.42",
"ports": [
{ "type": "udp", "container": 7777, "host": 49152 }
]
}

Players connect to host on the matching ports[].host port, here 203.0.113.42:49152. Inside the container, the same port is available as GAMEYE_PORT_UDP_7777.

List your running sessions with GET /session, or inspect one with GET /session/{id}. See Get sessions.

Stop a session when its match ends:

Terminal window
curl -X DELETE https://api.production-gameye.gameye.net/session/f7965a22-e327-4541-a30e-8262890d3a29 \
-H "Authorization: Bearer $GAMEYE_TOKEN"

A successful stop returns 204 No Content. A session you don’t stop keeps running until its ttl expires, so always set a ttl as a safety net.


Response or symptomWhat to check
401 UnauthorizedThe token is missing, mistyped, or not sent as Authorization: Bearer <token>.
402 Payment RequiredYour organization has used up its quota. Contact Gameye support.
403 ForbiddenThe token lacks the scope this endpoint needs, such as session:start.
404 Not FoundThe application name in image doesn’t exist, or the version tag isn’t loaded in that region yet. Check with tag availability.
Session starts but players can’t connectIn bridge mode, check that the application’s port bindings match the ports your server listens on. In host mode, check that the server listens on the GAMEYE_PORT_* ports. See Choose your network mode.

Still stuck? Ask on Discord or through the support portal.


Explore the API V2 documentation for player tracking, logs, artifacts and more, or set up warm pools so sessions start instantly.