openapi: 3.0.4
info:
  title: Evolution Foundation - Evolution API - General
  description: Main Evolution API for WhatsApp
  version: 2.3.7
servers:
- url: http://localhost:8080
  description: Local development server
- url: https://api.evolution-api.com
  description: Production server
- url: '{customUrl}'
  description: Custom server
  variables:
    customUrl:
      default: https://your-instance.com
      description: Enter your server URL
security:
- ApiKeyAuth: []
paths:
  /:
    get:
      summary: API Status
      description: Get API status and version information
      security: []
      responses:
        '200':
          description: API is working
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 200
                  message:
                    type: string
                    example: Welcome to the Evolution API, it is working!
                  version:
                    type: string
                    example: 2.3.7
                  clientName:
                    type: string
                    example: evolution
                  manager:
                    type: string
                    nullable: true
                    example: http://localhost:8080/manager
                  documentation:
                    type: string
                    example: https://docs.evolutionfoundation.com.br
                  whatsappWebVersion:
                    type: string
                    example: 2.24.7.84
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request data
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /
                  method: GET
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing API key
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /
                  method: GET
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /
                  method: GET
        '404':
          description: Not Found - Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Resource not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /
                  method: GET
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /
                  method: GET
  /verify-creds:
    post:
      summary: Verify Facebook Credentials
      description: Verify Facebook/Meta Business API credentials
      responses:
        '200':
          description: Credentials are valid
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 200
                  message:
                    type: string
                    example: Credentials are valid
                  facebookAppId:
                    type: string
                  facebookConfigId:
                    type: string
                  facebookUserToken:
                    type: string
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request data. Facebook credentials are required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /verify-creds
                  method: POST
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing API key
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /verify-creds
                  method: POST
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to verify credentials
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /verify-creds
                  method: POST
        '404':
          description: Not Found - Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Resource not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /verify-creds
                  method: POST
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /verify-creds
                  method: POST
components:
  schemas:
    ErrorResponse:
      type: object
      required:
      - success
      - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          required:
          - code
          - message
          properties:
            code:
              type: string
            message:
              type: string
        meta:
          type: object
          properties:
            timestamp:
              type: string
              format: date-time
            path:
              type: string
            method:
              type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: apikey
      description: API Key for authentication (global or instance-specific)
