API Reference
Base URL: https://api.mayaresaerch.com
All requests must include an Authorization: Bearer YOUR_API_KEY header. API keys are issued at registration and can be rotated from the dashboard.
Authentication
Pass your API key in the Authorization header on every request:
Authorization: Bearer myr_live_xxxxxxxxxxxxxxxxxxxxxxxx
Keys are prefixed myr_live_ for production and myr_test_ for sandbox. Test keys return synthesized audio with a short watermark tone at the beginning.
POST /v1/synthesize
Synthesize text to audio and return the complete audio file in a single response. Best for short inputs where buffering the full file is acceptable. For real-time or user-facing applications, prefer the streaming endpoint.
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
text |
string | Yes | The text to synthesize. Max 5,000 characters. Accepts plain text or SSML. |
language |
string | Yes | BCP-47 language code. See GET /v1/languages for supported values. |
voice_id |
string | No | Voice identifier. Defaults to the recommended voice for the language. |
format |
string | No | Output audio format: mp3 (default), pcm_16, ogg. |
sample_rate |
integer | No | Sample rate in Hz. Default: 24000. Supported: 8000, 16000, 22050, 24000, 44100. |
speed |
float | No | Playback speed multiplier. Range: 0.5 to 2.0. Default: 1.0. |
Example request
POST /v1/synthesize
Content-Type: application/json
Authorization: Bearer myr_live_xxxx
{
"text": "नमस्ते, आज का मौसम अच्छा है।",
"language": "hi-IN",
"format": "mp3"
}
Response
Returns binary audio data with content type matching the requested format (audio/mpeg, audio/pcm, or audio/ogg).
Response headers include:
Content-Type: audio/mpeg
X-Maya-Characters: 23
X-Maya-Language: hi-IN
X-Maya-Voice: hi-female-1
X-Maya-Latency-Ms: 142
POST /v1/synthesize/stream
Synthesize text and stream audio chunks as they are generated. The server returns chunks progressively, allowing clients to begin playback before the full synthesis is complete. First-byte latency is typically under 180ms for inputs up to 500 characters.
Request body
Identical to POST /v1/synthesize with one additional parameter:
| Parameter | Type | Required | Description |
|---|---|---|---|
text |
string | Yes | Text to synthesize. Max 10,000 characters in streaming mode. |
language |
string | Yes | BCP-47 language code. |
format |
string | No | mp3 (default) or pcm_16. OGG not supported in streaming mode. |
chunk_size |
integer | No | Target chunk size in bytes. Default: 4096. Range: 1024 to 32768. |
Example request
POST /v1/synthesize/stream
Content-Type: application/json
Authorization: Bearer myr_live_xxxx
{
"text": "مرحبا بكم في تطبيقنا الجديد.",
"language": "ar-EG",
"format": "pcm_16"
}
Streaming response
The response uses HTTP chunked transfer encoding. Audio bytes are sent as soon as synthesis chunks are ready. Clients should open a connection and pipe the response bytes directly to an audio player.
import maya_tts
client = maya_tts.Client("myr_live_xxxx")
with client.synthesize_stream(
text="مرحبا بكم في تطبيقنا الجديد.",
language="ar-EG"
) as stream:
for chunk in stream:
audio_player.write(chunk)
GET /v1/languages
Returns the list of supported languages and their available voices.
No request body
This endpoint takes no body. Authentication header required.
Example response
{
"languages": [
{
"code": "hi-IN",
"name": "Hindi",
"native_name": "हिन्दी",
"script": "Devanagari",
"status": "ga",
"voice_count": 4
},
{
"code": "ar-EG",
"name": "Arabic (Egyptian)",
"native_name": "عربي (مصري)",
"script": "Arabic",
"status": "ga",
"voice_count": 2
}
]
}
GET /v1/voices
Returns all available voices with metadata. Filter by language using the language query parameter.
Query parameters
| Parameter | Type | Description |
|---|---|---|
language |
string | Optional BCP-47 code to filter voices. Example: ?language=ta-IN |
Example response
{
"voices": [
{
"id": "hi-female-1",
"language": "hi-IN",
"gender": "female",
"style": "conversational",
"is_default": true
}
]
}
Error codes
The API returns standard HTTP status codes. All error responses include a JSON body with a code and message field.
| HTTP Status | Code | Description |
|---|---|---|
400 |
invalid_request |
Missing or malformed parameter. Check message for details. |
401 |
invalid_key |
API key missing, expired, or malformed. |
403 |
language_not_available |
The requested language is not included in your current plan. |
413 |
text_too_long |
Input text exceeds the character limit for the requested endpoint. |
429 |
rate_limit_exceeded |
Too many requests. See the Retry-After header for backoff guidance. |
500 |
synthesis_error |
Internal synthesis failure. Retrying with exponential backoff is safe. |
Rate limits
Rate limits are applied per API key. Limits reset on a rolling 60-second window.
| Plan | Requests / minute | Characters / day |
|---|---|---|
| Free | 10 | 1,000 |
| Growth | 120 | 65,000 (approx. 2M/month) |
| Pro | 600 | 330,000 (approx. 10M/month) |
When a rate limit is exceeded, the API returns 429 with a Retry-After header indicating seconds until the limit resets. Implement exponential backoff in any production integration.