Sonna
Developer

Getting Started

Base URL, authentication, versioning, and response conventions for the Sonna REST API.

The Sonna REST API lets you generate speech (Text-to-Speech) programmatically — the same engines that power the Web and Android apps. This page covers the conventions shared by every endpoint.


Base URL

All API requests are made to:

https://api.sonnalabs.app

Authentication

Authenticate every request with a developer API key (sona_sk_...) in either header:

Authorization: Bearer sona_sk_your_api_key_here
X-API-Key: sona_sk_your_api_key_here

API keys can only be created by paying users (active Pro/Max subscription or a positive PAYG balance). Requests authenticated with an API key also receive a 10% credit discount on Speech. See Authentication.

Keys vs JWT

The Web and Android apps use short-lived JWTs for UI sessions. Direct REST integrations should always use an API key — that's what marks a request as developer ("api") usage and applies the discount.


Path versioning

Sonna's routes are not uniformly versioned — some sit under /api/v1/ and others directly under /api/. Use the exact path documented for each endpoint. The prefixes you'll use:

PrefixUsed by
/api/v1/tts/*Text-to-Speech synthesis, models, voices
/api/v1/user/*Account: credits, subscription, API keys

Request & response conventions

  • Request and response bodies are JSON (Content-Type: application/json).
  • Successful responses include "success": true and return the result directly.
  • Speech synthesis is synchronous — the response carries the finished audio URL; there is no job_id and no polling.
  • Credits are deducted upfront and refunded automatically if synthesis fails. See Errors & Refunds.

Error shape

Failed requests return a non-2xx status with an error message, and where applicable a machine-readable code:

{
  "error": "Too many requests. Please wait."
}
StatusMeaning
401Missing or invalid API key
402Insufficient credits
403Endpoint not accessible with a developer API key
429Rate limit exceeded — see Rate Limits

Next steps

On this page