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

# Check a player's login state

> Used when a player joins the game server. `data.state` tells what the plugin should do:
`REGISTER_REQUIRED`, `EMAIL_NOT_VERIFIED`, `LOGIN_REQUIRED`, `TFA_REQUIRED` or `HAS_SESSION`.




## OpenAPI

````yaml /plugin-api/openapi.yaml post /auth/game-sessions
openapi: 3.1.0
info:
  title: LeaderOS Plugin API
  version: 1.0.0
  description: >
    Server-to-server API of a LeaderOS website, used by the LeaderOS plugins
    (Minecraft, Hytale, FiveM, Rust…),

    Discord bots and your own backend integrations.


    - Every request needs the `X-Api-Key` header (Dashboard → Settings → API).
    The key is **secret**: never use it in browser or client code.

    - Request bodies are **form encoded** (`application/x-www-form-urlencoded`
    or `multipart/form-data`). JSON bodies are not validated.

    - Success: `{ "status": true, "data"?: … }`. Error: `{ "status": false,
    "error": "CODE", "message"?: "…" }`.
      Some read endpoints return the raw object or array without the envelope.
servers:
  - url: '{siteUrl}/api'
    description: Your LeaderOS website
    variables:
      siteUrl:
        default: https://your-site.com
        description: Your LeaderOS website URL (no trailing slash)
security:
  - apiKey: []
tags:
  - name: Auth
    description: In-game login, registration and sessions.
  - name: Store
    description: Products, categories, buying with credits, donations and community goal.
  - name: Credits
    description: Read and change a user's credit balance.
  - name: Users
    description: Users, their orders, tickets and roles.
  - name: Bazaar
    description: Player bazaar storage (items sent from the game).
  - name: Support
    description: Support tickets, messages, categories and canned answers.
  - name: Vote
    description: Voting links.
  - name: Discord
    description: Data used by the LeaderOS Discord bot.
  - name: Integrations
    description: LeaderOS ID and LeaderOS AI.
  - name: Command logs
    description: Command delivery queue used by LeaderOS Connect plugins.
paths:
  /auth/game-sessions:
    post:
      tags:
        - Auth
      summary: Check a player's login state
      description: >
        Used when a player joins the game server. `data.state` tells what the
        plugin should do:

        `REGISTER_REQUIRED`, `EMAIL_NOT_VERIFIED`, `LOGIN_REQUIRED`,
        `TFA_REQUIRED` or `HAS_SESSION`.
      operationId: authGameSessionCheck
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - username
                - ip
                - useragent
              properties:
                username:
                  type: string
                ip:
                  type: string
                useragent:
                  type: string
      responses:
        '200':
          description: Current state
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Success'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          state:
                            type: string
                            enum:
                              - REGISTER_REQUIRED
                              - EMAIL_NOT_VERIFIED
                              - LOGIN_REQUIRED
                              - TFA_REQUIRED
                              - HAS_SESSION
                          token:
                            type:
                              - string
                              - 'null'
                          user:
                            type:
                              - object
                              - 'null'
                            properties:
                              id:
                                type: integer
                              realname:
                                type: string
                              isVerified:
                                type: string
        '400':
          $ref: '#/components/responses/Error'
components:
  schemas:
    Success:
      type: object
      properties:
        status:
          type: boolean
          const: true
        data: {}
    Error:
      type: object
      properties:
        status:
          type: boolean
          const: false
        error:
          type: string
          description: Stable error code
          e.g. USER_NOT_FOUND: null
        message:
          description: >-
            Human readable message (English). For VALIDATION, a list of
            messages.
          oneOf:
            - type: string
            - type: array
              items:
                type: string
  responses:
    Error:
      description: Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-Api-Key
      description: Secret API key from Dashboard → Settings → API. Server-side use only.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.