> ## Documentation Index
> Fetch the complete documentation index at: https://docs.evolutionfoundation.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat



## OpenAPI

````yaml /api-reference/openapi/EvoAI-Processor-Service/chat.yaml post /api/v1/chat/{agent_id}/{session_id}
openapi: 3.1.0
info:
  title: Evolution Foundation - AI Processor Service - Chat
  description: AI processing, integrations and sessions
  version: 1.0.0
servers:
  - url: https://api.evoai.app
    description: Production server
  - url: http://localhost:3004
    description: Development server
    variables:
      port:
        default: '3004'
  - url: '{customUrl}'
    description: Custom server
    variables:
      customUrl:
        default: https://your-instance.com
        description: Enter your server URL
security: []
paths:
  /api/v1/chat/{agent_id}/{session_id}:
    post:
      summary: Chat
      operationId: chat_api_v1_chat__agent_id___session_id__post
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            title: Session Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatRequest'
      responses:
        '200':
          description: Chat response generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse_ChatResponseData_'
        '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/chat/{agent_id}/{session_id}
                  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/chat/{agent_id}/{session_id}
                  method: POST
        '402':
          description: Payment Required (resource limit exceeded)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: PAYMENT_REQUIRED
                  message: Resource limit exceeded
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/chat/{agent_id}/{session_id}
                  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/chat/{agent_id}/{session_id}
                  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/chat/{agent_id}/{session_id}
                  method: POST
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '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/chat/{agent_id}/{session_id}
                  method: POST
      security:
        - ApiAccessToken: []
components:
  schemas:
    ChatRequest:
      properties:
        message:
          type: string
          title: Message
          description: User message to the agent
        agent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Id
          description: Agent ID to process the message
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: External ID for user identification
        files:
          anyOf:
            - items: 7383e7a7-53c6-4576-8903-b819093bb021
              type: array
            - type: 'null'
          title: Files
          description: List of files attached to the message
      type: object
      required:
        - message
      title: ChatRequest
      description: Model to represent a chat request.
    SuccessResponse_ChatResponseData_:
      properties:
        success:
          type: boolean
          title: Success
          description: Success indicator
          default: true
        data:
          $ref: fe52ab96-0f3d-468a-bf31-6ef9792b4662
          description: Response payload
        meta:
          $ref: bb558d50-7180-49cb-87a1-5c18268a0082
          description: Metadata
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          description: Optional success message
      type: object
      required:
        - data
        - meta
      title: SuccessResponse[ChatResponseData]
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Success indicator
          default: false
        error: b6e21c4c-3e30-4477-81d9-7187cc362c3a
        meta:
          $ref: 45ffcfbf-22bb-4af8-a147-14347db02a06
          description: Metadata
      type: object
      required:
        - error
        - meta
      title: ErrorResponse
      description: |-
        Standard error response schema matching error_response() return format.

        This schema matches the structure returned by error_response() function,
        which always uses ErrorInfo for the error field.
    HTTPValidationError:
      properties:
        detail:
          items: a48fcf5d-1152-4958-bf6e-b670d361977f
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
  securitySchemes:
    ApiAccessToken:
      type: apiKey
      in: header
      name: api_access_token
      description: API Access Token (UUID) for authentication

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.