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

# Bearer Token

> Obtain an access token using client credentials flow



## OpenAPI

````yaml POST /realms/api/protocol/openid-connect/token
openapi: 3.1.0
info:
  title: Belio API
  description: OpenAPI Specification for Belio's REST API
  contact:
    name: Belio API Support
    url: https://belio.co.ke
  version: 1.0.0
servers:
  - url: https://api.belio.co.ke
    description: API Server
security:
  - bearerAuth: []
paths:
  /realms/api/protocol/openid-connect/token:
    servers:
      - url: https://account.belio.co.ke
        description: Authorization Server
    post:
      tags:
        - Authentication
      description: Obtain an access token using client credentials flow
      operationId: getAccessToken
      requestBody:
        description: Client authentication details
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                client_id:
                  type: string
                  description: The client identifier
                client_secret:
                  type: string
                  description: The client secret
                grant_type:
                  type: string
                  enum:
                    - client_credentials
                  default: client_credentials
              required:
                - client_id
                - client_secret
                - grant_type
        required: true
      responses:
        '200':
          description: Successful token response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenResponse'
        '400':
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
        '401':
          description: Unauthenticated - invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
        '403':
          description: Unauthorized - Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
        '404':
          description: Not Found - the requested resource does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
      security: []
components:
  schemas:
    TokenResponse:
      type: object
      properties:
        access_token:
          type: string
          description: >-
            The access token. This is used as a bearer token in the
            Authorization header of requests to the API.
        expires_in:
          type: integer
          format: int32
          description: Lifetime of the access token in seconds
        refresh_expires_in:
          type: integer
          format: int32
          default: 0
          description: Lifetime of the refresh token in seconds
        token_type:
          type: string
          enum:
            - Bearer
          description: Type of the token
        not-before-policy:
          type: integer
          format: int32
          default: 0
          description: Not Before Policy time
        scope:
          type: string
          description: Space separated list of scopes associated with the access token
    AuthError:
      type: object
      properties:
        error:
          type: string
        error_description:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````