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

# Get Access Token

> This endpoint generates an access token for REST and WebSocket APIs.



## OpenAPI

````yaml POST /api/v1/token
openapi: 3.1.0
info:
  title: Auth API
  version: 1.0.0
  description: API for handling authentication
servers:
  - url: https://api-auth.sandbox.rails.xyz
security: []
paths:
  /api/v1/token:
    post:
      summary: User Authentication
      description: Endpoint to handle user authentication
      parameters:
        - name: X-Api-Key
          in: header
          description: The API key for the user
          required: true
          schema:
            type: string
        - name: X-Api-Secret
          in: header
          description: The API secret for the user
          required: true
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                    description: The access token used for API authentication
                  token_type:
                    type: string
                    description: The type of token returned, typically `Bearer`
                  expires_in:
                    type: integer
                    description: The number of seconds until the token expires
                required:
                  - access_token
                  - token_type
                  - expires_in
              example:
                access_token: >-
                  eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50VHlwZSI6InJldGFpbCIsImlzcyI6InN0YWdpbmcuZnVuZ2libGUueHl6Iiwic3ViIjoiNDcwMGYyODItMGFkNC00ZjU1LWIxNDItZGUzZTYwZDVkMTFlIiwiYXVkIjpbInN0YWdpbmctYXBwLmZ1bmdpYmxlLnh5eiJdLCJleHAiOjE3MTA4ODIxNzAsImlhdCI6MTcxMDg4MDM3MH0.Vgh_zKUgPSOPbVQ7nTHVg6jCYZ59nSJwqx6pfSDfGss
                token_type: Bearer
                expires_in: 1800
        '401':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    description: An object containing error details.
                    properties:
                      slug:
                        type: string
                        description: A short string identifier for the error type.
                      code:
                        type: string
                        description: A string code representing the error.
                    required:
                      - slug
                      - code
                  message:
                    type: string
                    description: A human-readable message describing the error.
                required:
                  - error
                  - message
              example:
                error:
                  slug: UNAUTHORIZED
                  code: '1002'
                message: Unauthorized

````