Browse API documentation
Apply for API access

POST /v1/speech/batches

Batch text-to-speech

Send 2–8 Persian words or short phrases in one request. Get a batch ID, wait for completion, then download a WAV file for each item.

POSThttps://api.vowelmarks.com/v1/speech/batches

Updated November 4, 2026 · API version 1

Use batches for vocabulary cards, pronunciation exercises, or a library of short clips. All items in a batch use the same voice and delivery settings. For a passage that should play as one recording, use POST /v1/speech.

The batch route is available in production for Premium speech. It requires a server-side API key with the speech scope and an active Premium allowance. Basic voices are not supported.

If you currently call POST /v1/speech once per word, change your client to submit an items array to this route. Existing individual requests are not grouped automatically.

Create a batch

Save this as batch-request.json. Give each item an ID you can use to match the downloaded file to your own records.

{
  "tier": "premium",
  "voice": "Erinome",
  "pace": 1,
  "style": "instructional",
  "expressiveness": "natural",
  "items": [
    {"id": "greeting", "text": "سلام"},
    {"id": "book", "text": "کتاب"}
  ]
}

Choose an idempotency key for this exact request and save it before submitting. Keep using that key if the connection fails or you need to retry.

curl --fail-with-body https://api.vowelmarks.com/v1/speech/batches \
  -H "Authorization: Bearer $VOWELMARKS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: vocabulary-set-001" \
  --data-binary @batch-request.json \
  --output batch-accepted.json

A newly accepted batch returns HTTP 202. For example:

{
  "id": "b7f48e5a-f217-4e16-9988-87ff9468c209",
  "request_id": "11d4499a-b8aa-4f38-8694-cd7e9cd56112",
  "status": "queued",
  "item_count": 2,
  "poll_after_seconds": 5,
  "expires_at": "2026-11-05T02:00:00.000Z"
}

Save the batch ID. Closing your connection does not cancel an accepted batch.

For a longer list, split it into batches of 2–8 items that also fit the text limits below. Ten words can be sent as two batches of five. When first integrating, process one batch at a time: submit it, wait for the result, and download its files before starting the next.

Wait for the result

BATCH_ID=$(jq -r '.id' batch-accepted.json)
sleep 5
curl --fail-with-body "https://api.vowelmarks.com/v1/speech/batches/$BATCH_ID" \
  -H "Authorization: Bearer $VOWELMARKS_API_KEY" \
  --output batch-status.json

Check status in the response:

StatusWhat to do
queued or runningWait at least five seconds, then poll the same batch ID. Follow a longer Retry-After delay if one is returned.
succeededDownload the files in items.
failedRead error.code and error.action. The reservation is released and no clips are returned.

Polling uses your organization's requests-per-minute limit. Sending more polls will not make generation finish sooner.

Download the clips

A successful response returns items in the order you submitted them. Each item contains the original id and text, its duration_seconds, a signed audio_url, and audio_expires_at. Every file is a 24 kHz, mono, 16-bit WAV.

For example, a completed batch looks like this. The download URLs below are placeholders.

{
  "id": "b7f48e5a-f217-4e16-9988-87ff9468c209",
  "request_id": "11d4499a-b8aa-4f38-8694-cd7e9cd56112",
  "status": "succeeded",
  "item_count": 2,
  "poll_after_seconds": 5,
  "expires_at": "2026-11-05T02:00:00.000Z",
  "items": [
    {
      "id": "greeting",
      "text": "سلام",
      "duration_seconds": 0.9,
      "audio_url": "https://example.com/greeting.wav",
      "audio_expires_at": "2026-11-04T03:01:00.000Z"
    },
    {
      "id": "book",
      "text": "کتاب",
      "duration_seconds": 1.1,
      "audio_url": "https://example.com/book.wav",
      "audio_expires_at": "2026-11-04T03:01:00.000Z"
    }
  ],
  "usage": {
    "meter": "premium_speech",
    "seconds": 2,
    "generated_seconds": 6.6,
    "excluded_separator_seconds": 4.6
  }
}

