components:
  examples: {}
  headers: {}
  parameters: {}
  requestBodies: {}
  responses: {}
  schemas:
    JsonErrorResponse:
      properties:
        code:
          type: number
          format: double
        error:
          type: string
        message:
          type: string
        details:
          properties: {}
          additionalProperties: {}
          type: object
      required:
        - code
        - error
        - message
      type: object
      additionalProperties: false
    Call:
      properties:
        id:
          type: number
          format: double
        tenantId:
          type: string
        providerId:
          type: string
        providerName:
          type: string
        funnelConversationId:
          type: number
          format: double
          nullable: true
        sessionId:
          type: number
          format: double
          nullable: true
        userId:
          type: number
          format: double
          nullable: true
        contactId:
          type: number
          format: double
        opportunityId:
          type: number
          format: double
          nullable: true
        analysisConfigId:
          type: number
          format: double
        teamId:
          type: number
          format: double
          nullable: true
        from:
          type: string
        to:
          type: string
        redirectedTo:
          type: string
          nullable: true
        duration:
          type: number
          format: double
          nullable: true
        direction:
          type: string
        status:
          type: string
        startTime:
          type: string
          format: date-time
        metadata: {}
        customData: {}
        agentScore:
          type: number
          format: double
        category:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        lastUpdateSequence:
          type: number
          format: double
      required:
        - id
        - tenantId
        - providerId
        - providerName
        - funnelConversationId
        - sessionId
        - userId
        - contactId
        - opportunityId
        - analysisConfigId
        - teamId
        - from
        - to
        - duration
        - direction
        - status
        - startTime
        - metadata
        - customData
        - agentScore
        - category
        - createdAt
        - updatedAt
        - lastUpdateSequence
      type: object
      additionalProperties: false
    VapiOpenAIModel:
      type: string
      enum:
        - gpt-4o
        - gpt-4o-mini
        - gpt-4.1
        - gpt-4.1-mini
        - o3
        - o4-mini
        - gpt-4.5-preview
      description: Type for VapiOpenAIModel
    VapiOpenAIModelConfig:
      description: Interface representing Vapi OpenAI model configuration
      properties:
        provider:
          type: string
          enum:
            - openai
          nullable: false
        model:
          $ref: '#/components/schemas/VapiOpenAIModel'
      required:
        - provider
        - model
      type: object
      additionalProperties: false
    VapiAnthropicModel:
      type: string
      enum:
        - claude-3-opus-20240229
        - claude-3-5-sonnet-20241022
        - claude-3-5-haiku-20241022
        - claude-3-7-sonnet-20250219
        - claude-opus-4-20250514
        - claude-sonnet-4-20250514
      description: Type for VapiAnthropicModel
    VapiAnthropicModelConfig:
      description: Interface representing Vapi Anthropic model configuration
      properties:
        provider:
          type: string
          enum:
            - anthropic
          nullable: false
        model:
          $ref: '#/components/schemas/VapiAnthropicModel'
      required:
        - provider
        - model
      type: object
      additionalProperties: false
    VapiModelConfig:
      properties:
        maxTokens:
          type: number
          format: double
        temperature:
          type: number
          format: double
        model:
          anyOf:
            - $ref: '#/components/schemas/VapiOpenAIModelConfig'
            - $ref: '#/components/schemas/VapiAnthropicModelConfig'
      type: object
      description: Discriminated union for Vapi model configurations
    VapiVoiceConfig:
      description: Interface representing Vapi voice configuration
      properties:
        provider:
          type: string
          enum:
            - 11labs
          nullable: false
        voiceId:
          type: string
        model:
          type: string
        speed:
          type: number
          format: double
        stability:
          type: number
          format: double
        style:
          type: number
          format: double
        optimizeStreamingLatency:
          type: number
          format: double
      type: object
      additionalProperties: false
    EmployeePersonalityLocalization:
      type: string
      enum:
        - CL
        - MX
        - CO
        - PE
        - US
    VapiTranscriberConfig:
      description: Interface representing Vapi transcriber configuration
      properties:
        provider:
          type: string
          enum:
            - deepgram
          nullable: false
        model:
          type: string
          enum:
            - nova-2
          nullable: false
        localization:
          $ref: '#/components/schemas/EmployeePersonalityLocalization'
        confidenceThreshold:
          type: number
          format: double
        keywords:
          items:
            type: string
          type: array
      type: object
      additionalProperties: false
    VapiProviderConfig:
      description: Interface representing Vapi-specific configurations
      properties:
        model:
          $ref: '#/components/schemas/VapiModelConfig'
        voice:
          $ref: '#/components/schemas/VapiVoiceConfig'
        transcriber:
          $ref: '#/components/schemas/VapiTranscriberConfig'
      type: object
      additionalProperties: false
    AgentCallCommunicationStyle:
      description: Enum representing agent call communication styles
      enum:
        - professional
        - friendly
        - assertive
        - technical
        - enthusiastic
        - empathetic
      type: string
    AgentCallPersonality:
      description: Interface representing agent call personality
      properties:
        name:
          type: string
          description: The name of the agent
        communicationStyle:
          $ref: '#/components/schemas/AgentCallCommunicationStyle'
          description: The communication style of the agent
        customTraits:
          type: string
          description: |-
            Custom personality traits that make the agent unique
            Example: "patient and understanding", "energetic and motivating"
      required:
        - name
        - communicationStyle
      type: object
      additionalProperties: false
    Dictionary_string_:
      properties: {}
      additionalProperties:
        type: string
      type: object
      description: |-
        A TSOA-compatible dictionary type that replaces Record<string, T>.
        This type is used to ensure proper runtime validation with TSOA.
    ContactInfo:
      description: Interface representing contact information
      properties:
        firstName:
          type: string
        lastName:
          type: string
        company:
          type: string
        additionalInfo:
          $ref: '#/components/schemas/Dictionary_string_'
      type: object
      additionalProperties: false
    Dictionary_unknown_:
      properties: {}
      additionalProperties: {}
      type: object
      description: |-
        A TSOA-compatible dictionary type that replaces Record<string, T>.
        This type is used to ensure proper runtime validation with TSOA.
    VapiAgentCallCreateBodyParams:
      description: Interface representing Vapi agent call creation parameters
      properties:
        toPhoneNumber:
          type: string
        fromPhoneNumber:
          type: string
        objectives:
          items:
            type: string
          type: array
        userId:
          type: number
          format: double
        personality:
          $ref: '#/components/schemas/AgentCallPersonality'
        localization:
          $ref: '#/components/schemas/EmployeePersonalityLocalization'
        constraints:
          items:
            type: string
          type: array
        contactInfo:
          $ref: '#/components/schemas/ContactInfo'
        knowledgeBase:
          type: string
        taskSteps:
          items:
            type: string
          type: array
        maxDurationSeconds:
          type: number
          format: double
        silenceTimeoutSeconds:
          type: number
          format: double
        customData:
          $ref: '#/components/schemas/Dictionary_unknown_'
        provider:
          type: string
          enum:
            - vapi
          nullable: false
        providerConfig:
          $ref: '#/components/schemas/VapiProviderConfig'
      required:
        - toPhoneNumber
        - objectives
      type: object
      additionalProperties: false
    AgentCallCreateBodyParams:
      $ref: '#/components/schemas/VapiAgentCallCreateBodyParams'
      description: Type for agent call creation parameters
    TCTask:
      description: |-
        TSOA-compatible task interface
        Explicitly defines all properties instead of relying on Zod inference
      properties:
        id:
          type: string
        tenantId:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        context:
          properties:
            conversationId:
              type: number
              format: double
          type: object
        objective:
          type: string
        createdBy:
          properties:
            id:
              type: string
            type:
              type: string
              enum:
                - user
                - ai_employee
          required:
            - id
            - type
          type: object
        assignedTo:
          properties:
            id:
              type: string
            type:
              type: string
              enum:
                - user
                - ai_employee
          required:
            - id
            - type
          type: object
        publishedAt:
          type: string
          format: date-time
          nullable: true
        dueDate:
          type: string
          format: date-time
          nullable: true
        completedAt:
          type: string
          format: date-time
          nullable: true
        cancelledAt:
          type: string
          format: date-time
          nullable: true
        cancellationReason:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - completed
            - cancelled
            - scheduled
            - overdue
      required:
        - id
        - tenantId
        - createdAt
        - updatedAt
        - context
        - objective
        - createdBy
        - assignedTo
        - status
      type: object
      additionalProperties: false
    TCTaskListResponse:
      description: |-
        TSOA-compatible version of TaskListResponse.
        Simplifies the complex nested schemas for TSOA compatibility.
      properties:
        nextPageToken:
          type: string
        totalCount:
          type: number
          format: double
        items:
          items:
            $ref: '#/components/schemas/TCTask'
          type: array
      required:
        - items
      type: object
      additionalProperties: false
    TCTaskListQueryParams:
      description: |-
        TSOA-compatible version of TaskListQueryParams.
        Simplifies the complex nested schemas for TSOA compatibility.
      properties:
        limit:
          type: number
          format: double
        pageToken:
          type: string
        status:
          type: string
          enum:
            - completed
            - cancelled
            - scheduled
            - overdue
        dueBefore:
          type: string
          format: date-time
        dueAfter:
          type: string
          format: date-time
        conversationId:
          type: number
          format: double
        assignedToType:
          type: string
          enum:
            - user
            - ai_employee
        assignedToId:
          type: string
      type: object
      additionalProperties: false
    TCTaskGetResponse:
      allOf:
        - $ref: '#/components/schemas/TCTask'
      nullable: true
      description: |-
        TSOA-compatible version of TaskGetResponse.
        Simplifies the complex nested schemas for TSOA compatibility.
    TCTaskCreateResponse:
      $ref: '#/components/schemas/TCTask'
      description: |-
        TSOA-compatible version of TaskCreateResponse.
        Simplifies the complex nested schemas for TSOA compatibility.
    TCTaskCreateBodyParams:
      description: |-
        TSOA-compatible task create body params interface
        Mirrors the NewTask type structure for task creation
      properties:
        context:
          properties:
            conversationId:
              type: number
              format: double
          type: object
        objective:
          type: string
        createdBy:
          properties:
            id:
              type: string
            type:
              type: string
              enum:
                - user
                - ai_employee
          required:
            - id
            - type
          type: object
        assignedTo:
          properties:
            id:
              type: string
            type:
              type: string
              enum:
                - user
                - ai_employee
          required:
            - id
            - type
          type: object
        dueDate:
          type: string
          format: date-time
          nullable: true
        status:
          type: string
          enum:
            - completed
            - cancelled
            - scheduled
            - overdue
      required:
        - context
        - objective
        - createdBy
        - assignedTo
      type: object
      additionalProperties: false
    TCTaskUpdateResponse:
      $ref: '#/components/schemas/TCTask'
      description: |-
        TSOA-compatible version of TaskUpdateResponse.
        Simplifies the complex nested schemas for TSOA compatibility.
    TCTaskUpdateBodyParams:
      description: |-
        TSOA-compatible version of TaskUpdateBodyParams.
        Simplifies the complex nested schemas for TSOA compatibility.
      properties:
        status:
          type: string
          enum:
            - completed
            - cancelled
            - scheduled
            - overdue
        context:
          properties:
            conversationId:
              type: number
              format: double
          type: object
        objective:
          type: string
        assignedTo:
          properties:
            id:
              type: string
            type:
              type: string
              enum:
                - user
                - ai_employee
          required:
            - id
            - type
          type: object
        publishedAt:
          type: string
          format: date-time
          nullable: true
        dueDate:
          type: string
          format: date-time
          nullable: true
        completedAt:
          type: string
          format: date-time
          nullable: true
        cancelledAt:
          type: string
          format: date-time
          nullable: true
        cancellationReason:
          type: string
          nullable: true
      type: object
      additionalProperties: false
    TCTaskDeleteResponse:
      $ref: '#/components/schemas/TCTask'
      description: |-
        TSOA-compatible version of TaskDeleteResponse.
        Simplifies the complex nested schemas for TSOA compatibility.
    Recording:
      properties:
        id:
          type: number
          format: double
        tenantId:
          type: string
        callId:
          type: number
          format: double
          nullable: true
        providerId:
          type: string
          nullable: true
        providerName:
          type: string
          nullable: true
        callProviderId:
          type: string
          nullable: true
        callProviderName:
          type: string
          nullable: true
        url:
          type: string
          nullable: true
        startTime:
          type: string
          format: date-time
          nullable: true
        duration:
          type: number
          format: double
          nullable: true
        dualChannel:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - tenantId
        - callId
        - providerId
        - providerName
        - callProviderId
        - callProviderName
        - url
        - startTime
        - duration
        - dualChannel
        - createdAt
        - updatedAt
      type: object
      additionalProperties: false
    CallDirection:
      enum:
        - outgoing
        - incoming
      type: string
    LoadRecordingParams:
      properties:
        userId:
          type: number
          format: double
        url:
          type: string
        callTo:
          type: string
        callFrom:
          type: string
        callDirection:
          $ref: '#/components/schemas/CallDirection'
        callStartTime:
          type: string
      required:
        - userId
        - url
      type: object
      additionalProperties: false
    ValidationErrorCode:
      description: Error codes for different types of validation failures
      enum:
        - REQUIRED_FIELD
        - INVALID_FORMAT
        - DUPLICATE_IN_BATCH
        - EXISTING_ENTITY
        - CUSTOM_FIELD_ERROR
        - INVALID_REFERENCE
        - LIMIT_EXCEEDED
      type: string
    BulkOperationItemValidationError:
      description: Represents a validation error for a specific field
      properties:
        field:
          type: string
          description: Field that caused the error
        message:
          type: string
          description: Error message
        code:
          $ref: '#/components/schemas/ValidationErrorCode'
          description: Error code for programmatic handling
        context:
          $ref: '#/components/schemas/Dictionary_unknown_'
          description: Additional context about the error
      required:
        - field
        - message
        - code
      type: object
      additionalProperties: false
    BulkOperationItemValidation:
      description: Results of validation for a specific item
      properties:
        index:
          type: number
          format: double
          description: Index of the item in the bulk operation
        itemId:
          type: number
          format: double
          description: ID of the item if it exists
        errors:
          items:
            $ref: '#/components/schemas/BulkOperationItemValidationError'
          type: array
          description: Array of validation errors
        warnings:
          items:
            $ref: '#/components/schemas/BulkOperationItemValidationError'
          type: array
          description: Array of validation warnings that don't prevent operation
        existingEntities:
          $ref: '#/components/schemas/Dictionary_unknown_'
          description: Existing entities found during validation
      required:
        - index
        - errors
        - warnings
      type: object
      additionalProperties: false
    BulkOperationReport:
      description: Validation results for the entire bulk operation
      properties:
        itemsIssues:
          items:
            $ref: '#/components/schemas/BulkOperationItemValidation'
          type: array
          description: Individual validation results for each item
        batchErrors:
          items:
            $ref: '#/components/schemas/BulkOperationItemValidationError'
          type: array
          description: Global validation errors that apply to the entire bulk operation
        counts:
          properties:
            successful:
              type: number
              format: double
              description: >-
                Number of items that passed validation and were processed
                successfully
            warnings:
              type: number
              format: double
              description: Number of items with warnings
            duplicates:
              type: number
              format: double
              description: Number of duplicate items found
            errors:
              type: number
              format: double
              description: Number of items that failed validation
            total:
              type: number
              format: double
              description: Total number of items received in the batch
          required:
            - successful
            - warnings
            - duplicates
            - errors
            - total
          type: object
          description: Statistics about the validation
      required:
        - itemsIssues
        - batchErrors
        - counts
      type: object
      additionalProperties: false
    BulkOperationResponse:
      description: Response for bulk operations
      properties:
        message:
          type: string
          description: Message describing the result of the operation
        operationId:
          type: string
          description: Operation ID for tracking
        report:
          $ref: '#/components/schemas/BulkOperationReport'
          description: Validation results
      required:
        - message
        - operationId
        - report
      type: object
      additionalProperties: false
    BulkConversationContactCreateParams:
      description: >-
        Contact information for creating a contact within a bulk conversation
        request
      properties:
        firstName:
          type: string
          description: First name of the contact
        lastName:
          type: string
          description: Last name of the contact
        phones:
          items:
            type: string
          type: array
          description: >-
            Array of phone numbers in international format (+[country
            code][number])
        emails:
          items:
            type: string
          type: array
          description: Array of email addresses
        nationalId:
          type: string
          description: Optional national ID of the contact
        companyPosition:
          type: string
          description: Optional company position of the contact
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
          description: Optional custom fields for the contact
        userId:
          type: number
          format: double
          nullable: true
          description: Optional reference to the user this contact should be assigned to
      type: object
      additionalProperties: false
    BulkSingleConversationCreateParams:
      description: |-
        Single conversation payload for creation within a bulk
        Simplified version of the FunnelConversation type from @llamadapro/types
      properties:
        createdAt:
          type: string
          format: date-time
        userId:
          type: number
          format: double
          nullable: true
          description: Reference to the user involved in the conversation
        funnelId:
          type: number
          format: double
          description: Reference to the funnel this conversation belongs to
        funnelStatusId:
          type: number
          format: double
          nullable: true
          description: Optional reference to the current funnel status
        archivedAt:
          type: string
          format: date-time
          nullable: true
          description: Optional timestamp when the conversation was archived
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
          description: Optional custom fields for the conversation
        contactId:
          type: number
          format: double
          description: >-
            Optional explicit contact to attach; bypasses address-based
            disambiguation
        contact:
          $ref: '#/components/schemas/BulkConversationContactCreateParams'
          description: Optional contact information; if omitted, contactId must be provided
      required:
        - funnelId
      type: object
      additionalProperties: false
    BulkConversationPassthroughCreateParams:
      description: Bulk create payload containing multiple conversations with passthrough
      properties:
        conversations:
          items:
            anyOf:
              - $ref: '#/components/schemas/BulkSingleConversationCreateParams'
              - {}
          type: array
          description: Array of conversations to process, allowing unknown
      required:
        - conversations
      type: object
      additionalProperties: false
    BulkConversationContactUpdateParams:
      description: >-
        Contact information for updating a contact within a bulk conversation
        request
      properties:
        firstName:
          type: string
          description: First name of the contact
        lastName:
          type: string
          description: Last name of the contact
        phones:
          items:
            type: string
          type: array
          description: >-
            Array of phone numbers in international format (+[country
            code][number])
        emails:
          items:
            type: string
          type: array
          description: Array of email addresses
        nationalId:
          type: string
          description: Optional national ID of the contact
        companyPosition:
          type: string
          description: Optional company position of the contact
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
          description: Optional custom fields for the contact
        userId:
          type: number
          format: double
          nullable: true
          description: Optional reference to the user this contact should be assigned to
        id:
          type: number
          format: double
          description: ID of the contact to update
      required:
        - id
      type: object
      additionalProperties: false
    BulkSingleConversationUpdateParams:
      description: Single conversation payload for update within a bulk
      properties:
        createdAt:
          type: string
          format: date-time
        userId:
          type: number
          format: double
          nullable: true
          description: Reference to the user involved in the conversation
        funnelStatusId:
          type: number
          format: double
          nullable: true
          description: Optional reference to the current funnel status
        archivedAt:
          type: string
          format: date-time
          nullable: true
          description: Optional timestamp when the conversation was archived
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
          description: Optional custom fields for the conversation
        id:
          type: number
          format: double
          description: ID of the conversation to update
        contact:
          $ref: '#/components/schemas/BulkConversationContactUpdateParams'
          description: Optional contact information to update
      required:
        - id
      type: object
      additionalProperties: false
    BulkConversationPassthroughUpdateParams:
      description: Bulk update payload containing multiple conversations with passthrough
      properties:
        conversations:
          items:
            anyOf:
              - $ref: '#/components/schemas/BulkSingleConversationUpdateParams'
              - {}
          type: array
          description: Array of conversations to process, allowing unknown
      required:
        - conversations
      type: object
      additionalProperties: false
    ChannelType:
      type: string
      enum:
        - WHATSAPP
        - PHONE
        - EMAIL
      description: Represents the available communication channel types in the CRM system
    FunnelChannelSession:
      description: Represents a channel-specific session within a funnel conversation.
      properties:
        id:
          type: number
          format: double
          description: Unique identifier for the channel session
        tenantId:
          type: string
          description: Tenant identifier the session belongs to
        funnelConversationId:
          type: number
          format: double
          description: Reference to the funnel conversation this session belongs to
        funnelAddressId:
          type: number
          format: double
          description: Reference to the funnel address used for this session
        contactAddressId:
          type: number
          format: double
          description: Reference to the contact address used in this session
        archivedAt:
          type: string
          format: date-time
          nullable: true
          description: Optional timestamp when the session was archived
        startTime:
          type: string
          format: date-time
          description: Timestamp when the session started
        endTime:
          type: string
          format: date-time
          nullable: true
          description: Optional timestamp when the session ended
        channelType:
          $ref: '#/components/schemas/ChannelType'
          description: Type of channel used for this session
        messagingConversationId:
          type: string
          nullable: true
          description: Optional messaging conversation identifier
        createdAt:
          type: string
          format: date-time
          description: Timestamp of when the session was created
        updatedAt:
          type: string
          format: date-time
          description: Timestamp of when the session was last updated
      required:
        - id
        - tenantId
        - funnelConversationId
        - funnelAddressId
        - contactAddressId
        - startTime
        - channelType
        - createdAt
        - updatedAt
      type: object
      additionalProperties: false
    ContactAddress:
      description: >-
        Represents a communication address for a contact in the CRM system.

        This can be an email address, phone number, or other channel-specific
        address.
      properties:
        id:
          type: number
          format: double
          description: Unique identifier for the contact address
        tenantId:
          type: string
          description: Tenant identifier the address belongs to
        contactId:
          type: number
          format: double
          description: Reference to the associated contact
        channelType:
          $ref: '#/components/schemas/ChannelType'
          description: Type of communication channel
        address:
          type: string
          description: The actual address value (e.g., email address, phone number)
        createdAt:
          type: string
          format: date-time
          description: Timestamp of when the address was created
        updatedAt:
          type: string
          format: date-time
          description: Timestamp of when the address was last updated
      required:
        - id
        - tenantId
        - contactId
        - channelType
        - address
        - createdAt
        - updatedAt
      type: object
      additionalProperties: false
    Contact:
      description: Interface representing a contact in the CRM system
      properties:
        id:
          type: number
          format: double
        tenantId:
          type: string
        providerId:
          type: string
          nullable: true
        providerName:
          type: string
          nullable: true
        nationalId:
          type: string
          nullable: true
        firstName:
          type: string
          nullable: true
        lastName:
          type: string
          nullable: true
        email:
          type: string
          nullable: true
          deprecated: true
        phone:
          type: string
          nullable: true
          deprecated: true
        userId:
          type: number
          format: double
          nullable: true
        contactCompanyId:
          type: number
          format: double
          nullable: true
        companyPosition:
          type: string
          nullable: true
        metadata: {}
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
        addresses:
          items:
            $ref: '#/components/schemas/ContactAddress'
          type: array
      required:
        - id
        - tenantId
        - metadata
        - createdAt
        - updatedAt
      type: object
      additionalProperties: false
    FunnelConversation:
      description: Represents a conversation within a funnel.
      properties:
        id:
          type: number
          format: double
          description: Unique identifier for the funnel conversation
        tenantId:
          type: string
          description: Tenant identifier the conversation belongs to
        contactId:
          type: number
          format: double
          description: Reference to the contact involved in the conversation
        userId:
          type: number
          format: double
          nullable: true
          description: Reference to the user involved in the conversation
        funnelId:
          type: number
          format: double
          description: Reference to the funnel this conversation belongs to
        funnelStatusId:
          type: number
          format: double
          nullable: true
          description: Optional reference to the current funnel status
        archivedAt:
          type: string
          format: date-time
          nullable: true
          description: Optional timestamp when the conversation was archived
        createdAt:
          type: string
          format: date-time
          description: Timestamp of when the conversation was created
        updatedAt:
          type: string
          format: date-time
          description: Timestamp of when the conversation was last updated
        channelSessions:
          items:
            $ref: '#/components/schemas/FunnelChannelSession'
          type: array
          description: Optional array of channel sessions associated with this conversation
        contacts:
          items:
            $ref: '#/components/schemas/Contact'
          type: array
          description: Optional array of contacts involved in this conversation
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
          description: Optional custom fields for the conversation
      required:
        - id
        - tenantId
        - contactId
        - funnelId
        - createdAt
        - updatedAt
      type: object
      additionalProperties: false
    FunnelConversationCreateResponse:
      $ref: '#/components/schemas/FunnelConversation'
      description: Response type for funnel conversation creation
    PaginatedResult_Contact_:
      description: Interface for cursor-based paginated query results.
      properties:
        items:
          items:
            $ref: '#/components/schemas/Contact'
          type: array
        nextPageToken:
          type: string
        totalCount:
          type: number
          format: double
      required:
        - items
      type: object
      additionalProperties: false
    ContactListResponse:
      $ref: '#/components/schemas/PaginatedResult_Contact_'
      description: Response type for listing contacts
    ContactListQueryParams:
      description: Query parameters for listing contacts
      properties:
        filterBy:
          type: string
        searchBy:
          type: string
        sortBy:
          type: string
        page:
          type: number
          format: double
        pageSize:
          type: number
          format: double
        pageToken:
          type: string
      type: object
      additionalProperties: false
    ContactGetResponse:
      allOf:
        - $ref: '#/components/schemas/Contact'
      nullable: true
      description: Response type for getting a single contact
    ContactCreateResponse:
      $ref: '#/components/schemas/Contact'
      description: Response type for contact creation
    Pick_NewContactAddress.Exclude_keyofNewContactAddress.contactId__:
      properties:
        channelType:
          $ref: '#/components/schemas/ChannelType'
          description: Type of communication channel
        address:
          type: string
          description: The actual address value (e.g., email address, phone number)
      required:
        - channelType
        - address
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Omit_NewContactAddress.contactId_:
      $ref: >-
        #/components/schemas/Pick_NewContactAddress.Exclude_keyofNewContactAddress.contactId__
      description: Construct a type with the properties of T except for those in type K.
    ContactCreateBodyParams:
      description: Request body parameters for creating a new contact
      properties:
        userId:
          type: number
          format: double
          nullable: true
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
        providerId:
          type: string
          nullable: true
        providerName:
          type: string
          nullable: true
        nationalId:
          type: string
          nullable: true
        firstName:
          type: string
          nullable: true
        lastName:
          type: string
          nullable: true
        email:
          type: string
          nullable: true
          deprecated: true
        phone:
          type: string
          nullable: true
          deprecated: true
        contactCompanyId:
          type: number
          format: double
          nullable: true
        companyPosition:
          type: string
          nullable: true
        metadata: {}
        createdAt:
          type: string
          format: date-time
        addresses:
          items:
            $ref: '#/components/schemas/Omit_NewContactAddress.contactId_'
          type: array
      type: object
      additionalProperties: false
    ContactUpdateResponse:
      $ref: '#/components/schemas/Contact'
      description: Response type for contact update
    ContactUpdateBodyParams:
      description: Request body parameters for updating a contact
      properties:
        id:
          type: number
          format: double
        tenantId:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        userId:
          type: number
          format: double
          nullable: true
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
        metadata: {}
        providerId:
          type: string
          nullable: true
        providerName:
          type: string
          nullable: true
        nationalId:
          type: string
          nullable: true
        firstName:
          type: string
          nullable: true
        lastName:
          type: string
          nullable: true
        email:
          type: string
          nullable: true
          deprecated: true
        phone:
          type: string
          nullable: true
          deprecated: true
        contactCompanyId:
          type: number
          format: double
          nullable: true
        companyPosition:
          type: string
          nullable: true
        addresses:
          items:
            $ref: '#/components/schemas/Omit_NewContactAddress.contactId_'
          type: array
      type: object
      additionalProperties: false
    ContactDeleteResponse:
      $ref: '#/components/schemas/Contact'
      description: Response type for contact deletion
    SearcherDocumentModelType:
      type: string
      enum:
        - Contact
        - Message
        - Call
        - Conversation
        - StatusHistory
      description: Type representing the allowed model types for searcher documents
    ContactDocument:
      description: Interface representing a contact document
      properties:
        tenantId:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
        metadata: {}
        addresses:
          items:
            $ref: '#/components/schemas/ContactAddress'
          type: array
        providerId:
          type: string
          nullable: true
        providerName:
          type: string
          nullable: true
        nationalId:
          type: string
          nullable: true
        firstName:
          type: string
          nullable: true
        lastName:
          type: string
          nullable: true
        email:
          type: string
          nullable: true
          deprecated: true
        phone:
          type: string
          nullable: true
          deprecated: true
        companyPosition:
          type: string
          nullable: true
        id:
          type: string
        modelType:
          type: string
          enum:
            - Contact
          nullable: false
        archivedAt:
          type: string
          format: date-time
          nullable: true
        eventSequence:
          type: number
          format: double
        eventTimestamp:
          type: string
          format: date-time
        userId:
          type: string
          nullable: true
        contactCompanyId:
          type: string
          nullable: true
      required:
        - tenantId
        - createdAt
        - updatedAt
        - metadata
        - id
        - modelType
      type: object
      additionalProperties: false
    PaginatedResult_ContactDocument_:
      description: Interface for cursor-based paginated query results.
      properties:
        items:
          items:
            $ref: '#/components/schemas/ContactDocument'
          type: array
        nextPageToken:
          type: string
        totalCount:
          type: number
          format: double
      required:
        - items
      type: object
      additionalProperties: false
    SearcherDocumentSearchResponse_ContactDocument_:
      $ref: '#/components/schemas/PaginatedResult_ContactDocument_'
      description: Type representing a paginated search result
    SearcherDocumentSearchFilterOperator:
      type: string
      enum:
        - eq
        - neq
        - gt
        - lt
        - gte
        - lte
        - contains
        - exists
        - missing
        - in
        - nin
        - startsWith
      description: Type representing the allowed operators for search filters
    Record_string.unknown_:
      properties: {}
      type: object
      description: Construct a type with a set of properties K of type T
    SearcherDocumentSearchFilterValue:
      anyOf:
        - type: string
        - type: number
          format: double
        - type: boolean
        - items:
            type: string
          type: array
        - items:
            type: number
            format: double
          type: array
        - items:
            type: boolean
          type: array
        - $ref: '#/components/schemas/Record_string.unknown_'
      description: Type representing the allowed values for search filters
    SearcherDocumentSearchFilter:
      description: Type representing a search filter
      properties:
        field:
          type: string
        operator:
          $ref: '#/components/schemas/SearcherDocumentSearchFilterOperator'
        value:
          $ref: '#/components/schemas/SearcherDocumentSearchFilterValue'
        or:
          type: boolean
      required:
        - field
        - operator
      type: object
      additionalProperties: false
    SearcherDocumentSearchSortDirection:
      type: string
      enum:
        - asc
        - desc
      description: Type representing the allowed sort directions
    SearcherDocumentSearchSort:
      description: Type representing a sort parameter
      properties:
        field:
          type: string
        direction:
          $ref: '#/components/schemas/SearcherDocumentSearchSortDirection'
      required:
        - field
        - direction
      type: object
      additionalProperties: false
    SearcherDocumentSearchBodyParams:
      description: Type representing search parameters
      properties:
        search:
          type: string
        filters:
          items:
            $ref: '#/components/schemas/SearcherDocumentSearchFilter'
          type: array
        sort:
          items:
            $ref: '#/components/schemas/SearcherDocumentSearchSort'
          type: array
        size:
          type: number
          format: double
        pageToken:
          type: string
        includeArchived:
          type: boolean
        includeTotalCount:
          type: boolean
      type: object
      additionalProperties: false
    MessageStatus:
      type: string
      enum:
        - pending
        - sent
        - failed
        - delivered
        - read
        - deleted
        - warning
      description: Interface representing a message status DTO.
    MessageDirection:
      type: string
      enum:
        - inbound
        - outbound
      description: Type representing a message direction.
    ConversationChannel:
      type: string
      enum:
        - whatsapp
        - email
        - sms
      description: Interface representing a conversation channel DTO.
    ParticipantRole:
      type: string
      enum:
        - user
        - contact
        - system
      description: Type representing a participant role.
    MessageParticipantInfo:
      description: Interface representing message participant information.
      properties:
        providerId:
          type: string
        address:
          type: string
        role:
          $ref: '#/components/schemas/ParticipantRole'
        displayName:
          type: string
        metadata:
          properties: {}
          additionalProperties: {}
          type: object
      required:
        - providerId
        - address
        - role
      type: object
      additionalProperties: false
    AttachmentType:
      type: string
      enum:
        - image
        - video
        - audio
        - file
      description: Type representing attachment types.
    MessageMediaProcessingStatus:
      type: string
      enum:
        - pending
        - processing
        - completed
        - failed
      description: Type representing a message media processing status.
    MessageMediaProcessing:
      description: Interface representing message media processing information.
      properties:
        textRepresentation:
          properties:
            errorMessage:
              type: string
            processedAt:
              type: string
            content:
              type: string
            status:
              $ref: '#/components/schemas/MessageMediaProcessingStatus'
          required:
            - status
          type: object
        summary:
          properties:
            errorMessage:
              type: string
            processedAt:
              type: string
            content:
              type: string
            status:
              $ref: '#/components/schemas/MessageMediaProcessingStatus'
          required:
            - status
          type: object
      type: object
      additionalProperties: false
    Attachment:
      description: Interface representing an attachment.
      properties:
        id:
          type: string
        type:
          $ref: '#/components/schemas/AttachmentType'
        url:
          type: string
        unsignedUrl:
          type: string
        metadata:
          $ref: '#/components/schemas/Dictionary_unknown_'
        mediaProcessing:
          $ref: '#/components/schemas/MessageMediaProcessing'
        isCacheable:
          type: boolean
      required:
        - id
        - type
        - url
      type: object
      additionalProperties: false
    MessageError:
      description: Interface representing a message error.
      properties:
        code:
          type: number
          format: double
        title:
          type: string
        message:
          type: string
        href:
          type: string
        provider:
          type: string
      required:
        - title
      type: object
      additionalProperties: false
    MessageGetResponse:
      description: Interface representing the response for getting a message.
      properties:
        id:
          type: string
        tenantId:
          type: string
        conversationId:
          type: string
        funnelConversationId:
          type: number
          format: double
        sessionId:
          type: number
          format: double
        providerId:
          type: string
        contactId:
          type: number
          format: double
        userId:
          type: string
        content:
          type: string
        status:
          $ref: '#/components/schemas/MessageStatus'
        direction:
          $ref: '#/components/schemas/MessageDirection'
        channel:
          $ref: '#/components/schemas/ConversationChannel'
        sender:
          $ref: '#/components/schemas/MessageParticipantInfo'
        recipient:
          $ref: '#/components/schemas/MessageParticipantInfo'
        attachments:
          items:
            $ref: '#/components/schemas/Attachment'
          type: array
        createdAt:
          type: string
        updatedAt:
          type: string
        metadata:
          $ref: '#/components/schemas/Dictionary_unknown_'
        errors:
          items:
            $ref: '#/components/schemas/MessageError'
          type: array
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
        mediaProcessing:
          $ref: '#/components/schemas/MessageMediaProcessing'
      required:
        - id
        - tenantId
        - conversationId
        - providerId
        - content
        - status
        - direction
        - channel
        - sender
        - createdAt
        - updatedAt
      type: object
      additionalProperties: false
    WhatsAppTemplateMessageCreateResponse:
      description: >-
        Interface representing the response for creating a WhatsApp template
        message.
      properties:
        id:
          type: string
        tenantId:
          type: string
        conversationId:
          type: string
        funnelConversationId:
          type: number
          format: double
        sessionId:
          type: number
          format: double
        providerId:
          type: string
        contactId:
          type: number
          format: double
        userId:
          type: string
        content:
          type: string
        status:
          $ref: '#/components/schemas/MessageStatus'
        direction:
          $ref: '#/components/schemas/MessageDirection'
        channel:
          $ref: '#/components/schemas/ConversationChannel'
        sender:
          $ref: '#/components/schemas/MessageParticipantInfo'
        recipient:
          $ref: '#/components/schemas/MessageParticipantInfo'
        attachments:
          items:
            $ref: '#/components/schemas/Attachment'
          type: array
        createdAt:
          type: string
        updatedAt:
          type: string
        metadata:
          $ref: '#/components/schemas/Dictionary_unknown_'
        errors:
          items:
            $ref: '#/components/schemas/MessageError'
          type: array
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
        mediaProcessing:
          $ref: '#/components/schemas/MessageMediaProcessing'
      required:
        - id
        - tenantId
        - conversationId
        - providerId
        - content
        - status
        - direction
        - channel
        - sender
        - createdAt
        - updatedAt
      type: object
      additionalProperties: false
    WhatsAppTemplateMessageVariable:
      description: >-
        Type representing a WhatsApp template message variable (for body
        component).
      properties:
        value:
          type: string
      required:
        - value
      type: object
      additionalProperties: false
    WhatsAppTemplateHeaderComponentType:
      type: string
      enum:
        - header
        - HEADER
      description: Type representing the header component type in a WhatsApp template
    WhatsAppTemplateMessageTextParameterType:
      type: string
      enum:
        - text
      nullable: false
      description: Type for text parameter type.
    WhatsAppTemplateMessageTextParameter:
      description: Interface for text parameter.
      properties:
        type:
          $ref: '#/components/schemas/WhatsAppTemplateMessageTextParameterType'
        text:
          type: string
      required:
        - type
        - text
      type: object
      additionalProperties: false
    WhatsAppTemplateMessageImageParameterType:
      type: string
      enum:
        - image
      nullable: false
      description: Type for image parameter type.
    WhatsAppTemplateMessageImageParameter:
      description: Interface for image parameter.
      properties:
        type:
          $ref: '#/components/schemas/WhatsAppTemplateMessageImageParameterType'
        image:
          properties:
            link:
              type: string
          required:
            - link
          type: object
      required:
        - type
        - image
      type: object
      additionalProperties: false
    WhatsAppTemplateMessageDocumentParameterType:
      type: string
      enum:
        - document
      nullable: false
      description: Type for document parameter type.
    WhatsAppTemplateMessageDocumentParameter:
      description: Interface for document parameter.
      properties:
        type:
          $ref: '#/components/schemas/WhatsAppTemplateMessageDocumentParameterType'
        document:
          properties:
            filename:
              type: string
            link:
              type: string
          required:
            - link
          type: object
      required:
        - type
        - document
      type: object
      additionalProperties: false
    WhatsAppTemplateMessageVideoParameterType:
      type: string
      enum:
        - video
      nullable: false
      description: Type for video parameter type.
    WhatsAppTemplateMessageVideoParameter:
      description: Interface for video parameter.
      properties:
        type:
          $ref: '#/components/schemas/WhatsAppTemplateMessageVideoParameterType'
        video:
          properties:
            link:
              type: string
          required:
            - link
          type: object
      required:
        - type
        - video
      type: object
      additionalProperties: false
    WhatsAppTemplateMessageLocationParameterType:
      type: string
      enum:
        - location
      nullable: false
      description: Type for location parameter type.
    WhatsAppTemplateMessageLocationParameter:
      description: Interface for location parameter.
      properties:
        type:
          $ref: '#/components/schemas/WhatsAppTemplateMessageLocationParameterType'
        location:
          properties:
            address:
              type: string
            name:
              type: string
            longitude:
              type: number
              format: double
            latitude:
              type: number
              format: double
          required:
            - longitude
            - latitude
          type: object
      required:
        - type
        - location
      type: object
      additionalProperties: false
    WhatsAppTemplateMessageHeaderComponentParameter:
      anyOf:
        - $ref: '#/components/schemas/WhatsAppTemplateMessageTextParameter'
        - $ref: '#/components/schemas/WhatsAppTemplateMessageImageParameter'
        - $ref: '#/components/schemas/WhatsAppTemplateMessageDocumentParameter'
        - $ref: '#/components/schemas/WhatsAppTemplateMessageVideoParameter'
        - $ref: '#/components/schemas/WhatsAppTemplateMessageLocationParameter'
      description: Type for header component parameters.
    WhatsAppTemplateMessageHeaderComponent:
      description: Interface for header component.
      properties:
        type:
          $ref: '#/components/schemas/WhatsAppTemplateHeaderComponentType'
        parameters:
          items:
            $ref: >-
              #/components/schemas/WhatsAppTemplateMessageHeaderComponentParameter
          type: array
      required:
        - type
      type: object
      additionalProperties: false
    WhatsAppTemplateBodyComponentType:
      type: string
      enum:
        - body
        - BODY
      description: Type representing the body component type in a WhatsApp template
    WhatsAppTemplateMessageCurrencyParameterType:
      type: string
      enum:
        - currency
      nullable: false
      description: Type for currency parameter type.
    WhatsAppTemplateMessageCurrencyParameter:
      description: Interface for currency parameter.
      properties:
        type:
          $ref: '#/components/schemas/WhatsAppTemplateMessageCurrencyParameterType'
        currency:
          properties:
            amount1000:
              type: number
              format: double
            code:
              type: string
            fallbackValue:
              type: string
          required:
            - amount1000
            - code
            - fallbackValue
          type: object
      required:
        - type
        - currency
      type: object
      additionalProperties: false
    WhatsAppTemplateMessageDateTimeParameterType:
      type: string
      enum:
        - date_time
      nullable: false
      description: Type for date_time parameter type.
    WhatsAppTemplateMessageDateTimeParameter:
      description: Interface for date_time parameter.
      properties:
        type:
          $ref: '#/components/schemas/WhatsAppTemplateMessageDateTimeParameterType'
        dateTime:
          properties:
            fallbackValue:
              type: string
          required:
            - fallbackValue
          type: object
      required:
        - type
        - dateTime
      type: object
      additionalProperties: false
    WhatsAppTemplateMessageBodyComponentParameter:
      anyOf:
        - $ref: '#/components/schemas/WhatsAppTemplateMessageTextParameter'
        - $ref: '#/components/schemas/WhatsAppTemplateMessageCurrencyParameter'
        - $ref: '#/components/schemas/WhatsAppTemplateMessageDateTimeParameter'
      description: Type for body component parameters.
    WhatsAppTemplateMessageBodyComponent:
      description: Interface for body component.
      properties:
        type:
          $ref: '#/components/schemas/WhatsAppTemplateBodyComponentType'
        parameters:
          items:
            $ref: '#/components/schemas/WhatsAppTemplateMessageBodyComponentParameter'
          type: array
      required:
        - type
      type: object
      additionalProperties: false
    WhatsAppTemplateButtonComponentType:
      type: string
      enum:
        - button
        - BUTTON
        - buttons
        - BUTTONS
      description: Type representing the button component type in a WhatsApp template
    WhatsAppTemplateMessageButtonSubType:
      type: string
      enum:
        - quick_reply
        - url
        - phone_number
      description: Type for button component sub types.
    WhatsAppTemplateMessagePayloadParameterType:
      type: string
      enum:
        - payload
      nullable: false
      description: Type for payload parameter type.
    WhatsAppTemplateMessagePayloadParameter:
      description: Interface for payload parameter.
      properties:
        type:
          $ref: '#/components/schemas/WhatsAppTemplateMessagePayloadParameterType'
        payload:
          type: string
      required:
        - type
        - payload
      type: object
      additionalProperties: false
    WhatsAppTemplateMessageButtonComponentParameter:
      anyOf:
        - $ref: '#/components/schemas/WhatsAppTemplateMessagePayloadParameter'
        - $ref: '#/components/schemas/WhatsAppTemplateMessageTextParameter'
      description: Type for button component parameters.
    WhatsAppTemplateMessageButtonComponent:
      description: Interface for button component.
      properties:
        type:
          $ref: '#/components/schemas/WhatsAppTemplateButtonComponentType'
        subType:
          $ref: '#/components/schemas/WhatsAppTemplateMessageButtonSubType'
        index:
          type: string
        parameters:
          items:
            $ref: >-
              #/components/schemas/WhatsAppTemplateMessageButtonComponentParameter
          type: array
      required:
        - type
        - subType
        - index
      type: object
      additionalProperties: false
    WhatsAppTemplateMessageComponent:
      anyOf:
        - $ref: '#/components/schemas/WhatsAppTemplateMessageHeaderComponent'
        - $ref: '#/components/schemas/WhatsAppTemplateMessageBodyComponent'
        - $ref: '#/components/schemas/WhatsAppTemplateMessageButtonComponent'
      description: Type for WhatsApp template message component.
    WhatsAppTemplateMessageCreateBodyParams:
      description: >-
        Interface representing the body parameters for sending a WhatsApp
        template message.
      properties:
        fromPhoneNumber:
          type: string
        toPhoneNumber:
          type: string
        userId:
          type: string
        templateName:
          type: string
        languageCode:
          type: string
        variables:
          items:
            $ref: '#/components/schemas/WhatsAppTemplateMessageVariable'
          type: array
        components:
          items:
            $ref: '#/components/schemas/WhatsAppTemplateMessageComponent'
          type: array
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
      required:
        - fromPhoneNumber
        - toPhoneNumber
        - templateName
        - languageCode
      type: object
      additionalProperties: false
    WhatsAppMessageCreateResponse:
      description: Interface representing the response for creating a WhatsApp message.
      properties:
        id:
          type: string
        tenantId:
          type: string
        conversationId:
          type: string
        funnelConversationId:
          type: number
          format: double
        sessionId:
          type: number
          format: double
        providerId:
          type: string
        contactId:
          type: number
          format: double
        userId:
          type: string
        content:
          type: string
        status:
          $ref: '#/components/schemas/MessageStatus'
        direction:
          $ref: '#/components/schemas/MessageDirection'
        channel:
          $ref: '#/components/schemas/ConversationChannel'
        sender:
          $ref: '#/components/schemas/MessageParticipantInfo'
        recipient:
          $ref: '#/components/schemas/MessageParticipantInfo'
        attachments:
          items:
            $ref: '#/components/schemas/Attachment'
          type: array
        createdAt:
          type: string
        updatedAt:
          type: string
        metadata:
          $ref: '#/components/schemas/Dictionary_unknown_'
        errors:
          items:
            $ref: '#/components/schemas/MessageError'
          type: array
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
        mediaProcessing:
          $ref: '#/components/schemas/MessageMediaProcessing'
      required:
        - id
        - tenantId
        - conversationId
        - providerId
        - content
        - status
        - direction
        - channel
        - sender
        - createdAt
        - updatedAt
      type: object
      additionalProperties: false
    WhatsAppMessageType:
      type: string
      enum:
        - text
        - image
        - audio
        - video
        - document
        - sticker
        - location
        - contacts
        - interactive
        - reaction
        - button
        - order
        - system
        - unknown
        - unsupported
        - media_placeholder
      description: >-
        WhatsApp message types.


        Defines all supported message types that can be received from WhatsApp
        webhooks,

        including standard message types and special types for coexistence
        features.
    V2WhatsAppMessageCreateBodyParams:
      description: >-
        Interface representing the body parameters for sending a WhatsApp
        message.
      properties:
        fromPhoneNumber:
          type: string
        toPhoneNumber:
          type: string
        userId:
          type: string
        content:
          type: string
        type:
          $ref: '#/components/schemas/WhatsAppMessageType'
        customFields:
          $ref: '#/components/schemas/Dictionary_unknown_'
        fileId:
          type: string
      required:
        - fromPhoneNumber
        - toPhoneNumber
        - content
        - type
      type: object
      additionalProperties: false
    WhatsAppMediaUploadResponse:
      description: |-
        TSOA-compatible version of WhatsAppMediaUploadResponse.
        Simplifies the complex nested schemas for TSOA compatibility.
      properties:
        url:
          type: string
        size:
          type: number
          format: double
        fileName:
          type: string
        contentType:
          type: string
        fileId:
          type: string
        mediaId:
          type: string
        tags:
          $ref: '#/components/schemas/Dictionary_string_'
          description: Optional metadata tags for the media upload
      required:
        - url
        - size
        - fileName
        - contentType
        - fileId
        - mediaId
      type: object
      additionalProperties: false
    WhatsAppMediaUploadBodyParams:
      description: >-
        Type representing the body parameters for WhatsApp media upload.
        Supports two modes: file ID (existing file) or direct upload (new file).
      properties:
        fileName:
          type: string
        contentType:
          type: string
        fileId:
          type: string
        fromPhoneNumber:
          type: string
        content:
          type: string
        tags:
          $ref: '#/components/schemas/Dictionary_string_'
          description: Optional metadata tags for the media upload
      required:
        - fromPhoneNumber
      type: object
      additionalProperties: false
    CustomFieldListOption:
      description: Represents a predefined option for a LIST type custom field.
      properties:
        id:
          type: number
          format: double
          description: Unique identifier for the list option
        tenantId:
          type: string
          description: Tenant identifier the custom field belongs to
        definitionId:
          type: number
          format: double
          description: Reference to the custom field definition this option belongs to
        value:
          type: string
          description: The actual value to be stored
        label:
          type: string
          nullable: true
          description: Optional human-readable label for the value
        description:
          type: string
          nullable: true
          description: Optional description of what this option represents
        createdAt:
          type: string
          format: date-time
          description: Timestamp of when the option was created
        updatedAt:
          type: string
          format: date-time
          description: Timestamp of when the option was last updated
      required:
        - id
        - tenantId
        - definitionId
        - value
        - createdAt
        - updatedAt
      type: object
      additionalProperties: false
    PaginatedResult_CustomFieldListOption_:
      description: Interface for cursor-based paginated query results.
      properties:
        items:
          items:
            $ref: '#/components/schemas/CustomFieldListOption'
          type: array
        nextPageToken:
          type: string
        totalCount:
          type: number
          format: double
      required:
        - items
      type: object
      additionalProperties: false
    CustomFieldListOptionListResponse:
      $ref: '#/components/schemas/PaginatedResult_CustomFieldListOption_'
      description: Response type for listing custom field list options
    OTCustomFieldListOptionListQueryParams:
      description: >-
        Interface representing the parameters for listing custom field list
        options, with an optional tenant ID.
      properties:
        filterBy:
          type: string
        searchBy:
          type: string
        sortBy:
          type: string
        page:
          type: number
          format: double
        pageSize:
          type: number
          format: double
        pageToken:
          type: string
        tenantId:
          type: string
      type: object
      additionalProperties: false
    CustomFieldListOptionGetResponse:
      allOf:
        - $ref: '#/components/schemas/CustomFieldListOption'
      nullable: true
      description: Response type for getting a single custom field list option
    CustomFieldListOptionCreateResponse:
      $ref: '#/components/schemas/CustomFieldListOption'
      description: Response type for custom field list option creation
    CustomFieldListOptionCreateBodyParams:
      description: Request body parameters for creating a new custom field list option
      properties:
        definitionId:
          type: number
          format: double
          description: Reference to the custom field definition this option belongs to
        value:
          type: string
          description: The actual value to be stored
        label:
          type: string
          nullable: true
          description: Optional human-readable label for the value
        description:
          type: string
          nullable: true
          description: Optional description of what this option represents
      required:
        - definitionId
        - value
      type: object
      additionalProperties: false
    CustomFieldListOptionUpdateResponse:
      $ref: '#/components/schemas/CustomFieldListOption'
      description: Response type for custom field list option update
    CustomFieldListOptionUpdateBodyParams:
      description: Request body parameters for updating a custom field list option
      properties:
        id:
          type: number
          format: double
          description: Unique identifier for the list option
        tenantId:
          type: string
          description: Tenant identifier the custom field belongs to
        definitionId:
          type: number
          format: double
          description: Reference to the custom field definition this option belongs to
        value:
          type: string
          description: The actual value to be stored
        label:
          type: string
          nullable: true
          description: Optional human-readable label for the value
        description:
          type: string
          nullable: true
          description: Optional description of what this option represents
        createdAt:
          type: string
          format: date-time
          description: Timestamp of when the option was created
        updatedAt:
          type: string
          format: date-time
          description: Timestamp of when the option was last updated
      type: object
      additionalProperties: false
    CustomFieldListOptionDeleteResponse:
      $ref: '#/components/schemas/CustomFieldListOption'
      description: Response type for custom field list option deletion
    CustomFieldEntityType:
      type: string
      enum:
        - CONTACT
        - COMPANY
        - FUNNEL_CONVERSATION
        - FUNNEL_CHANNEL_SESSION
        - PRODUCT
      description: Represents the entity types that custom fields can have.
    CustomFieldType:
      type: string
      enum:
        - STRING
        - NUMBER
        - DATE
        - BOOLEAN
        - LIST
        - FILE
      description: Represents the supported data types for custom fields.
    CustomFieldDefinition:
      description: Represents the definition of a custom field.
      properties:
        id:
          type: number
          format: double
          description: Unique identifier for the custom field definition
        tenantId:
          type: string
          description: Tenant identifier the custom field belongs to
        entityType:
          $ref: '#/components/schemas/CustomFieldEntityType'
          description: Type of entity this custom field is for
        fieldKey:
          type: string
          description: Unique key/identifier for the field
        fieldLabel:
          type: string
          nullable: true
          description: Optional human-readable label for the field
        fieldType:
          $ref: '#/components/schemas/CustomFieldType'
          description: Data type of the field
        description:
          type: string
          nullable: true
          description: Optional description of the field's purpose
        createdAt:
          type: string
          format: date-time
          description: Timestamp of when the definition was created
        updatedAt:
          type: string
          format: date-time
          description: Timestamp of when the definition was last updated
      required:
        - id
        - tenantId
        - entityType
        - fieldKey
        - fieldType
        - createdAt
        - updatedAt
      type: object
      additionalProperties: false
    PaginatedResult_CustomFieldDefinition_:
      description: Interface for cursor-based paginated query results.
      properties:
        items:
          items:
            $ref: '#/components/schemas/CustomFieldDefinition'
          type: array
        nextPageToken:
          type: string
        totalCount:
          type: number
          format: double
      required:
        - items
      type: object
      additionalProperties: false
    CustomFieldDefinitionListResponse:
      $ref: '#/components/schemas/PaginatedResult_CustomFieldDefinition_'
      description: Response type for listing custom field definitions
    OTCustomFieldDefinitionListQueryParams:
      description: >-
        Interface representing the parameters for listing custom field
        definitions, with an optional tenant ID.
      properties:
        filterBy:
          type: string
        searchBy:
          type: string
        sortBy:
          type: string
        page:
          type: number
          format: double
        pageSize:
          type: number
          format: double
        pageToken:
          type: string
        tenantId:
          type: string
      type: object
      additionalProperties: false
    CustomFieldDefinitionGetResponse:
      allOf:
        - $ref: '#/components/schemas/CustomFieldDefinition'
      nullable: true
      description: Response type for getting a single custom field definition
    CustomFieldDefinitionCreateResponse:
      $ref: '#/components/schemas/CustomFieldDefinition'
      description: Response type for custom field definition creation
    CustomFieldDefinitionCreateBodyParams:
      description: Request body parameters for creating a new custom field definition
      properties:
        description:
          type: string
          nullable: true
          description: Optional description of the field's purpose
        entityType:
          $ref: '#/components/schemas/CustomFieldEntityType'
          description: Type of entity this custom field is for
        fieldKey:
          type: string
          description: Unique key/identifier for the field
        fieldLabel:
          type: string
          nullable: true
          description: Optional human-readable label for the field
        fieldType:
          $ref: '#/components/schemas/CustomFieldType'
          description: Data type of the field
      required:
        - entityType
        - fieldKey
        - fieldType
      type: object
      additionalProperties: false
    CustomFieldDefinitionUpdateResponse:
      $ref: '#/components/schemas/CustomFieldDefinition'
      description: Response type for custom field definition update
    CustomFieldDefinitionUpdateBodyParams:
      description: Request body parameters for updating a custom field definition
      properties:
        id:
          type: number
          format: double
          description: Unique identifier for the custom field definition
        tenantId:
          type: string
          description: Tenant identifier the custom field belongs to
        entityType:
          $ref: '#/components/schemas/CustomFieldEntityType'
          description: Type of entity this custom field is for
        fieldKey:
          type: string
          description: Unique key/identifier for the field
        fieldLabel:
          type: string
          nullable: true
          description: Optional human-readable label for the field
        fieldType:
          $ref: '#/components/schemas/CustomFieldType'
          description: Data type of the field
        description:
          type: string
          nullable: true
          description: Optional description of the field's purpose
        createdAt:
          type: string
          format: date-time
          description: Timestamp of when the definition was created
        updatedAt:
          type: string
          format: date-time
          description: Timestamp of when the definition was last updated
      type: object
      additionalProperties: false
    CustomFieldDefinitionDeleteResponse:
      $ref: '#/components/schemas/CustomFieldDefinition'
      description: Response type for custom field definition deletion
    ProviderData:
      properties:
        providerName:
          type: string
        contactProviderId:
          type: string
        opportunityProviderId:
          type: string
      type: object
      additionalProperties: false
    CallCustomData:
      properties: {}
      type: object
      additionalProperties:
        type: string
    NewBridgeCall:
      properties:
        from:
          type: string
        to:
          type: string
        callProviderData:
          $ref: '#/components/schemas/ProviderData'
        callCustomData:
          $ref: '#/components/schemas/CallCustomData'
      required:
        - to
      type: object
      additionalProperties: false
      example:
        to: '+1234567890'
        callCustomData:
          customKey: customValue
    NewAgentCall:
      properties:
        voiceAgentId:
          type: number
          format: double
        to:
          type: string
        contextVariables:
          properties: {}
          additionalProperties:
            type: string
          type: object
        customData:
          $ref: '#/components/schemas/CallCustomData'
      required:
        - voiceAgentId
        - to
        - contextVariables
      type: object
      additionalProperties: false
      example:
        voiceAgentId: 123
        to: '+1234567890'
        contextVariables:
          customerFirstName: Pedro
          customerLastName: Gomez
        customData:
          customKey: customValue
    NewCallFromProvider:
      properties:
        status:
          type: string
        userId:
          type: number
          format: double
          nullable: true
        metadata: {}
        providerId:
          type: string
        providerName:
          type: string
        customData: {}
        funnelConversationId:
          type: number
          format: double
        sessionId:
          type: number
          format: double
        from:
          type: string
        to:
          type: string
        redirectedTo:
          type: string
          nullable: true
        duration:
          type: number
          format: double
          nullable: true
        direction:
          type: string
        startTime:
          type: string
          format: date-time
        teamId:
          type: number
          format: double
          nullable: true
      required:
        - status
        - userId
        - metadata
        - from
        - to
        - duration
        - direction
        - startTime
      type: object
      additionalProperties: false
    Transcription:
      properties:
        id:
          type: number
          format: double
        tenantId:
          type: string
        providerId:
          type: string
          nullable: true
        providerName:
          type: string
          nullable: true
        recordingId:
          type: number
          format: double
        url:
          type: string
          nullable: true
        text:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - tenantId
        - providerId
        - providerName
        - recordingId
        - url
        - text
        - createdAt
        - updatedAt
      type: object
      additionalProperties: false
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
info:
  title: LlamadaPro API
  version: 1.0.0
  description: API to consume LlamadaPro services (beta).
  license:
    name: ISC
  contact: {}
