> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.oppigames.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Game Sessions

> This API retrieves game sessions associated with a playerId and gameId. 

## Status

* **0** = InActive
* **1** = Active

The status indicates the current state of the user's game session.

## Headers

<ParamField header="x-api-key" type="string" required>
  A unique identifier associated with operator calling API.
</ParamField>

<ParamField header="x-signature" type="string" required>
  A SHA256 HMAC signature generated using the request body and timestamp.
  Format: HMAC\_SHA256(JSON.stringify(data) + '|' + timestamp), signed using the
  provided secret key.
</ParamField>

<ParamField header="x-timestamp" type="string" required>
  An Unix timestamp (milliseconds) Used to verify the request’s freshness.
  Ensure the same value is used in signature generation.

  <Note>
    The signature will remain valid for only 5 minutes from the provided
    timestamp.
  </Note>
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be set to `application/json`.
</ParamField>

## Query Parameters

<ParamField query="page" type="number" default={1}>
  Specifies the current page number for pagination purposes.
</ParamField>

<ParamField query="limit" type="number" default={10}>
  Specifies how many records to display on each page, controlling the size of each data segment.
</ParamField>

<ParamField query="playerId" type="string">
  Unique identifier for the player whose game sessions you want to retrieve.
</ParamField>

<ParamField query="gameId" type="string">
  Unique identifier for the game whose game sessions you want to retrieve.
</ParamField>

## Response

<ResponseField name="status" type="string" required>
  Code indicates status of the request weather it is succeed or failed. We have listed error codes <a href="/introduction#error-codes">here</a>
</ResponseField>

<ResponseField name="data" type="Data Object">
  <Expandable title="Data properties">
    <ResponseField name="currentPage" type="integer" required>
      The current page number of the results.
    </ResponseField>

    <ResponseField name="totalPages" type="integer" required>
      The total number of pages available.
    </ResponseField>

    <ResponseField name="totalCount" type="integer" required>
      The total number of records matching the query.
    </ResponseField>

    <ResponseField name="result" type="array" required>
      An array of session objects containing details about each game session.
    </ResponseField>

    <Expandable title="result properties">
      <ResponseField name="sessionId" type="string" required>
        Unique identifier for the player’s game session.
      </ResponseField>

      <ResponseField name="playerId" type="string" required>
        Unique identifier for the player.
      </ResponseField>

      <ResponseField name="playerName" type="string" required>
        Display name of the player.
      </ResponseField>

      <ResponseField name="gameId" type="string" required>
        Unique identifier for the game.
      </ResponseField>

      <ResponseField name="gameName" type="string" required>
        Name of the game.
      </ResponseField>

      <ResponseField name="status" type="integer" required>
        Status code of the game session (e.g., 1 for active).
      </ResponseField>

      <ResponseField name="currency" type="string" required>
        ISO currency code used for the game (e.g., EUR).
      </ResponseField>

      <ResponseField name="createdAt" type="string" required>
        Timestamp indicating when the session was created (UTC format).
      </ResponseField>
    </Expandable>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json SUCCESS theme={null}

      {
      "status": "RS_OK",
      "data": {
          "totalPages": 1,
          "currentPage": 1,
          "totalCount": 41,
          "result": [
              {
                  "sessionId": "85082d4d-2d6c-4f80-b72f-00b806eea2ab1742893648478",
                  "playerId": "MAGICIAN_USER_VISHAL",
                  "playerName": "MAGICIAN_USER_VISHAL",
                  "gameId": "G1742373671848",
                  "gameName": "The magician",
                  "status": 1,
                  "currency": "EUR",
                  "createdAt": "2025-03-25T09:07:28.966Z"
              }
          ]
      }
  }

  ```

  ```json FAILURE theme={null}
  {
    "status": "RS_ERROR",
    "message": "Oops! Something went wrong. Please refresh the page or try again in a moment"
  }

  ```
</ResponseExample>
