Skip to content

The Voice213 API authenticates requests with API keys. Send your key as a Bearer token in the Authorization header of every request:

curl -X POST https://api.voice213.com/api/v1/tts \
  -H "Authorization: Bearer $VOICE213_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "مرحبا بيكم", "model": "voice213-lite", "voice": "nariman"}'

You can send the key in an x-api-key header instead:

curl https://api.voice213.com/api/v1/me -H "x-api-key: $VOICE213_API_KEY"

When a request has both headers, the Authorization header wins. Write Bearer with a capital B: with any other spelling, Voice213 ignores the header.

​Who can use the API

Everyone. The API is open on every plan, Free included, and every key gets the same limits. What you need is API credit: a prepaid balance in dinars that pays for your voice-overs, separate from your plan's credits. A key keeps working whatever happens to your plan.

​Your API key

  • Create your key on the API Keys page of the Developer workspace.
  • A key starts with sk_live_. It's shown once, when you create it; afterwards the page shows only its last eight characters. A lost key can't be shown again: delete it and create a new one.
  • An account has one API key. To replace it, delete the old one first.
  • You can switch the key off and on again. While it's off, requests that use it are refused.
  • Voice213 can switch off API access for an account. Its key is then refused with 403 and the code API_ACCESS_BLOCKED, and it can't create a key or switch one back on. See API access switched off.
  • The API Keys page shows when the key last made a successful voice-over (estimates, GET /me and the catalogue endpoints don't update it). Usage shows your calls day by day.

​Deleting a key

Delete the key on the API Keys page when it's no longer needed or may have leaked. It stops working immediately, and requests that use it get 401 Invalid or inactive API key. This can't be undone.

​Authentication errors

StatusErrorCause
401Missing API key. Pass it as 'Authorization: Bearer sk_live_...'The request has no key: no Authorization: Bearer header and no x-api-key header.
401Invalid or inactive API keyThe key is wrong, incomplete, switched off or deleted.
403Account deactivatedThe account that owns the key is deactivated or suspended. Contact support.
403API_ACCESS_BLOCKED (in code)API access is switched off for the account that owns the key. The message in error is in Arabic. Contact support.
429Rate limit exceeded: RPM limit exceededThe key reached its requests per minute. See Rate Limits.
429Rate limit exceeded: Daily limit exceededThe key reached its requests per day.
429Rate limit exceeded: Concurrent request limit exceededThe key already has 20 voice-overs running (POST /tts only).
500Internal server error during authenticationSomething went wrong on our side while checking the key. Retry.

​Keeping keys safe

An API key gives full access to your API credit. Keep it secret.

  • Store the key in an environment variable or a secret manager, never in source code.
  • Use it only in server-side code. Never put it in websites, mobile apps or anything else you ship to users.
  • If the key may have leaked, switch it off right away, then delete it and create a new one.

Was this page helpful?