openapi: 3.0.0
info:
  title: Auth
  version: 1.0.0
  description: >-
    Authentication service for obtaining OAuth2 tokens using the client
    credentials flow.
servers:
  - url: https://auth-demo.vultsecurity.com
    description: Demo Environment
  - url: https://auth-prod.vultsecurity.com
    description: Production Environment
paths:
  /token:
    post:
      summary: Get an OAuth2 token
      description: Obtain an access token using client credentials for API access.
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                grant_type:
                  type: string
                  example: client_credentials
                  description: OAuth2 grant type. Must be set to `client_credentials`.
                client_id:
                  type: string
                  description: Client ID provided by the API provider.
                client_secret:
                  type: string
                  description: Client Secret associated with the Client ID.
              required:
                - grant_type
                - client_id
                - client_secret
      responses:
        '200':
          description: Successful response with an access token
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                    description: The access token to be used in subsequent requests.
                  token_type:
                    type: string
                    description: Type of token, usually `Bearer`.
                  expires_in:
                    type: number
                    description: Token expiration time in seconds.
                required:
                  - access_token
                  - token_type
                  - expires_in
        '400':
          description: >-
            Invalid request. Check the `grant_type`, `client_id`, and
            `client_secret`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message describing why the request failed.
                required:
                  - error
      tags:
        - Auth
components:
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /token
          scopes: {}
      description: >-
        Use client credentials to obtain a token. Use `/token` endpoint for both
        development and production environments.
security:
  - oauth2: []
