---
title: "Generate Speech"
method: POST
path: "/v3/voices/speech"
tags: ["Voices"]
---

# Generate Speech

`POST /v3/voices/speech`

Synthesize speech audio from text using a specified voice. The voice must support the starfish engine — use GET /v3/voices?engine=starfish to find compatible voices. Supports plain text and SSML. Speed range: 0.5–2.0x. Returns a URL to the generated audio file along with duration and optional word-level timestamps.

## Request body

- TextToSpeechRequest — Request body for text-to-speech generation.
  - `text` string, required — Text to synthesize (1-5000 characters).
  - `voice_id` string, required — Voice ID to use. The voice must support the starfish engine. Filter compatible voices by passing engine=starfish to the voice listing endpoint.
  - `input_type` string — Type of the input: 'text' for plain text, 'ssml' for SSML markup. Defaults to 'text'.
  - `speed` number — Speed multiplier (0.5-2.0).
  - `language` string, nullable — Base language code (e.g. 'en', 'pt', 'zh'). Optional — auto-detected from text when omitted.
  - `locale` string, nullable — BCP-47 locale tag (e.g. 'en-US', 'pt-BR'). When set, language is inferred from locale.

## Response `200`

Successful response

- object
  - `data` TextToSpeechResponseData — Response payload for text-to-speech generation.
    - `audio_url` string, required — URL of the generated audio file.
    - `duration` number, required — Duration of the audio in seconds.
    - `request_id` string, nullable — Unique identifier for this generation request.
    - `word_timestamps` WordWithTimestamp[], nullable — Word-level timing data.
      - `word` string, required — The word.
      - `start` number, required — Start time in seconds.
      - `end` number, required — End time in seconds.

## Other responses

- `400` — Invalid request parameters
- `401` — Authentication failed
- `429` — Rate limit exceeded

---

[API](https://skmtc.net/heygen/apis/heygen-external-api.md) · [All operations](https://skmtc.net/heygen/apis/heygen-external-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/heygen/heygen-external-api/versions/e2e54726e210/schema)
