Introduction
One voice API: the base URL, the endpoints, and how to switch model and voice in a request
The Voice213 API is a REST API for voice-overs in Algerian, Tunisian and Libyan darija. It's built around one endpoint: send your text to POST /tts, and choose the voice model with model and the voice with voice. Switching from a fast everyday voice to the most expressive one is a one-word change in the request. It takes and returns JSON, and authenticates every request with an API key.
Base URL
All endpoints live under one base URL:
https://api.voice213.com/api/v1One endpoint, any model, any voice
curl -X POST https://api.voice213.com/api/v1/tts \
-H "Authorization: Bearer $VOICE213_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "مرحبا بيكم في Voice213", "model": "voice213-pro-2", "voice": "nariman"}'modelpicks one of the five voice models, fromvoice213-lite(the default) tovoice213-pro-2. Each has its own price per character.voicepicks one of the 30 voices. Every voice works with every model.dialectpicks Algerian (the default), Tunisian or Libyan.
GET /models and GET /tts/voices list what you can choose from, and POST /tts/estimate tells you what a text will cost on a model before you generate it. Don't have a key yet? See Get Your API Key.
Endpoints
| Method | Path | Description | Price |
|---|---|---|---|
POST | /tts | Turn a script into speech, with any model and any voice | Per character, by model |
POST | /tts/estimate | What a voice-over will cost, before you generate it | Free |
GET | /models | List the voice models and their prices | Free |
GET | /tts/voices | List the voices | Free |
GET | /tts/tones | List the tone directions | Free |
GET | /me | Your API credit, and your key's name and limits | Free |
GET | /health | Check that the API is up (at https://api.voice213.com/health) | Free |
The API is for voice. Ad scripts, tone directions written for you, tashkeel, product images and landing pages are made in the web app. The endpoints that used to do them through the API (/generate-script, /generate-angles, /generate-tone, /tashkiil, /product-image and /landing-page) now answer 410 with the code ENDPOINT_REMOVED. See Errors.
Requests
- Send JSON bodies with
Content-Type: application/json, UTF-8 encoded, up to 25 MB. Without that header the body is ignored, and the request fails as if it were empty. - Voice-overs are billed per character of text, including spaces and punctuation, with a minimum of 100 characters per request. Tone directions in parentheses aren't billed when they're at most 100 characters long.
- A voice-over takes up to 5,000 words, tone directions included, and needs something to speak: a text made only of tone directions is refused with
400 EMPTY_TEXT. - Tone directions, spaces and invisible characters can't outweigh the spoken text: a text may be at most twice its billable characters plus 1,000 characters long, or it's refused with
400 TEXT_TOO_LONG.
Responses
Successful responses are JSON. A voice-over reports the model and voice that spoke, the characters billed, what it cost and what's left of your API credit, in Algerian dinars:
{
"success": true,
"audioUrl": "https://pub-5d56f47943d84bbda9b38f1a6f9962e6.r2.dev/tts/66f1c0a4e1b2c3d4e5f60718/1727254800000-9f3c2a7b1d4e6f80.mp3",
"model": "voice213-pro-2",
"voice": "nariman",
"cost": 1.2,
"currency": "DZD",
"chars": 22,
"billableChars": 100,
"remainingCredit": 4998.8,
"words": 4,
"quality": "pro2",
"dailyProCount": 0,
"dailyProLimit": null
}Audio comes back as a link to an MP3 file or, in the inline format, as a WAV data URL. Errors use standard HTTP status codes and a JSON body with a readable message:
{
"error": "Missing 'text' in request body"
}See Errors for every status code and which ones to retry.
Call it from your server
Use the API from backend code. It doesn't accept cross-origin requests from other websites' browser code, and a key in front-end code would be exposed to anyone who opens your app. If your front end needs audio, have it call your server, and let your server call Voice213. See Going to Production.
Pricing and limits
The API is open on every plan, Free included. Requests are paid from prepaid API credit in dinars, separate from your plan's credits, and every key has the same limits: 600 requests a minute, 1,000 a day and 20 voice-overs running at once. See API Pricing & Limits and Rate Limits.
Was this page helpful?