Text-To-Speech API Reference
This page covers all steps to integrate text-to-speech (TTS) API into your system.
Get your API keys
Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.
You can generate an API key from your user dashboard in Miragic website anytime.

Authentication
All requests must include the X-API-Key header containing your assigned API key.
How To Create Image Generation Task
POST /api/v1/text-to-speech/generate
This API starts the TTS process by creating a task that generates an audio file containing speech.
Request
text
String
Yes
Input text to generate audio.
voice
String
Yes
This value can be set to alloy, amuch, ash, ballad, dan, echo, onyx, verse, coral, elan, fable, nova, sage, shimmer, etc.
Request Example
Response
Response Field
jobId
String
A unique identifier used to track task status and retrieve results.
status
String
The initial status will be PENDING. Use the Get Task Status API to track progress.
success
Logic
true or false to indicate whether task is successful or not.
message
String
To indicate the status of task
How To Get Task Status
GET /api/v1/text-to-speech/jobs/:jobId
This API lets you check the status of a TTS task and retrieve the final result. Because the TTS process runs asynchronously, you’ll need to poll this endpoint until the task is finished.
Task Status:
PENDING
Task is currently being processed.
0~99%
Continue polling
COMPLETED
Task has finished successfully.
100%
Download result using download_signed_url
FAILED
Task processing failed.
N/A
Check error details and retry if needed
Request:
URL Parameters
JobId
String
Yes
This value indicates task ID assigned by requesting TTS process API
Request Example
Response Example
Completed Status (200):
Response Fields
id
String
Unique identifier of the task
status
String
Current status of the task (PENDING/COMPLETED/FAILED)
audio_link
String
URL to result audio file.
createdAt
Number
Unix timestamp when processing is created
Full Code Example
The following code lines are quick example to use our API in multiple languages.
Last updated