# Generate multi-speaker TTS (inline tags)

> `POST /job/add/paperoffice_voice___tts` · Section: Media AI — Voice · PaperOffice AI API, release `R20261020.2258`.

`POST https://api.paperoffice.ai/latest/job/add/paperoffice_voice___tts`

## Overview
Generate speech with **multiple catalog speakers** in one job using inline **speaker tags** (PaperOffice neural TTS).

Set `voice=Multi` and mark who speaks which line. Speaker names must exist in `POST /voice/voices` (same language buckets as in the tags).

**Pipeline:** `paperoffice_voice___tts` (same URL as single-voice TTS).

## Prerequisites
1. Call **`POST /voice/voices`** and note exact `name` values (e.g. `Abigail`, `James`).
2. Tag **every** spoken segment — untagged text fails validation in multi mode.
3. Set top-level `language` (e.g. `en`) — **required** by the API (validates the job bucket) even when tags include per-line language hints.

## Speaker tag syntax (three forms)

| Style | Example |
|-------|---------|
| Legacy XML | `<Abigail>Hello</Abigail><James>Hi there</James>` |
| Shorthand | `[en\\\|Abigail] Hello [en\\\|James] Hi there` |
| Key-Value | `[voice:Abigail lang:en] Hello [voice:James lang:en] Hi` |

Emotion markers (`[chuckle]`, `[laugh]`, …) work inside segment text and are passed through to synthesis.

## Request parameters
| Parameter | Required | Default | Notes |
|-----------|----------|---------|-------|
| `text` | yes | — | Full script with speaker tags on every segment. Max 50,000 characters per job. |
| `voice` | yes | `Multi` | Must be `Multi` (case-insensitive). |
| `language` | yes | `en` | Top-level language code (e.g. `en`, `de`). |
| `quality` | no | `premium` | `basic`, `premium`, `ultra`. |
| `output_format` | no | `mp3` | `mp3`, `wav`, `ogg`. |
| `output` | no | `inline` | `inline` (default), `base64`, `url`. |

## Connection hold & polling (about 5 minute limit)

Identical to **Generate speech (single voice)**: default connection hold about 295s, then **HTTP 202** + `GET /job/get/{job_id}`.

## Start-SLA / processing_lane — Voice

Omit `processing_lane` → workspace default / fair-use `no_sla`. Lanes: no_sla|sla_24h|sla_12h|sla_6h|sla_1h|instant.

## Related endpoints

| Use case | Postman item |
|----------|----------------|
| One speaker | Generate speech (single voice) |
| Custom voice from audio | Clone voice (TTS) |
| Voice catalog | List available TTS voices | Use processing_lane for Start-SLA (no_sla|sla_24h|sla_12h|sla_6h|sla_1h|instant).

**Parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `text` | string | Yes | Script with speaker tags on every segment (max 50,000 characters). Examples: [en / Abigail] Hello [en / James] Hi. Default demo: support dialog with emotions. (default: "[en\|Abigail][happy] Welcome to PaperOffice Voice AI — thanks for calling support today. [en\|James][breath] Hi, I am James. Your order SO-24091 shipped this morning. [en\|Abigail][excited] We can narrate up to fifty thousand characters in one job — with speaker tags, emotions, and natural handoffs. [en\|James][whisper] Try quality ultra when the message must sound executive-ready.") |
| `voice` | string | Yes | Must be Multi for multi-speaker mode. (allowed: Multi) (default: "Multi") |
| `language` | string | Yes | Top-level language code (required). Use the same codes as POST /voice/voices (e.g. en, de). (default: "en") |
| `quality` | string | No | Quality tier: basic, premium (default), ultra. (allowed: basic, premium, ultra) (default: "premium") |
| `output_format` | string | No | Audio format: mp3, wav, ogg. Default: mp3. (allowed: mp3, wav, ogg) (default: "mp3") |
| `output` | string | No | Response delivery: inline (audio in HTTP body, default), base64, url. (allowed: inline, base64, url) (default: "inline") |
| `client_wait` | boolean | No | Connection hold: true (default) = API holds this HTTP request while the job runs, up to the dynamic pipeline timeout (priority, pages, pipeline type; minimum about 20s, infrastructure cap about 295s). Returns the finished result when ready, or HTTP 202 with job_id and poll_url if the hold is exceeded. false = immediate job_id. |
| `async_only` | boolean | No | Same as client_wait=false: immediate job_id — poll GET /job/get/{job_id} every 5–10s. (default: false) |
| `processing_lane` | string | No | Start-SLA lane (wait-to-start guarantee, not completion). Values: no_sla (fair use ×1), sla_24h (×1.5), sla_12h (×2), sla_6h (×3), sla_1h (×4), instant (×5 interactive start). Prefer this over legacy numeric priority. If omitted: workspace default_processing_lane, else no_sla. (allowed: no_sla, sla_24h, sla_12h, sla_6h, sla_1h, instant) |

