This API provides a text-to-speech (TTS) service that converts written text into high-quality spoken audio. The service is powered by Microsoft Edge's TTS engine, allowing developers to easily integrate voice generation into their applications.
API Endpoints
1. Generate Speech
This is the core endpoint for converting a string of text into an audio file. It returns a temporary URL to download the generated MP3 file.
- Functionality: Converts text to speech.
- Method:
POST
- Endpoint:
/tts/v1/generate
Query Parameters
Parameter | Required | Type | Description & Example |
---|---|---|---|
apikey | Yes | string | Your unique API Key for authentication. |
text | Yes | string | The text you want to convert to speech. Example: Hello, world! |
lang | No | string | The language code for the voice. Defaults to en-US . |
gender | No | string | The preferred gender of the voice. Used to select a voice when voice is not specified. Example: female |
voice | No | string | The specific voice name to use. This parameter has the highest priority. If provided, it overrides lang and gender . Example: en-US-JennyNeural |
Available lang
values:
en-US
(American English)zh-CN
(Mandarin Chinese)zh-TW
(Taiwanese Mandarin)ja-JP
(Japanese)ko-KR
(Korean)fr-FR
(French)de-DE
(German)it-IT
(Italian)
Responses
Successful Response (Code 200)
A successful request returns a JSON object containing a direct download link for the audio file.
JSON
{ "code": "200", "msg": "Request processed successfully", "data": { "success": true, "url": "https://storage.juheapi.com/tts-audio-bucket/20250625/c4d5e6f7-a8b9-4c1d-8e7f-9a0b1c2d3e4f.mp3?Expires=1719369635&Signature=ABC...", "message": "Text to speech conversion was successful. The audio file is available for download.", "selected_voice": "en-US-Standard-F" } }
data.url
: The temporary URL to download the generated MP3 audio file. Note that this link is time-sensitive.data.selected_voice
: The actual voice model that was used for the conversion.
Error Response
If the request fails, the API will return an error code and message.
JSON
{ "code": "string", "msg": "string" }
2. List Voices
This endpoint allows you to retrieve a list of all available voices supported by the service.
- Functionality: Lists all available voices.
- Method:
GET
- Endpoint:
/tts/v1/list-voices
(Note: Use this endpoint to find the exact names for the voice
parameter in the generation request.)
⚠️ Important Considerations
- API Key is Mandatory: Every request to the
/generate
endpoint must include a validapikey
. - Voice Selection: For consistent results, it is highly recommended to use the
/list-voices
endpoint to find a specificvoice
name and use it in your requests. If you don't specify avoice
, the system will select one based on thelang
andgender
parameters. - URL Expiration: The audio
url
returned in a successful response is temporary and will expire. You should download the file to your own storage if you need to use it permanently. Do not use this URL for long-term embedding.