Authentication
Send your API key in theX-API-KEY header on every request, to the base URL https://api-eg.olimi.ai. See API Authentication.
You only ever see the audio that belongs to the company your API key is issued to.
How it works
Creating audio runs in the background:- Create: Create audio returns straight away with
status: "pending". - Poll: call Get audio every few seconds until
statusiscompletedorfailed. - Download: once it’s
completed, download the file fromattachment.url. The link expires after one hour; call Get audio again for a fresh one.
Choosing a voice and language
A request needs alanguageId and a voiceId. Fetch them once and cache them; they don’t change.
- Language: list the languages available for speech, with List languages. It needs no API key.
- Voice: list the voices for the language you picked, with List voices.
voice_language_not_compatible.
Audio fields
Responses also carry internal fields. They may change without notice, so rely only on the fields listed on this page.
Status values
Attachment object
Audio format
The file is a WAV (RIFF/WAVE) holding signed 16-bit little-endian PCM, mono. The sample rate varies by voice, because different voices run on different engines. You’ll see 24,000 Hz or 16,000 Hz. Don’t hard-code it; read it from the WAV header, which every audio library does for you:Tips
- Normalise numbers before sending. Spell out digits, currencies, dates and phone numbers as words (
"1234"→"ألف ومتين أربعة وتلاتين"). Written-out Arabic is pronounced far more reliably than raw numerals. - Split long text. Send sentences or paragraphs rather than whole documents. Shorter requests finish faster and fail less often.
- Sanity-check
duration. Compare it with what you’d expect for the length of your text. A wildly different value means that request went wrong; delete it and create it again.
Errors
Always branch onstatusCode first. Most errors also carry a machine-readable errorCode:
If the engine behind a voice fails, you don’t get an error. The audio’s
status becomes failed instead.
Validation errors (422) have a different body. message is a list of what went wrong, and there’s no errorCode:
message text is for humans and may change, so don’t match on it.