---
title: "Convert Text to Audio"
method: POST
path: "/text-to-audio"
tags: ["Audio"]
---

# Convert Text to Audio

`POST /text-to-audio`

**Available for**: Chatflow, Workflow, New Agent, Chatbot, Agent, Text Generator apps.

Converts text to speech audio. Pass `text` to synthesize arbitrary text, or `message_id` to voice an existing message's answer.

## Request body

- TextToAudioRequest — Request body for text-to-audio conversion. Provide either `message_id` or `text`.
  - `message_id` string, uuid — ID of the message whose answer to voice. Takes priority over `text` when both are provided. Get message IDs from [List Conversation Messages](/en/api-reference/conversations/list-conversation-messages).
  - `text` string — Text to synthesize into speech.
  - `user` string — End-user identifier, defined by your app and unique within it. See [End User Identity](/en/api-reference/guides/end-user-identity).
  - `voice` string — Voice to use for text-to-speech. Available voices depend on the TTS provider configured for this app. Use the `voice` value from [Get App Parameters](/en/api-reference/applications/get-app-parameters) → `text_to_speech.voice` for the default.
  - `streaming` boolean — Accepted for backward compatibility but has no effect. Whether the audio is streamed is determined by the configured TTS provider's output, not by this field.

## Response `200`

Returns the generated audio file. The `Content-Type` header is set to the audio MIME type (e.g., `audio/wav`, `audio/mp3`). When the configured TTS provider returns a stream, the audio is delivered as `audio/mpeg` with chunked transfer encoding; the request `streaming` field does not control this.

## Other responses

- `400` — - `app_unavailable` : The app is unavailable or misconfigured. - `invalid_param` : Text-to-speech is not enabled, `text` is missing, or no voice is available. - `provider_not_initialize` : No valid model provider credentials are configured. - `provider_quota_exceeded` : The model provider quota is exhausted. - `model_currently_not_support` : The current model does not support this operation. - `completion_request_error` : The text-to-speech request failed.
- `500` — `internal_server_error` : Internal server error.

---

[API](https://skmtc.net/langgenius/apis/dify-service-api.md) · [All operations](https://skmtc.net/langgenius/apis/dify-service-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/langgenius/dify-service-api/revisions/e49b3db72bad/schema)
