> ## 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.

# Suggest Voice Overs

> Describe what you need, and Hamsa writes three scripts and has each read by a voice that suits the type (the same voice can read more than one), with a different background track for each if you ask for music. It is made in the background: read it with Get Voice Over until `status` changes. You are charged once, when it is ready. When two or three takes succeed, choose one with Approve Voice Over; when only one does, it is chosen for you.

The voices are public Arabic voices of the dialect you pick, so `dialectId` must be an Arabic dialect from List Dialects.

Needs **Create** on **Voice overs** (`voice_overs:create`).



## OpenAPI

````yaml /api-reference/openapi.json post /v2/voice-overs
openapi: 3.0.1
info:
  title: Hamsa API
  description: >-
    The Hamsa API: voice agents and their calls, phone numbers, batch calls and
    knowledge bases; speech to text, text to speech, voices and AI content.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tryhamsa.com
security: []
paths:
  /v2/voice-overs:
    post:
      tags: []
      summary: Suggest voice over scripts
      description: >-
        Describe what you need, and Hamsa writes three scripts and has each read
        by a voice that suits the type (the same voice can read more than one),
        with a different background track for each if you ask for music. It is
        made in the background: read it with Get Voice Over until `status`
        changes. You are charged once, when it is ready. When two or three takes
        succeed, choose one with Approve Voice Over; when only one does, it is
        chosen for you.


        The voices are public Arabic voices of the dialect you pick, so
        `dialectId` must be an Arabic dialect from List Dialects.


        Needs **Create** on **Voice overs** (`voice_overs:create`).
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - type
                - dialectId
                - voiceOverDescription
              properties:
                type:
                  type: string
                  enum:
                    - POETRY
                    - COMMERCIAL
                    - RELIGIOUS
                    - STORIES
                  description: >-
                    The kind of voice over. `POETRY`: a poem (in Arabic, with
                    rhyme and rhythm). `COMMERCIAL`: an ad, hook to benefits to
                    call to action. `RELIGIOUS`: a calm, spiritual script.
                    `STORIES`: a narrated story. The three prose types aim for
                    30 to 120 seconds (75 to 220 words).
                  example: COMMERCIAL
                dialectId:
                  type: string
                  format: uuid
                  description: >-
                    The Arabic dialect of the voices, from [List
                    Dialects](/api-reference/list-dialects).
                  example: 2b7e4c9a-1f3d-4a6b-8e5c-0d2f4a6c8e17
                voiceOverDescription:
                  type: string
                  minLength: 1
                  maxLength: 1000
                  description: 'What the voice over is for: 1 to 1000 characters.'
                  example: A 30-second ad for a new coffee shop in Cairo
                includeBackgroundMusic:
                  type: boolean
                  default: false
                  description: Mix background music that suits the type under each take.
                  example: true
      responses:
        '200':
          description: Started. The three takes start as `PENDING`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      voiceOver:
                        type: object
                        properties:
                          id:
                            type: string
                            format: uuid
                            example: bd0ebca4-a16e-488b-b195-4690792259c7
                          status:
                            type: string
                            example: IN_PROGRESS
                          prompt:
                            type: string
                            nullable: true
                          media:
                            type: string
                            nullable: true
                            example: null
                          type:
                            type: string
                            enum:
                              - POETRY
                              - COMMERCIAL
                              - RELIGIOUS
                              - STORIES
                            example: COMMERCIAL
                          voiceOverSuggestions:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  type: string
                                  format: uuid
                                  example: c816c6f6-9d49-4b5d-8c87-4a7a24fc8af1
                                status:
                                  type: string
                                  example: PENDING
        '400':
          description: >-
            Invalid body, for example "voiceOverDescription must not exceed 1000
            characters!". A `type` outside the four values gets "Invalid enum
            value. Expected 'POETRY' | 'COMMERCIAL' | 'RELIGIOUS' | 'STORIES',
            received ...".
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '402':
          description: >-
            Your balance has run out ("Balance is insufficient, please renew or
            upgrade your plan!").
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '403':
          description: >-
            The key's scopes don't allow this (it needs `voice_overs:create`),
            or the project is deactivated (only reading works then).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '404':
          description: >-
            Fewer than three voices fit this dialect and type ("TTS voice not
            found", `TtsVoiceNotFound`), or with music on, fewer than three
            tracks fit the type ("Background music not found").
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '500':
          description: Server Side Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ErrorSchema:
      type: object
      properties:
        code:
          type: integer
          description: >-
            Service error code: the HTTP status with a service prefix (for
            example `8404`). Missing when the service has no code for that
            status.
          example: 8404
        message:
          type: string
          description: >-
            What went wrong. Some services (calls and recordings) put the error
            key here, for example `CallNotFoundOrUnavailable`, and send no
            `messageKey`.
          example: Policy not found!
        messageKey:
          type: string
          description: >-
            Stable key for the error, safe to match on in code. Not returned by
            every service.
          example: PolicyNotFound
        params:
          type: object
          additionalProperties: true
          description: >-
            Details for some errors (for example `reason`). Not returned by
            every service.
          example:
            reason: NO_DRAFT
  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>'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.