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

# Clone a Voice

> Creates a private voice from a recording and adds it to your voices.



## OpenAPI

````yaml post /v2/Speech/Clone
openapi: 3.0.1
info:
  title: NLPearl Client API
  description: A sample API that demonstrates features in the OpenAPI specification
  version: v2
servers:
  - url: https://api.nlpearl.ai
    description: Production Environement
security:
  - bearer_auth: []
  - oauth2_client_credentials: []
tags:
  - name: Pearl
    description: >-
      Manage your Pearls, the AI agents that handle your inbound and outbound
      calls. Create and configure Pearls, retrieve their details and settings,
      run or pause them, list and bulk-export their calls, monitor calls in
      progress, get analytics, and reset a customer's conversation memory.
  - name: Speech
    description: >-
      Turn text into speech with your voices, as a single clip or as a stream,
      and clone new voices from a recording.
paths:
  /v2/Speech/Clone:
    post:
      tags:
        - Speech
      summary: Clone a Voice
      description: Creates a private voice from a recording and adds it to your voices.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CloneVoiceRequestApi'
      responses:
        '200':
          description: The new voice's id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloneVoiceResponseApi'
              example:
                voiceId: 6a2f41c9e8b7d3a15c0f9e42
          headers:
            X-Credits-Charged:
              description: Credits charged for the clone.
              schema:
                type: integer
        '400':
          description: '`invalid_request`. The message names the field.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpeechErrorApi'
        '401':
          description: Missing or invalid credentials.
        '402':
          description: '`insufficient_credits` or `debt_limit_reached`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpeechErrorApi'
        '403':
          description: '`insufficient_scope`, `account_suspended` or `clone_limit_reached`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpeechErrorApi'
        '422':
          description: '`invalid_audio`: the recording can''t be used.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpeechErrorApi'
        '429':
          description: >-
            `concurrency_limit_exceeded`, `voice_limit_reached` or
            `rate_limit_exceeded` (too many clone attempts in the last hour).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpeechErrorApi'
        '502':
          description: The voice could not be created. Nothing is charged.
components:
  schemas:
    CloneVoiceRequestApi:
      required:
        - audio
        - name
        - language
        - consent
      type: object
      properties:
        audio:
          type: string
          format: binary
          description: >-
            A recording of one speaker: 5 to 60 seconds of clear speech with no
            background noise. WAV, MP3, M4A, OGG or WEBM, up to 20 MB.
        name:
          type: string
          description: The voice's name.
        language:
          type: string
          example: en-US
          description: >-
            The language of the recording, as a BCP-47 tag. English and Spanish
            need the region, which sets the accent.


            - English: `en-US`, `en-GB`, `en-AU`, `en-CA`, `en-IE`, `en-IN`

            - Spanish: `es-ES`, `es-MX`, `es-AR`, `es-CO`, `es-VE`

            - French: `fr-FR`

            - German: `de-DE`

            - Italian: `it-IT`
        gender:
          type: string
          enum:
            - female
            - male
          description: The speaker's gender.
        tags:
          type: array
          items:
            type: string
          description: Up to 3 labels, such as `warm` or `support`.
        consent:
          type: boolean
          description: >-
            Must be `true`, confirming you have the speaker's permission to
            clone their voice.
    CloneVoiceResponseApi:
      type: object
      properties:
        voiceId:
          type: string
          description: The new voice's id.
    SpeechErrorApi:
      type: object
      properties:
        code:
          type: string
          description: The error code, for example `voice_not_found`.
        message:
          type: string
          description: What went wrong.
  securitySchemes:
    bearer_auth:
      type: http
      description: >-
        Specify the authorization token.


        For more information, check out the [Authorization
        Guide](/api-reference/authorization).
      scheme: bearer
    oauth2_client_credentials:
      type: oauth2
      description: >-
        OAuth2 client_credentials grant. Use the Id of an OAuth API key as
        `client_id` and its one-time secret as `client_secret`.
      flows:
        clientCredentials:
          tokenUrl: /oauth/token
          scopes:
            pearls:read: List and view Pearls
            pearls:write: >-
              Create and update Pearls (settings, conversation flows, voices);
              implies pearls:read
            pearls:moderate: Run/pause Pearls and reset customer memory; implies pearls:read
            pearls:analytics: Read Pearl analytics; implies pearls:read
            pearls:leads: Manage and read outbound leads; implies pearls:read
            pearls:calls: >-
              Read calls and recordings, make and delete calls; implies
              pearls:read
            account:phone_numbers: >-
              Read account phone numbers and text channels, manage custom VoIP
              numbers, import Twilio numbers and delete phone numbers
            account:users: Read account users
            account:advanced: Manage advanced account settings (blacklist)
            account:billing: Read account information and credit balance
            account:audit_log: Read the audit log
            tts: Synthesise speech and clone voices

````

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