> ## Documentation Index
> Fetch the complete documentation index at: https://docs.game-services.work/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Player Session

> Opens player game session for provided player token and game UUID.

> `GET` /session

### Headers

| Name                                                                | Type     | Description                                                                                                                   |
| ------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **<span style={{color: "rgb(var(--primary)"}}>X-Auth-Token</span>** | `string` | Custom authentication header in the format X-Auth-Token: your\_token\_here. This token is required to authorize API requests. |

***

### Request Parameters

| Name                                                               | Type     | Description                                                             |
| ------------------------------------------------------------------ | -------- | ----------------------------------------------------------------------- |
| **<span style={{color: "rgb(var(--primary)"}}>playerToken</span>** | `string` | Unique token representing the player that was received with launch url. |
| **<span style={{color: "rgb(var(--primary)"}}>gameUuid</span>**    | `string` | Unique identifier of the game for which the request is being made.      |

***

### Response Parameters

| Name                                                             | Type     | Description                                                                           |
| ---------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------- |
| **<span style={{color: "rgb(var(--primary)"}}>playerId</span>**  | `string` | Unique identifier of the player.                                                      |
| **<span style={{color: "rgb(var(--primary)"}}>sessionId</span>** | `string` | Unique identifier of the player's session.                                            |
| **<span style={{color: "rgb(var(--primary)"}}>currency</span>**  | `string` | The currency code associated with the player's session, typically in ISO 4217 format. |

***

### Error

<Note>If an error occurs while processing a request, the API must return a response with `HTTP Status Code: 400 Bad Request`</Note>

| Name                                                               | Type     | Description                               |
| ------------------------------------------------------------------ | -------- | ----------------------------------------- |
| **<span style={{color: "rgb(var(--primary)"}}>error\_code</span>** | `string` | Error code describing the specific issue. |

<Expandable title="Possible Error Codes">
  | Error Code                                                              | Description                                                       |
  | ----------------------------------------------------------------------- | ----------------------------------------------------------------- |
  | **<span style={{color: "rgb(var(--primary)"}}>INVALID\_TOKEN</span>**   | The provided token is invalid or expired.                         |
  | **<span style={{color: "rgb(var(--primary)"}}>TECHNICAL\_ERROR</span>** | An unexpected error occurred.                                     |
  | **<span style={{color: "rgb(var(--primary)"}}>NOT\_AUTHORIZED</span>**  | The request is not authorized due to invalid X-Auth-Token header. |
</Expandable>

***

<Warning>
  Responsibility of the wallet platform
</Warning>

Assert that the incoming playerToken is valid, and return the playerID that is connected to the playerToken.

The playerID that is returned must be unique per player, and identical each time an individual player authenticates.

RGS will use the returned sessionId value in all subsequent Get Balance, Credit, Debit and Rollback requests for this game session.

<ResponseExample>
  ```http Request theme={null}
  GET /session?playerToken=123e4567-e89b-12d3-a456-426614174000&gameUuid=game-uuid-456
  ```

  ```json Response 200 theme={null}
  {
      "playerId": "123e4567-e89b-12d3-a456-426614174000",
      "currency":"USD",
      "sessionId": "1c4f1d6d-5e37-4a8f-e642-def88a3b4749"
  }
  ```

  ```json Error 400 theme={null}
  {
      "error_code": "INVALID_TOKEN"
  }
  ```
</ResponseExample>
