One key for the speech API, studio endpoints for signed-in apps, and a signed provenance record for every render. Keys are created on the API & Docs screen in the app.
Your first voice in three steps
Make one file first, then read the rest. Free trial credits cover it.
1
Get a key
Sign in, open API & Docs in the app and create a key with the speech scope. Copy the secret now: it is shown only once.
speech.mp3 is Aram, the warm Sorani narrator from the voice library, saying “Welcome to RegaLabs”. To use another voice, change voice to any id from GET /api/public/voices.
Authentication
One header, one key. Keys are created on the API & Docs screen and spend your account's credits — free trial, subscription or purchased — from the same balance as the app.
Parameter
Type
Required
Description
Authorization
Bearer rega_live_…
yesRequired
The key. A malformed or revoked key is 401 before anything else runs.
Idempotency-Key
string ≤ 160
Required: no
Required in production on POST /api/v1/tts and POST /v1/agent/respond; optional on the speech API. A key is held for 24 hours: the same request again returns the first response instead of charging twice, a different request under it is 409, and so is a retry while the first is still running. A request that failed frees its key.
Content-Type
application/json | application/octet-stream
yesRequired
JSON for metadata requests; original-recording parts carry raw bytes. Multipart speech uploads use their generated form-data boundary.
What a key can reach
A key authenticates the speech API (/v1/audio/speech, /v1/audio/transcriptions, /v1/audio/transcriptions/stream, /v1/audio/stream), the agent API (POST /v1/agent/respond), queued speech (/api/v1/tts), original-recording transcription and credit purchases for the key itself. With the matching scope it also reaches the agent order feed, the agent settings and knowledge base, the business catalogue, the outbound dialer and follow-up routes, and the call log and its statistics. Voice cloning, voice design, captioned video, key management and workspace administration use a signed-in session.
Keys belong on your server
Browsers may call only the speech API and the website chat from another site. Never ship a key in web or app code: anyone who reads it can spend your credits. A signed-in session that changes something must also send the app’s Origin, as the session examples on this page do.
GET/api/healthz
Service health
A minimal liveness check. Dependency and deployment details are available only to authenticated operators.
curl
curl https://api.regalabs.dev/api/healthz
response
{ "ok": true }
Key scopes
Reading your callers’ orders, changing what the agent says or knows, replacing your catalogue, running your dialer, queuing follow-ups and reading the call log each take a scope chosen when the key is created. A new key must name at least one scope and gets exactly what it names; nothing is granted by default.
Parameter
Type
Required
Description
agent:orders
scope
Required: no
Read and acknowledge the orders the agent took: callers’ names, numbers and addresses.
agent:config
scope
Required: no
Change the agent’s settings (instructions, escalation number, voice, call recording) and add or remove knowledge-base documents. With a key, reading the settings and their saved versions needs it too.
catalogue:write
scope
Required: no
Replace the business catalogue and inventory. Any key of the account may read them.
outbound
scope
Required: no
Let your dialer claim campaign contacts (GET /api/v1/outbound/campaigns/{id}/next) and report each attempt (POST /api/v1/outbound/contacts/{id}/outcome).
messages
scope
Required: no
Queue a post-call follow-up (POST /api/v1/messages/follow-up) and read the outbox and the templates.
calls:read
scope
Required: no
Read the call log, one call’s transcript and the call statistics (GET /api/v1/calls, /api/v1/calls/{id}, /api/v1/calls/stats).
A key without the scope a route needs is 403 API_KEY_SCOPE_REQUIRED. Scopes are fixed when the key is made; to change them, create a new key and revoke the old one.
Keys made before 2026-11-09 keep the access they had: one created without a scope list carries agent:orders, agent:config and catalogue:write, and outbound, messages and calls:read reach only keys that name them.
Capability scopes
Four more scopes limit what a key may spend credits on. A new key may use only the ones it names: ["speech"] is a speech-only key, and a key that names none of them can spend nothing. A key made before 2026-11-09 that names none of them may still use all four. Test keys pass all four. Every key can still buy credits for itself.
Parameter
Type
Required
Description
speech
scope
Required: no
Generate speech: /v1/audio/speech, /v1/audio/stream and queued speech (/api/v1/tts).
transcribe
scope
Required: no
Transcribe: /v1/audio/transcriptions, /v1/audio/transcriptions/stream and original-recording jobs (/api/transcribe/file-jobs).
knowledge:read
scope
Required: no
Read the knowledge base (GET /api/v1/knowledge).
agent:respond
scope
Required: no
Call the agent API (POST /v1/agent/respond).
A key without the capability a route needs is refused: 403 API_KEY_SCOPE_REQUIRED on the app’s routes, and insufficient_scope in the speech API’s own envelope on /v1/audio/* and /v1/agent/respond, including the streams. Send capability scopes in the same scopes list as the others.
POST/api/keys
Create a key
Signed-in session. The API & Docs screen calls this for you; call it yourself to choose scopes. The secret is in the response once and is never shown again. Five keys an hour per account.
At least one. The key may do exactly what is named: ["speech"] is speech only. Omitted or [] is 400 VALIDATION_FAILED; nothing is granted by default.
spendCapCredits
integer 0–100,000,000 | null
Required: no
The most credits the key may ever spend, counted over its whole life. A request that would pass it is refused with 402 and nothing is charged. Omitted or null: no limit beyond the account’s balance.
expiresInDays
integer 1–1830 | null
Required: no
The key stops working this many days from now, at most five years. Omitted or null: it never expires. Send this or expiresAt, not both.
expiresAt
ISO 8601 date-time | null
Required: no
The older form of expiresInDays: an ISO 8601 date and time with offset, in the future and at most five years ahead.
Signed-in session. Every key spends the account’s one balance, so a cap is what stops a leaked key from emptying it. A key made since 2026-11-09 counts everything it has ever spent; an older key counts credits spent in the current calendar month (UTC).
Parameter
Type
Required
Description
spendCapCredits
integer ≥ 0 | null
yesRequired
The most this key may spend: over its whole life for a key made since 2026-11-09, in a calendar month for an older key. null removes the cap. A request that would pass it is refused with 402 and nothing is charged.
Limits
Per-route limits and the gateway-wide limits are counted per key: two keys have separate allowances, and one key used from several connections has one.
/v1/audio/speech, /v1/audio/transcriptions and /v1/agent/respond: 60 requests a minute per key, each.
/v1/audio/stream: two open streams per key and four per account; one more is closed with concurrency_limit.
/v1/audio/transcriptions/stream: two open streams per key and four per account, counted apart from /v1/audio/stream; one more is closed with concurrency_limit.
Queued speech (POST /api/v1/tts): five jobs a minute per account, one queued or running at a time, within a daily generation budget.
Every key is also limited to 240 requests a minute across all routes. Requests without a working key are limited to 240 a minute per signed-in session, or per address when signed out, and to 600 a minute per address; key requests do not count against that address limit. An address that sends more than 30 requests a minute with keys that do not work is refused until the minute ends. A refused request is 429 RATE_LIMITED with a Retry-After header.
Request bodies: 1 MB for most JSON, 2 MB for queued speech, 8 MB of audio per transcription request and 512 KB for /v1/agent/respond; original recordings upload in 8 MB parts. A larger body is 413.
Rega is open for set hours each day. Outside them, or while a service is paused, new work is 503 OUTSIDE_HOURS or SERVICE_PAUSED with a Retry-After header; polling and downloads keep working.
A key works only once its account has confirmed its age in the app; until then every request is 403 AGE_CONFIRMATION_REQUIRED.
Removing a public route is announced at least 180 days ahead with Deprecation, Sunset and Link headers on the affected responses; the Link header points to this page. The routes renamed on 2026-11-06 already answer at their new paths and keep answering at their former ones, with these headers, until 2027-05-06.
Error contract
Gateway errors share one shape, { error, message, fields? }: a machine-readable code, a human message and, when a field is invalid, the fields at fault. The speech API under /v1/audio and the agent API under /v1/agent keep their own envelope, described in their chapters; a refusal made before a request reaches them — a rate limit, opening hours, age confirmation — still uses this one.
error codes
{ "VALIDATION_FAILED": "A field is invalid; fields lists which.", "INVALID_JSON": "The body is not valid JSON.", "BODY_TOO_LARGE": "The body is over this route's size limit.", "SIGN_IN_REQUIRED": "No valid session or API key.", "API_KEY_SCOPE_REQUIRED": "The key lacks the scope this route needs.", "PBX_SIGNATURE_REQUIRED": "Only a signed PBX may open a call.", "AGE_CONFIRMATION_REQUIRED": "Confirm your age in the app first.", "ACCOUNT_BANNED": "Account is no longer active.", "ACCOUNT_INACTIVE": "The account stopped being active; nothing was saved.", "REAUTH_REQUIRED": "Confirm with your password or code, or sign in again.", "STUDIO_CLOSED": "The studio is closed for maintenance.", "NOT_FOUND": "No such route, or nothing of yours at it.", "RATE_LIMITED": "Too many requests; wait for Retry-After.", "OUTSIDE_HOURS": "Outside today's opening hours; see opensAt.", "SERVICE_PAUSED": "This service is paused; wait for Retry-After.", "CREDITS_EXHAUSTED": "Not enough credits for this generation.", "SPEND_CAP_REACHED": "The key's spend cap is reached.", "PLAN_JOB_LIMIT": "The job is longer than your plan allows.", "VOICE_CLONE_LIMIT_EXCEEDED": "Plan's voice-clone allowance is used up.", "VOICE_TIER_UNAVAILABLE": "A voice, or an @voice switch, is not on that tier.", "IDEMPOTENCY_KEY_REQUIRED": "Paid generations need an Idempotency-Key header.", "IDEMPOTENCY_KEY_REUSED": "That key was used for different content.", "REQUEST_IN_PROGRESS": "The first request with that key is still running.", "OCR_NO_TEXT": "No text could be read from the document.", "OCR_UNAVAILABLE": "The document reader is down; try again shortly."}
Besides the general limits, RATE_LIMITED also answers wrong passwords or two-factor codes when you confirm a sensitive change (they count against one budget per account), a fourth verification email to one address within an hour, more than 30 normalizer or script-parser requests a minute per account, and more than 20 exports (POST /api/v1/tts/export) in 10 minutes per account. Wait for Retry-After before trying again.
The speech API and the agent API answer a key that lacks a capability scope with insufficient_scope in their own envelope; every other route answers API_KEY_SCOPE_REQUIRED.
Local dev
Run npm run stack and hit http://127.0.0.1:8787/api/v1/* directly — the gateway proxies the signed inference channel for you.
Studio errors
The signed-in app meets a few codes of its own, from routes an API key cannot reach: saved projects, campaign set-up, test calls, erasing a caller and coupons. They share the same shape, and each message is written to be shown as it is.
studio error codes
{ "PROJECT_QUOTA": "200 projects or 8 MB of project data; delete one.", "CAMPAIGN_LIMIT": "200 campaigns, or 10 running at once.", "CONTACT_LIMIT": "50,000 contacts a campaign, or 250,000 in all.", "TENANT_CALL_LIMIT": "Calls you started are still connecting.", "CALL_IN_PROGRESS": "That number is on a call; erase it afterwards.", "ERASURE_NOT_RECORDED": "The erasure could not be recorded; try again.", "ERASURE_INCOMPLETE": "The erasure did not finish; try again.", "COUPON_APPLIES_AT_CHECKOUT": "A percent code comes off the price, not the balance.", "COUPON_PENDING_CHECKOUT": "A checkout you started is holding this code.", "COUPON_ALREADY_REDEEMED": "Code already used on this account."}
Archived campaigns do not count toward the 200, and the campaign list returns up to 200, so archiving an old campaign makes room for a new one.
TENANT_CALL_LIMIT (429) means test calls you started have not been joined yet: join or end one. It is not the shared call capacity, which is CALL_CONCURRENCY_LIMIT.
Erasing a caller (DELETE /api/v1/outbound/callers/{msisdn}) accepts an Iraqi number in any spelling, an international number in E.164 form and Eastern Arabic or Persian digits; anything else is 400 with “That is not a valid phone number.” CALL_IN_PROGRESS is 409; ERASURE_NOT_RECORDED and ERASURE_INCOMPLETE are 503.