**Request body:** `multipart/form-data` (or `application/x-www-form-urlencoded`) — use form fields from the parameters table; upload via `file`, `file_1`, or `files` (all accepted) or pass `files` as a JSON array of HTTPS URLs / `source_url` / `file_url`. Do **not** send `application/json` unless the endpoint is listed as JSON-only.

## Responses

Returns JSON with `status: "success"`; key fields: `job_id` (poll `GET /job/get/{job_id}`) or inline `result` when `client_wait=true`; after poll read `result ?? job_result`. Optional `_billing` and `processing_time`. Errors: HTTP 4xx/5xx with `status: "error"`, `code`, and `message`.

## Connection hold & polling

- **Default (`client_wait` omitted or `true`):** The API holds **this HTTP connection** while the job runs, up to the **dynamic pipeline timeout** (priority, pages, pipeline type; minimum about 20s, infrastructure cap about 295s). Returns the finished result when ready.
- **Hold exceeded:** If the job is not finished in time → **HTTP 202** with `job_id`, `poll_url`, `max_wait_seconds`, and `client_wait: false`. The job **continues in the background** — poll `GET /job/get/{job_id}` every 5–10 seconds.
- **Immediate poll mode:** `client_wait=false` or `async_only=true` → `job_id` immediately (about 100ms), then poll as above.

**Response fields:** `client_wait` (boolean) — whether this response used connection hold; `max_wait_seconds` — actual hold duration attempted.

**Completed payload key:** After polling, OCR pipelines return the payload in `job_result`; workflow/IDP (`POST /job/add/workflow`) return it in `result`. Always read `result ?? job_result`. See **Job result schema**.

**Note:** Prefer `processing_lane` Start-SLA for wait-to-start / job price — see collection guide **Start-SLA (`processing_lane`) — wait-to-start**. Legacy `priority` is compat only.

## Essentials (all endpoints)

- **Base URL:** `https://api.paperoffice.ai/latest` · **Auth:** `Authorization: Bearer po_sk_…` or `po_ut_…` (server-side only); browser code uses `po_pk_…` with an allowlisted `Origin`. No Bearer at all on a product API returns HTTP 403 `TIER_RESTRICTED`.
- **Errors:** HTTP 4xx/5xx with `status: "error"`, `code` and `message`. Retry 429 (`Retry-After`) and 5xx with exponential backoff; do not retry validation errors.
- **Jobs:** `client_wait=true` (default) holds the connection. HTTP 202 means the job is still running — poll `GET /job/get/{job_id}` every 5–10 s until `job_status` is `completed`, then read `result ?? job_result`. `processing_lane` sets the Start-SLA; legacy `priority` is not part of the public contract.
- **Billing:** every billable product call costs at least 5 credits; read `_billing.job.credits_billed` on billed responses.
- **Mutations** use `POST` with action paths (e.g. `POST /documents/document-delete`), not HTTP `DELETE`.

---

All endpoints: [llms.txt](https://api.paperoffice.ai/latest/docs/llms.txt) · Everything in one file: [llms-full.txt](https://api.paperoffice.ai/latest/docs/llms-full.txt) · [OpenAPI 3.1](https://api.paperoffice.ai/latest/docs/openapi.json) · This page: https://api.paperoffice.ai/latest/docs/endpoints/po-tts-multivoice-4-speakers.md

*Generated 2026-10-20 from live API documentation (release `R20261020.2258`).*
