openapi: 3.0.1
info:
  title: Authorization
  version: 2.10.0
  description: REST API for webhooks management.
  contact:
    name: Tradevest GmbH
servers:
  - description: Test Auth
    url: https://b2b.auth.platform-test.tradevest.ai
tags:
  - name: Authorization
    description: Authorization endpoints
paths:
  /oauth2/token:
    post:
      summary: Get Token
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthResponse'
              examples:
                Example 1:
                  value:
                    access_token: string
                    expires_in: 3600
                    token_type: Bearer
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - invalid_request
                      - invalid_client
                      - invalid_grant
                      - unauthorized_client
                      - unsupported_grant_type
                required:
                  - error
      operationId: get-token
      description: 'Get token to authorize API operations '
      tags:
        - Authorization
      parameters:
        - schema:
            type: string
            example: application/x-www-form-urlencoded
            default: application/x-www-form-urlencoded
          in: header
          name: Content-Type
          description: Must always be 'application/x-www-form-urlencoded'
          required: true
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/AuthRequest'
            examples:
              Example 1:
                value:
                  client_id: string
                  client_secret: string
                  grant_type: client_credentials
        description: ''
    parameters: []
components:
  schemas:
    AuthRequest:
      title: Authorization Request
      type: object
      x-examples:
        Example 1:
          client_id: string
          client_secret: string
          grant_type: client_credentials
      properties:
        client_id:
          type: string
          description: Provided client_id for partner
        client_secret:
          type: string
          description: Provided client secret for partner
        grant_type:
          type: string
          default: client_credentials
          description: Grant type, always use 'client_credentials'
      required:
        - client_id
        - client_secret
        - grant_type
    AuthResponse:
      title: Authentication Response
      type: object
      properties:
        access_token:
          type: string
          readOnly: true
        expires_in:
          type: integer
          default: 3600
          readOnly: true
        token_type:
          type: string
          default: Bearer
          readOnly: true
      required:
        - access_token
        - expires_in
        - token_type
      x-examples:
        Example 1:
          access_token: string
          expires_in: 3600
          token_type: Bearer
x-tagGroups:
  - name: Authorization
    tags:
      - Authorization
