Convert Text to Speech API

750 atoms
Base tier

About

This API converts any text to speech in multiple languages. Additionally the API can detect the language of your text automatically.
You can input any text that you would like to have converted to speech directly, or provide any file or URL, and the API will extract and convert the text for you. This is a great solution for handling long documents or web pages without extra steps of copying or pasting text. As an excellent free TTS tool, ApyHub API can easily convert text to speech online.
This API can be applied and used in different accessibility features, aiding individuals with visual impairments by providing an auditory representation of written text, audiobooks, navigation systems, language learning apps, and virtual assistants. Content creators and marketers can leverage the text-to-speech API to enhance user engagement by offering audio versions of written content, making information more accessible and convenient for diverse audiences.
Try out the Text to Speech API in the API playground and see how this TTS converter API can help you convert text to speech easily and provide great experiences to your users with a simple API call.
Select API Endpoints
Input
Output

API Playground

API Documentation

Convert File to Speech File
POST
https://api.apyhub.com/tts/file

Request example

1
curl --location --request POST 'https://api.apyhub.com/tts/file' \
2
--header 'apy-token: {{token}}' \
3
--form 'file=@"sample.pdf"' \
4
--form 'gender="female"'
Method: POST
Content Type: multipart/form-data
Request Body
AttributeTypeMandatoryDescription
fileFileYesThe source file that you want to convert to speech. Supported file formats are pdf, doc, docx, png, jpg, jpeg, bmp, tiff, xlsx, pptx, html, and xml
genderStringYesThe voice you want for your speech. Accepts male and female.
Sample Response
A successful request returns the audio file. If the request fails, the response contains an error code and a message to help determine what went wrong.

HTTP Response Codes

The method may return one of the following HTTP status codes:
Status CodeDescription
200The request was successful.
400Invalid input - the file is corrupt or the supported inputs are not provided.
401Required authentication information is either missing or not valid for the resource.
500If any unexpected error occurs while processing the request.

Supported Languages

Afrikaans, Amharic, Arabic, Azerbaijani, Bulgarian, Bangla, Bengali, Bosnian, Catalan, Czech, Welsh, Danish, German, Greek, English, Spanish, Estonian, Basque, Persian, Finnish, Filipino, French, Irish, Galician, Gujarati, Hebrew, Hindi, Croatian, Hungarian, Armenian, Indonesian, Icelandic, Italian, Japanese, Javanese, Georgian, Kazakh, Khmer, Kannada, Korean, Lao, Lithuanian, Latvian, Macedonian, Malayalam, Mongolian, Marathi, Malay, Maltese, Burmese, Norwegian, Nepali, Dutch, Polish, Pashto, Portuguese, Romanian, Russian, Sinhala, Slovak, Slovenian, Somali, Albanian, Serbian, Sundanese, Swedish, Swahili, Tamil, Telugu, Thai, Turkish, Ukrainian, Urdu, Uzbek, Vietnamese, Chinese, Zulu

Authentication

All API requests to ApyHub services need to be authenticated. Currently we support tokens or basic authentication mechanisms. You can generate and view your existing credentials from your workspace settings (on the left side of the navbar) and go to “API Keys".
Points to note:
  • Credential secrets are generated on the fly and are not stored in plain text, so on generating a credential please save the secrets somewhere safe.
  • Use the apy-token as the header parameter to pass the token.
  • Use the Authorization header to send the basic authentication credentials.

Error codes

1
{
2
"error": {
3
"code": 105,
4
"message": "Invalid URL"
5
}
6
}
To search for a specific error code, enter the code in the search box below. Alternatively, you can click on the button to view a complete list of all error codes.