Submit a TTS generation job
Changed onSubmits a text-to-speech job. Returns immediately with a jobId. Poll GET /v1/tts/{jobId} — or GET /v1/tts?ids=… for several jobs at once — to check progress and retrieve the audio URL when complete. When identical audio already exists (same text, voice, speed, emotion and engine), the response is status: "completed" with audioUrl included — nothing to poll. Tokens are deducted on submission, billed by the submitted character count (minimum 50, × the AI surcharge only when you opt in with aiRefine: true), and refunded if the job permanently fails. Send an Idempotency-Key header whenever you might retry (timeouts, connection resets, a 502 from the edge): the same key with the same body returns the FIRST job instead of creating and charging a second one.
Request
- Base URLhttps://api.vieneu.io
- Auth
- API key in header X-API-Key
- or HTTP bearer
Headers
Optional. A client-chosen key (8–128 printable ASCII characters — a UUID is ideal) that makes this call safe to retry. A second POST with the same key AND the same body returns the FIRST job (same jobId, no second charge) with the response header Idempotent-Replayed: true. Keys are scoped to your API key and remembered for 24 hours. Same key + different body → 422 IDEMPOTENCY_KEY_REUSED; same key while the first call is still running → 409 IDEMPOTENCY_IN_FLIGHT with Retry-After — retry with the SAME key, never a new one.
Request body
Example request
{
"text": "Xin chào Việt Nam!",
"voiceId": "Trúc Ly",
"emotion": "natural",
"speed": 1,
"engine": "v4",
"applyPronunciation": true
}Response
Job accepted: queued (poll GET /api/v1/tts/{jobId}) or, when the audio was already in the cache, completed with audioUrl. When the call replayed an earlier submit under the same Idempotency-Key, the body names the original job as queued and the response carries Idempotent-Replayed: true.
Example response
{
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"status": "queued",
"message": "Job queued. Poll GET /v1/tts/{jobId} for status and audio URL.",
"audioUrl": "https://s3.amazonaws.com/bucket/tts/job.wav?X-Amz-Expires=86400&...",
"audioUrlExpiresIn": 86400,
"duration": 3.42
}Changes
- info
added the new optional request property
- info
- breaking
removed the enum value
v3of the request property
- breaking