What is the Mitto Voice API?

Mitto’s Voice API is a feature of the 2FA API. You can use it to send text-to-speech messages. Features include the ability to:

  • Send messages in different languages.
  • Choose whether the voice is male or female.
  • Send a random OTP code or one you choose.

Documentation Organization

We organize our documentation as follows:

  • Read details about the API. This includes endpoints,  authentication, and a sample request and a response. – Voice
  • See a list of use cases showing the capability of the API. – Voice Use Cases
  • Review API details with the reference page.  See each individual request and response parameter. – Voice API Reference

Get Started with the Mitto Voice API

Get started with Mitto’s Voice API. After reading this, you will know how to sign up with Mitto, what endpoints are available, and the request and response format for this API.

Sign up for a Mitto Account

To get started with Mitto, do the following:
1. Sign up for a Mitto account at https://www.mitto.ch/contact/ or write to info@mitto.ch.
2. Submit the IPs you want to use for requests. They must be whitelisted on Mitto’s system.
3. For callbacks, provide your dedicated callback URL and method (both GET and POST methods are supported). Alternatively, you can use dynamic callbacks.
4. Mitto will respond with your API key and confirmation that your IP addresses and callback URL are configured.

Request Requirements

To send a text-to-speech (TTS) message, make a POST request to this endpoint: https://cpaas.mittoapi.com/2fa/send

The rest of the message-related information goes in as body parameters. Include the Content-Type: application/json header in your request.

By default, Mitto returns JSON.

A sample request in cURL looks like:

curl -X POST https://cpaas.mittoapi.com/2fa/send.json \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d 'From=XXXXXXXX' \
-d 'To=XXXXXXXX' \
-d 'service=MitoAPI' \
-d 'channel=call' \
-d 'body=Your verification code is: {code}' \
-u 'YourAccountSid:YourAuthToken'

Response Format and Content

The response is returned in JSON. A successful response looks like:

{"code":200,"message":"OK","requestID":"OTPb6eb071d21124dbab20b095c25f1274f"}

For more details about response parameters, refer to the information in Voice API Reference. For more details about use cases with example request and responses, refer to Voice Use Cases.

Authentication

Mitto’s Voice API requires authentication on every request. To authenticate, you use basic authentication. Basic authentication is a simple authentication method that’s built into the HTTP protocol. You send HTTP requests with an Authorization header formatted like so:
Authorization: Basic base64(accountID:API key)

In the example, you would replace base64(accountID:API key) with a base64-encoded string where the string consisted of “accountID:API key”.

For examples of requests using basic authentication, refer to Voice Use Cases.