GetOTP Documentation

Voice OTP

The Voice OTP allows you to perform OTP via automated phone call.

Request for Voice OTP API

To request for Voice OTP, make a POST request to our OTP endpoint.

https://api.otp.dev/v1/verifications

With the following Basic HTTP verification method:

DescriptionRequiredData TypeExample
Your API KeyYesStringmtbi2w4hlendfpxa1igthcu5p6mzxf7k

Note

With the following parameters:

NameDescriptionRequiredData TypeExample
channelChannel for delivering OTPYesStringvoice
voice_typeVoice type of verification message. 'flash' will result in a dropped call, 'tts' will result in code to speechYesStringflash
phoneThe user mobile phone number (with country code)YesString60123456789
code_lengthThe length of the code, which falls within the range of 4 to 6 characters. At least one of the following is required: 'code_length' or'code'.NoNumber4
codeThe 'code' field accepts only digits and must be between 4 to 6 characters in length. At least one of the following is required: 'code_length' or'code'.NoString1234
ringing_durationThe ringing duration for 'flash' call, must be between 5 to 10 seconds. Default ringing duration is 8 seconds.NoNumber8
languageSupported languages for 'tts' verification. Default value is 'EN' English.NoStringEN
payloadAdditional info that will be sent back to the client through the Webhook URL.NoString
For JSON object, convert into JSON string.
{\"order_id\":\"xfdu48sfdjsdf\", \"agent_id\":2258}

Note

Notes on the phone parameter:

  • You must provide a phone number as digits without spaces or special characters, beginning with the country dialing code.
  • Notes on the language parameter:

  • With 'tts' voice type, you can specify the language of the verification message. Defaults to 'EN'.
  • Supported languages are: 'AR', 'ZH', 'EN', 'GB', 'FR', 'DE', 'HI', 'JA', 'RU', 'ES', 'MX', 'BN', 'ID', 'MS', 'FIL', 'TH', 'VI'.
  • Examples

    Below is an example request using cURL:

    curl --request POST \
         --url https://api.otp.dev/v1/verifications \
         --header 'X-OTP-Key: {YOUR_API_KEY}' \
         --header 'accept: application/json' \
         --header 'content-type: application/json' \
         --data '
    {
        "data": {
            "channel": "voice",
            "voice_type": "flash",
            "phone": "60123456789",
            "code_length": 4,
            "ringing_duration": 10
        }
    }
    '

    The response would be a JSON structure, returned with HTTP 200 Codestatus code:

    {
      "account_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "message_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "phone": "60123456789",
      "code": "1234",
      "sender": "1234567890",
      "create_date": "2025-08-18T06:28:58.962Z",
      "expire_date": "2025-08-18T06:28:58.962Z"
    }

    Response data details:

    NameDescriptionData TypeExample
    account_idThe unique identifier of the accountString3fa85f64-5717-4562-b3fc-2c963f66afa6
    message_idThe unique identifier of the messageString3fa85f64-5717-4562-b3fc-2c963f66afa6
    phoneRecipient's phone numberString60123456789
    codeVerification code (can be specified or auto-generated, depending on your setup)String7890
    senderThe phone number the call will originate fromString1234567890
    create_dateCreation date of the verification in UTC, formatted as yyyy-mm-dd hh:mm:ssString2025-08-18 00:00:00
    expire_dateExpiration date of the verification in UTC, formatted as yyyy-mm-dd hh:mm:ssString2025-08-18 02:00:00

    If there is an error with the API call, you will receive a JSON response with 400+ status code, error code and message.

    {
      "errors": [{
        "timestamp": "2025-08-18 00:00:00",
        "path": "/v1/verifications",
        "method": "POST",
        "status": 401,
        "message": "User Not Authorized",
        "code": "1136"
      }]
    }

    Please refer to this table for details:

    Error CodeDescriptionHTTP Code
    1136User Not Authorized401
    1523Invalid recipient number(s)400
    1621'phone' is missing400
    1623Invalid code length400
    1629Provide either 'data.code' or 'data.code_length' but not both400
    1630When 'data.channel' is voice, 'data.code' must be valid and 4 to 6 characters long400
    1632'data.code' should be numeric if provided400
    1650Provided 'data.language' is not supported400
    1700Provide 'data.voice_type'400
    1701Invalid voice type. Must be 'flash' or 'tts'400
    1702Invalid ringing duration400
    1705Invalid payload400