apyhub-logo

Convert Text to Speech API

750 atoms
Base tier

About

This Utility API converts text to speech in multiple languages. It detects the language of your text automatically.
You can input text directly, or provide a file or URL, and the utility will extract and convert the text for you. This is great for handling long documents or web pages without extra steps of copying or pasting text.
This API can be applied and used in 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 leverage text-to-speech to enhance engagement by offering audio versions of written content, making information more accessible and convenient for diverse audiences.
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 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 workspace settings (on the left side of the navbar) and go to applications.
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.