Text2Audio - Convert Text to Speech Online - Free TTS Tool logo

Text2Audio API Instructions

Welcome to the Text2Audio API! Follow the instructions below to convert text to audio using our API.

1. Make a Request

Use the following curl command to make a sample request to convert text to audio:

Code:
curl -X POST -H "Content-Type: application/json" -d '{"language": "en-US", "paragraphs": "test paragraph", "splitParagraph": true}' https://text2audio.cc/api/audio

You can also use the fetch API with Javascript

Code:
fetch('https://text2audio.cc/api/audio', {
            method: 'POST',
            headers: {
              'Content-Type': 'application/json'
            },
            body: JSON.stringify({
              language: 'en-US',
              paragraphs: 'test paragraph',
              splitParagraph: true
            })
          })
            .then(response => response.json())
            .then(data => console.log(data))
            .catch(error => console.error(error));
          

2. Response

A successful response will be an array of objects like this:

Code:
[
  {
    "url": "https://example.com/audio.mp3",
    "text": "Hello, world!"
  }
]

Each object in the array contains a URL and the corresponding text.