1. Home
  2. Docs
  3. Voice
  4. Text-to-Speech (TTS)

Text-to-Speech (TTS)

PARAMETERFORMATREQUIREDDESCRIPTIONDEFAULT
messagestringYesBody of the Voice message.
* Limited to 600 characters.
* Please use a single language in the message. Mixing languages may make parts of your message unreadable.
recipientintegerYesRecipient’s mobile number including country code without “+” prefix
referencestringOptionalA unique reference ID for keeping track of requests and responses
originatorstringYesThe originator address for the outgoing Voice message.
If the given originator address is not whitelisted, a random address will display on the recipient’s phone
localestringOptionalThe voice and language you want to use for the text-to-speech message. Supported languages and voices are detailed here.en-US

Sample request using CURL:

$ curl -X POST https://api.geniq.io/rest/v1/voice \
-H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json' \
-d '{
    "message": "Hi 😀, this is a test message",
    "locale": "en-US",
    "recipient": "6591234567",
    "originator": "6531596518",
    "reference": "123",
}' \

Parameters returned in the API response:

PARAMETERFORMATDESCRIPTION
referencestringIf reference parameter is submitted during the API request, the same value will be returned
responseMessagestringResponse message returned from the API call
responseCodeintegerResponse code returned from the API call. Refer to section “Response Codes” for list of possible values
messageIdsarrayA list of unique IDs for each Voice sent.

Sample Response:

{
    "reference":"12345",
    "responseMessage":"Success",
    "responseCode":"0",
    "messageIds":["118ad4e0-5014-4466-8593-332b01a20cb7"]
}