openapi: 3.0.0
info:
  title: Evolution Foundation - AI Core Service - Agents
  description: AI Agents, MCP tools and intelligent processing
  version: '1.0'
servers:
- url: https://api.evoai.app
  description: Production server
- url: http://localhost:5555
  description: Development server
  variables:
    port:
      default: '5555'
- url: '{customUrl}'
  description: Custom server
  variables:
    customUrl:
      default: https://your-instance.com
      description: Enter your server URL
paths:
  /api/v1/agents:
    get:
      description: List all agents with pagination by client id
      parameters:
      - name: page
        in: query
        description: Page number
        schema:
          type: integer
          default: 1
      - name: pageSize
        in: query
        description: Page size
        schema:
          type: integer
          default: 10
      - description: Skip
        in: query
        name: skip
        schema:
          type: integer
      - description: Limit
        in: query
        name: limit
        schema:
          type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/model.AgentListResponse'
              example:
                success: true
                data:
                - id: your-agent-id
                  account_id: your-account-id
                  name: Customer Support Agent
                  description: AI agent for handling customer support inquiries
                  type: llm
                  model: your-model-name
                  api_key_id: your-api-key-id
                  instruction: You are a helpful customer support assistant...
                  card_url: ''
                  folder_id: your-folder-id
                  config: {}
                  role: assistant
                  goal: Help customers resolve their issues efficiently
                  evolution_bot_id: ''
                  evolution_bot_sync: false
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  pagination:
                    page: 1
                    page_size: 10
                    total_pages: 1
                    total: 1
                    has_next_page: false
                    has_previous_page: false
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request parameters
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents
                  method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents
                  method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents
                  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: No agents found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents
                  method: GET
        '500':
          description: Internal Server Error (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: /api/v1/agents
                  method: GET
      security:
      - ApiAccessToken: []
      summary: List agents by client id
    post:
      description: Create a new agent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/model.AgentRequest'
      responses:
        '200':
          description: Agent created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/model.AgentResponse'
              example:
                success: true
                data:
                  id: your-agent-id
                  account_id: your-account-id
                  name: Customer Support Agent
                  description: AI agent for handling customer support inquiries
                  type: llm
                  model: your-model-name
                  api_key_id: your-api-key-id
                  instruction: You are a helpful customer support assistant...
                  card_url: ''
                  folder_id: your-folder-id
                  config: {}
                  role: assistant
                  goal: Help customers resolve their issues efficiently
                  evolution_bot_id: ''
                  evolution_bot_sync: false
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input data
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents
                  method: POST
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents
                  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 perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents
                  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: /api/v1/agents
                  method: POST
        '500':
          description: Internal Server Error (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: /api/v1/agents
                  method: POST
      security:
      - ApiAccessToken: []
      summary: Create agent
  /api/v1/agents/apikeys:
    get:
      description: List all api keys with pagination by client id
      parameters:
      - name: page
        in: query
        description: Page number
        schema:
          type: integer
          default: 1
      - name: pageSize
        in: query
        description: Page size
        schema:
          type: integer
          default: 10
      - description: Skip
        in: query
        name: skip
        schema:
          type: integer
      - description: Limit
        in: query
        name: limit
        schema:
          type: integer
      - name: active
        in: query
        description: Status filter
        schema:
          type: boolean
          enum:
          - true
          - false
          default: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/model.ApiKeyListResponse'
              example:
                success: true
                data:
                - id: your-api-key-id
                  account_id: your-account-id
                  name: Your API Key Name
                  provider: your-provider
                  base_url: your-provider-base-url
                  key: your-encrypted-key
                  is_active: true
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  pagination:
                    page: 1
                    page_size: 10
                    total_pages: 1
                    total: 1
                    has_next_page: false
                    has_previous_page: false
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request parameters
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys
                  method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys
                  method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys
                  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: No API keys found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys
                  method: GET
        '500':
          description: Internal Server Error (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: /api/v1/agents/apikeys
                  method: GET
      security:
      - ApiAccessToken: []
      summary: List api keys by client id
    post:
      description: Create a new api key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/model.ApiKeyRequest'
      responses:
        '200':
          description: API key created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/model.ApiKeyResponse'
              example:
                success: true
                data:
                  id: your-api-key-id
                  account_id: your-account-id
                  name: Your API Key Name
                  provider: your-provider
                  base_url: your-provider-base-url
                  key: your-encrypted-key
                  is_active: true
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input data
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys
                  method: POST
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys
                  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 perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys
                  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: /api/v1/agents/apikeys
                  method: POST
        '500':
          description: Internal Server Error (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: /api/v1/agents/apikeys
                  method: POST
      security:
      - ApiAccessToken: []
      summary: Create api key
  /api/v1/agents/apikeys/{id}:
    delete:
      description: Delete a api key
      parameters:
      - description: Api key id
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          description: API key deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.SuccessResponseData'
              example:
                success: true
                message: API key deleted successfully
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid API key ID format
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys/{id}
                  method: DELETE
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys/{id}
                  method: DELETE
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys/{id}
                  method: DELETE
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Api key not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys/{id}
                  method: DELETE
        '500':
          description: Internal Server Error (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: /api/v1/agents/apikeys/{id}
                  method: DELETE
      security:
      - ApiAccessToken: []
      summary: Delete api key
    get:
      description: Get a api key by id
      parameters:
      - description: Api key id
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/model.ApiKeyResponse'
              example:
                success: true
                data:
                  id: your-api-key-id
                  account_id: your-account-id
                  name: Your API Key Name
                  provider: your-provider
                  base_url: your-provider-base-url
                  key: your-encrypted-key
                  is_active: true
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid API key ID format
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys/{id}
                  method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys/{id}
                  method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys/{id}
                  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: Api key not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys/{id}
                  method: GET
        '500':
          description: Internal Server Error (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: /api/v1/agents/apikeys/{id}
                  method: GET
      security:
      - ApiAccessToken: []
      summary: Get api key by id
    put:
      description: Update a api key
      parameters:
      - description: Api key id
        in: path
        name: id
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/model.ApiKeyUpdateRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/model.ApiKeyResponse'
              example:
                success: true
                data:
                  id: your-api-key-id
                  account_id: your-account-id
                  name: Your API Key Name (Updated)
                  provider: your-provider
                  base_url: your-provider-base-url
                  key: your-encrypted-key
                  is_active: true
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-16T14:00:00Z'
                meta:
                  timestamp: '2024-01-16T14:00:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input data
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys/{id}
                  method: PUT
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys/{id}
                  method: PUT
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys/{id}
                  method: PUT
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Api key not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/apikeys/{id}
                  method: PUT
        '500':
          description: Internal Server Error (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: /api/v1/agents/apikeys/{id}
                  method: PUT
      security:
      - ApiAccessToken: []
      summary: Update api key
  /api/v1/agents/import:
    post:
      description: Import one or more agents from a JSON file
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: JSON file containing agent data
                folder_id:
                  type: string
                  description: Folder ID (optional)
              required:
              - file
      responses:
        '200':
          description: Agents imported successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/model.AgentResponse'
              example:
                success: true
                data:
                - id: your-agent-id
                  account_id: your-account-id
                  name: Imported Agent 1
                  description: First imported agent
                  type: llm
                  model: your-model-name
                  api_key_id: your-api-key-id
                  instruction: You are a helpful assistant...
                  card_url: ''
                  folder_id: your-folder-id
                  config: {}
                  role: assistant
                  goal: Assist users with their tasks
                  evolution_bot_id: ''
                  evolution_bot_sync: false
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input data or file format
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/import
                  method: POST
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/import
                  method: POST
        '402':
          description: Payment Required (agent limit exceeded)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: PAYMENT_REQUIRED
                  message: Agent limit exceeded
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/import
                  method: POST
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Folder does not belong to the client
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/import
                  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: Folder not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/import
                  method: POST
        '500':
          description: Internal Server Error (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: /api/v1/agents/import
                  method: POST
      security:
      - ApiAccessToken: []
      summary: Import agents
  /api/v1/agents/{id}:
    delete:
      description: Delete a agent
      parameters:
      - description: Agent id
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Agent deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.SuccessResponseData'
              example:
                success: true
                message: Agent deleted successfully
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid agent ID format
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}
                  method: DELETE
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}
                  method: DELETE
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}
                  method: DELETE
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Agent not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}
                  method: DELETE
        '500':
          description: Internal Server Error (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: /api/v1/agents/{id}
                  method: DELETE
      security:
      - ApiAccessToken: []
      summary: Delete agent
    get:
      description: Get a agent by id
      parameters:
      - description: Agent id
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/model.AgentResponse'
              example:
                success: true
                data:
                  id: your-agent-id
                  account_id: your-account-id
                  name: Customer Support Agent
                  description: AI agent for handling customer support inquiries
                  type: llm
                  model: your-model-name
                  api_key_id: your-api-key-id
                  instruction: You are a helpful customer support assistant...
                  card_url: ''
                  folder_id: your-folder-id
                  config: {}
                  role: assistant
                  goal: Help customers resolve their issues efficiently
                  evolution_bot_id: ''
                  evolution_bot_sync: false
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid agent ID format
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}
                  method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}
                  method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}
                  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: Agent not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}
                  method: GET
        '500':
          description: Internal Server Error (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: /api/v1/agents/{id}
                  method: GET
      security:
      - ApiAccessToken: []
      summary: Get agent by id
    put:
      description: Update a agent
      parameters:
      - description: Agent id
        in: path
        name: id
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/model.AgentUpdateRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/model.AgentResponse'
              example:
                success: true
                data:
                  id: your-agent-id
                  account_id: your-account-id
                  name: Customer Support Agent (Updated)
                  description: Updated AI agent for customer support
                  type: llm
                  model: your-model-name
                  api_key_id: your-api-key-id
                  instruction: You are an updated helpful customer support assistant...
                  card_url: ''
                  folder_id: your-folder-id
                  config: {}
                  role: assistant
                  goal: Help customers resolve their issues efficiently
                  evolution_bot_id: ''
                  evolution_bot_sync: false
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-16T14:00:00Z'
                meta:
                  timestamp: '2024-01-16T14:00:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input data
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}
                  method: PUT
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}
                  method: PUT
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}
                  method: PUT
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Agent not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}
                  method: PUT
        '500':
          description: Internal Server Error (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: /api/v1/agents/{id}
                  method: PUT
      security:
      - ApiAccessToken: []
      summary: Update agent
  /api/v1/agents/{id}/integrations:
    get:
      description: List all integrations for an agent
      parameters:
      - description: Agent ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/model.AgentIntegrationResponse'
              example:
                success: true
                data:
                - id: your-integration-id
                  account_id: your-account-id
                  agent_id: your-agent-id
                  provider: whatsapp
                  config:
                    phone_number: '+5511999999999'
                    instance_name: my-instance
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request parameters
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations
                  method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations
                  method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations
                  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: Agent not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations
                  method: GET
        '500':
          description: Internal Server Error (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: /api/v1/agents/{id}/integrations
                  method: GET
      security:
      - ApiAccessToken: []
      summary: List agent integrations
    post:
      description: Create or update an agent integration
      parameters:
      - description: Agent ID
        in: path
        name: id
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/model.AgentIntegrationRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/model.AgentIntegrationResponse'
              example:
                success: true
                data:
                  id: your-integration-id
                  account_id: your-account-id
                  agent_id: your-agent-id
                  provider: whatsapp
                  config:
                    phone_number: '+5511999999999'
                    instance_name: my-instance
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input data
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations
                  method: POST
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations
                  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 perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations
                  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: Agent not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations
                  method: POST
        '500':
          description: Internal Server Error (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: /api/v1/agents/{id}/integrations
                  method: POST
      security:
      - ApiAccessToken: []
      summary: Upsert agent integration
  /api/v1/agents/{id}/integrations/{provider}:
    delete:
      description: Delete an agent integration
      parameters:
      - description: Agent ID
        in: path
        name: id
        required: true
        schema:
          type: string
      - description: Provider name
        in: path
        name: provider
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Agent integration deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response.SuccessResponseData'
              example:
                success: true
                message: Integration deleted successfully
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input parameters
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations/{provider}
                  method: DELETE
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations/{provider}
                  method: DELETE
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations/{provider}
                  method: DELETE
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Integration not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations/{provider}
                  method: DELETE
        '500':
          description: Internal Server Error (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: /api/v1/agents/{id}/integrations/{provider}
                  method: DELETE
      security:
      - ApiAccessToken: []
      summary: Delete agent integration
    get:
      description: Get an agent integration by provider name
      parameters:
      - description: Agent ID
        in: path
        name: id
        required: true
        schema:
          type: string
      - description: Provider name
        in: path
        name: provider
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/model.AgentIntegrationResponse'
              example:
                success: true
                data:
                  id: your-integration-id
                  account_id: your-account-id
                  agent_id: your-agent-id
                  provider: whatsapp
                  config:
                    phone_number: '+5511999999999'
                    instance_name: my-instance
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input parameters
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations/{provider}
                  method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations/{provider}
                  method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations/{provider}
                  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: Integration not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/integrations/{provider}
                  method: GET
        '500':
          description: Internal Server Error (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: /api/v1/agents/{id}/integrations/{provider}
                  method: GET
      security:
      - ApiAccessToken: []
      summary: Get agent integration by provider
  /api/v1/agents/{id}/share:
    get:
      description: Get a share agent
      parameters:
      - description: Agent id
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
              example:
                api_key: your-shared-api-key
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid agent ID format
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/share
                  method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/share
                  method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/share
                  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: Agent not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/share
                  method: GET
        '500':
          description: Internal Server Error (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: /api/v1/agents/{id}/share
                  method: GET
      security:
      - ApiAccessToken: []
      summary: Get share agent
  /api/v1/agents/{id}/shared:
    get:
      description: Get a shared agent
      parameters:
      - description: Agent id
        in: path
        name: id
        required: true
        schema:
          type: string
      - description: API key
        in: header
        name: x-api-key
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/model.AgentResponse'
              example:
                success: true
                data:
                  id: your-agent-id
                  account_id: your-account-id
                  name: Customer Support Agent
                  description: AI agent for handling customer support inquiries
                  type: llm
                  model: your-model-name
                  api_key_id: your-api-key-id
                  instruction: You are a helpful customer support assistant...
                  card_url: ''
                  folder_id: your-folder-id
                  config: {}
                  role: assistant
                  goal: Help customers resolve their issues efficiently
                  evolution_bot_id: ''
                  evolution_bot_sync: false
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input parameters
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/shared
                  method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/shared
                  method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/shared
                  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: Agent not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/shared
                  method: GET
        '500':
          description: Internal Server Error (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: /api/v1/agents/{id}/shared
                  method: GET
      security:
      - ApiAccessToken: []
      summary: Get shared agent
  /api/v1/agents/{id}/sync-evolution:
    post:
      description: Sync agent with Evolution bot
      parameters:
      - description: Agent id
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/model.AgentResponse'
              example:
                success: true
                data:
                  id: your-agent-id
                  account_id: your-account-id
                  name: Customer Support Agent
                  description: AI agent for handling customer support inquiries
                  type: llm
                  model: your-model-name
                  api_key_id: your-api-key-id
                  instruction: You are a helpful customer support assistant...
                  card_url: ''
                  folder_id: your-folder-id
                  config: {}
                  role: assistant
                  goal: Help customers resolve their issues efficiently
                  evolution_bot_id: bot-12345
                  evolution_bot_sync: true
                  created_at: '2024-01-15T10:30:00Z'
                  updated_at: '2024-01-15T10:30:00Z'
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input data
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/sync-evolution
                  method: POST
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/sync-evolution
                  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 perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/sync-evolution
                  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: Agent not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/agents/{id}/sync-evolution
                  method: POST
        '500':
          description: Internal Server Error (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: /api/v1/agents/{id}/sync-evolution
                  method: POST
      security:
      - ApiAccessToken: []
      summary: Sync Evolution bot
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:
    ApiAccessToken:
      type: apiKey
      in: header
      name: api_access_token
      description: API Access Token (UUID) for authentication
