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

# Create Voice Agent Route

> Create a new voice agent to start using our powerful and robust voice assistant feature. This route requires an API key for authentication.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/voice-agents
openapi: 3.0.1
info:
  title: Hamsa API
  description: Trying out our transcription and media-to-text APIs
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tryhamsa.com
security: []
paths:
  /v1/voice-agents:
    post:
      summary: Create a new voice agent
      description: >-
        Create a new voice agent to start using our powerful and robust voice
        assistant feature. This route requires an API key for authentication.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VoiceAgentRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VoiceAgentResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '401':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '403':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
      deprecated: true
      security:
        - ApiKeyAuth: []
components:
  schemas:
    VoiceAgentRequest:
      type: object
      properties:
        agentName:
          type: string
        greetingMessage:
          description: >-
            Greeting Message can be customized by adding params like: {{name}},
            to make the message more personal!
          type: string
          default: Hello, how can I help you today?
        greetingMessageType:
          type: string
          nullable: true
          enum:
            - STATIC
            - PROMPT
          default: null
        preamble:
          description: >-
            Preamble can be customized by adding params like: {{agentName}}, to
            make the prompt more specific and context aware!
          type: string
          default: You are a helpful assistant that will answer users questions.
        lang:
          type: string
          enum:
            - ar
            - en
          default: ar
        pokeMessages:
          description: The messages to say to the user when he doesn't respond!
          type: array
          items:
            type: string
          default: []
        realTime:
          type: boolean
          default: false
        silenceThreshold:
          type: integer
          default: 800
          minimum: 1
          description: >-
            The silence threshold in milliseconds. Minimum value is 1
            millisecond.
        interrupt:
          type: boolean
          default: true
        type:
          type: string
          default: Single Prompt
        outcome:
          description: >-
            A prompt to take the conversation and transform it to anything you
            like, like creating an article out of the conversation!
          type: string
          nullable: true
          default: null
        webhookUrl:
          type: string
          nullable: true
          format: uri
          example: https://example.com/webhook
        webhookAuth:
          $ref: '#/components/schemas/ExternalWebhookAuthScheme'
        outcomeResponseShape:
          type: object
          title: Outcome Response Schema
          description: >-
            Recursive OpenAPI-style shape with 'type', 'properties', 'required',
            'items', ...etc. Please refer to the `OpenAPI Outcome Response
            Instructions` above for more information.
          example:
            type: object
            properties:
              test:
                type: number
                description: Hello world from Hamsa AI!
            required:
              - test
        voiceId:
          description: >-
            For trying voices and choosing one by yourself, or even cloning a
            voice, please visit Hamsa Agents platform voices tab
            [here](https://agents.tryhamsa.com/app/voices).
          type: string
          nullable: true
          default: null
        tools:
          type: object
          properties:
            genderDetection:
              type: boolean
              default: false
            smartCallEnd:
              type: boolean
              default: false
          default:
            genderDetection: false
            smartCallEnd: false
        params:
          description: >-
            Set the params you define in the greeting message or preamble fields
            here, the key is the same as the param and the value is the param
            value. Press 'Add new property' below to set the param name then
            press enter, after that add the value.
          type: object
          default: {}
        alignment:
          type: object
          properties:
            greetingMessage:
              type: string
              default: ltr
            preamble:
              type: string
              default: ltr
          default:
            greetingMessage: ltr
            preamble: ltr
        webToolsIds:
          type: array
          items:
            type: string
        voiceDictionaryIds:
          type: array
          items:
            type: string
        knowledgeBaseItemsIds:
          type: array
          items:
            type: string
        webToolsOverrides:
          type: object
        userInactivityTimeout:
          type: number
          minimum: 5
          maximum: 30
          default: 15
        maxCallDuration:
          type: number
          minimum: 30
          maximum: 600
          default: 300
        responseDelay:
          type: number
          minimum: 100
          maximum: 1500
          default: 400
        backgroundNoise:
          type: boolean
          default: false
        waitForUserToSpeakFirst:
          type: integer
          minimum: 0
          maximum: 2
          default: 0
        thinkingVoice:
          type: boolean
          default: false
        speakerIdentification:
          type: boolean
          default: false
        llmConfig:
          $ref: '#/components/schemas/VoiceAgentLlmConfig'
        noiseCancellation:
          type: string
          default: telephony-optimized
        cancelNoisePer:
          type: string
          default: conversation
        agenticRag:
          type: boolean
          default: false
        languageDialectSwitcher:
          type: boolean
          default: false
        minInterruptionDuration:
          type: number
          minimum: 0.2
          maximum: 1.5
          default: 0.5
        vadActivationThreshold:
          type: number
          minimum: 0.2
          maximum: 0.9
          default: 0.5
        enableAutoGainControl:
          type: boolean
          default: false
        sendDenoisedToStt:
          type: boolean
          default: false
      required:
        - agentName
    VoiceAgentResponse:
      type: object
      properties:
        success:
          type: boolean
          default: false
        message:
          type: string
          default: success
        data:
          $ref: '#/components/schemas/VoiceAgentResponseData'
    ErrorSchema:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
    ExternalWebhookAuthScheme:
      type: object
      description: >-
        Authorization header to be sent in this format: `Authorization:
        [authKey] [authSecret]`
      properties:
        authKey:
          type: string
          example: Token
          nullable: true
        authSecret:
          type: string
          example: Secret
          nullable: true
    VoiceAgentLlmConfig:
      type: object
      description: Configuration for the LLM (Large Language Model) used by the voice agent
      properties:
        provider:
          type: string
          enum:
            - OpenAI
            - Gemini
            - deepmyst
            - Custom
            - Groq
          description: The LLM provider to use
          default: OpenAI
          example: OpenAI
        modelName:
          type: string
          description: >-
            The model name to use. Valid models depend on the provider: OpenAI
            (GPT-5, GPT-5-Mini, GPT-5-Nano, GPT-4.1, GPT-4.1-Mini, GPT-4.1-Nano,
            GPT-4o, GPT-4o-mini), Gemini (Gemini 2.5-Pro, Gemini 2.5-Flash,
            gemini-3-flash-preview), deepmyst (gpt-4.1-optimize,
            gpt-4.1-mini-optimize), Groq (openai/gpt-oss-120b,
            openai/gpt-oss-20b)
          default: GPT-4.1
          example: GPT-4.1
        baseUrl:
          type: string
          description: Custom base URL for the LLM API. Required when provider is 'Custom'
          example: https://api.custom-llm.com/v1
        apiKey:
          type: string
          description: >-
            API key for authentication with the LLM provider. Required when
            provider is 'Custom'
          example: sk-...
        temperature:
          type: number
          minimum: 0
          maximum: 1
          description: >-
            Controls randomness in the model's responses. Lower values make
            output more deterministic, higher values make it more creative.
            Note: GPT-5, GPT-5-Mini, and GPT-5-Nano models require temperature
            to be exactly 1.
          default: 0.2
          example: 0.2
    VoiceAgentResponseData:
      type: object
      properties:
        id:
          type: string
        agentName:
          type: string
        greetingMessage:
          type: string
        greetingMessageType:
          type: string
          enum:
            - STATIC
            - PROMPT
          nullable: true
        description:
          type: string
        preamble:
          type: string
        lang:
          type: string
        pokeMessages:
          type: array
          items:
            type: string
        realTime:
          type: boolean
        silenceThreshold:
          type: integer
        interrupt:
          type: boolean
        type:
          type: string
        outcome:
          type: string
          nullable: true
        outcomeResponseShape:
          type: object
          nullable: true
          example:
            type: object
            properties:
              test:
                type: number
                description: Hello world from Hamsa AI!
            required:
              - test
        projectId:
          type: string
        apiKeyId:
          type: string
        voiceId:
          type: string
          nullable: true
        voiceRecordId:
          type: string
          nullable: true
        voiceRecord:
          type: object
          description: The voice record object which is connected to this agent.
          nullable: true
        collectionId:
          type: string
          nullable: true
        isTemplate:
          type: boolean
        icon:
          type: string
          nullable: true
        webhookUrl:
          type: string
          nullable: true
          format: uri
          example: https://example.com/webhook
        webhookAuth:
          $ref: '#/components/schemas/ExternalWebhookAuthScheme'
        params:
          type: object
          description: The parameters that are created for this agent.
        alignment:
          type: object
          properties:
            greetingMessage:
              type: string
            preamble:
              type: string
        tools:
          type: object
          properties:
            genderDetection:
              type: boolean
            smartCallEnd:
              type: boolean
        webToolsIds:
          type: array
          items:
            type: string
        voiceDictionaryIds:
          type: array
          items:
            type: string
        knowledgeBaseItemsIds:
          type: array
          items:
            type: string
        webToolsOverrides:
          type: object
        userInactivityTimeout:
          type: number
        maxCallDuration:
          type: number
        responseDelay:
          type: number
        backgroundNoise:
          type: boolean
        waitForUserToSpeakFirst:
          type: integer
        thinkingVoice:
          type: boolean
        speakerIdentification:
          type: boolean
        llmConfig:
          $ref: '#/components/schemas/VoiceAgentLlmConfig'
        noiseCancellation:
          type: string
        cancelNoisePer:
          type: string
          nullable: true
        agenticRag:
          type: boolean
        languageDialectSwitcher:
          type: boolean
        minInterruptionDuration:
          type: number
        vadActivationThreshold:
          type: number
        enableAutoGainControl:
          type: boolean
        sendDenoisedToStt:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Pass the API key in the Authorization header, You need to put Token
        keyword before the API key. e.g. 'Authorization: Token <api-key>'

````