Quickstart: from API key to mp3
Text to speech in five requests — voice, template, order, wait, and a file link.
Text to speech takes five requests. Each request uses an ID from the previous response.
Once
- KeyX-API-KEY
- Scopesorders.write
- VoiceGET /voices
- TemplatePOST /templates
Every order
- Templatetemplate_id
- OrderPOST /orders
- WaitingGET /orders/{order}
- Filesresult.files[]
- LinkPOST /storage/url
What you need
An API key with the voices.read, templates.write, orders.write, orders.read, and
orders.download scopes. Create one in My API keys. The full preset works. The
automation preset lacks templates.write, so step 2 returns 403.
Warning
Step 3 creates a real order. It is paid from your subscription quota, and anything beyond the quota comes from your balance: see Tokens, quotas, LMC and PAYG. One short phrase is enough for a first run.
End-to-end scenario
Steps run with your key. Without a key only the code is available — you can still copy it.
# 1. Pick a voice → voice_id
curl -X GET 'https://api.lumean.app/api/public/voices/elevenlabs/library?page=0&page_size=20' \
-H 'Accept: application/json' \
-H 'X-API-KEY: YOUR_API_KEY'
# 2. Create a template → template_id
curl -X POST 'https://api.lumean.app/api/public/templates' \
-H 'Accept: application/json' \
-H 'X-API-KEY: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"service_key": "elevenlabs",
"name": "API quickstart",
"config": {
"tts_settings": {
"mode": "mode_v1",
"model_id": "eleven_multilingual_v2",
"voice_id": "{{voice_id}}",
"advanced_voice_settings": true,
"voice_settings": {
"stability": 0.5,
"similarity_boost": 0.75,
"use_speaker_boost": true,
"speed": 1.0
}
}
}
}'
# 3. Create an order → order_id
curl -X POST 'https://api.lumean.app/api/public/orders' \
-H 'Accept: application/json' \
-H 'X-API-KEY: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"template_id": "{{template_id}}",
"input_text": "Hello from the Lumean public API."
}'
# 4. Wait for the result → path
curl -X GET 'https://api.lumean.app/api/public/orders/{{order_id}}' \
-H 'Accept: application/json' \
-H 'X-API-KEY: YOUR_API_KEY'
# 5. Get a file link → url
curl -X POST 'https://api.lumean.app/api/public/storage/url' \
-H 'Accept: application/json' \
-H 'X-API-KEY: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"path": "{{path}}",
"download": true
}'- 1
Pick a voice
Take a voice_id from the ElevenLabs library. Pages in this catalog start at zero.
curl -X GET 'https://api.lumean.app/api/public/voices/elevenlabs/library?page=0&page_size=20' \ -H 'Accept: application/json' \ -H 'X-API-KEY: YOUR_API_KEY' - 2
Create a template
A template stores the voice and the voiceover settings. voice_id goes in config.tts_settings.
curl -X POST 'https://api.lumean.app/api/public/templates' \ -H 'Accept: application/json' \ -H 'X-API-KEY: YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "service_key": "elevenlabs", "name": "API quickstart", "config": { "tts_settings": { "mode": "mode_v1", "model_id": "eleven_multilingual_v2", "voice_id": "{{voice_id}}", "advanced_voice_settings": true, "voice_settings": { "stability": 0.5, "similarity_boost": 0.75, "use_speaker_boost": true, "speed": 1.0 } } } }' - 3
Create an order
The order refers to the template by template_id, and the text goes in input_text. The response is 201 with status created.
This step creates a real order and charges for it.
curl -X POST 'https://api.lumean.app/api/public/orders' \ -H 'Accept: application/json' \ -H 'X-API-KEY: YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "template_id": "{{template_id}}", "input_text": "Hello from the Lumean public API." }' - 4
Wait for the result
Poll the order until it finishes. If the order stops at partially_completed, some chunks failed.
curl -X GET 'https://api.lumean.app/api/public/orders/{{order_id}}' \ -H 'Accept: application/json' \ -H 'X-API-KEY: YOUR_API_KEY' - 5
Get a file link
result.files[] holds the file path. POST /storage/url exchanges it for a download link.
curl -X POST 'https://api.lumean.app/api/public/storage/url' \ -H 'Accept: application/json' \ -H 'X-API-KEY: YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "path": "{{path}}", "download": true }'
The whole flow as one script
You need curl and jq. Put your key in KEY.
#!/usr/bin/env bash
set -euo pipefail
BASE=https://api.lumean.app/api/public
KEY=<your_api_key>
AUTH=(-H "X-API-KEY: $KEY" -H "Content-Type: application/json")
# 1. Voice: the first voice_id from the ElevenLabs library.
# Pages in this catalog start at zero.
VOICE_ID=$(curl -s "$BASE/voices/elevenlabs/library?page=0&page_size=20" \
-H "X-API-KEY: $KEY" | jq -r '.data.voices[0].voice_id')
# 2. A template with that voice. model_id, voice_id, mode and voice_settings.stability are required.
TEMPLATE_UUID=$(curl -s -X POST "$BASE/templates" "${AUTH[@]}" -d '{
"service_key": "elevenlabs",
"name": "My TTS",
"config": {
"tts_settings": {
"mode": "mode_v1",
"model_id": "eleven_multilingual_v2",
"voice_id": "'"$VOICE_ID"'",
"advanced_voice_settings": true,
"voice_settings": {
"stability": 0.5, "similarity_boost": 0.75,
"use_speaker_boost": true, "speed": 1.0
}
}
}
}' | jq -r '.data.id')
# 3. An order from the template. The text goes in input_text.
# Response: 201, status "created", no result yet.
ORDER_UUID=$(curl -s -X POST "$BASE/orders" "${AUTH[@]}" -d '{
"template_id": "'"$TEMPLATE_UUID"'",
"input_text": "Hello! This is a test voiceover through the Lumean API."
}' | jq -r '.data.id')
# 4. Wait for the order to finish.
while :; do
STATUS=$(curl -s "$BASE/orders/$ORDER_UUID" -H "X-API-KEY: $KEY" | jq -r '.data.status')
echo "status: $STATUS"
case "$STATUS" in
completed|result_delivered) break ;;
partially_completed|failed|cancelled|compensated) echo "order not completed: $STATUS"; exit 1 ;;
esac
sleep 5
done
# 5. result.files[] holds a path. Exchange it for a link and download the file.
FILE_PATH=$(curl -s "$BASE/orders/$ORDER_UUID" -H "X-API-KEY: $KEY" \
| jq -r '.data.result.files[0]')
URL=$(curl -s -X POST "$BASE/storage/url" "${AUTH[@]}" \
-d '{ "path": "'"$FILE_PATH"'", "download": true }' | jq -r '.data.url')
curl -sL "$URL" -o result.mp3Common mistakes
| Mistake | What to do instead |
|---|---|
Sending voice_id with the order | The voice is set in the template, in config.tts_settings.voice_id. POST /orders has no such field |
Downloading the value from result.files[] | It is a file path. POST /storage/url returns a link, valid for one hour |
Waiting only for completed | An order can stop at partially_completed. POST /orders/{order}/items/retry-failed retries the failed chunks |
Starting the ElevenLabs catalog at page=1 | The ElevenLabs and HeyGen catalogs count pages from zero; other lists count from one |
| Downloading later | Order files are kept for 7 days after the order finishes. Deleted files are marked with files_expired: true |
Errors at step 3
- What happened
The order was not created and no money was charged.
POST /ordersandPOST /orders/{order}/retryreturn this code: both are paid for the same way. Chunk retry and regeneration also return402when an extra charge cannot be paid:insufficient_balance,insufficient_allowance, and for retry alsoinsufficient_funds(the order's reserved remainder is not enough). Thereasonfield names the cause.- What to do right now
Branch on
reason, not onmessage: the message text can change without notice. Forinsufficient_balance, top up the balance. Forinsufficient_allowance, wait for the next quota or change the plan. Until then, the same request keeps returning the same 402.
402 with reason: insufficient_balance means the subscription quota is used up and your
balance does not have enough LMC to pay beyond it. insufficient_allowance means the quota is
used up and paying beyond the quota is disabled for this service. See
Tokens, quotas, LMC and PAYG.
429 means one of the limits was hit. The reason field tells you which one: see
Limits and the 429 code.
422 with an errors field is a problem with the request fields. 422 with a reason and no
errors is a content rejection: the same request returns the same response.
Next steps
- Keys, scopes and headers — key scopes and presets.
- The asynchronous order model — order statuses and cancellation.
- Realtime — order statuses over WebSocket instead of polling.
- Templates — service settings and
GET /templates/config-options. - Voiceover text — pauses, markup, and which markup is billed.
- Files, links and storage — subtitles and how long files are kept.
- Conventions — the response and error format.
- Pagination — page numbering across lists.
- Voices — voice catalogs and where to get a
voice_id. - Limits and the 429 code — the limits and how to tell them apart.
- Tokens, quotas, LMC and PAYG — how orders are paid for.
- Retries and idempotency — retrying orders and chunks.
- Operations in this flow: POST /orders, POST /templates, POST /storage/url.
This page for AI
Updated 10/18/2026 · API version 1.0.0