OTP Verification API in the CommPeak Portal

Send and verify one-time passwords over SMS, WhatsApp, and Voice with automatic failover, using two API calls and a token from an OTP configuration.

The OTP Verification API page in the CommPeak Portal introduces the CommPeak OTP service: API that sends one-time passwords (OTP) over SMS, WhatsApp, and Voice and verifies the code your user enters. If a channel fails, delivery moves to the next channel in the chain automatically.

OTP configurations are created in TextPeak messaging platform. Each configuration has its own API token, and the Portal OTP Service page shows you how to put that token to work.

Opening the OTP Verification API page

  1. Expand Messaging in the main menu and select OTP Service.
Screenshot of the Messaging menu in the CommPeak Portal with Messaging Campaigns selected

Messaging Campaigns menu tab

  1. The OTP Verification API page opens.
Screenshot of the OTP Verification API page showing the OTP Service features and the Send a code API example

OTP Verification API page

Getting an API token

To send codes, you need an OTP configuration and its API token.

  1. On the OTP Verification API page, click Create your first configuration. TextPeak opens in a new browser tab on the OTP Service > Configurations page, already signed in with your CommPeak Portal account.

  2. Create the configuration and copy its token. For the general, security, channel, and failover settings, see Creating OTP Configurations.

  3. Alternatively, click Open in SMS Platform at the top of the page to open your configurations in TextPeak.

What the OTP Service does

  • Manage send failures between channels: you choose the channels and their priority. If a channel fails, delivery moves to the next one automatically, and each request can override the chain.
  • Sends codes by voice call: Voice OTP delivers the code over the CommPeak VoIP network. You can turn on a DTMF confirmation check, which asks the recipient to press a digit to confirm that a real person answered.
  • Protects against fraud: limit requests per phone number and per IP address, apply a cooldown after the limit, disable a code after too many failed attempts, and restrict API access by IP.
  • Generates codes your way: let the service generate codes with your length and expiry, send your own code, or send a fully custom message. You can set a dedicated configuration for each channel type.

Typical uses are login verification, sign-up and phone verification, password resets, and transaction confirmation.

Verifying a user in two API calls

Verifying a user takes two requests to the same configuration, both authorized with its API token.

Sending a code

The first request delivers the code to the user's phone number through the first available channel in the failover chain.

curl https://api.commpeak.com/textpeak/streams/otp/auth \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: YOUR_SECRET_TOKEN' \
  --data '{
  "recipient_phone": "12125550123"
}'

You can add these optional parameters to the request body:

  • provider: sends through one channel instead of the failover chain. Accepts sms, voice, or whatsapp_business.
  • retry: set to true to resend a code to the same recipient.
Screenshot of thSend a code to end-user tab showing the send request example

Send a code to end-user tab

For the full request and response schema, see OTP Auth Request.

Verifying the code

The second request checks the code the user entered. The service handles code expiry and the count of verification attempts for you.

curl https://api.commpeak.com/textpeak/streams/otp/verify \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: YOUR_SECRET_TOKEN' \
  --data '{
  "recipient_phone": "12125550123",
  "code": "12345"
}'
Screenshot of the Verify the code received from end-user tab showing the verify request example

Verify the code received from end-user tab

For the full request and response schema, see OTP Verify Request.

👍

TIP

Click Copy in the top right corner of a code example to copy the request with its formatting.

Next steps


Did this page help you?