Skip to main content
POST
/
v1
/
tts
/
generate
curl --location 'https://v3.mayaresearch.ai/v1/tts/generate' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: maya_YOUR_API_KEY_HERE' \
--data '{
  "voice_id": "Ava",
  "text": "Welcome back to another episode of our podcast! Today we are diving into an absolutely fascinating topic.",
  "stream": false
}'
Audio file will be returned in WAV or MP3 format
This endpoint generates high-quality speech audio using pre-designed character voices. Supports streaming, emotional tags, and verbose output.
X-API-Key
string
required
API key for authentication

Request Body

voice_id
string
default:"Ava"
required
The unique identifier of a pre-designed voice from the Get Characters endpointRealistic Voices:
  • Ava
  • Chloe
  • Liam
  • Noah
  • James
  • Emma
  • Sophie
  • Oliver
Creative Character Voices:
  • AnimatedCartoon
  • Anime
  • Flirty
  • Seductively
  • AIMachineVoice
  • Cyborg
  • AlienSciFi
  • Pirate
  • Gangster
  • DarkVillain
  • Demon
text
string
required
The text to convert to speech.Max Length: 5,000 characters
stream
boolean
default:false
Enable streaming audio generation
  • true - Stream audio chunks as they’re generated (lower latency)
  • false - Return complete audio file after processing
curl --location 'https://v3.mayaresearch.ai/v1/tts/generate' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: maya_YOUR_API_KEY_HERE' \
--data '{
  "voice_id": "Ava",
  "text": "Welcome back to another episode of our podcast! Today we are diving into an absolutely fascinating topic.",
  "stream": false
}'

Response

audio
binary
The generated audio file in WAV or MP3 format
metadata
object
Additional metadata about the generation (only when verbose is enabled)
Audio file will be returned in WAV or MP3 format

Example Use Cases

  • Ava - American 20s Female
  • Emma - American 40s Female
  • Noah - American 20s Male
  • Liam - British 20s Male
  • James - American 40s Male
  • Chloe - British 20s Female
  • Sophie - British 40s Female
  • Oliver - British 40s Male
{
  "voice_id": "Ava",
  "text": "Welcome back to another episode of our podcast! Today we're diving into an absolutely fascinating topic that I know you're going to love.",
  "stream": false
}

Streaming Response

When stream is set to true, the API returns audio chunks as they are generated for lower latency:
Streaming Example
const response = await fetch('https://v3.mayaresearch.ai/v1/tts/generate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'maya_YOUR_API_KEY_HERE'
  },
  body: JSON.stringify({
    voice_id: "Ava",
    text: "Welcome back to another episode of our podcast! Today we're diving into some truly fascinating content that I know you're going to absolutely love.",
    stream: true
  })
});

const reader = response.body.getReader();
const audioChunks = [];

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  audioChunks.push(value);
  
  // Process or play audio chunk immediately for real-time playback
  await playAudioChunk(value);
}

// Optionally combine all chunks for complete audio
const completeAudio = new Blob(audioChunks, { type: 'audio/wav' });
Use streaming mode for:
  • Real-time voice assistants and chatbots
  • Interactive applications where latency matters
  • Long-form content where you want to start playback immediately
  • Live customer support systems

Best Practices

Browse available characters using the Get Characters endpoint and select one that matches your use case and target audience.
  • Customer service → Friendly, patient, clear voices
  • Podcast → Conversational, warm, engaging voices
  • Audiobook → Clear, expressive, consistent voices
  • Professional → Authoritative, confident, polished voices
  • Enable streaming for interactive applications
  • Cache character IDs for repeated use
  • Break long text into manageable chunks

Error Codes

Always implement proper error handling to gracefully manage API errors.
CodeDescriptionResolution
400Invalid request formatCheck JSON syntax and ensure required fields are present
401Authentication failedVerify your API key is correct and properly formatted
403Access deniedCheck API permissions and usage quotas
404Voice not foundVerify the voice_id exists using Get Characters endpoint
413Text too longReduce text length to under 5,000 characters
500Internal server errorContact support if the error persists

Performance Tips

Cache Character IDs

Store and reuse character IDs for consistent voice across your application.

Enable Streaming

Streaming reduces perceived latency for interactive applications and long content.

Batch Requests

Generate multiple audio files in parallel when possible to maximize throughput.

Optimize Text

Break very long text into manageable chunks (under 1,000 characters) for better performance.
Pro tip: For consistent brand voice across your application, select the right voice once, test thoroughly, then reuse the same voice_id for all subsequent generations.

Authorizations

X-API-Key
string
header
required

API key for Maya1 API authentication

Body

application/json
voice_id
enum<string>
required

The unique identifier of a pre-designed voice

Available options:
Ava,
Chloe,
Liam,
Noah,
James,
Emma,
Sophie,
Oliver,
AnimatedCartoon,
Anime,
Flirty,
Seductively,
AIMachineVoice,
Cyborg,
AlienSciFi,
Pirate,
Gangster,
DarkVillain,
Demon
Example:

"Ava"

text
string
required

The text to convert to speech.

Maximum length: 5000
Example:

"Welcome back to another episode of our podcast! Today we're diving into an absolutely fascinating topic that I know you're going to love. We've got some incredible insights to share with you, so let's get started right away."

stream
boolean
default:false

Enable streaming audio generation

Example:

false

Response

Successfully generated audio

Generated audio file in WAV format

I