Elevenlabs Text-to-Speech Generation API - n8n Workflow

Use this powerful n8n workflow template to create an instant Text-to-Speech API endpoint using Elevenlabs. Automate audio generation and streamline your content creation using this robust n8n node configuration.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Content creators needing on-demand voice generation.
Developers looking for a fast, customizable Text-to-Speech API endpoint built using n8n.
Users who want to utilize the Elevenlabs service without writing custom server code.
Anyone interested in advanced HTTP Request setups within an n8n workflow.

Overview

This n8n workflow solves the problem of needing a dedicated backend service to handle text-to-speech conversions via the Elevenlabs API. By utilizing a simple Webhook n8n trigger, this automation instantly provides a high-performance endpoint. When triggered with the necessary text and voice ID, the n8n node executes the API call, and crucially, returns the generated binary audio file directly to the caller. This structure makes the n8n workflow perfect for integrating automated voice generation into larger applications, streamlining video production, and ensuring efficient use of the Elevenlabs service. It's a prime example of leveraging n8n templates for rapid development.

How it Works

This efficient n8n workflow operates entirely via a dedicated API endpoint:


  1. Triggering the n8n workflow: The process begins with the Webhook n8n trigger, which listens for a POST request at the specified path (generate-voice). The incoming request must contain voiceid and text parameters in the body.

  2. Input Validation: The flow immediately hits the 'If params correct' n8n node. This core logic node checks if both the required parameters (voiceid and text) are present in the webhook body. If either is missing, the automation is diverted to the 'Error' n8n node.

  3. API Execution (Success Path): If validation passes, the 'Generate voice' n8n node (an HTTP Request) fires. It dynamically constructs the Elevenlabs API URL using the provided voice_id and includes the text payload in the JSON body. Crucially, it uses custom HTTP authentication to pass the required API key.

  4. Responding with Audio: The Elevenlabs API returns the generated audio file as binary data. The successful 'Respond to Webhook' n8n node immediately takes this binary output and sends it back as the response to the original POST request, completing the full transaction.

  5. Handling Errors (Failure Path): If the input validation fails, the 'Error' n8n node is executed, sending a simple JSON response back to the requester indicating 'Invalid inputs.'

Installation Guide

To set up this powerful n8n workflow template, follow these steps:


  1. Import the JSON: Copy the provided n8n workflow JSON and paste it into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. Elevenlabs Credentials Setup (Custom Auth): This step is essential for the 'Generate voice' n8n node to function.

Go to 'Credentials' in n8n and create a new credential of type 'Generic Credential Type' (HTTP Custom Auth).
In the credentials configuration, select the 'Header' method.
Define the header using the following structure, replacing your-elevenlabs-api-key with your actual key:
{
"headers": {
"xi-api-key": "your-elevenlabs-api-key"
}
}
Save these credentials and link them to the 'Generate voice' n8n node.

  1. Activate and Test: Activate the n8n workflow. The Webhook n8n trigger is now live. Send a POST request to the Webhook URL (e.g., YOURN8NURL/webhook/generate-voice) with a JSON body containing voice_id and text to test the full flow.

Node Details

Webhook (n8n trigger):
Function: Serves as the initiation point for this n8n workflow.
Key Configuration: Configured to listen for POST requests at the path /generate-voice and uses Response Mode: Response Node.
If params correct (n8n node):
Function: Core logic control. Ensures that the incoming JSON payload contains both the required fields: voiceid and text.
Key Configuration: Checks for existence (exists operator) of both parameters.
Generate voice (HTTP Request n8n node):
Function: Communicates with the external Elevenlabs API to convert text into speech.
Key Configuration: URL dynamically uses voiceid; Request body dynamically uses text. Authentication is set to the custom HTTP Auth credential containing the xi-api-key.
Respond to Webhook (Success n8n node):
Function: Successfully terminates the execution and returns the result.
Key Configuration: Set to respond with binary, ensuring the generated audio file is passed back to the user.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by

🎉 Do you want to master AI automation, so you can save time and build cool stuff? I’ve created a welcoming Skool community for non-technical yet resourceful learners.

Featured*