Method: gameStats.batchRecordEvents

Records a batch of player game events for a specific player. This method allows sending multiple events in a single request.

HTTP request

POST https://games.googleapis.com/games/v1/players/{playerId}/gameStats:batchRecordEvents

Path parameters

Parameters
playerId

string

Required: The player ID of the player that performed the events.

Request body

The request body contains data with the following structure:

JSON representation
{
  "packageName": string,
  "requestTime": string,
  "events": [
    {
      object (PlayerGameEvent)
    }
  ],
}
Fields
packageName

string

Required: Application package name (e.g., "com.example.game").

requestTime

string (Timestamp format)

Required: The time from the client when this specific batch of events was submitted.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

events[]

object (PlayerGameEvent)

Required: A list of player game events to be recorded. Maximum of 30 events per batch request.

Response body

A successful response indicates that the batch of events has been processed.

If successful, the response body contains data with the following structure:

JSON representation
{
  "failedRequests": {
    integer: {
      object (Status)
    },
    ...
  }
}
Fields
failedRequests

map (key: integer, value: object (Status))

Map of failed events, keyed by their zero-based index in BatchRecordEventsRequest.events. Omitted keys indicate successful recording.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/games
  • https://www.googleapis.com/auth/games_lite

For more information, see the OAuth 2.0 Overview.

PlayerGameEvent

A representation of a single player game event triggered by a player's event in a game. This might be completing a level, unlocking an item, or finishing a match.

JSON representation
{
  "eventId": string,
  "eventName": string,
  "eventProperties": {
    string: {
      object (PropertyValue)
    },
    ...
  },
  "eventTime": string
}
Fields
eventId

string

Required: A unique client-generated UUID for this specific event instance. Used for server-side idempotency and deduplication. Submitting an event with a previously recorded eventId for the same player will be ignored.

eventName

string

Required: Client-defined name of the event (e.g., "run_completed", "level_up"). Maximum length: 100 characters.

eventProperties

map (key: string, value: object (PropertyValue))

Optional: Key-value properties providing details about the event. - Maximum number of properties: 25. - Property key maximum length: 100 characters. - String values within PropertyValue maximum length: 1024 characters.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

eventTime

string (Timestamp format)

Required: The time from the client when this specific event was performed.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

PropertyValue

Wrapper for the value.

JSON representation
{

  // Union field value can be only one of the following:
  "intValue": string,
  "doubleValue": number,
  "stringValue": string,
  "boolValue": boolean,
  // End of list of possible types for union field value.
}
Fields
Union field value. The value of the scalar. value can be only one of the following:
intValue

string (int64 format)

An integer value.

doubleValue

number

A double value.

stringValue

string

A string value.

boolValue

boolean

A boolean value.

Status

The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. Each Status message contains three pieces of data: error code, error message, and error details.

You can find out more about this error model and how to work with it in the API Design Guide.

JSON representation
{
  "code": integer,
  "message": string,
  "details": [
    {
      "@type": string,
      field1: ...,
      ...
    }
  ]
}
Fields
code

integer

The status code, which should be an enum value of google.rpc.Code.

message

string

A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.

details[]

object

A list of messages that carry the error details. There is a common set of message types for APIs to use.

An object containing fields of an arbitrary type. An additional field "@type" contains a URI identifying the type. Example: { "id": 1234, "@type": "types.example.com/standard/id" }.