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

# Clone Voice

> Create a custom voice clone from your audio files. Requires base64-encoded audio samples.



## OpenAPI

````yaml /api-reference/openapi.json post /voices/clone
openapi: 3.1.0
info:
  title: Truedy API
  description: >-
    Truedy Public API - Build voice AI agents and make automated phone calls.


    ## Authentication

    All requests require **Authorization: Bearer <your_api_key>**.

    Get your API key from the [Truedy Dashboard](https://app.truedy.ai).


    ## Response Format

    All successful responses follow this format:

    ```json

    {
      "data": { /* resource or list of resources */ },
      "meta": {
        "request_id": "req_xxx",
        "ts": "2026-03-03T20:30:21.310278Z"
      },
      "pagination": { /* optional, for list endpoints */ }
    }

    ```


    ## Error Handling

    Errors return appropriate HTTP status codes with structured error messages.
    Always check the `error` field in the response body for details.
  version: 1.0.0
servers:
  - url: https://api.truedy.ai/api/public/v1
    description: Truedy Public API
security:
  - BearerAuth: []
paths:
  /voices/clone:
    post:
      tags:
        - Voices
      summary: Clone Voice
      description: >-
        Create a custom voice clone from your audio files. Requires
        base64-encoded audio samples.
      operationId: clone_voice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VoiceCloneRequest'
            examples:
              basic:
                summary: Clone voice from audio file
                value:
                  name: My Custom Voice
                  files:
                    - filename: sample.mp3
                      data: //NExAAqQIf... (base64-encoded audio)
                      content_type: audio/mpeg
      responses:
        '201':
          description: Voice clone created successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - meta
                properties:
                  data:
                    $ref: '#/components/schemas/VoiceResponse'
                  meta:
                    $ref: '#/components/schemas/ResponseMeta'
              examples:
                success:
                  value:
                    data:
                      id: voice_custom123
                      name: My Custom Voice
                      provider: elevenlabs
                      type: custom
                      language: en-US
                      status: training
                      created_at: '2026-03-03T20:30:21.310278Z'
                      updated_at: '2026-03-03T20:30:21.310278Z'
                    meta:
                      request_id: req_32e7531c-8
                      ts: '2026-03-03T20:30:21.310278Z'
              example:
                data:
                  id: voice_clone_9a8b7c
                  name: My Custom Voice
                  gender: female
                  language: en-US
                  accent: American
                  provider: elevenlabs
                  preview_url: https://api.truedy.ai/voices/voice_c7d82fec/preview
                  is_custom: true
                  created_at: '2026-01-01T00:00:00Z'
                  status: processing
                meta:
                  request_id: req_32e7531c
                  ts: '2026-04-05T10:22:00Z'
        '400':
          description: Bad request - Invalid audio format or file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Payment required - Insufficient credits for voice cloning
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                no_credits:
                  value:
                    error:
                      code: insufficient_credits
                      message: Insufficient credits for voice cloning
                      details:
                        required_credits: 100
                        current_balance: 50
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    VoiceCloneRequest:
      type: object
      required:
        - name
        - files
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
          description: Name for the cloned voice
          example: My Custom Voice
        files:
          type: array
          minItems: 1
          items:
            type: object
            required:
              - filename
              - data
            properties:
              filename:
                type: string
                description: Name of the audio file
                example: sample1.mp3
              data:
                type: string
                description: Base64-encoded audio data
                example: //NExAAqQIf...
              content_type:
                type: string
                description: MIME type of the audio
                default: audio/mpeg
                example: audio/mpeg
          description: Array of audio files (base64-encoded)
    VoiceResponse:
      type: object
      required:
        - id
        - name
        - provider
        - type
        - language
        - status
        - created_at
        - updated_at
      properties:
        id:
          type: string
          description: Unique voice identifier
          example: voice_c7d82fec
        name:
          type: string
          description: Display name of the voice
          example: Sarah
        provider:
          type: string
          description: TTS provider
          example: elevenlabs
        type:
          type: string
          enum:
            - custom
            - reference
          description: Voice type
          example: reference
        language:
          type: string
          description: Language code
          example: en-US
        status:
          type: string
          enum:
            - training
            - active
            - failed
          description: Voice status
          example: active
        created_at:
          type: string
          format: date-time
          description: When the voice was created
          example: '2026-03-03T20:30:21.310278Z'
        updated_at:
          type: string
          format: date-time
          description: When the voice was last updated
          example: '2026-03-03T20:30:21.310278Z'
    ResponseMeta:
      type: object
      required:
        - request_id
        - ts
      properties:
        request_id:
          type: string
          description: Unique request identifier for debugging and support
          example: req_32e7531c-8
        ts:
          type: string
          format: date-time
          description: Server timestamp when the response was generated
          example: '2026-03-03T20:30:21.310278Z'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Error code
              example: not_found
            message:
              type: string
              description: Human-readable error message
              example: The requested resource does not exist
            details:
              description: Additional error context
              example:
                resource: agent
                id: agt_invalid
              type:
                - object
                - 'null'
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            type: object
            properties:
              loc:
                type: array
              msg:
                type: string
              type:
                type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authentication. Include your API key in the Authorization
        header: Bearer <your_api_key>

````