API Reference
Generate natural Myanmar speech via REST API
BASE URL
https://api.athanlab.com/api/v1Authentication
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 requests2import base6434response = 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 file15with 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/generategenerateRequest Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Text to synthesize (max 5,000 chars) |
| voice_id | string | No | Voice ID for cloning. Omit for default voice. |
| gender | "male" | "female" | No | Voice gender (when no voice_id) |
| pace | "slow" | "normal" | "fast" | No | Speaking pace. Default: normal |
Response
JSON
1{2 "id": "gen_abc123def456",3 "audio": "UklGRi4AAABXQVZFZm10...", // base64 WAV4 "format": "wav",5 "sample_rate": 48000,6 "duration": 3.5,7 "watermarked": true,8 "chars_used": 150,9 "chars_remaining": 199985010}
Voices
GET
/v1/voicesvoicesGET
/v1/voices/:id/previewvoicesResponse
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/usageJSON
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
429withRetry-Afterheader
Error Codes
| Status | Code | Description |
|---|---|---|
| 400 | — | Bad request — invalid parameters |
| 401 | AUTH_MISSING | Missing or invalid API key / token |
| 403 | CHARS_EXCEEDED | Character limit exceeded |
| 403 | DEVELOPER_NOT_APPROVED | Developer account not approved |
| 403 | ACCOUNT_BANNED | Account suspended |
| 404 | VOICE_NOT_FOUND | Voice ID not found |
| 429 | RATE_LIMITED | Rate limit exceeded (60/min) |
| 500 | GENERATION_FAILED | Server error — retry |
Error Response Format
JSON
1{2 "error": "Character limit exceeded (2,000,000/2,000,000)",3 "code": "CHARS_EXCEEDED"4}
Need help? support@athanlab.com
athanlab.com