Server APIAnalytics Queries
Execute retention query
Execute a retention query. Returns cohort retention rates showing what fraction of users who performed the entry event also performed the return event within the specified retention window. Supports look_back and look_ahead compute modes.
AuthorizationBearer <token>
Secret server key (prefixed gb_sk_) for server-to-server calls. Send it as Authorization: Bearer <key>. Never ship a secret key in a game client.
In: header
Path Parameters
applicationId*number
Gamebeast project ID
Header Parameters
environment_id*number
Gamebeast environment ID
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
curl -X POST "https://example.com/application/0/analytics/v1/queries/retention/execute" \ -H "environment_id: 0" \ -H "Content-Type: application/json" \ -d '{ "time": { "step": "second", "relative": { "step": "second", "value": 0 } }, "metrics": [ { "id": "string", "visible": true, "data": { "name": "string", "type": "event" } }, { "id": "string", "visible": true, "data": { "name": "string", "type": "event" } } ], "retentionCriteria": { "measurement": "retention_rate", "intervalType": "on", "retentionWindow": "second" }, "options": { "display": "line" } }'Empty