---
title: "Render a voiceover from a script"
method: POST
path: "/api/generate_voice"
tags: ["Video"]
---

# Render a voiceover from a script

`POST /api/generate_voice`

## Request

- Base URL: `https://app.pedra.ai`
- URL: `https://app.pedra.ai/api/generate_voice`
- Auth: none required

Renders a script to a voiceover audio track via text-to-speech, returning an audioId to pass to a video's voice.audioId (which also drives synced subtitles). Costs 1 credit. Text limit is 1000 characters.

## Request body

- object
  - `apiKey` string, required: Account API key, sent in the request body. Get one at https://app.pedra.ai under Settings → API.
  - `text` string, required: The script to narrate.
  - `language` string: Voice language (selects the speaker). See /api/music_library for accepted values.

## Response `200`

Voiceover rendered.

- object
  - `message` string
  - `audioId` string: Pass to a video's voice.audioId to attach the narration.
  - `audioUrl` string: Public URL of the rendered mp3.
  - `alignmentUrl` string: URL of the word-alignment JSON used for synced subtitles.
  - `duration` integer: Approximate duration in seconds.

## Other responses

- `400`: Invalid request — bad or unreachable image URL, missing required field, or validation error.
- `403`: Not enough credits for the requested generation.
- `404`: Missing, invalid, or revoked API key.
- `405`: Wrong HTTP method — all endpoints accept POST (credits also accepts GET).

---

[API](https://skmtc.dev/pedra/apis/pedra-api.md) · [All operations](https://skmtc.dev/pedra/apis/pedra-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pedra/apis/pedra-api/revisions/87b2e76912c8?raw)
