openapi: 3.0.3
info:
  title: Authentication API
  description: Authentication API - Managed by Platform Team
  version: 1.0.0
  contact:
    name: Bettermile - Platform Team
    email: platform@bettermile.com
servers:
  - url: https://auth.bettermile.com
    description: Production Environment
tags:
  - name: Machines Token
    description: Machines Token
paths:
  /api/v1/machines/token:
    post:
      summary: Token
      operationId: token
      tags:
        - Machines Token
      security:
        - basicAuthentication: []
      requestBody:
        description: Request body for token
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/tokenRequest'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/tokenResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
components:
  schemas:
    tokenRequest:
      type: object
      properties:
        grant_type:
          type: string
          example: client_credentials
    tokenResponse:
      type: object
      properties:
        access_token:
          type: string
          example: eyJhbGciOiJIUz...
        expires_in:
          type: integer
          example: 3600
        token_type:
          type: string
          example: Bearer
    BadRequestResponse:
      type: object
      properties:
        message:
          type: string
          example: Bad Request.
    InternalServerErrorResponse:
      type: object
      properties:
        message:
          type: string
          example: Internal Server Error.
  securitySchemes:
    basicAuthentication:
      type: http
      scheme: basic
      description: >
        This security scheme uses HTTP Basic Authentication.

        The client must provide a username and password, which are
        Base64-encoded and sent in the Authorization header.
