Generate speech

August 18, 2025 (January 21, 2026)

Table of contents

  1. Request Headers
  2. Request Body
  3. Responses
  4. Model
  5. Examples
  6. Try It

This endpoint generates high-quality speech from text using Mureka’s advanced text-to-speech technology. You can use either predefined voices or custom cloned voices created via POST /speech/voice. For multi-speaker conversations, use the conversation parameter with different voice IDs. Speech generation typically takes 20-90 seconds depending on text length.

Unlike music generation endpoints, this endpoint has no rate limits or concurrent generation restrictions, allowing unlimited parallel speech generations per account.

https://api.useapi.net/v1/mureka/speech

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Content-Type: multipart/form-data
Request Body
  • account is optional when only one account configured. However, if you have multiple accounts configured, this parameter becomes required.

  • title is optional string.
    Maximum length is 500 characters.

  • text is required string when not using conversation. Must be used together with voice_id.
    Maximum text length is 5000 characters.

  • voice_id is required number when not using conversation. Must be used together with text. Get available voice IDs from GET /speech/voices.
    To create a cloned voice, first use POST /speech/voice to upload an audio sample and clone the voice.

  • conversation is optional JSON string. Alternative to text and voice_id. Must be a JSON string array of objects with voice_id (number) and text (string) fields. Cannot be used together with text and voice_id. Total text length across all conversation items cannot exceed 5000 characters.

    Example conversation JSON:

      [
          {"voice_id": 12345, "text": "Hello, welcome to our service!"},
          {"voice_id": 67890, "text": "Thank you for choosing us today."},
          {"voice_id": 12345, "text": "Is there anything I can help you with?"}
      ]
    
  • async is optional, enables fire-and-forget mode (default: false). When true, returns immediately with 201 Created and job metadata. Poll GET /jobs/jobid for completion status. Useful for avoiding long request timeouts since speech generation takes 20-90 seconds.

  • replyUrl is optional, webhook URL for job status callbacks. Receives POST requests with job status updates (created, completed, failed). The JSON payload shape matches GET /jobs/jobid response.

  • replyRef is optional, custom reference string passed back in webhook callbacks. Useful for tracking jobs on your end.

Responses
  • 200 OK

    {
        "jobid": "j0121061456745673364t-u777-a12345678901234-bot:mureka",
        "title": "Sample Speech Title",
        "preview": "This is a preview of the generated speech content that demonstrates the text-to-speech capabilities.",
        "cover": "https://static-cos.mureka.ai/cos-prod/res/cover/….png",
        "mp3_url": "https://static-cos.mureka.ai/cos-prod/tts-v2/….mp3",
        "id": 12345678901234,
        "duration_milliseconds": 15000,
        "audio_quality": 2,
        "state": 3
    }
    
  • 201 Created

    Job created in async mode (async: true). Speech generation is processing in the background.

    Use GET /jobs/jobid to poll for completion status.

    {
        "jobid": "j0121061456745673364t-u777-a12345678901234-bot:mureka",
        "verb": "speech",
        "jobType": "tts",
        "status": "created",
        "created": "2026-01-20T12:34:56.789Z",
        "request": {
            "account": "12345678901234",
            "text": "Hello, this is a sample text for speech generation.",
            "voice_id": 67890,
            "async": true,
            "replyUrl": "https://your-domain.com/webhook",
            "replyRef": "my-custom-ref-123"
        }
    }
    
  • 400 Bad Request

    {
        "error": "<Error message>",
        "code": 400
    }
    
  • 401 Unauthorized

    {
      "error": "Unauthorized",
      "code": 401
    }
    
  • 596 Account Error

    Returned when the account has an error state preventing API calls.

    {
        "error": "Session refresh failed 2026-01-19T14:31:15.000Z, manual update required",
        "code": "REFRESH_FAILED"
    }
    

    Possible error codes:

    • ACCOUNT_ERROR - Account has a blocking error
    • REFRESH_FAILED - Automatic token refresh failed
    • REFRESH_IN_PROGRESS - Token refresh already in progress, retry shortly
    • SESSION_EXPIRED - Session expired and no auto-refresh available
    • COOKIE_EXPIRED - Google cookie has expired

    To resolve, update your account configuration via POST /accounts.

Model
  • Speech generation completed. Returns full audio data with MP3 URL.

    {
        jobid: string                              // Job identifier (for later lookup)
        title: string
        preview: string
        cover: string
        mp3_url: string
        id: number
        duration_milliseconds: number
        audio_quality: number
        state: number
    }
    
  • Job created and processing in background. Structure matches GET /jobs/jobid response.

    {
        jobid: string                              // Job identifier
        verb: 'speech'                             // Job verb
        jobType: 'tts'                             // Job type
        status: 'created'                          // Job status
        created: string                            // ISO 8601 timestamp
        request: {
            account?: string
            title?: string
            text?: string
            voice_id?: number
            conversation?: string
            async: true
            replyUrl?: string
            replyRef?: string
        }
    }
    
  • Error response structure (applies to both sync and async modes).

    {
        jobid?: string                             // Present for job-related errors
        error: string                              // Error summary message
        code?: number                              // HTTP status code or error code
        rawData?: string                           // Raw error data (if available)
    }
    
Examples
  • curl "https://api.useapi.net/v1/mureka/speech" \
       -H "Accept: application/json" \
       -H "Authorization: Bearer …" \
       -H "Content-Type: application/json" \
       -d '{
         "text": "Hello, this is a sample text for speech generation.",
         "voice_id": 67890
       }'
    
  • const token = "API token";
    const apiUrl = "https://api.useapi.net/v1/mureka/speech"; 
    const response = await fetch(apiUrl, {
      method: "POST",
      headers: {
        "Authorization": `Bearer ${token}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        text: "Hello, this is a sample text for speech generation.",
        voice_id: 67890
      }),
    });
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    token = "API token"
    apiUrl = "https://api.useapi.net/v1/mureka/speech"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    data = {
        "text": "Hello, this is a sample text for speech generation.",
        "voice_id": 67890
    }
    response = requests.post(apiUrl, headers=headers, json=data)
    print(response, response.json())
    
Try It