LevelCompleted events to award coins as soon as they are flushed from the queue. You can include up to 200 events per request.
Authenticate your request
POST /ingest/events requires a valid Bearer token. Use the access_token obtained from registration or login.401 UNAUTHORIZED. If the token is valid but the user_id in the payload does not match the token’s sub claim, the server returns 403 FORBIDDEN.Build your event batch
Every request body has three top-level fields:
Each event object in the
| Field | Type | Description |
|---|---|---|
user_id | string | The player’s ID. Must match the sub claim in the access token. |
game_id | string | Your game’s bundle ID (e.g., com.example.mygame). |
events | array | Between 1 and 200 event objects. |
events array has:| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | One of the six supported event type names. |
timestamp | string | Yes | ISO 8601 datetime with timezone offset. |
customdata | object | No | Any JSON object with additional context. |
customEventName | string | No | Required when type is Custom. |
Choose your event types
PlaySmart supports six event types:
When sending a
| Type | When to send |
|---|---|
AppOpen | The player opens the app and the game session begins. |
LevelCompleted | The player successfully completes a level. This event triggers coin awards when coins_enabled is true. |
GameEnd | The current game session ends, whether through completion, failure, or exit. |
AdImpression | An ad was shown to the player. |
IAPPurchase | The player completed an in-app purchase. |
Custom | Any other game-specific event. Set customEventName to describe it. |
Custom event, include customEventName in the event object alongside type. For example:Timestamp format
Alltimestamp values must be ISO 8601 strings with an explicit timezone offset. UTC is recommended:
400 BAD_REQUEST.
customdata
Thecustomdata field accepts any flat or nested JSON object. Use it to attach context that is useful for analytics or debugging — for example, the level number, score, ad unit ID, or purchase SKU. There is no enforced schema, but keep payloads small to avoid unnecessary overhead.
A
202 Accepted response means the events were received and queued in memory. They are flushed to the database within a few seconds. There is no need to retry a 202 response.