openapi: 3.0.0
info:
  version: 1.0.0
  title: Yumeru API
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas: {}
  parameters: {}
paths:
  /:
    get:
      tags:
        - Index
      responses:
        '200':
          description: Tasks API Index
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
                example:
                  message: Tasks API
  /health:
    get:
      tags:
        - Health
      responses:
        '200':
          description: The health status
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - ok
                required:
                  - status
  /usage/{organizationId}:
    get:
      summary: Get usage stats for an organization
      description: Get usage stats for a specific organization
      security:
        - BearerAuth: []
      tags:
        - Usage
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
      responses:
        '200':
          description: Organization's usage stats
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      organizationId:
                        type: string
                      month:
                        type: number
                      year:
                        type: number
                      contactsEnriched:
                        type: number
                      contactsLimit:
                        type: number
                      phoneNumbersUsed:
                        type: number
                      phoneNumbersLimit:
                        type: number
                      concurrentCallsLimit:
                        type: number
                        nullable: true
                      monthlyMinutesUsed:
                        type: number
                      monthlyMinutesLimit:
                        type: number
                      dailyMinutesLimit:
                        type: number
                      resetDate:
                        type: string
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                    required:
                      - id
                      - organizationId
                      - month
                      - year
                      - contactsEnriched
                      - contactsLimit
                      - phoneNumbersUsed
                      - phoneNumbersLimit
                      - concurrentCallsLimit
                      - monthlyMinutesUsed
                      - monthlyMinutesLimit
                      - dailyMinutesLimit
                      - resetDate
                      - createdAt
                      - updatedAt
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      organizationId:
                        type: string
                      month:
                        type: number
                      year:
                        type: number
                      contactsEnriched:
                        type: number
                      contactsLimit:
                        type: number
                      phoneNumbersUsed:
                        type: number
                      phoneNumbersLimit:
                        type: number
                      concurrentCallsLimit:
                        type: number
                        nullable: true
                      monthlyMinutesUsed:
                        type: number
                      monthlyMinutesLimit:
                        type: number
                      dailyMinutesLimit:
                        type: number
                      resetDate:
                        type: string
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                    required:
                      - id
                      - organizationId
                      - month
                      - year
                      - contactsEnriched
                      - contactsLimit
                      - phoneNumbersUsed
                      - phoneNumbersLimit
                      - concurrentCallsLimit
                      - monthlyMinutesUsed
                      - monthlyMinutesLimit
                      - dailyMinutesLimit
                      - resetDate
                      - createdAt
                      - updatedAt
        '403':
          description: User doesn't have access to this organization
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      organizationId:
                        type: string
                      month:
                        type: number
                      year:
                        type: number
                      contactsEnriched:
                        type: number
                      contactsLimit:
                        type: number
                      phoneNumbersUsed:
                        type: number
                      phoneNumbersLimit:
                        type: number
                      concurrentCallsLimit:
                        type: number
                        nullable: true
                      monthlyMinutesUsed:
                        type: number
                      monthlyMinutesLimit:
                        type: number
                      dailyMinutesLimit:
                        type: number
                      resetDate:
                        type: string
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                    required:
                      - id
                      - organizationId
                      - month
                      - year
                      - contactsEnriched
                      - contactsLimit
                      - phoneNumbersUsed
                      - phoneNumbersLimit
                      - concurrentCallsLimit
                      - monthlyMinutesUsed
                      - monthlyMinutesLimit
                      - dailyMinutesLimit
                      - resetDate
                      - createdAt
                      - updatedAt
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      organizationId:
                        type: string
                      month:
                        type: number
                      year:
                        type: number
                      contactsEnriched:
                        type: number
                      contactsLimit:
                        type: number
                      phoneNumbersUsed:
                        type: number
                      phoneNumbersLimit:
                        type: number
                      concurrentCallsLimit:
                        type: number
                        nullable: true
                      monthlyMinutesUsed:
                        type: number
                      monthlyMinutesLimit:
                        type: number
                      dailyMinutesLimit:
                        type: number
                      resetDate:
                        type: string
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                    required:
                      - id
                      - organizationId
                      - month
                      - year
                      - contactsEnriched
                      - contactsLimit
                      - phoneNumbersUsed
                      - phoneNumbersLimit
                      - concurrentCallsLimit
                      - monthlyMinutesUsed
                      - monthlyMinutesLimit
                      - dailyMinutesLimit
                      - resetDate
                      - createdAt
                      - updatedAt
  /usage/{organizationId}/weekly:
    get:
      summary: Get weekly usage for an organization
      description: Get weekly usage for a specific organization
      security:
        - BearerAuth: []
      tags:
        - Usage
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
      responses:
        '200':
          description: Weekly minutes usage
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                        minutesUsed:
                          type: number
                      required:
                        - date
                        - minutesUsed
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                        minutesUsed:
                          type: number
                      required:
                        - date
                        - minutesUsed
        '403':
          description: User doesn't have access to this organization
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                        minutesUsed:
                          type: number
                      required:
                        - date
                        - minutesUsed
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                        minutesUsed:
                          type: number
                      required:
                        - date
                        - minutesUsed
  /usage/{organizationId}/quotas:
    get:
      summary: Get quota overview for an organization
      description: Get quota overview for a specific organization
      security:
        - BearerAuth: []
      tags:
        - Usage
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
      responses:
        '200':
          description: Usage quotas overview
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      minutes:
                        type: object
                        properties:
                          used:
                            type: number
                          remaining:
                            type: number
                          total:
                            type: number
                          dailyLimit:
                            type: number
                        required:
                          - used
                          - remaining
                          - total
                          - dailyLimit
                      contacts:
                        type: object
                        properties:
                          used:
                            type: number
                          remaining:
                            type: number
                          total:
                            type: number
                        required:
                          - used
                          - remaining
                          - total
                      phoneNumbers:
                        type: object
                        properties:
                          used:
                            type: number
                          remaining:
                            type: number
                          total:
                            type: number
                        required:
                          - used
                          - remaining
                          - total
                      startDate:
                        type: string
                      resetDate:
                        type: string
                    required:
                      - minutes
                      - contacts
                      - phoneNumbers
                      - startDate
                      - resetDate
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      minutes:
                        type: object
                        properties:
                          used:
                            type: number
                          remaining:
                            type: number
                          total:
                            type: number
                          dailyLimit:
                            type: number
                        required:
                          - used
                          - remaining
                          - total
                          - dailyLimit
                      contacts:
                        type: object
                        properties:
                          used:
                            type: number
                          remaining:
                            type: number
                          total:
                            type: number
                        required:
                          - used
                          - remaining
                          - total
                      phoneNumbers:
                        type: object
                        properties:
                          used:
                            type: number
                          remaining:
                            type: number
                          total:
                            type: number
                        required:
                          - used
                          - remaining
                          - total
                      startDate:
                        type: string
                      resetDate:
                        type: string
                    required:
                      - minutes
                      - contacts
                      - phoneNumbers
                      - startDate
                      - resetDate
        '403':
          description: User doesn't have access to this organization
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      minutes:
                        type: object
                        properties:
                          used:
                            type: number
                          remaining:
                            type: number
                          total:
                            type: number
                          dailyLimit:
                            type: number
                        required:
                          - used
                          - remaining
                          - total
                          - dailyLimit
                      contacts:
                        type: object
                        properties:
                          used:
                            type: number
                          remaining:
                            type: number
                          total:
                            type: number
                        required:
                          - used
                          - remaining
                          - total
                      phoneNumbers:
                        type: object
                        properties:
                          used:
                            type: number
                          remaining:
                            type: number
                          total:
                            type: number
                        required:
                          - used
                          - remaining
                          - total
                      startDate:
                        type: string
                      resetDate:
                        type: string
                    required:
                      - minutes
                      - contacts
                      - phoneNumbers
                      - startDate
                      - resetDate
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      minutes:
                        type: object
                        properties:
                          used:
                            type: number
                          remaining:
                            type: number
                          total:
                            type: number
                          dailyLimit:
                            type: number
                        required:
                          - used
                          - remaining
                          - total
                          - dailyLimit
                      contacts:
                        type: object
                        properties:
                          used:
                            type: number
                          remaining:
                            type: number
                          total:
                            type: number
                        required:
                          - used
                          - remaining
                          - total
                      phoneNumbers:
                        type: object
                        properties:
                          used:
                            type: number
                          remaining:
                            type: number
                          total:
                            type: number
                        required:
                          - used
                          - remaining
                          - total
                      startDate:
                        type: string
                      resetDate:
                        type: string
                    required:
                      - minutes
                      - contacts
                      - phoneNumbers
                      - startDate
                      - resetDate
  /organizations/{organizationId}/agents:
    post:
      tags:
        - Agents
      summary: Create a new agent
      description: Create a new agent for a specific organization
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                voiceId:
                  type: string
                language:
                  type: string
                  enum:
                    - en
                    - es
                metadata:
                  type: object
                  properties:
                    firstMessage:
                      type: string
                    llmModel:
                      type: string
                      enum:
                        - gpt-4o-mini
                        - gpt-4o
                        - claude-3.7-sonnet
                        - claude-3.5-haiku
                    modelTemperature:
                      type: number
                    voiceSpeed:
                      type: number
                    voiceTemperature:
                      type: number
                    interruptionSensitivity:
                      type: number
                    maxCallDurationMs:
                      type: number
                    endCallAfterSilenceMs:
                      type: number
                    enableTranscriptionFormatting:
                      type: boolean
                    enableVoicemailDetection:
                      type: boolean
                    voicemailMessage:
                      type: string
                    ambientSound:
                      type: string
                      enum:
                        - none
                        - coffee-shop
                        - convention-hall
                        - summer-outdoor
                        - mountain-outdoor
                        - static-noise
                        - call-center
                    pronunciationDictionary:
                      type: array
                      items:
                        type: object
                        properties:
                          word:
                            type: string
                          pronunciation:
                            type: string
                          alphabet:
                            type: string
                            enum:
                              - ipa
                              - cmu
                          phoneme:
                            type: string
                        required:
                          - word
                          - pronunciation
                          - alphabet
                          - phoneme
                    calendarConfig:
                      type: object
                      nullable: true
                      properties:
                        apiKey:
                          type: string
                        eventTypeId:
                          type: number
                      required:
                        - apiKey
                        - eventTypeId
                    transferNumber:
                      type: string
                      nullable: true
                    enableIvr:
                      type: boolean
                    enableEndCall:
                      type: boolean
                    postCallAnalysisData:
                      type: array
                      items:
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - boolean
                              - string
                              - number
                          name:
                            type: string
                          description:
                            type: string
                        required:
                          - type
                          - name
                          - description
                    enableBackchanneling:
                      type: boolean
                    backchannelMessages:
                      type: array
                      items:
                        type: object
                        properties:
                          message:
                            type: string
                          minSilenceMs:
                            type: number
                        required:
                          - message
                          - minSilenceMs
                context:
                  type: string
                templateType:
                  type: string
                  enum:
                    - book_meeting
                    - warm_up
                    - qualify
                    - blank
                valuePropositions:
                  type: array
                  items:
                    type: object
                    properties:
                      value:
                        type: string
                    required:
                      - value
                callToActions:
                  type: array
                  items:
                    type: object
                    properties:
                      callToAction:
                        type: string
                    required:
                      - callToAction
                questions:
                  type: array
                  items:
                    type: object
                    properties:
                      question:
                        type: string
                      purpose:
                        type: string
                    required:
                      - question
                objections:
                  type: array
                  items:
                    type: object
                    properties:
                      objection:
                        type: string
                      response:
                        type: string
                    required:
                      - objection
                      - response
                caseStudies:
                  type: array
                  items:
                    type: object
                    properties:
                      description:
                        type: string
                      results:
                        type: string
                    required:
                      - description
                      - results
              required:
                - name
                - voiceId
                - language
                - templateType
      responses:
        '201':
          description: Agent created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      agent:
                        type: object
                        properties:
                          id:
                            type: number
                          name:
                            type: string
                          voiceId:
                            type: string
                          language:
                            type: string
                            enum:
                              - en
                              - es
                          metadata:
                            type: object
                            additionalProperties:
                              nullable: true
                          context:
                            type: string
                          templateType:
                            type: string
                            enum:
                              - book_meeting
                              - warm_up
                              - qualify
                              - blank
                          status:
                            type: string
                            enum:
                              - draft
                              - active
                              - inactive
                              - archived
                          createdAt:
                            type: string
                          updatedAt:
                            type: string
                        required:
                          - id
                          - name
                          - voiceId
                          - language
                          - templateType
                          - status
                          - createdAt
                          - updatedAt
                      valuePropositions:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            value:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - value
                            - createdAt
                            - updatedAt
                      callToActions:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            callToAction:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - callToAction
                            - createdAt
                            - updatedAt
                      questions:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            question:
                              type: string
                            purpose:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - question
                            - createdAt
                            - updatedAt
                      objections:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            objection:
                              type: string
                            response:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - objection
                            - response
                            - createdAt
                            - updatedAt
                      caseStudies:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            description:
                              type: string
                            results:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - description
                            - results
                            - createdAt
                            - updatedAt
                    required:
                      - agent
                      - valuePropositions
                      - callToActions
                      - questions
                      - objections
                      - caseStudies
                required:
                  - success
                  - data
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: User doesn't have access to this organization
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /agents/{agentId}:
    get:
      tags:
        - Agents
      summary: Get agent details
      description: Get details for a specific agent
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: agentId
          in: path
      responses:
        '200':
          description: Agent details retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      agent:
                        type: object
                        properties:
                          id:
                            type: number
                          name:
                            type: string
                          voiceId:
                            type: string
                          language:
                            type: string
                            enum:
                              - en
                              - es
                          metadata:
                            type: object
                            additionalProperties:
                              nullable: true
                          context:
                            type: string
                          templateType:
                            type: string
                            enum:
                              - book_meeting
                              - warm_up
                              - qualify
                              - blank
                          status:
                            type: string
                            enum:
                              - draft
                              - active
                              - inactive
                              - archived
                          createdAt:
                            type: string
                          updatedAt:
                            type: string
                        required:
                          - id
                          - name
                          - voiceId
                          - language
                          - templateType
                          - status
                          - createdAt
                          - updatedAt
                      valuePropositions:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            value:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - value
                            - createdAt
                            - updatedAt
                      callToActions:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            callToAction:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - callToAction
                            - createdAt
                            - updatedAt
                      questions:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            question:
                              type: string
                            purpose:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - question
                            - createdAt
                            - updatedAt
                      objections:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            objection:
                              type: string
                            response:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - objection
                            - response
                            - createdAt
                            - updatedAt
                      caseStudies:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            description:
                              type: string
                            results:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - description
                            - results
                            - createdAt
                            - updatedAt
                    required:
                      - agent
                      - valuePropositions
                      - callToActions
                      - questions
                      - objections
                      - caseStudies
                required:
                  - success
                  - data
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: User doesn't have access to this organization
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Agent not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
    put:
      tags:
        - Agents
      summary: Update agent details
      description: Update the details of a specific agent
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: agentId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                voiceId:
                  type: string
                language:
                  type: string
                  enum:
                    - en
                    - es
                metadata:
                  type: object
                  properties:
                    firstMessage:
                      type: string
                    llmModel:
                      type: string
                      enum:
                        - gpt-4o-mini
                        - gpt-4o
                        - claude-3.7-sonnet
                        - claude-3.5-haiku
                    modelTemperature:
                      type: number
                    voiceSpeed:
                      type: number
                    voiceTemperature:
                      type: number
                    interruptionSensitivity:
                      type: number
                    maxCallDurationMs:
                      type: number
                    endCallAfterSilenceMs:
                      type: number
                    enableTranscriptionFormatting:
                      type: boolean
                    enableVoicemailDetection:
                      type: boolean
                    voicemailMessage:
                      type: string
                    ambientSound:
                      type: string
                      enum:
                        - none
                        - coffee-shop
                        - convention-hall
                        - summer-outdoor
                        - mountain-outdoor
                        - static-noise
                        - call-center
                    pronunciationDictionary:
                      type: array
                      items:
                        type: object
                        properties:
                          word:
                            type: string
                          pronunciation:
                            type: string
                          alphabet:
                            type: string
                            enum:
                              - ipa
                              - cmu
                          phoneme:
                            type: string
                        required:
                          - word
                          - pronunciation
                          - alphabet
                          - phoneme
                    calendarConfig:
                      type: object
                      nullable: true
                      properties:
                        apiKey:
                          type: string
                        eventTypeId:
                          type: number
                      required:
                        - apiKey
                        - eventTypeId
                    transferNumber:
                      type: string
                      nullable: true
                    enableIvr:
                      type: boolean
                    enableEndCall:
                      type: boolean
                    postCallAnalysisData:
                      type: array
                      items:
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - boolean
                              - string
                              - number
                          name:
                            type: string
                          description:
                            type: string
                        required:
                          - type
                          - name
                          - description
                    enableBackchanneling:
                      type: boolean
                    backchannelMessages:
                      type: array
                      items:
                        type: object
                        properties:
                          message:
                            type: string
                          minSilenceMs:
                            type: number
                        required:
                          - message
                          - minSilenceMs
                context:
                  type: string
                templateType:
                  type: string
                  enum:
                    - book_meeting
                    - warm_up
                    - qualify
                    - blank
                valuePropositions:
                  type: array
                  items:
                    type: object
                    properties:
                      value:
                        type: string
                    required:
                      - value
                callToActions:
                  type: array
                  items:
                    type: object
                    properties:
                      callToAction:
                        type: string
                    required:
                      - callToAction
                questions:
                  type: array
                  items:
                    type: object
                    properties:
                      question:
                        type: string
                      purpose:
                        type: string
                    required:
                      - question
                objections:
                  type: array
                  items:
                    type: object
                    properties:
                      objection:
                        type: string
                      response:
                        type: string
                    required:
                      - objection
                      - response
                caseStudies:
                  type: array
                  items:
                    type: object
                    properties:
                      description:
                        type: string
                      results:
                        type: string
                    required:
                      - description
                      - results
      responses:
        '200':
          description: Agent updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      agent:
                        type: object
                        properties:
                          id:
                            type: number
                          name:
                            type: string
                          voiceId:
                            type: string
                          language:
                            type: string
                            enum:
                              - en
                              - es
                          metadata:
                            type: object
                            additionalProperties:
                              nullable: true
                          context:
                            type: string
                          templateType:
                            type: string
                            enum:
                              - book_meeting
                              - warm_up
                              - qualify
                              - blank
                          status:
                            type: string
                            enum:
                              - draft
                              - active
                              - inactive
                              - archived
                          createdAt:
                            type: string
                          updatedAt:
                            type: string
                        required:
                          - id
                          - name
                          - voiceId
                          - language
                          - templateType
                          - status
                          - createdAt
                          - updatedAt
                      valuePropositions:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            value:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - value
                            - createdAt
                            - updatedAt
                      callToActions:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            callToAction:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - callToAction
                            - createdAt
                            - updatedAt
                      questions:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            question:
                              type: string
                            purpose:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - question
                            - createdAt
                            - updatedAt
                      objections:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            objection:
                              type: string
                            response:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - objection
                            - response
                            - createdAt
                            - updatedAt
                      caseStudies:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: number
                            description:
                              type: string
                            results:
                              type: string
                            createdAt:
                              type: string
                            updatedAt:
                              type: string
                          required:
                            - id
                            - description
                            - results
                            - createdAt
                            - updatedAt
                    required:
                      - agent
                      - valuePropositions
                      - callToActions
                      - questions
                      - objections
                      - caseStudies
                required:
                  - success
                  - data
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: User doesn't have access to this organization
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Agent not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
    delete:
      tags:
        - Agents
      summary: Delete an agent
      description: Delete a specific agent
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: agentId
          in: path
      responses:
        '200':
          description: Agent deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                required:
                  - success
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Agent not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /agents:
    get:
      tags:
        - Agents
      summary: List agents
      description: List all agents for a specific organization
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: query
        - schema:
            type: string
            enum:
              - draft
              - active
              - inactive
              - archived
          required: false
          name: status
          in: query
        - schema:
            type: number
            minimum: 1
          required: false
          name: page
          in: query
        - schema:
            type: number
            minimum: 1
            maximum: 100
          required: false
          name: limit
          in: query
      responses:
        '200':
          description: Agents retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                        name:
                          type: string
                        voiceId:
                          type: string
                        language:
                          type: string
                          enum:
                            - en
                            - es
                        metadata:
                          type: object
                          additionalProperties:
                            nullable: true
                        context:
                          type: string
                        templateType:
                          type: string
                          enum:
                            - book_meeting
                            - warm_up
                            - qualify
                            - blank
                        status:
                          type: string
                          enum:
                            - draft
                            - active
                            - inactive
                            - archived
                        createdAt:
                          type: string
                        updatedAt:
                          type: string
                      required:
                        - id
                        - name
                        - voiceId
                        - language
                        - templateType
                        - status
                        - createdAt
                        - updatedAt
                  total:
                    type: number
                  page:
                    type: number
                  totalPages:
                    type: number
                required:
                  - success
                  - data
                  - total
                  - page
                  - totalPages
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: User doesn't have access to this organization
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /agents/{agentId}/web-simulate:
    post:
      tags:
        - Agents
      summary: Web simulate an agent
      description: Web simulate a specific agent
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: agentId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                dynamicVariables:
                  type: object
                  additionalProperties:
                    type: string
      responses:
        '200':
          description: Web simulation connection details
          content:
            application/json:
              schema:
                type: object
                properties:
                  accessToken:
                    type: string
                  callId:
                    type: string
                  prompt:
                    type: string
                required:
                  - accessToken
                  - callId
                  - prompt
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: User doesn't have access to this organization
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Agent not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /organizations/{organizationId}/agents/{agentId}/demo:
    post:
      tags:
        - Agents
      summary: Create a new demo link
      description: Create a new demo link for a specific agent
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
        - schema:
            type: string
          required: true
          name: agentId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                expiresAt:
                  type: string
                  format: date-time
                maxUses:
                  type: number
                  minimum: 1
      responses:
        '200':
          description: Demo link created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      path:
                        type: string
                      expiresAt:
                        type: string
                        format: date-time
                      maxUses:
                        type: number
                      usageCount:
                        type: number
                    required:
                      - id
                      - path
                      - usageCount
                required:
                  - success
                  - data
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: User doesn't have access to this organization
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Agent not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /agents/{agentId}/archive:
    post:
      tags:
        - Agents
      summary: Archive an agent
      description: Archive a specific agent
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: agentId
          in: path
      responses:
        '200':
          description: Agent archived successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      organizationId:
                        type: string
                      name:
                        type: string
                      voiceId:
                        type: string
                      language:
                        type: string
                        enum:
                          - en
                          - es
                      metadata:
                        type: object
                        properties:
                          firstMessage:
                            type: string
                          llmModel:
                            type: string
                            enum:
                              - gpt-4o-mini
                              - gpt-4o
                              - claude-3.7-sonnet
                              - claude-3.5-haiku
                          modelTemperature:
                            type: number
                          voiceSpeed:
                            type: number
                          voiceTemperature:
                            type: number
                          interruptionSensitivity:
                            type: number
                          maxCallDurationMs:
                            type: number
                          endCallAfterSilenceMs:
                            type: number
                          enableTranscriptionFormatting:
                            type: boolean
                          enableVoicemailDetection:
                            type: boolean
                          voicemailMessage:
                            type: string
                          ambientSound:
                            type: string
                            enum:
                              - none
                              - coffee-shop
                              - convention-hall
                              - summer-outdoor
                              - mountain-outdoor
                              - static-noise
                              - call-center
                          pronunciationDictionary:
                            type: array
                            items:
                              type: object
                              properties:
                                word:
                                  type: string
                                pronunciation:
                                  type: string
                                alphabet:
                                  type: string
                                  enum:
                                    - ipa
                                    - cmu
                                phoneme:
                                  type: string
                              required:
                                - word
                                - pronunciation
                                - alphabet
                                - phoneme
                          calendarConfig:
                            type: object
                            nullable: true
                            properties:
                              apiKey:
                                type: string
                              eventTypeId:
                                type: number
                            required:
                              - apiKey
                              - eventTypeId
                          transferNumber:
                            type: string
                            nullable: true
                          enableIvr:
                            type: boolean
                          enableEndCall:
                            type: boolean
                          postCallAnalysisData:
                            type: array
                            items:
                              type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - boolean
                                    - string
                                    - number
                                name:
                                  type: string
                                description:
                                  type: string
                              required:
                                - type
                                - name
                                - description
                          enableBackchanneling:
                            type: boolean
                          backchannelMessages:
                            type: array
                            items:
                              type: object
                              properties:
                                message:
                                  type: string
                                minSilenceMs:
                                  type: number
                              required:
                                - message
                                - minSilenceMs
                      context:
                        type: string
                      templateType:
                        type: string
                        enum:
                          - book_meeting
                          - warm_up
                          - qualify
                          - blank
                      status:
                        type: string
                        enum:
                          - draft
                          - active
                          - inactive
                          - archived
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                    required:
                      - id
                      - organizationId
                      - name
                      - voiceId
                      - language
                      - templateType
                      - status
                      - createdAt
                      - updatedAt
                required:
                  - success
                  - data
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Agent not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /organizations/{organizationId}/campaigns:
    post:
      tags:
        - Campaigns
      summary: Create a new campaign
      description: Create a new campaign for a specific organization
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                agentId:
                  type: number
                description:
                  type: string
                timezone:
                  type: string
                fromNumber:
                  type: string
                retryAttempts:
                  type: number
                  minimum: 0
                  maximum: 3
                maxConcurrentCalls:
                  type: number
                  minimum: 1
                maxMinutesPerDay:
                  type: number
                  minimum: 1
                executeNewCallEvery:
                  type: number
                  minimum: 1
                  maximum: 60
                workingHours:
                  type: array
                  items:
                    type: object
                    properties:
                      dayOfWeek:
                        type: number
                        minimum: 0
                        maximum: 6
                      startTime:
                        type: string
                        pattern: ^([01]?\d|2[0-3]):[0-5]\d$
                      endTime:
                        type: string
                        pattern: ^([01]?\d|2[0-3]):[0-5]\d$
                      enabled:
                        type: boolean
                    required:
                      - dayOfWeek
              required:
                - name
                - agentId
                - fromNumber
      responses:
        '200':
          description: Campaign created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      name:
                        type: string
                      status:
                        type: string
                        enum:
                          - draft
                          - active
                          - paused
                          - completed
                          - failed
                          - archived
                      workingHours:
                        type: array
                        items:
                          type: object
                          properties:
                            dayOfWeek:
                              type: number
                              minimum: 0
                              maximum: 6
                            startTime:
                              type: string
                              pattern: ^([01]?\d|2[0-3]):[0-5]\d$
                            endTime:
                              type: string
                              pattern: ^([01]?\d|2[0-3]):[0-5]\d$
                            enabled:
                              type: boolean
                          required:
                            - dayOfWeek
                    required:
                      - id
                      - name
                      - status
                      - workingHours
                required:
                  - success
                  - data
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
    get:
      tags:
        - Campaigns
      summary: List campaigns
      description: List all campaigns for a specific organization
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
        - schema:
            type: string
            enum:
              - draft
              - active
              - paused
              - completed
              - failed
              - archived
          required: false
          name: status
          in: query
        - schema:
            type: number
            minimum: 1
          required: false
          name: page
          in: query
        - schema:
            type: number
            minimum: 1
            maximum: 100
          required: false
          name: limit
          in: query
      responses:
        '200':
          description: List of campaigns
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                        name:
                          type: string
                        status:
                          type: string
                          enum:
                            - draft
                            - active
                            - paused
                            - completed
                            - failed
                            - archived
                        totalMinutes:
                          type: number
                        completedContacts:
                          type: number
                        failedContacts:
                          type: number
                        averageCallDuration:
                          type: number
                          nullable: true
                        successRate:
                          type: number
                          nullable: true
                      required:
                        - id
                        - name
                        - status
                        - totalMinutes
                        - completedContacts
                        - failedContacts
                        - averageCallDuration
                        - successRate
                  total:
                    type: number
                  page:
                    type: number
                  totalPages:
                    type: number
                required:
                  - success
                  - data
                  - total
                  - page
                  - totalPages
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /organizations/{organizationId}/campaigns/{campaignId}:
    get:
      tags:
        - Campaigns
      summary: Get campaign details
      description: Get details for a specific campaign
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
        - schema:
            type: string
          required: true
          name: campaignId
          in: path
      responses:
        '200':
          description: Campaign details
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      organizationId:
                        type: string
                      name:
                        type: string
                      description:
                        type: string
                        nullable: true
                      status:
                        type: string
                        enum:
                          - draft
                          - active
                          - paused
                          - completed
                          - failed
                          - archived
                      archived:
                        type: boolean
                      archivedAt:
                        type: string
                        nullable: true
                      deletedByUser:
                        type: boolean
                      deletedAt:
                        type: string
                        nullable: true
                      agentId:
                        type: number
                      fromNumber:
                        type: string
                      timezone:
                        type: string
                        nullable: true
                      retryAttempts:
                        type: number
                        nullable: true
                      maxConcurrentCalls:
                        type: number
                        nullable: true
                      maxMinutesPerDay:
                        type: number
                        nullable: true
                      executeNewCallEvery:
                        type: number
                        nullable: true
                      workingHours:
                        type: array
                        items:
                          type: object
                          properties:
                            dayOfWeek:
                              type: number
                              minimum: 0
                              maximum: 6
                            startTime:
                              type: string
                              pattern: ^([01]?\d|2[0-3]):[0-5]\d$
                            endTime:
                              type: string
                              pattern: ^([01]?\d|2[0-3]):[0-5]\d$
                            enabled:
                              type: boolean
                          required:
                            - dayOfWeek
                      totalMinutes:
                        type: number
                      completedContacts:
                        type: number
                      failedContacts:
                        type: number
                      averageCallDuration:
                        type: number
                        nullable: true
                      successRate:
                        type: number
                        nullable: true
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                    required:
                      - id
                      - organizationId
                      - name
                      - description
                      - status
                      - archived
                      - archivedAt
                      - deletedByUser
                      - deletedAt
                      - agentId
                      - fromNumber
                      - timezone
                      - retryAttempts
                      - maxConcurrentCalls
                      - maxMinutesPerDay
                      - executeNewCallEvery
                      - workingHours
                      - totalMinutes
                      - completedContacts
                      - failedContacts
                      - averageCallDuration
                      - successRate
                      - createdAt
                      - updatedAt
                required:
                  - success
                  - data
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Campaign not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
    patch:
      tags:
        - Campaigns
      summary: Update campaign details
      description: Update the details of a specific campaign
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
        - schema:
            type: string
          required: true
          name: campaignId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                agentId:
                  type: number
                description:
                  type: string
                timezone:
                  type: string
                fromNumber:
                  type: string
                retryAttempts:
                  type: number
                  minimum: 0
                  maximum: 3
                maxConcurrentCalls:
                  type: number
                  minimum: 1
                maxMinutesPerDay:
                  type: number
                  minimum: 1
                  maximum: 1440
                executeNewCallEvery:
                  type: number
                  minimum: 1
                  maximum: 60
                workingHours:
                  type: array
                  items:
                    type: object
                    properties:
                      dayOfWeek:
                        type: number
                        minimum: 0
                        maximum: 6
                      startTime:
                        type: string
                        pattern: ^([01]?\d|2[0-3]):[0-5]\d$
                      endTime:
                        type: string
                        pattern: ^([01]?\d|2[0-3]):[0-5]\d$
                      enabled:
                        type: boolean
                    required:
                      - dayOfWeek
      responses:
        '200':
          description: Campaign updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      organizationId:
                        type: string
                      name:
                        type: string
                      description:
                        type: string
                        nullable: true
                      status:
                        type: string
                        enum:
                          - draft
                          - active
                          - paused
                          - completed
                          - failed
                          - archived
                      agentId:
                        type: number
                      fromNumber:
                        type: string
                      timezone:
                        type: string
                        nullable: true
                      retryAttempts:
                        type: number
                        nullable: true
                      maxConcurrentCalls:
                        type: number
                        nullable: true
                      maxMinutesPerDay:
                        type: number
                        nullable: true
                      executeNewCallEvery:
                        type: number
                        nullable: true
                      workingHours:
                        type: array
                        items:
                          type: object
                          properties:
                            dayOfWeek:
                              type: number
                              minimum: 0
                              maximum: 6
                            startTime:
                              type: string
                              pattern: ^([01]?\d|2[0-3]):[0-5]\d$
                            endTime:
                              type: string
                              pattern: ^([01]?\d|2[0-3]):[0-5]\d$
                            enabled:
                              type: boolean
                          required:
                            - dayOfWeek
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                    required:
                      - id
                      - organizationId
                      - name
                      - description
                      - status
                      - agentId
                      - fromNumber
                      - timezone
                      - retryAttempts
                      - maxConcurrentCalls
                      - maxMinutesPerDay
                      - executeNewCallEvery
                      - workingHours
                      - createdAt
                      - updatedAt
                required:
                  - success
                  - data
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Campaign not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
    delete:
      tags:
        - Campaigns
      summary: Delete a campaign
      description: Delete a specific campaign
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
        - schema:
            type: string
          required: true
          name: campaignId
          in: path
      responses:
        '200':
          description: Campaign deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                required:
                  - success
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Campaign not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /organizations/{organizationId}/campaigns/{campaignId}/status:
    post:
      tags:
        - Campaigns
      summary: Update campaign status
      description: Update the status of a specific campaign
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
        - schema:
            type: string
          required: true
          name: campaignId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                action:
                  type: string
                  enum:
                    - start
                    - pause
                    - resume
                    - stop
              required:
                - action
      responses:
        '200':
          description: Campaign status updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      status:
                        type: string
                        enum:
                          - draft
                          - active
                          - paused
                          - completed
                          - failed
                          - archived
                    required:
                      - id
                      - status
                required:
                  - success
                  - data
        '400':
          description: Invalid action
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Campaign not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Failed to update campaign status
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /organizations/{organizationId}/campaigns/{campaignId}/contacts:
    post:
      tags:
        - Campaigns
      summary: Import contacts
      description: Import contacts for a specific campaign
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
        - schema:
            type: string
          required: true
          name: campaignId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                contacts:
                  type: array
                  items:
                    type: object
                    properties:
                      firstName:
                        type: string
                      lastName:
                        type: string
                      fullName:
                        type: string
                      email:
                        type: string
                      phone:
                        type: string
                        pattern: ^\+?[1-9]\d{1,14}$
                      jobTitle:
                        type: string
                      linkedinUrl:
                        type: string
                      company:
                        type: object
                        properties:
                          name:
                            type: string
                          website:
                            type: string
                          industry:
                            type: string
                          size:
                            type: string
                          linkedinUrl:
                            type: string
                        required:
                          - name
                      metadata:
                        type: object
                        additionalProperties:
                          nullable: true
              required:
                - contacts
      responses:
        '200':
          description: Contacts imported successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      imported:
                        type: number
                      failed:
                        type: number
                      errors:
                        type: array
                        items:
                          type: string
                    required:
                      - imported
                      - failed
                      - errors
                required:
                  - success
                  - data
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Campaign not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
    get:
      tags:
        - Campaigns
      summary: Get campaign contacts
      description: Get all contacts for a specific campaign
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
        - schema:
            type: string
          required: true
          name: campaignId
          in: path
        - schema:
            type: string
            enum:
              - pending
              - queued
              - completed
              - failed
              - in_progress
          required: false
          name: status
          in: query
        - schema:
            type: number
            minimum: 1
          required: false
          name: page
          in: query
        - schema:
            type: number
            minimum: 1
            maximum: 100
          required: false
          name: limit
          in: query
      responses:
        '200':
          description: List of campaign contacts
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                        targetId:
                          type: number
                        email:
                          type: string
                          nullable: true
                        firstName:
                          type: string
                          nullable: true
                        lastName:
                          type: string
                          nullable: true
                        phone:
                          type: string
                          nullable: true
                        jobTitle:
                          type: string
                          nullable: true
                        linkedinUrl:
                          type: string
                          nullable: true
                        location:
                          type: string
                          nullable: true
                        seniority:
                          type: string
                          nullable: true
                        role:
                          type: string
                          nullable: true
                        bio:
                          type: string
                          nullable: true
                        enrichmentConfidence:
                          type: number
                          nullable: true
                        status:
                          type: string
                          enum:
                            - pending
                            - queued
                            - completed
                            - failed
                            - in_progress
                            - archived
                        attempts:
                          type: number
                        metadata:
                          type: object
                          nullable: true
                          additionalProperties:
                            nullable: true
                        calls:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              status:
                                type: string
                                enum:
                                  - pending
                                  - queued
                                  - in_progress
                                  - completed
                                  - failed
                              startedAt:
                                type: string
                                nullable: true
                              endedAt:
                                type: string
                                nullable: true
                              recordingUrl:
                                type: string
                                nullable: true
                              durationMs:
                                type: number
                                nullable: true
                              failureReason:
                                type: string
                                nullable: true
                              metadata:
                                type: object
                                properties:
                                  transcripts:
                                    type: array
                                    items:
                                      type: string
                                  postCallAnalysis:
                                    type: object
                                    properties:
                                      isSuccessfulCall:
                                        type: boolean
                            required:
                              - id
                              - status
                              - startedAt
                              - endedAt
                              - recordingUrl
                              - durationMs
                              - failureReason
                        company:
                          type: object
                          nullable: true
                          properties:
                            id:
                              type: number
                            name:
                              type: string
                            website:
                              type: string
                              nullable: true
                            industry:
                              type: string
                              nullable: true
                            size:
                              type: string
                              nullable: true
                            linkedinUrl:
                              type: string
                              nullable: true
                            enriched:
                              type: boolean
                            metadata:
                              type: object
                              properties:
                                enrichmentData:
                                  type: object
                                  properties:
                                    confidence:
                                      type: number
                                    description:
                                      type: string
                                    revenue:
                                      type: string
                                    founded:
                                      type: string
                                    employees:
                                      type: string
                          required:
                            - id
                            - name
                            - website
                            - industry
                            - size
                            - linkedinUrl
                            - enriched
                      required:
                        - id
                        - targetId
                        - email
                        - firstName
                        - lastName
                        - phone
                        - jobTitle
                        - linkedinUrl
                        - location
                        - seniority
                        - role
                        - bio
                        - enrichmentConfidence
                        - status
                        - attempts
                        - metadata
                        - calls
                        - company
                  total:
                    type: number
                  page:
                    type: number
                  totalPages:
                    type: number
                required:
                  - success
                  - data
                  - total
                  - page
                  - totalPages
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Campaign not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /organizations/{organizationId}/campaigns/{campaignId}/calls/{callId}:
    get:
      tags:
        - Campaigns
      summary: Get call details
      description: Get details for a specific call
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
        - schema:
            type: string
          required: true
          name: campaignId
          in: path
        - schema:
            type: string
          required: true
          name: callId
          in: path
      responses:
        '200':
          description: Call details
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      status:
                        type: string
                        enum:
                          - pending
                          - queued
                          - in_progress
                          - completed
                          - failed
                      startedAt:
                        type: string
                        nullable: true
                      endedAt:
                        type: string
                        nullable: true
                      recordingUrl:
                        type: string
                        nullable: true
                      durationMs:
                        type: number
                        nullable: true
                      failureReason:
                        type: string
                        nullable: true
                      disconnectReason:
                        type: string
                        nullable: true
                      metadata:
                        type: object
                        properties:
                          transcripts:
                            type: array
                            items:
                              type: string
                          postCallAnalysis:
                            type: object
                            properties:
                              isSuccessfulCall:
                                type: boolean
                      contact:
                        type: object
                        properties:
                          id:
                            type: number
                          email:
                            type: string
                            nullable: true
                          firstName:
                            type: string
                            nullable: true
                          lastName:
                            type: string
                            nullable: true
                          phone:
                            type: string
                            nullable: true
                          jobTitle:
                            type: string
                            nullable: true
                          linkedinUrl:
                            type: string
                            nullable: true
                          location:
                            type: string
                            nullable: true
                          seniority:
                            type: string
                            nullable: true
                          role:
                            type: string
                            nullable: true
                          bio:
                            type: string
                            nullable: true
                          company:
                            type: object
                            nullable: true
                            properties:
                              id:
                                type: number
                              name:
                                type: string
                              website:
                                type: string
                                nullable: true
                              industry:
                                type: string
                                nullable: true
                              size:
                                type: string
                                nullable: true
                              linkedinUrl:
                                type: string
                                nullable: true
                              enriched:
                                type: boolean
                              metadata:
                                type: object
                                additionalProperties:
                                  nullable: true
                            required:
                              - id
                              - name
                              - website
                              - industry
                              - size
                              - linkedinUrl
                              - enriched
                        required:
                          - id
                          - email
                          - firstName
                          - lastName
                          - phone
                          - jobTitle
                          - linkedinUrl
                          - location
                          - seniority
                          - role
                          - bio
                          - company
                      campaign:
                        type: object
                        properties:
                          id:
                            type: number
                          name:
                            type: string
                          status:
                            type: string
                            enum:
                              - draft
                              - active
                              - paused
                              - completed
                              - failed
                              - archived
                          agentId:
                            type: number
                          fromNumber:
                            type: string
                        required:
                          - id
                          - name
                          - status
                          - agentId
                          - fromNumber
                    required:
                      - id
                      - status
                      - startedAt
                      - endedAt
                      - recordingUrl
                      - durationMs
                      - failureReason
                      - disconnectReason
                      - contact
                      - campaign
                required:
                  - success
                  - data
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Call not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /organizations/{organizationId}/campaigns/{campaignId}/targets/{targetId}/calls:
    get:
      tags:
        - Campaigns
      summary: Get calls by target ID
      description: Get all calls for a specific target
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
        - schema:
            type: string
          required: true
          name: campaignId
          in: path
        - schema:
            type: string
          required: true
          name: targetId
          in: path
      responses:
        '200':
          description: List of calls
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        status:
                          type: string
                          enum:
                            - pending
                            - queued
                            - in_progress
                            - completed
                            - failed
                        startedAt:
                          type: string
                          nullable: true
                        endedAt:
                          type: string
                          nullable: true
                        recordingUrl:
                          type: string
                          nullable: true
                        durationMs:
                          type: number
                          nullable: true
                        failureReason:
                          type: string
                          nullable: true
                        metadata:
                          type: object
                          properties:
                            transcripts:
                              type: array
                              items:
                                type: string
                            postCallAnalysis:
                              type: object
                              properties:
                                isSuccessfulCall:
                                  type: boolean
                      required:
                        - id
                        - status
                        - startedAt
                        - endedAt
                        - recordingUrl
                        - durationMs
                        - failureReason
                required:
                  - success
                  - data
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Target not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /organizations/{organizationId}/campaigns/{campaignId}/export:
    get:
      tags:
        - Campaigns
      summary: Export campaign contacts
      description: Export all contacts for a specific campaign
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
        - schema:
            type: string
          required: true
          name: campaignId
          in: path
      responses:
        '200':
          description: Campaign executive report
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        contact:
                          type: object
                          properties:
                            id:
                              type: number
                            email:
                              type: string
                              nullable: true
                            firstName:
                              type: string
                              nullable: true
                            lastName:
                              type: string
                              nullable: true
                            phone:
                              type: string
                              nullable: true
                            jobTitle:
                              type: string
                              nullable: true
                            linkedinUrl:
                              type: string
                              nullable: true
                            location:
                              type: string
                              nullable: true
                            seniority:
                              type: string
                              nullable: true
                            role:
                              type: string
                              nullable: true
                            bio:
                              type: string
                              nullable: true
                            company:
                              type: object
                              nullable: true
                              properties:
                                name:
                                  type: string
                                website:
                                  type: string
                                  nullable: true
                                industry:
                                  type: string
                                  nullable: true
                                size:
                                  type: string
                                  nullable: true
                                linkedinUrl:
                                  type: string
                                  nullable: true
                              required:
                                - name
                                - website
                                - industry
                                - size
                                - linkedinUrl
                          required:
                            - id
                            - email
                            - firstName
                            - lastName
                            - phone
                            - jobTitle
                            - linkedinUrl
                            - location
                            - seniority
                            - role
                            - bio
                            - company
                        lastCall:
                          type: object
                          nullable: true
                          properties:
                            id:
                              type: string
                            status:
                              type: string
                              enum:
                                - pending
                                - queued
                                - in_progress
                                - completed
                                - failed
                            startedAt:
                              type: string
                              nullable: true
                            endedAt:
                              type: string
                              nullable: true
                            recordingUrl:
                              type: string
                              nullable: true
                            durationMs:
                              type: number
                              nullable: true
                            failureReason:
                              type: string
                              nullable: true
                            metadata:
                              type: object
                              properties:
                                transcripts:
                                  type: array
                                  items:
                                    type: string
                                postCallAnalysis:
                                  type: object
                                  properties:
                                    isSuccessfulCall:
                                      type: boolean
                                    custom_analysis_data:
                                      type: object
                                      additionalProperties:
                                        anyOf:
                                          - type: string
                                          - type: number
                                          - type: boolean
                          required:
                            - id
                            - status
                            - startedAt
                            - endedAt
                            - recordingUrl
                            - durationMs
                            - failureReason
                      required:
                        - contact
                        - lastCall
                required:
                  - success
                  - data
        '401':
          description: User is not authorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Campaign not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
                required:
                  - success
                  - error
  /organizations/{organizationId}/campaigns/{campaignId}/archive:
    post:
      tags:
        - Campaigns
      summary: Archive a campaign
      description: Archive a specific campaign
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: path
        - schema:
            type: string
          required: true
          name: campaignId
          in: path
      responses:
        '200':
          description: Campaign archived successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      status:
                        type: string
                        enum:
                          - draft
                          - active
                          - paused
                          - completed
                          - failed
                          - archived
                      archived:
                        type: boolean
                      archivedAt:
                        type: string
                        nullable: true
                    required:
                      - id
                      - status
                      - archived
                      - archivedAt
                required:
                  - success
                  - data
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Campaign not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - success
                  - error
  /meetings:
    get:
      tags:
        - Meetings
      summary: Get booked meetings
      description: Get all booked meetings for a specific organization
      security:
        - BearerAuth: []
      parameters:
        - schema:
            type: string
          required: true
          name: organizationId
          in: query
        - schema:
            type: string
          required: true
          name: startDate
          in: query
        - schema:
            type: string
          required: true
          name: endDate
          in: query
        - schema:
            type: string
          required: false
          name: campaignId
          in: query
      responses:
        '200':
          description: Booked meetings retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  calendarBookings:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                        targetEmail:
                          type: string
                        calBookingId:
                          type: string
                        scheduledAt:
                          type: string
                        bookedAt:
                          type: string
                        campaign:
                          type: object
                          nullable: true
                          properties:
                            id:
                              type: number
                            name:
                              type: string
                          required:
                            - id
                            - name
                        target:
                          type: object
                          nullable: true
                          properties:
                            id:
                              type: number
                            contact:
                              type: object
                              nullable: true
                              properties:
                                firstName:
                                  type: string
                                  nullable: true
                                lastName:
                                  type: string
                                  nullable: true
                                email:
                                  type: string
                              required:
                                - firstName
                                - lastName
                                - email
                          required:
                            - id
                            - contact
                      required:
                        - id
                        - targetEmail
                        - calBookingId
                        - scheduledAt
                        - bookedAt
                        - campaign
                        - target
                  callBookings:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        targetEmail:
                          type: string
                        scheduledAt:
                          type: string
                        bookedAt:
                          type: string
                        campaign:
                          type: object
                          nullable: true
                          properties:
                            id:
                              type: number
                            name:
                              type: string
                          required:
                            - id
                            - name
                        target:
                          type: object
                          nullable: true
                          properties:
                            id:
                              type: number
                            contact:
                              type: object
                              nullable: true
                              properties:
                                firstName:
                                  type: string
                                  nullable: true
                                lastName:
                                  type: string
                                  nullable: true
                                email:
                                  type: string
                              required:
                                - firstName
                                - lastName
                                - email
                          required:
                            - id
                            - contact
                      required:
                        - id
                        - targetEmail
                        - scheduledAt
                        - bookedAt
                        - campaign
                        - target
                required:
                  - calendarBookings
                  - callBookings
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                required:
                  - success
                  - message
        '500':
          description: Error retrieving booked meetings
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                required:
                  - success
                  - message
  /agents/{agentId}/webhooks:
    post:
      tags:
        - Webhooks
      security:
        - BearerAuth: []
      description: Create a new webhook for an agent
      summary: Create a new webhook for an agent
      parameters:
        - schema:
            type: string
          required: true
          name: agentId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  format: uri
                enabled:
                  type: boolean
                  default: true
                events:
                  type: array
                  items:
                    type: string
                    enum:
                      - call_started
                      - call_ended
                      - call_analyzed
                  default:
                    - call_started
                    - call_ended
                    - call_analyzed
              required:
                - url
      responses:
        '201':
          description: Webhook created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      agentId:
                        type: number
                      url:
                        type: string
                        format: uri
                      secret:
                        type: string
                      enabled:
                        type: boolean
                      events:
                        type: array
                        items:
                          type: string
                          enum:
                            - call_started
                            - call_ended
                            - call_analyzed
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                    required:
                      - id
                      - agentId
                      - url
                      - secret
                      - enabled
                      - events
                      - createdAt
                      - updatedAt
                required:
                  - success
                  - data
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: User doesn't have access to this agent
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Agent not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
    get:
      tags:
        - Webhooks
      security:
        - BearerAuth: []
      description: List all webhooks for an agent
      summary: List all webhooks for an agent
      parameters:
        - schema:
            type: string
          required: true
          name: agentId
          in: path
      responses:
        '200':
          description: Webhooks retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                        agentId:
                          type: number
                        url:
                          type: string
                          format: uri
                        secret:
                          type: string
                        enabled:
                          type: boolean
                        events:
                          type: array
                          items:
                            type: string
                            enum:
                              - call_started
                              - call_ended
                              - call_analyzed
                        createdAt:
                          type: string
                        updatedAt:
                          type: string
                      required:
                        - id
                        - agentId
                        - url
                        - secret
                        - enabled
                        - events
                        - createdAt
                        - updatedAt
                required:
                  - success
                  - data
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: User doesn't have access to this agent
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Agent not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
  /agents/{agentId}/webhooks/{webhookId}:
    get:
      tags:
        - Webhooks
      security:
        - BearerAuth: []
      description: Get a webhook by ID for an agent
      summary: Get a webhook by ID for an agent
      parameters:
        - schema:
            type: string
          required: true
          name: agentId
          in: path
        - schema:
            type: string
          required: true
          name: webhookId
          in: path
      responses:
        '200':
          description: Webhook retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      agentId:
                        type: number
                      url:
                        type: string
                        format: uri
                      secret:
                        type: string
                      enabled:
                        type: boolean
                      events:
                        type: array
                        items:
                          type: string
                          enum:
                            - call_started
                            - call_ended
                            - call_analyzed
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                    required:
                      - id
                      - agentId
                      - url
                      - secret
                      - enabled
                      - events
                      - createdAt
                      - updatedAt
                required:
                  - success
                  - data
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: User doesn't have access to this agent
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Webhook not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
    put:
      tags:
        - Webhooks
      security:
        - BearerAuth: []
      description: Update a webhook by ID for an agent
      summary: Update a webhook by ID for an agent
      parameters:
        - schema:
            type: string
          required: true
          name: agentId
          in: path
        - schema:
            type: string
          required: true
          name: webhookId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  format: uri
                enabled:
                  type: boolean
                  default: true
                events:
                  type: array
                  items:
                    type: string
                    enum:
                      - call_started
                      - call_ended
                      - call_analyzed
                  default:
                    - call_started
                    - call_ended
                    - call_analyzed
      responses:
        '200':
          description: Webhook updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      agentId:
                        type: number
                      url:
                        type: string
                        format: uri
                      secret:
                        type: string
                      enabled:
                        type: boolean
                      events:
                        type: array
                        items:
                          type: string
                          enum:
                            - call_started
                            - call_ended
                            - call_analyzed
                      createdAt:
                        type: string
                      updatedAt:
                        type: string
                    required:
                      - id
                      - agentId
                      - url
                      - secret
                      - enabled
                      - events
                      - createdAt
                      - updatedAt
                required:
                  - success
                  - data
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: User doesn't have access to this agent
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Webhook not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Failed to update webhook
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
    delete:
      tags:
        - Webhooks
      security:
        - BearerAuth: []
      description: Delete a webhook by ID for an agent
      summary: Delete a webhook by ID for an agent
      parameters:
        - schema:
            type: string
          required: true
          name: agentId
          in: path
        - schema:
            type: string
          required: true
          name: webhookId
          in: path
      responses:
        '200':
          description: Webhook deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    nullable: true
                required:
                  - success
                  - data
        '401':
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
        '403':
          description: User doesn't have access to this agent
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
        '404':
          description: Webhook not found
          content:
            application/json:
              schema:
                type: oject
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
        '500':
          description: Failed to delete webhook
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: string
                required:
                  - success
                  - error
