Text to Speech Synthesize

Synthesize

Generate speech from Arabic text and receive a complete WAV audio file. The entire audio is generated before being returned, ensuring complete audio quality.

1

Endpoint

POST /api/v1/text-to-speech/{model_id}

Requires API key authentication via the x-api-key header. Get a model_id from Models and a voice_id from Voices.

2

Request

Path parameters

ParameterTypeRequiredDescription
model_idstringYesThe model identifier to use for generation

Request bodyContent-Type: application/json

FieldTypeRequiredDescription
voice_idstringYesThe voice ID to use for synthesis
textstringYesThe Arabic text to convert to speech
stabilitynumberYesVoice stability (0.0 to 1.0). Higher values produce more consistent output
speednumberNoSpeech speed (0.7 to 1.2, default 1.0). Values below 1.0 slow down speech, above 1.0 speed it up
streamingbooleanNoOmit or set false (default) for a complete WAV file response. Set true to receive PCM16 chunks as they're generated — see Audio streaming output.
sample_ratenumberNoOutput sample rate in Hz, 800048000 (default 24000). Use 48000 — it's the engine's native rate, so the audio skips downsampling and needs no client-side resampling for WebRTC.
dialectstringNoDialect hint for synthesis: auto (default), emirati, or fusha.
3

Pauses

Insert a silence of a fixed length anywhere in text with a break tag. It works on every text-to-speech endpoint, including streaming and word timestamps.

break tags
"text": "مرحبا بكم <break time=\"3s\"/> في فصيح""text": "أهلا <break time=\"500ms\"/> وسهلا"
PropertyValue
Syntax<break time="<duration>"/>
UnitsRequired. Seconds (3s, 1.5s) or milliseconds (500ms)
Max per tag3s — longer values are clamped down to 3 s
Max per request20 break tags, and about 30 s of pause in total
PlacementAnywhere in the text, repeated as needed, within the limits above
The unit is mandatory, and a tag without one is silently ignored. <break time="3"/> produces no pause, no error, and is not spoken — the request succeeds and the tag simply disappears. Always write 3s or 500ms.

Every one of these limits degrades quietly rather than returning an error. A 10s tag yields roughly 3 s of silence; past 20 tags or about 30 s of accumulated pause, further breaks add little or nothing. Nothing in the response tells you a limit was hit, so treat the numbers above as a budget you stay inside rather than something the API will enforce for you.

The pause is rendered by the model as part of the audio, so it lands inside the returned waveform and counts toward the clip's duration.

Multi-speaker. Break tags are the way to space out speaker turns — put one at the end of a segment's text. There are no separate pause fields on the speakers array.
4

Example request

Leave streaming unset (or false) and save the response body as a WAV file. For chunked output, see Audio streaming output.

curl
curl -X POST "https://api.munsit.com/api/v1/text-to-speech/faseeh-v1-preview" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "voice_id": "ar-najdi-male-2", "text": "مرحبا بك في فصيح كيف يمكنني مساعدتك اليوم", "stability": 0.5, "speed": 1.0, "streaming": false }' \ --output output.wav
5

Response

Status code: 200 OK. The body is a complete WAV audio file.

HeaderValue
Content-Typeaudio/wav
Cache-Controlno-cache
Content-Length<file_size>
6

Error responses

Errors come back as JSON with an errorCode and errorMessage.

StatusError codeExample message
400 Bad Request400xxModel not found: invalid_model_id
402 Payment Required402xxInsufficient wallet balance. Required: $0.05, Available: $0.02
7

Cost calculation

The cost is calculated from the text length (number of characters) and the model cost per character. Cost is deducted from your wallet balance upon successful generation.

Wallet balance. Ensure your wallet has sufficient balance before making requests. Check your balance in the Munsit dashboard.
8

Go further

Working with an AI assistant? Every page is available as Markdown: add .md to the URL, or send an Accept: text/markdown header. For the whole documentation in one request, point it at llms-full.txt; the page index is llms.txt. Or use Copy Page, top right.