Skip to content

Start a game session โ€‹

POST /v1/me/sessions

  • Operation ID: createGameSession
  • Tags: Game sessions
  • Base URL: http://localhost:8787

Starts a cloud-gaming session for the caller. The plan tier is the ceiling for resolved stream settings. An open link reuses the runtime idempotency key; failed or ended links return idempotency_key_used. Returned stream values are resolved locally: the current adapter does not forward yuv444 or audioChannels, and actual support depends on the streaming backend.

Workflow: Integration guide.

Authentication: Platform user Bearer JWT. Acts only on the caller's own data.

Idempotency: Send a fresh 8-128 character key per user action; retries of the same action reuse it.

Authentication โ€‹

  • Auth: Platform user Bearer JWT (Authorization: Bearer <access_token>).

Parameters โ€‹

NameInTypeRequiredDescription
idempotency-keyheaderstringyesMin length: 8. Max length: 128

Request body โ€‹

Required: yes.

Content type: application/json

Schema: object

FieldTypeRequiredDescription
appSlugstringyesMin length: 1. Max length: 100. Pattern: ^[a-z0-9][a-z0-9_-]*$
runtimeAppIdstringnoMin length: 1. Max length: 200
create_lobbybooleannoDefault: false
preferencesobjectno-
preferences.widthintegernoMin: 320. Max: 7680
preferences.heightintegernoMin: 240. Max: 4320
preferences.fpsintegernoMin: 1. Max: 360
preferences.bitrateKbpsintegernoMin: 1000. Max: 150000
preferences.hdrbooleanno-
preferences.yuv444booleanno-
preferences.audioChannelsintegernoMin: 1. Max: 8

Example

json
{
  "appSlug": "example-game",
  "create_lobby": false,
  "preferences": {
    "width": 1280,
    "height": 720,
    "fps": 30
  }
}

Responses โ€‹

201 โ€‹

Session created; stream fields report locally resolved settings.

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object

FieldTypeRequiredDescription
sessionIdstringyes-
playUrlstringyes-
tokenstringyes-
displayobjectyes-
display.widthintegeryes-
display.heightintegeryes-
display.fpsintegeryes-
display.hdrbooleanno-
streamobjectyes-
stream.widthintegeryes-
stream.heightintegeryes-
stream.fpsintegeryes-
stream.bitrateKbpsintegeryes-
stream.hdrbooleanyes-
stream.yuv444booleanyes-
stream.audioChannelsintegeryes-

Example

json
{
  "sessionId": "sess_example",
  "playUrl": "https://play.example.com/s/sess_example",
  "token": "<MEMBER_TOKEN>",
  "display": {
    "width": 1920,
    "height": 1080,
    "fps": 60,
    "hdr": false
  },
  "stream": {
    "width": 1280,
    "height": 720,
    "fps": 30,
    "bitrateKbps": 3000,
    "hdr": false,
    "yuv444": false,
    "audioChannels": 2
  }
}

Errors โ€‹

400 โ€‹

Request validation failed.

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ValidationErrorBody)

FieldTypeRequiredDescription
successbooleanyesOne of: false
errorobjectyes-
error.namestringyesOne of: "ZodError"
error.issuesobject[]yes-
error.issues[].codestringyes-
error.issues[].path(string | number)[]yes-
error.issues[].messagestringyes-

Request validation

json
{
  "success": false,
  "error": {
    "name": "ZodError",
    "issues": [
      {
        "code": "custom",
        "path": [
          "field"
        ],
        "message": "Invalid value"
      }
    ]
  }
}

401 โ€‹

Missing, malformed, expired or wrong-audience Bearer token (missing_token, invalid_token, invalid_audience).

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ErrorBody)

FieldTypeRequiredDescription
errorstringyesStable machine-readable error code, e.g. forbidden, not_found.
detailsanynoOptional structured context. For 403 it is { perm }.

Error response

json
{
  "error": "missing_token"
}

402 โ€‹

insufficient_credits: the account has no credits.

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ErrorBody), fields as described above.

Error response

json
{
  "error": "insufficient_credits"
}

403 โ€‹

forbidden (inactive account), banned, or plan_required.

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ErrorBody), fields as described above.

Error response

json
{
  "error": "forbidden"
}

404 โ€‹

app_not_found: no enabled runtime app for the game or runtimeAppId.

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ErrorBody), fields as described above.

Error response

json
{
  "error": "app_not_found"
}

409 โ€‹

concurrent_limit, idempotency_key_conflict or idempotency_key_used.

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ErrorBody), fields as described above.

Error response

json
{
  "error": "concurrent_limit"
}

500 โ€‹

Unexpected server error (internal). No details are returned.

  • Header x-request-id: Request identifier; quote it when reporting an error. Content type: application/json

Schema: object (ErrorBody), fields as described above.

Error response

json
{
  "error": "internal"
}

503 โ€‹

unavailable: the runtime could not create the session; retry. Maintenance can refuse this write before authentication (degraded blocks session start and checkout; lockdown blocks other public/user writes).

  • Header x-request-id: Request identifier; quote it when reporting an error.
  • Header Retry-After: Maintenance retry delay in seconds; present for panic_mode. Example: 30. Content type: application/json

Schema: object (ErrorBody) | object (MaintenanceErrorBody)

FieldTypeRequiredDescription
(variant 1).errorstringyesStable machine-readable error code, e.g. forbidden, not_found.
(variant 1).detailsanynoOptional structured context. For 403 it is { perm }.
(variant 2).errorstringyesOne of: "panic_mode"
(variant 2).levelstringyesOne of: "degraded", "lockdown"
(variant 2).reasonstring | nullyes-

Error response

json
{
  "error": "unavailable"
}

Dependency unavailable

json
{
  "error": "unavailable"
}

Maintenance lockdown

json
{
  "error": "panic_mode",
  "level": "lockdown",
  "reason": "Scheduled maintenance"
}

Examples โ€‹

curl โ€‹

bash
curl -X POST 'http://localhost:8787/v1/me/sessions' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'idempotency-key: 7d0f3c52-9a1e-4b6f-8c2d-5e4a3b2c1d0e' \
  -H 'Content-Type: application/json' \
  --data '{"appSlug":"example-game","create_lobby":false,"preferences":{"width":1280,"height":720,"fps":30}}'

TypeScript โ€‹

ts
const accessToken = process.env.ACCESS_TOKEN; // user JWT from your sign-in flow

const response = await fetch("http://localhost:8787/v1/me/sessions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${accessToken}`,
    "idempotency-key": "7d0f3c52-9a1e-4b6f-8c2d-5e4a3b2c1d0e",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "appSlug": "example-game",
    "create_lobby": false,
    "preferences": {
      "width": 1280,
      "height": 720,
      "fps": 30
    }
  }),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const data = response.status === 204 || response.status === 205
  ? undefined
  : response.headers.get("content-type")?.includes("json")
    ? await response.json()
    : await response.text();

Try this endpoint

Requests go directly from your browser to the API. Send request executes this endpoint against the selected server.

POST/v1/me/sessions

Your token stays in this tab's memory and is sent only when you press Send request.

Parameters
Request body (required)

Built for developers. Ready for agents.