# Method: accesstokens.generatePlayGroupingApiToken

- [HTTP request](https://developer.android.com/games/services/web/api/rest/v1/accesstokens/generatePlayGroupingApiToken#body.HTTP_TEMPLATE)
- [Query parameters](https://developer.android.com/games/services/web/api/rest/v1/accesstokens/generatePlayGroupingApiToken#body.QUERY_PARAMETERS)
- [Request body](https://developer.android.com/games/services/web/api/rest/v1/accesstokens/generatePlayGroupingApiToken#body.request_body)
- [Response body](https://developer.android.com/games/services/web/api/rest/v1/accesstokens/generatePlayGroupingApiToken#body.response_body)
  - [JSON representation](https://developer.android.com/games/services/web/api/rest/v1/accesstokens/generatePlayGroupingApiToken#body.GeneratePlayGroupingApiTokenResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://developer.android.com/games/services/web/api/rest/v1/accesstokens/generatePlayGroupingApiToken#body.aspect)
- [Try it!](https://developer.android.com/games/services/web/api/rest/v1/accesstokens/generatePlayGroupingApiToken#try-it)

Generates a Play Grouping API token for the PGS user identified by the attached credential.

### HTTP request

`POST https://games.googleapis.com/games/v1/accesstokens/generatePlayGroupingApiToken`

### Query parameters

|                                                                                                                                                              Parameters                                                                                                                                                              ||
|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `packageName` | `string` Required. App package name to generate the token for (e.g. com.example.mygame).                                                                                                                                                                                                                              |
| `persona`     | `string` Required. Persona to associate with the token. Persona is a developer-provided stable identifier of the user. Must be deterministically generated (e.g. as a one-way hash) from the user account ID and user profile ID (if the app has the concept), according to the developer's own user identity system. |

### Request body

The request body must be empty.

### Response body

Response for the accesstokens.generatePlayGroupingApiToken RPC.

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

|                                                 JSON representation                                                 |
|---------------------------------------------------------------------------------------------------------------------|
| ``` { "token": { object (https://developer.android.com/games/services/web/api/rest/v1/PlayGroupingApiToken) } } ``` |

|                                                                                   Fields                                                                                   ||
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `token` | `object (`[PlayGroupingApiToken](https://developer.android.com/games/services/web/api/rest/v1/PlayGroupingApiToken)`)` Token for accessing the Play Grouping API. |

### 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).