Play.HT
    • Stream Audio From Text
      POST
    • Generate Audio From Text
      POST
    • Get Text-To-Speech Job Data
      GET
    • List PlayHT Voices
      GET
    • Create Instant Voice Clone (via file upload)
      POST
    • Create Instant Voice Clone (via file URL)
      POST
    • List Cloned Voices
      GET
    • Delete Cloned Voices
      DELETE
    • Timestamp From Audio
      POST
    • Get Transcription Job Data
      GET
    • Convert Plain Text To Speech
      POST
    • Convert SSML To Speech
      POST
    • Get Conversion Job Status
      GET
    • Get Available Voices
      GET

      Generate Audio From Text

      Develop Env
      https://dev.your-api-server.com
      Develop Env
      https://dev.your-api-server.com
      POST
      /api/v2/tts
      Creates a new Text-to-Speech (TTS) job that converts input text into audio asynchronously.
      The API response varies based on the accept header, providing either the job data or a Server-Sent Events (SSE) text event-stream to track the job's progress.
      If the header contains accept: application/json, the API responds with information about the newly created TTS job:
      Status: 201 - Created
      Header: Location: /api/v2/tts/{id} - the URL for the recently-created job
      Body: Job data (identical to the response from GET /api/v2/tts/{id})
      If the header contains accept: text/event-stream or accept: */*, or the query param ?format=event-stream is present, the endpoint responds with a job creation progress SSE text event-stream:
      Status: 201 - Created
      Headers:
      Location: /api/v2/tts/{id} - the URL for the recently-created job
      Content-Location: /api/v2/tts/{id}?format=event-stream - the URL for the SSE stream
      Body: An event stream (same as /api/v2/tts/{id}?format=event-stream)
      NOTE: The created jobs are ephemeral and will be deleted after 48 hours. The generated files, on the other hand, are permanent and will be available for download for at least 30 days.

      Request

      Header Params

      Body Params application/json

      Examples

      Responses

      🟢200Success
      application/json
      Bodyapplication/json

      🟠400Bad Request
      Request Request Example
      Shell
      JavaScript
      Java
      Swift
      curl --location 'https://dev.your-api-server.com/api/v2/tts' \
      --header 'content-type: application/json' \
      --data '{
        "text": "Hello from a realistic voice.",
        "voice": "s3://voice-cloning-zero-shot/d9ff78ba-d016-47f6-b0ef-dd630f59414e/female-cs/manifest.json",
        "output_format": "mp3",
        "voice_engine": "PlayHT2.0"
      }'
      Response Response Example
      200 - Success
      {
        "id": "f0gZrOKBKL7veJ6o1M",
        "created": "2023-03-04T01:12:03.981Z",
        "input": {
          "text": "Hello! Said the realistic voice.",
          "voice": "s3://voice-cloning-zero-shot/d9ff78ba-d016-47f6-b0ef-dd630f59414e/female-cs/manifest.json",
          "quality": "draft",
          "output_format": "mp3",
          "speed": 1,
          "sample_rate": 24000,
          "seed": null,
          "temperature": null,
          "voice_engine": "PlayHT2.0",
          "emotion": "female_happy",
          "voice_guidance": 3,
          "style_guidance": 20
        },
        "output": {
          "duration": 1.664,
          "size": 35085,
          "url": "https://peregrine-results.s3.amazonaws.com/pigeon/f0gZrOKBKL7veJ6o1M_0.mp3"
        },
        "_links": [
          "{\n  href: 'https://play.ht/api/v2/tts/f0gZrOKBKL7veJ6o1M',\n  method: 'GET',\n  contentType: 'application/json',\n  rel: 'self',\n  description: \"Fetches this job's data. Poll it for the latest status.\",\n}\n"
        ]
      }
      Modified at 2024-07-30 05:55:39
      Previous
      Stream Audio From Text
      Next
      Get Text-To-Speech Job Data
      Built with