Voice Use Cases

This page provides details about use cases for the Voice API. Use the examples we provide here to build more complex applications. Voice use cases include:

For marketing materials about Voice, refer to the Products: Voice page.

For details about other 2FA use cases, refer to 2FA API. Using the 2FA API, you can send OTPs in text messages and cancel OTPs. You can set limits for maximum number of OTPs sent to one phone number in a set time. Choose other limits if you have a different criteria to use.

Send a Voice OTP

This example shows how to send a simple Voice OTP to a customer. The settings are all default values. For the body parameter, put your message. For the verification code use {code}. Mitto will generate a random six digit code. For more details, see Send a Voice OTP Endpoint.

Request

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=MittoAPI' \
-d 'channel=call' \
-d 'body=Your verification code is: {code}' \
-u 'YourAccountSid:YourAuthToken'

Response

If the request is successful, the response returned is:


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

Retrieve Usage Records

You can retrieve a record of the requests you made using the voice feature.

Request

curl -X GET https://cpaas.mittoapi.com/2fa/usage/records.json?startDate=2019-08-01&endDate=2019-08-31 \
-u 'YourAccountSid:YourAuthToken'

Response

If the request is successful, the response returned is:

{
"usageRecords":[
{
"channel":"All",
"description":"Total OTP sent for voice",
"accountSid":"ACae6e420f425248d6a26948c17a9e2acf",
"channel":"call"
"startTime":"2019-08-01",
"endTime":"2019-08-30",
"count":"14",
"unit":"OTP",
"uri":"/2fa/usage/records?startTime=2019-08-01&endTime=2019-08-30&accountSid=ACae6e420f425248d6a26948c17a9e2acf"
}
]
}