> ## 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 TTS voice

> Create a new TTS voice under the current project.



## OpenAPI

````yaml /api-reference/openapi.json post /v2/tts/voices
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:
  /v2/tts/voices:
    post:
      summary: Create TTS voice
      description: Create a new TTS voice under the current project.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTtsVoiceRequest'
      responses:
        '200':
          description: Voice created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedTtsVoice'
        '400':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CreateTtsVoiceRequest:
      type: object
      required:
        - name
        - audioUrl
        - audioTranscription
        - projectId
        - language
        - tags
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 190
          example: Support Assistant Female
          description: Voice name (Arabic & English letters and numbers only)
        description:
          type: string
          minLength: 1
          maxLength: 1000
          nullable: true
          example: Friendly female assistant voice
        audioUrl:
          type: string
          format: uri
          example: https://cdn.tryhamsa.com/uploads/voice.wav
          description: URL of the uploaded voice sample
        audioTranscription:
          type: string
          minLength: 1
          maxLength: 5000
          example: مرحباً، أنا مساعدك الصوتي.
          description: Exact transcription of the uploaded audio sample
        imageUrl:
          type: string
          format: uri
          nullable: true
          example: https://cdn.tryhamsa.com/voices/avatar.png
          description: Optional avatar image for the voice
        projectId:
          type: string
          format: uuid
          example: ae6d58c6-c6bd-4ae0-ad74-b8b39c29928b
        language:
          type: string
          enum:
            - en
            - ar
          example: ar
          description: Voice language
        dialectId:
          type: string
          format: uuid
          nullable: true
          example: ae6d58c6-c6bd-4ae0-ad74-b8b39c29928b
          description: >-
            Required when language is 'ar'. Must be omitted when language is
            'en'.
        tags:
          type: array
          minItems: 2
          maxItems: 2
          description: 'Exactly 2 tags: one gender + one voice style'
          items:
            type: string
            enum:
              - male
              - female
              - conversational
              - narrator
          example:
            - female
            - conversational
    CreatedTtsVoice:
      type: object
      allOf:
        - $ref: '#/components/schemas/SuccessResponse'
        - type: object
          properties:
            data:
              type: object
              properties:
                id:
                  type: string
                  format: uuid
                  example: 48f7656f-098b-4c43-b165-7cfd2cc8ac30
                voiceRecord:
                  type: string
                  example: test.wav
    ValidationErrorResponse:
      type: object
      properties:
        code:
          type: integer
          example: 9400
        message:
          type: string
          example: Field must be a string!
        messageKey:
          type: string
          example: FieldMustBeString
    InternalServerErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          type: integer
          example: 500
        message:
          type: string
          example: Internal server error
    SuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Operation completed successfully
        messageKey:
          type: string
          example: OPERATION_SUCCESSFUL
  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>'

````