Once status is succeeded, this downloads the item named greeting:

AUDIO_URL=$(jq -r '.items[] | select(.id == "greeting") | .audio_url' batch-status.json)
curl --fail --show-error "$AUDIO_URL" --output greeting.wav

The signed URL is enough to download the file. Do not attach your API key to it. Store the audio and its item ID on your server if you need them later.

Voice and delivery

The batch accepts the same Premium voice, pace, style, expressiveness, and director_notes fields as individual speech. If supplied, regional_mode must be standard.

If your individual requests use director_notes, send those notes once at the top level of the batch request. They apply to every item. For example, add "director_notes": "Clear, unhurried pronunciation for a beginner.". The limit is 600 UTF-16 units—the value of JavaScript string.length. Keep the words to speak in each item's text.

Use separate batches when delivery differs. If words need one set of directions and phrases need another, send two batches. Per-item settings and per-item notes are rejected.

VowelMarks adds instructions to keep items in order and leave pauses between them. Your notes replace the default vocabulary delivery directions. Start with a small batch and listen before generating a full library: word recognition and cut checks cannot judge every vowel, stress pattern, or tone of voice.

Limits and usage

LimitValue
Items2–8 per batch
TextUp to 80 Unicode code points per item and 480 across the batch
Item IDsUnique within the batch; 1–64 ASCII letters, digits, underscores, or hyphens; begin with a letter or digit
Request body32 KiB of serialized JSON
Generated audio90 seconds maximum, including separator pauses

Use Persian text with no surrounding whitespace. Vowel marks, half-spaces and ordinary punctuation are accepted. Numbers, Latin text, presentation-form letters and speech tags are rejected. Text must use NFC Unicode normalization. Spaces, marks and half-spaces count toward the text limits.

Starting a batch reserves 90 Premium seconds, so at least 90 seconds must be available even for a short list. On success, the API releases the unused reservation and charges the sum of the returned clip durations. Validated separator silence is excluded; silence retained within a clip counts.

usage.seconds is the amount charged. usage.generated_seconds includes the separators, and usage.excluded_separator_seconds reports the silence removed. Failed batches charge no Premium seconds.

A batch uses one grouped Gemini speech generation and a separate transcription check. This reduces speech-generation requests for a list of items, but provider capacity and your API request limit still apply. This route is separate from Google's Batch API.

Failed batches

The API checks recognized words against the submitted items and looks for quiet places to cut between them. It returns the full set only when every item passes. Missing words, extra words, or unclear boundaries can fail the batch.

A failed batch returns an error and no partial files. It does not silently generate each word again. Keep the batch and request IDs for support; do not put failed batches into an automatic generation loop.

A failed status inside an HTTP 200 response means generation or verification failed; HTTP success alone does not mean clips are available. Request errors use the standard error response:

HTTP responseWhat to do
400 invalid_speech_batch or idempotency_key_requiredCorrect the request using error.action. Do not keep resending an invalid body.
409 idempotency_conflictThe key already belongs to different items or settings. Resume the original request, or use a new key for an intentional new batch.
429 rate_limit_exceededWait for Retry-After, then retry with the same key or poll the same batch ID.
503 speech_batch_start_uncertainThe batch may already exist. Retry the unchanged request with its original key.
410 speech_batch_expiredThe result has expired. A retry cannot restore it; an intentional replacement needs a new key.

Retries and retention

The same idempotency key and exact ordered request identify the same batch. A retry returns its existing ID; a completed retry returns the existing clips without another generation or charge. Changing text, item order, IDs, voice, or delivery settings under that key returns 409.

Signed audio URLs last one hour. Poll a successful batch again to get fresh URLs while its files are still available. Batch files and results expire 24 hours after creation. Download them before expires_at.

Expired batch keys remain reserved for 30 days and return 410; they do not start a replacement generation. A new batch needs a new key. There is no batch cancellation or live-streaming endpoint.