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

# Create a new agent



## OpenAPI

````yaml post /agency/agents
openapi: 3.0.0
info:
  title: ClearTalk API
  description: The ClearTalk API Documentation
  version: '1.0'
  contact:
    name: Developer Support
    email: devsupport@cleartalk.ai
servers:
  - url: https://api.cleartalk.ai
    description: ClearTalk AI API Server
security: []
tags: []
paths:
  /agency/agents:
    post:
      tags:
        - Outbound Agents
      summary: Create a new agent
      operationId: AgentsController_store
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAgentDto'
      responses:
        '201':
          description: Agent created successfully
        '409':
          description: Agent name already exists
      security:
        - apiKey: []
components:
  schemas:
    CreateAgentDto:
      type: object
      properties:
        agentName:
          type: string
        task:
          type: string
        model:
          type: string
        temperature:
          type: number
        wait_for_greeting:
          type: string
        max_duration:
          type: number
        selectedVoice:
          type: string
        voiceId:
          type: string
        selectedLanguage:
          type: string
        voiceSpeed:
          type: number
        interruptionThreshold:
          type: number
        for_user_id:
          type: number
        agency_id:
          type: number
        calendarID:
          type: string
        startTime:
          format: date-time
          type: string
        firstSentence:
          type: string
        calendarName:
          type: string
        customTool:
          type: string
        isGHL:
          type: number
        appointmentAgent:
          type: number
        from_admin:
          type: number
        knowledgeBases:
          type: array
          items:
            $ref: '#/components/schemas/KnowledgeBaseDto'
        questionsData:
          type: array
          items: 76fef43c-c065-4cd3-81f1-0dcf67e0d84d
        pronunciationGuide:
          type: array
          items:
            $ref: '#/components/schemas/PronunciationGuideDto'
        fromAdmin:
          type: boolean
        fromAgency:
          type: number
        background_track:
          type: string
        block_interruptions:
          type: number
        transferPhoneNumber:
          type: array
          items:
            $ref: '#/components/schemas/TransferPhoneNumberDto'
        voiceMail_action:
          type: string
        agentPhones:
          type: array
          items:
            type: string
        pathwayID:
          type: string
        voicemailDetection:
          type: string
        noise_cancellation:
          type: boolean
          example: false
          description: Whether to enable noise cancellation
        keywords:
          example:
            - keyword1
            - keyword2
          description: Keywords to boost in transcription
          type: array
          items:
            type: string
        timezone:
          type: string
          example: America/Los_Angeles
          description: Timezone for the call
        request_data:
          type: object
          example:
            name: John Doe
            age: 30
          description: Request data available to the AI agent during the call
        start_time:
          type: string
          example: '2024-03-20 12:00:00 -05:00'
          description: Scheduled start time for the call
        voicemail_message:
          type: string
          example: Please leave a message after the beep
          description: Message to leave on voicemail
        voicemail_action:
          type: string
          example: hangup
          description: Action to take when voicemail is detected
          enum:
            - hangup
            - leave_message
            - ignore
        retry:
          example:
            wait: 10
            voicemail_action: leave_message
            voicemail_message: Hello, this is a test message.
          description: Retry configuration for voicemail calls
          allOf:
            - $ref: '#/components/schemas/RetryConfig'
        record:
          type: boolean
          example: true
          description: Whether to record the call
        webhook_events:
          example:
            - queue
            - call
            - latency
          description: Events to stream to webhook
          type: array
          items:
            type: string
        citation_schema_id:
          type: string
          example: dcad76eb-57b6-4be6-922f-8a5a95e2ffrt
          description: Citation schema ID for post-call analysis
        analysis_preset:
          type: string
          example: a0f0d4ed-f5f5-4f16-b3f9-22166594d7a7
          description: Analysis preset UUID
        answered_by_enabled:
          type: boolean
          example: true
          description: Whether to enable answered-by detection
        available_tags:
          example:
            - got_full_name_and_number
            - no_information_provided
          description: Available disposition tags
          type: array
          items:
            type: string
        geospatial_dialing:
          type: string
          example: bd039087-decb-435a-a6e3-ca1ffbf89974
          description: Geospatial dialing pool UUID
        precall_dtmf_sequence:
          type: string
          example: 1234567890*#w
          description: DTMF sequence to play before call starts
        pool_id:
          type: string
          example: '#1234-5678-9012-3456'
          description: Pool ID
        memory_id:
          type: string
          example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
          description: UUID of the memory to associate with this agent
        webhook:
          description: Webhook configuration
          allOf:
            - $ref: '#/components/schemas/WebhookDto'
        get_data:
          description: Get data configuration
          allOf:
            - $ref: '#/components/schemas/GetDataDto'
        sms:
          description: SMS configuration
          allOf:
            - $ref: '#/components/schemas/SmsDto'
        retry_wait:
          type: number
          example: 10
          description: Retry wait time in seconds (alternative to retry object)
        retry_voicemail_action:
          type: string
          example: leave_message
          description: Retry voicemail action (alternative to retry object)
        retry_voicemail_message:
          type: string
          example: Hello, this is a test message.
          description: Retry voicemail message (alternative to retry object)
      required:
        - agentName
        - task
        - model
        - temperature
        - wait_for_greeting
        - max_duration
        - selectedVoice
        - voiceId
        - selectedLanguage
        - voiceSpeed
        - interruptionThreshold
        - startTime
        - isGHL
        - appointmentAgent
        - from_admin
        - knowledgeBases
        - questionsData
        - pronunciationGuide
        - noise_cancellation
        - keywords
        - timezone
        - request_data
        - start_time
        - voicemail_message
        - voicemail_action
        - retry
        - record
        - webhook_events
        - citation_schema_id
        - analysis_preset
        - answered_by_enabled
        - available_tags
        - geospatial_dialing
        - precall_dtmf_sequence
        - pool_id
    KnowledgeBaseDto:
      type: object
      properties:
        id:
          type: number
        user_id:
          type: number
        knowledge_name:
          type: string
        question:
          type: string
        answer:
          type: string
      required:
        - id
        - user_id
        - knowledge_name
        - question
        - answer
    PronunciationGuideDto:
      type: object
      properties:
        word:
          type: string
        pronunciation:
          type: string
        caseSensitive:
          type: boolean
        spaced:
          type: boolean
      required:
        - word
        - pronunciation
        - caseSensitive
        - spaced
    TransferPhoneNumberDto:
      type: object
      properties:
        transfer_number:
          type: string
        transfer_type:
          type: string
      required:
        - transfer_number
        - transfer_type
    RetryConfig:
      type: object
      properties:
        wait:
          type: number
          example: 10
          description: Delay in seconds before retry
        voicemail_action:
          type: string
          example: leave_message
          description: Action to take on voicemail
          enum:
            - hangup
            - leave_message
            - ignore
        voicemail_message:
          type: string
          example: Hello, this is a test message.
          description: Message to leave on voicemail
      required:
        - wait
        - voicemail_action
        - voicemail_message
    WebhookDto:
      type: object
      properties:
        name:
          type: string
          example: WEBHOOK JSON TEMPLATES
          description: Webhook name
        description:
          type: string
          example: TEMPLATES
          description: Webhook description
        speech:
          type: string
          example: speech
          description: Speech text for the agent
        url:
          type: string
          example: https://templates.com
          description: Webhook URL
        method:
          type: string
          example: POST
          description: HTTP method
          enum:
            - GET
            - POST
            - PUT
            - PATCH
            - DELETE
        headers:
          type: object
          example:
            Authorization: '########'
            Content-Type: application/json
          description: HTTP headers as key-value pairs
        body:
          type: object
          example:
            BODY1: LOREM
            BODY2: LOREM
          description: Request body as key-value pairs
        timeout:
          type: number
          example: 10000
          description: Timeout in milliseconds
      required:
        - name
        - description
        - speech
        - url
        - method
        - headers
        - body
        - timeout
    GetDataDto:
      type: object
      properties:
        fields:
          $ref: '#/components/schemas/GetDataFieldsDto'
        headers:
          type: array
          items:
            $ref: '#/components/schemas/GetDataHeaderDto'
        response:
          type: array
          items:
            $ref: '#/components/schemas/GetDataResponseDto'
      required:
        - fields
        - headers
        - response
    SmsDto:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        speech:
          type: string
        body:
          type: string
      required:
        - name
        - description
        - speech
        - body
    GetDataFieldsDto:
      type: object
      properties:
        url:
          type: string
        name:
          type: string
        description:
          type: string
        speech:
          type: string
        method:
          type: string
        timeout:
          type: number
      required:
        - url
        - name
        - description
        - speech
        - method
        - timeout
    GetDataHeaderDto:
      type: object
      properties:
        id:
          type: number
        authorization:
          type: string
        apiKey:
          type: string
      required:
        - id
        - authorization
        - apiKey
    GetDataResponseDto:
      type: object
      properties:
        id:
          type: number
        number:
          type: string
        type:
          type: string
      required:
        - id
        - number
        - type
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API Key for authentication

````