- [HTTP request](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#body.HTTP_TEMPLATE)
- [Path parameters](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#body.PATH_PARAMETERS)
- [Request body](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#body.request_body)
  - [JSON representation](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#body.response_body)
  - [JSON representation](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#body.BatchRecordEventsResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#body.aspect)
- [PlayerGameEvent](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#PlayerGameEvent)
  - [JSON representation](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#PlayerGameEvent.SCHEMA_REPRESENTATION)
- [PropertyValue](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#PropertyValue)
  - [JSON representation](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#PropertyValue.SCHEMA_REPRESENTATION)
- [Status](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#Status)
  - [JSON representation](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#Status.SCHEMA_REPRESENTATION)
- [Try it!](https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#try-it)

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 (`https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#PlayerGameEvent`) } ], } ``` |

| Fields ||
|---|---|
| `packageName` | `string` Required. Application package name (e.g., "com.example.game"). |
| `requestTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#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 (`https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#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 (`https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#Status`) }, ... } } ``` |

| Fields ||
|---|---|
| `failedRequests` | ``map (key: integer, value: object (`https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#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](https://developers.google.com/identity/protocols/OAuth2).

## 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 (`https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#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 (`https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#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 (`https://protobuf.dev/reference/protobuf/google.protobuf#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 |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "intValue": string, "doubleValue": number, "stringValue": string, "boolValue": boolean, "durationValue": string } ``` |

| Fields ||
|---|---|
| The value of the scalar. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `intValue` | `string (https://developers.google.com/discovery/v1/type-format format)` An integer value. |
| `doubleValue` | `number` A double value. |
| `stringValue` | `string` A string value. |
| `boolValue` | `boolean` A boolean value. |
| `durationValue` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` A duration value. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |
| End of mutually exclusive fields. ||

## 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](https://github.com/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](https://cloud.google.com/apis/design/errors).

| 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 `https://developer.android.com/games/services/web/api/rest/v1/gameStats/batchRecordEvents#Status.FIELDS.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" }`. |