Generate Audio From Text

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.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Query Params
string
enum

The format query is an optional convenience parameter that allows controlling the response format without having to set the accept header. If used, the format query param overrides what is set by the accept header.

If format is omitted, the accept header is used to determine the response format.

Allowed:
Body Params
string
required
Defaults to Hello Play!

The text to be converted to speech. Limited to 20k characters when voice_engine is set to Play3.0-mini, or 2000 characters otherwise.

string
required
Defaults to s3://voice-cloning-zero-shot/d9ff78ba-d016-47f6-b0ef-dd630f59414e/female-cs/manifest.json

The unique ID for a PlayHT or Cloned Voice.

string
enum
Allowed:
string
enum
Defaults to mp3
Allowed:
number
0.1 to 5

Control how fast the generated audio should be. A number greater than 0 and less than or equal to 5.0

number
8000 to 48000

A number greater than or equal to 8000, and must be less than or equal to 48000

number | null
≥ 0

An integer number greater than or equal to 0. If equal to null or not provided, a random seed will be used. Useful to control the reproducibility of the generated audio. Assuming all other properties didn't change, a fixed seed should always generate the exact same audio file.

number | null
0 to 2

A floating point number between 0, inclusive, and 2, inclusive. If equal to null or not provided, the model's default temperature will be used. The temperature parameter controls variance. Lower temperatures result in more predictable results, higher temperatures allow each run to vary more, so the voice may sound less like the baseline voice.

string | null
enum
Defaults to PlayHT2.0

The voice engine used to synthesize the voice.

Allowed:
string | null
enum

An emotion to be applied to the speech. Only supported when voice_engine is set to PlayHT2.0, and voice uses that engine.

number | null
1 to 6

A number between 1 and 6. Use lower numbers to reduce how unique your chosen voice will be compared to other voices. Higher numbers will maximize its individuality. Only supported when voice_engine is set to PlayHT2.0, and voice uses that engine.

number | null
1 to 30

A number between 1 and 30. Use lower numbers to to reduce how strong your chosen emotion will be. Higher numbers will create a very emotional performance. Only supported when voice_engine is set to PlayHT2.0, and voice uses that engine.

Headers
string
enum
Defaults to text/event-stream

The accept header controls the response format. If accept: application/json or accept: */*, returns the job data. If accept: text/event-stream (or ?format=event-stream), streams the text-events for the progress, similar to the POST /api/v2/tts endpoint.

Allowed:
Responses

Language
Credentials
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
text/event-stream
application/json