API Reference

Generate natural Myanmar speech via REST API

BASE URLhttps://api.athanlab.com/api/v1

Authentication

All /v1 endpoints require an approved developer account.

Option 1: API Key (recommended)

Create keys in Settings and pass via X-API-Key header:

cURL
1curl -X POST https://api.athanlab.com/api/v1/generate \
2 -H "X-API-Key: ak_live_your_key_here" \
3 -H "Content-Type: application/json" \
4 -d '{"text": "မင်္ဂလာပါ"}'

Option 2: Firebase JWT

Pass your Firebase ID token via Authorization: Bearer header:

cURL
1curl -X POST https://api.athanlab.com/api/v1/generate \
2 -H "Authorization: Bearer YOUR_FIREBASE_ID_TOKEN" \
3 -H "Content-Type: application/json" \
4 -d '{"text": "မင်္ဂလာပါ"}'
Warning
  • API keys are shown once on creation — store them securely
  • Never expose keys in client-side code or public repos
  • Rate limit: 60 requests/minute per key (fixed)
  • API usage shares your plan character budget

Quick Start

Generate your first audio in one request:

cURL
1curl -X POST https://api.athanlab.com/api/v1/generate \
2 -H "X-API-Key: ak_live_your_key_here" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "text": "မင်္ဂလာပါ။ ဒီနေ့ ဘယ်လိုနေပါသလဲ။",
6 "gender": "female",
7 "pace": "normal"
8 }'
Tip
Response is JSON with base64-encoded WAV audio in the audio field. Decode it to get the audio file.

Python

Python
1import requests
2import base64
3
4response = requests.post(
5 "https://api.athanlab.com/api/v1/generate",
6 headers={"X-API-Key": "ak_live_your_key_here"},
7 json={
8 "text": "မင်္ဂလာပါ။ ဒီနေ့ ဘယ်လိုနေပါသလဲ။",
9 "gender": "female",
10 "pace": "normal"
11 }
12)
13data = response.json()
14# Save audio to file
15with open("output.wav", "wb") as f:
16 f.write(base64.b64decode(data["audio"]))

Node.js

Node.js
1const response = await fetch("https://api.athanlab.com/api/v1/generate", {
2 method: "POST",
3 headers: {
4 "X-API-Key": "ak_live_your_key_here",
5 "Content-Type": "application/json",
6 },
7 body: JSON.stringify({
8 text: "မင်္ဂလာပါ။ ဒီနေ့ ဘယ်လိုနေပါသလဲ။",
9 gender: "female",
10 pace: "normal",
11 }),
12});
13const { audio, duration, sample_rate } = await response.json();
14// audio is base64-encoded WAV

Generate Speech

POST/v1/generategenerate

Request Body

ParameterTypeRequiredDescription
textstringYesText to synthesize (max 5,000 chars)
voice_idstringNoVoice ID for cloning. Omit for default voice.
gender"male" | "female"NoVoice gender (when no voice_id)
pace"slow" | "normal" | "fast"NoSpeaking pace. Default: normal

Response

JSON
1{
2 "id": "gen_abc123def456",
3 "audio": "UklGRi4AAABXQVZFZm10...", // base64 WAV
4 "format": "wav",
5 "sample_rate": 48000,
6 "duration": 3.5,
7 "watermarked": true,
8 "chars_used": 150,
9 "chars_remaining": 1999850
10}

Voices

GET/v1/voicesvoices
GET/v1/voices/:id/previewvoices

Response

Returns your cloned voices and AthanLab official voices:

JSON
1{
2 "voices": [
3 { "id": "abc123", "name": "My Narrator", "category": "audiobook", "is_default": true, "source": "user" },
4 { "id": "def456", "name": "AthanLab News", "category": "news", "is_default": false, "source": "athanlab" }
5 ]
6}

Usage & Limits

GET/v1/usage
JSON
1{
2 "plan": "studio",
3 "plan_name": "Studio",
4 "chars": { "used": 150000, "limit": 2000000, "remaining": 1850000 },
5 "voices": { "used": 5, "limit": -1 },
6 "chars_reset_at": "2026-05-17T00:00:00Z"
7}
Note

Rate Limits

  • 60 requests/minute per API key or JWT user
  • Headers: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
  • Exceeded: HTTP 429 with Retry-After header

Error Codes

StatusCodeDescription
400Bad request — invalid parameters
401AUTH_MISSINGMissing or invalid API key / token
403CHARS_EXCEEDEDCharacter limit exceeded
403DEVELOPER_NOT_APPROVEDDeveloper account not approved
403ACCOUNT_BANNEDAccount suspended
404VOICE_NOT_FOUNDVoice ID not found
429RATE_LIMITEDRate limit exceeded (60/min)
500GENERATION_FAILEDServer error — retry

Error Response Format

JSON
1{
2 "error": "Character limit exceeded (2,000,000/2,000,000)",
3 "code": "CHARS_EXCEEDED"
4}