openapi: 3.0.0
paths:
  /api/v2/calls/start/agent:
    post:
      operationId: StartAgentCall
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Call'
        '400':
          description: Bad Request - Configuration error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      tags:
        - v2/calls
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - create:call
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentCallCreateBodyParams'
  /api/v1/tasks:
    get:
      operationId: GetTasks
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TCTaskListResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        List tasks with support for filtering, sorting, and pagination.


        Returns a paginated list of tasks. Supports filtering by status, due
        dates, conversation,

        assignee, and other criteria.


        **Example usage:**

        GET /api/v1/tasks?status=pending&limit=20&pageToken=Xde34567890
      tags:
        - v1/tasks
      security:
        - OAuth2:
            - read:task
        - ApiKeyAuth:
            - read:task
      parameters:
        - in: query
          name: limit
          required: false
          schema:
            format: double
            type: number
        - in: query
          name: pageToken
          required: false
          schema:
            type: string
        - in: query
          name: status
          required: false
          schema:
            type: string
            enum:
              - completed
              - cancelled
              - scheduled
              - overdue
        - in: query
          name: dueBefore
          required: false
          schema:
            format: date-time
            type: string
        - in: query
          name: dueAfter
          required: false
          schema:
            format: date-time
            type: string
        - in: query
          name: conversationId
          required: false
          schema:
            format: double
            type: number
        - in: query
          name: assignedToType
          required: false
          schema:
            type: string
            enum:
              - user
              - ai_employee
        - in: query
          name: assignedToId
          required: false
          schema:
            type: string
    post:
      operationId: CreateTask
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TCTaskCreateResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Create a new task.


        Creates a new task with the specified details. Tasks can be assigned to
        users

        and can include due dates, descriptions, and other metadata.


        **Example usage:**

        POST /api/v1/tasks

        {
          "title": "Follow up with client",
          "objective": "Send proposal to client",
          "dueDate": "2024-02-15T10:00:00Z",
          "assignedTo": {
            "type": "user",
            "id": "123"
          }
        }
      tags:
        - v1/tasks
      security:
        - OAuth2:
            - create:task
        - ApiKeyAuth:
            - create:task
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TCTaskCreateBodyParams'
  /api/v1/tasks/{taskId}:
    get:
      operationId: GetTask
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TCTaskGetResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Get a task by ID.


        Retrieves a single task by its unique identifier, including all task
        details

        and assignment information.
      tags:
        - v1/tasks
      security:
        - OAuth2:
            - read:task
        - ApiKeyAuth:
            - read:task
      parameters:
        - in: path
          name: taskId
          required: true
          schema:
            type: string
    put:
      operationId: UpdateTask
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TCTaskUpdateResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Update an existing task.


        Updates the details of an existing task. Only fields provided in the
        request body

        will be updated. This includes status changes, assignment updates, due
        date modifications, etc.


        **Example usage:**

        PUT /api/v1/tasks/task_123

        {
          "status": "completed",
          "objective": "Updated task objective"
        }
      tags:
        - v1/tasks
      security:
        - OAuth2:
            - update:task
        - ApiKeyAuth:
            - update:task
      parameters:
        - in: path
          name: taskId
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TCTaskUpdateBodyParams'
    delete:
      operationId: DeleteTask
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TCTaskDeleteResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Delete a task by ID.


        Permanently deletes a task and all associated data. This action cannot
        be undone.
      tags:
        - v1/tasks
      security:
        - OAuth2:
            - delete:task
        - ApiKeyAuth:
            - delete:task
      parameters:
        - in: path
          name: taskId
          required: true
          schema:
            type: string
  /api/v1/recordings/{id}:
    get:
      operationId: GetRecording
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Recording'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      tags:
        - v1/calls/recordings
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - read:recording
      parameters:
        - in: path
          name: id
          required: true
          schema:
            format: double
            type: number
  /api/v1/recordings/load:
    post:
      operationId: LoadRecording
      responses:
        '204':
          description: No content
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      tags:
        - v1/calls/recordings
      security:
        - ApiKeyAuth:
            - create:recording
            - create:call
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoadRecordingParams'
  /api/v1/conversations/bulk:
    post:
      operationId: BulkCreate
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkOperationResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Create multiple conversations in a single request.


        This endpoint allows you to create multiple conversations at once. Each
        conversation in the batch

        will be validated before processing. The response includes details about
        any validation issues

        encountered during processing.


        If some conversations fail validation, the valid ones will still be
        processed.
      tags:
        - v1/conversations
      security:
        - BasicAuth: []
        - OAuth2:
            - bulk-create:crm-funnel-conversation
        - ApiKeyAuth:
            - bulk-create:crm-funnel-conversation
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkConversationPassthroughCreateParams'
  /api/v1/conversations/bulk/update:
    post:
      operationId: BulkUpdate
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkOperationResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Update multiple conversations in a single request.


        This endpoint allows you to update multiple existing conversations at
        once. Each conversation

        update in the batch will be validated before processing. The response
        includes details about

        any validation issues encountered during processing.


        You must provide the ID for each conversation you want to update. If
        some conversations fail

        validation, the valid ones will still be processed.
      tags:
        - v1/conversations
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - bulk-update:crm-funnel-conversation
        - OAuth2:
            - bulk-update:crm-funnel-conversation
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkConversationPassthroughUpdateParams'
  /api/v1/conversations:
    post:
      operationId: Create
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FunnelConversationCreateResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Create a single conversation.


        This endpoint allows you to create a single conversation and returns the
        created conversation

        immediately with all associated data including contact information.


        Use this endpoint when you need the created conversation immediately for
        subsequent operations.


        Either `contactId` or `contact` information must be provided. If
        `contact` is provided,

        a new contact will be created or an existing contact will be matched
        based on the addresses and updated.
      tags:
        - v1/conversations
      security:
        - BasicAuth: []
        - OAuth2:
            - create:crm-funnel-conversation
        - ApiKeyAuth:
            - create:crm-funnel-conversation
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkSingleConversationCreateParams'
  /api/v1/contacts:
    get:
      operationId: GetContacts
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactListResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        List contacts with support for filtering, sorting, and pagination.


        Returns a paginated list of contacts. Supports basic filtering, sorting
        and pagination via query parameters.


        **Note:** The `phone` and `email` fields on the Contact object are
        legacy and will be removed in the future. Use the `addresses` array for
        all phone numbers and email addresses.


        **Example usage:**

        GET
        /api/v1/contacts?filterBy=firstName:John;email:john@example.com&sortBy=createdAt=desc&pageSize=20&pageToken=Xde34567890
      tags:
        - v1/contacts
      security:
        - OAuth2:
            - read:contact
        - ApiKeyAuth:
            - read:contact
      parameters:
        - in: query
          name: filterBy
          required: false
          schema:
            type: string
        - in: query
          name: searchBy
          required: false
          schema:
            type: string
        - in: query
          name: sortBy
          required: false
          schema:
            type: string
        - in: query
          name: page
          required: false
          schema:
            format: double
            type: number
        - in: query
          name: pageSize
          required: false
          schema:
            format: double
            type: number
        - in: query
          name: pageToken
          required: false
          schema:
            type: string
    post:
      operationId: CreateContact
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactCreateResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Create a new contact.


        Creates a new contact. Custom fields and addresses can be included in
        the request body.


        **Note:** The `phone` and `email` fields on the Contact object are
        legacy and will be removed in the future. Use the `addresses` array for
        all phone numbers and email addresses.


        **Example usage:**

        POST /api/v1/contacts

        {
          "firstName": "Jane",
          "lastName": "Doe",
          "customFields": { "source": "web" },
          "addresses": [ { "address": "+56912345678", "channelType": "PHONE" } ]
        }
      tags:
        - v1/contacts
      security:
        - OAuth2:
            - create:contact
        - ApiKeyAuth:
            - create:contact
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactCreateBodyParams'
  /api/v1/contacts/{id}:
    get:
      operationId: GetContact
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactGetResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Get a contact by ID.


        Retrieves a single contact by its unique identifier, including all
        custom fields and addresses.


        **Note:** The `phone` and `email` fields on the Contact object are
        legacy and will be removed in the future. Use the `addresses` array for
        all phone numbers and email addresses.
      tags:
        - v1/contacts
      security:
        - OAuth2:
            - read:contact
        - ApiKeyAuth:
            - read:contact
      parameters:
        - in: path
          name: id
          required: true
          schema:
            format: double
            type: number
    put:
      operationId: UpdateContact
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactUpdateResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Update an existing contact.


        Updates the details of an existing contact, including custom fields and
        addresses. Only fields provided in the request body will be updated.


        **Note:** The `phone` and `email` fields on the Contact object are
        legacy and will be removed in the future. Use the `addresses` array for
        all phone numbers and email addresses.


        **Example usage:**

        PUT /api/v1/contacts/123

        {
          "firstName": "Janet",
          "customFields": { "priority": "high" }
        }
      tags:
        - v1/contacts
      security:
        - OAuth2:
            - update:contact
        - ApiKeyAuth:
            - update:contact
      parameters:
        - in: path
          name: id
          required: true
          schema:
            format: double
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactUpdateBodyParams'
    delete:
      operationId: DeleteContact
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactDeleteResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Delete a contact by ID.


        Permanently deletes a contact and all associated custom fields and
        addresses.
      tags:
        - v1/contacts
      security:
        - OAuth2:
            - delete:contact
        - ApiKeyAuth:
            - delete:contact
      parameters:
        - in: path
          name: id
          required: true
          schema:
            format: double
            type: number
  /api/v1/contacts/search:
    post:
      operationId: SearchContacts
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/SearcherDocumentSearchResponse_ContactDocument_
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Search contacts using advanced querying, sorting, search and pagination.


        Performs a full search across all contacts. Supports advanced search
        parameters, sorting and pagination.


        **Note:**

        - This endpoint may be rate limited to ensure system stability.

        - The `phone` and `email` fields on the Contact object are legacy and
        may be removed in the future. Use the `addresses` array for all phone
        numbers and email addresses.


        **Example usage:**

        POST /api/v1/contacts/search

        {
          "filters": [
            {
              "field": "addresses.address",
              "operator": "eq",
              "value": "+56912345678"
            },
            {
              "field": "addresses.address",
              "operator": "contains",
              "value": "example.com"
            }
          ],
          "sort": [
            {
              "field": "createdAt",
              "direction": "desc"
            }
          ],
          "size": 20,
          "pageToken": "Xde34567890",
          "includeTotalCount": "true"
        }
      tags:
        - v1/contacts
      security:
        - OAuth2:
            - read:contact
        - ApiKeyAuth:
            - read:contact
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearcherDocumentSearchBodyParams'
  /api/v1/messaging/messages/{messageId}:
    get:
      operationId: GetMessage
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageGetResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Get a message by ID.


        This endpoint allows you to retrieve a specific message using its unique
        identifier.

        The response includes all message details including content,
        sender/recipient info,

        signed attachments, and metadata.
      tags:
        - v1/messaging/messages
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - read:message
        - OAuth2:
            - read:message
      parameters:
        - in: path
          name: messageId
          required: true
          schema:
            type: string
  /api/v1/messaging/whatsapp/messages/templates:
    post:
      operationId: CreateTemplateMessage
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhatsAppTemplateMessageCreateResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Send a WhatsApp template message.


        **Note:** You must use either 'variables' OR 'components', but not both:

        - Use 'variables' for simple cases with only text variables in the body
        component

        - Use 'components' for full functionality including images, documents,
        currency, headers, and buttons


        **Important:** While the API supports all WhatsApp template components,
        templates with some components

        (like images, documents, currency) are not yet supported using the
        LlamadaPro UI.


        Phone numbers must be in E.164 format (e.g. +14155552671)
      tags:
        - v1/messaging/whatsapp/messages
      security:
        - ApiKeyAuth:
            - create:message
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WhatsAppTemplateMessageCreateBodyParams'
  /api/v1/messaging/whatsapp/messages:
    post:
      operationId: CreateMessage
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhatsAppMessageCreateResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Send a WhatsApp free form message.


        Supports sending various types of messages including text, images,
        documents, etc.

        For media messages, provide a fileId from the files service.


        Phone numbers must be in E.164 format (e.g. +14155552671)
      tags:
        - v1/messaging/whatsapp/messages
      security:
        - ApiKeyAuth:
            - create:message
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/V2WhatsAppMessageCreateBodyParams'
  /api/v1/messaging/whatsapp/messages/media:
    post:
      operationId: UploadMedia
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhatsAppMediaUploadResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Upload media to WhatsApp Business API.


        Supports two modes:

        1. File ID mode: Upload existing file from files service via `fileId`

        2. Direct upload mode: Upload raw file data via `fileName`,
        `contentType`, and `content`


        Phone numbers must be in E.164 format (e.g. +14155552671)
      tags:
        - v1/messaging/whatsapp/messages
      security:
        - ApiKeyAuth:
            - create:message
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WhatsAppMediaUploadBodyParams'
  /api/v1/custom-fields/definitions/{definitionId}/options:
    get:
      operationId: GetCustomFieldListOptions
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldListOptionListResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: List options for a custom field definition with sorting and pagination.
      tags:
        - v1/custom-fields/list-options
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - read:crm-custom-field
      parameters:
        - in: path
          name: definitionId
          required: true
          schema:
            format: double
            type: number
        - in: query
          name: filterBy
          required: false
          schema:
            type: string
        - in: query
          name: searchBy
          required: false
          schema:
            type: string
        - in: query
          name: sortBy
          required: false
          schema:
            type: string
        - in: query
          name: page
          required: false
          schema:
            format: double
            type: number
        - in: query
          name: pageSize
          required: false
          schema:
            format: double
            type: number
        - in: query
          name: pageToken
          required: false
          schema:
            type: string
        - in: query
          name: tenantId
          required: false
          schema:
            type: string
    post:
      operationId: CreateCustomFieldListOption
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldListOptionCreateResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: Create a new option for a custom field definition.
      tags:
        - v1/custom-fields/list-options
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - create:crm-custom-field
      parameters:
        - in: path
          name: definitionId
          required: true
          schema:
            format: double
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomFieldListOptionCreateBodyParams'
  /api/v1/custom-fields/definitions/{definitionId}/options/{optionId}:
    get:
      operationId: GetCustomFieldListOption
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldListOptionGetResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: Get a specific option by ID, including its properties.
      tags:
        - v1/custom-fields/list-options
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - read:crm-custom-field
      parameters:
        - in: path
          name: definitionId
          required: true
          schema:
            format: double
            type: number
        - in: path
          name: optionId
          required: true
          schema:
            format: double
            type: number
    put:
      operationId: UpdateCustomFieldListOption
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldListOptionUpdateResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: Update an option's display properties while preserving its other values.
      tags:
        - v1/custom-fields/list-options
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - update:crm-custom-field
      parameters:
        - in: path
          name: definitionId
          required: true
          schema:
            format: double
            type: number
        - in: path
          name: optionId
          required: true
          schema:
            format: double
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomFieldListOptionUpdateBodyParams'
    delete:
      operationId: DeleteCustomFieldListOption
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldListOptionDeleteResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: |-
        Delete an option from a custom field definition.
        Warning: Affects existing records using this option.
      tags:
        - v1/custom-fields/list-options
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - delete:crm-custom-field
      parameters:
        - in: path
          name: definitionId
          required: true
          schema:
            format: double
            type: number
        - in: path
          name: optionId
          required: true
          schema:
            format: double
            type: number
  /api/v1/custom-fields/definitions:
    get:
      operationId: GetCustomFieldDefinitions
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldDefinitionListResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: |-
        List custom field definitions with support for filtering by entity type,
        sorting, and pagination.
      tags:
        - v1/custom-fields/definitions
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - read:crm-custom-field
      parameters:
        - in: query
          name: filterBy
          required: false
          schema:
            type: string
        - in: query
          name: searchBy
          required: false
          schema:
            type: string
        - in: query
          name: sortBy
          required: false
          schema:
            type: string
        - in: query
          name: page
          required: false
          schema:
            format: double
            type: number
        - in: query
          name: pageSize
          required: false
          schema:
            format: double
            type: number
        - in: query
          name: pageToken
          required: false
          schema:
            type: string
        - in: query
          name: tenantId
          required: false
          schema:
            type: string
    post:
      operationId: CreateCustomFieldDefinition
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldDefinitionCreateResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: Create a new custom field definition with specified type.
      tags:
        - v1/custom-fields/definitions
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - create:crm-custom-field
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomFieldDefinitionCreateBodyParams'
  /api/v1/custom-fields/definitions/{id}:
    get:
      operationId: GetCustomFieldDefinition
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldDefinitionGetResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: Get a custom field definition by ID, including its properties.
      tags:
        - v1/custom-fields/definitions
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - read:crm-custom-field
      parameters:
        - in: path
          name: id
          required: true
          schema:
            format: double
            type: number
    put:
      operationId: UpdateCustomFieldDefinition
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldDefinitionUpdateResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Update a custom field definition's properties while preserving existing
        data.
      tags:
        - v1/custom-fields/definitions
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - update:crm-custom-field
      parameters:
        - in: path
          name: id
          required: true
          schema:
            format: double
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomFieldDefinitionUpdateBodyParams'
    delete:
      operationId: DeleteCustomFieldDefinition
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomFieldDefinitionDeleteResponse'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '409':
          description: >-
            Cannot delete definition with associated values (use force=true to
            override)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      description: >-
        Delete a custom field definition. If force=true, deletes all associated
        values.

        This action is permanent and affects all entities using this field.
      tags:
        - v1/custom-fields/definitions
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - delete:crm-custom-field
      parameters:
        - in: path
          name: id
          required: true
          schema:
            format: double
            type: number
        - in: query
          name: force
          required: false
          schema:
            type: boolean
  /api/v1/calls/start/bridge:
    post:
      operationId: StartBridgeCall
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Call'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      tags:
        - v1/calls
      security:
        - ApiKeyAuth:
            - create:call
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewBridgeCall'
  /api/v1/calls/start/agent:
    post:
      operationId: StartAgentCall
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Call'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      tags:
        - v1/calls
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - create:call
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewAgentCall'
  /api/v1/calls:
    post:
      operationId: CreateCall
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Call'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      tags:
        - v1/calls
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - create:call
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewCallFromProvider'
  /api/v1/calls/{id}:
    get:
      operationId: GetCall
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Call'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      tags:
        - v1/calls
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - read:call
      parameters: []
  /api/v1/calls/{callId}/transcriptions:
    get:
      operationId: GetCallTranscription
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transcription'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      tags:
        - v1/calls
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - read:transcription
      parameters:
        - in: path
          name: callId
          required: true
          schema:
            format: double
            type: number
  /api/v1/calls/{callId}/recordings:
    get:
      operationId: GetCallRecording
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Recording'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonErrorResponse'
      tags:
        - v1/calls
      security:
        - BasicAuth: []
        - ApiKeyAuth:
            - read:recording
      parameters:
        - in: path
          name: callId
          required: true
          schema:
            format: double
            type: number
servers:
  - url: https://api.llamadapro.app
    description: API LlamadaPro
