SMS Verification API Documentation

Version – 1.0

API Parameter for Verify Now

The following parameters need to be sent while using VerifyNow APIs.

API Parameter
Type
Value
flowType
String
SMS/WHATSAPP/RCS/SAUTH
type
String
OTP

Rest API Base URLs

All Platform API endpoints below should be prefixed with the following URL:

https://cpaas.messagecentral.com

Generate Token

When using  Verify Now’s SMS verification  API to send SMS verification codes, the initial call should be to the token generation API.

This API returns a token that must be included in all subsequent calls. An authentication token is needed to validate the user and should be included in the header section of each request.

Field
Type
Mandatory?
Description
customerId
String
yes
Customer identifier (need to signup to get your  customer id)
country
String
no
Country code to send OTP to
email
String
no
Email
key
String
yes
Base-64 encrypted password
scope
String
no
Use ‘NEW’ for first time

Request URL Path:

/auth/v1/authentication/token

cURL

1curl --location 'https://cpaas.messagecentral.com/auth/v1/authentication/token? 
2customerId=%3CCustomerId%3E&key=%3CBase64%20Encrypted%20password%3E&scope=NEW&country=91
3&email=test%40messagecentral.com' \
4--header 'accept: */*'

NOTE: To convert a cURL command into code using Postman, open Postman, import the cURL command via the "Import" button, and then generate the code in your preferred language by clicking the "Code" button on the right side of the request.

Response JSON

1{
2  "status": Integer,
3  "token": "String"
4}

Send OTP

To sendOtp  on a mobile number below are the request parameters. The authentication token is required to send OTP which is generated by the generated token API (which you can find above in Introduction section).

API Parameter
Type
Mandatory?
authToken
String
Yes

Request URL Path:

A successful response will return a 200 status code.

/verification/v3/send

Request URL Parameters:

Field
Type
Mandatory?
Description
customerId
String
yes
Country code
otpLength
Integer
no
Send a number between 4 and 8. Default is 4
mobileNumber
String
yes
Mobile number for single text
flowType
String
yes
We send OTP using multiple mediums like SMS, WhatsApp, email, etc. For now, use either SMS or WhatsApp

cURL

1curl --location --request POST 'https://cpaas.messagecentral.com/verification/v3/send? 
2countryCode=91&flowType=SMS&mobileNumber=9999999999' \
3--header 'authToken: 
4eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJDLTMzNDMyQTVGNDIGNzQwNCI6ImIhdCI6MTcxMjExOTA0MCwiZXhwIjo'

NOTE: To convert a cURL command into code using Postman, open Postman, import the cURL command via the "Import" button, and then generate the code in your preferred language by clicking the "Code" button on the right side of the request. You can change the flowType basis the channel of your choice.

Response JSON

1{
2  "responseCode": 200,
3  "message": "SUCCESS",
4  "data": {
5    "verificationId": "xxxx",
6    "mobileNumber": "xxxx",
7    "responseCode": "200",
8    "errorMessage": null,
9    "timeout": "60",
10    "smCLI": null,
11    "transactionId": "xxxx"
12  }
13}

Validate OTP

The  validateOtp method is a REST API endpoint for validating a one-time password (OTP) for customers.

Request Header
Type
Mandatory?
authToken
String
Yes

Request URL Path:

A successful response will return a 200 status code.

/verification/v3/validateOtp/
Field
Type
Mandatory?
Description
verificationId
Long
yes
VerificationId from response of  /send  api
code
String
yes
otp
langid
String
no
Mobile number for single text
flowType
String
yes
  • For multiple language support
  • by default is English
  • For now we support English only

cURL

1curl --location 'https://cpaas.messagecentral.com/verification/v3/validateOtp? 
2&verificationId=2949&code=1476' \
3--header 'authToken: 
4eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJDLTMzNDMyQTVGNDIGNzQwNCI6ImIhdCI6MTcxMjExOTA0MC'

NOTE: To convert a cURL command into code using Postman, open Postman, import the cURL command via the "Import" button, and then generate the code in your preferred language by clicking the "Code" button on the right side of the request.

Response JSON

A successful response will return a 200 status code.

1{
2  "responseCode": 200,
3  "message": "SUCCESS",
4  "data": {
5    "verficationId": "xxxx",
6    "mobileNumber": "xxxx",
7    "responseCode": "200",
8    "errorMessage": null,
9    "verificationStatus": "VERIFICATION_COMPLETED",
10    "authToken": null,
11    "transactionId": "xxxx"
12  }
13}

Response Codes

Code
Display Text
200
SUCCESS
400
BAD_REQUEST
409
DUPLICATE_RESOURCE
500
SERVER_ERROR
501
INVALID_CUSTOMER_ID
505
INVALID_VERIFICATION_ID
506
REQUEST_ALREADY_EXISTS
511
INVALID_COUNTRY_CODE
700
VERIFICATION_FAILED
702
WRONG_OTP_PROVIDED
703
ALREADY_VERIFIED
705
VERIFICATION_EXPIRED
800
MAXIMUM_LIMIT_REACHED

Help and Support

For implementation support and any feedback, please reach out to us at: support@messagecentral.com

Frequently Asked Questions

1. How can I implement with custom code?

You can use postman to rewrite API calls in your preferred programming language. You’d need to use: -

  • POST method for sending SMS
  • GET method for validating OTP SMS

2. Why am I getting the error “Method not Allowed” or error code 405?

You’d need to ensure that the endpoint URL for the Token API matches the one defined in the documentation.The same has been mentioned below: -

a. Token API using GET method

b. Send API using POST method

c. Validate API using GET method



3. How do I test the SMS verification APIs?

You can use Postman to test Message Central’s SMS verification APIs.

4. Why am I getting “Whitelabel Error” page?

If you are getting Whitelabel Error page, you should check for the following errors: -

a. You are using incorrect API packet

b. You have not replaced placeholders with the actual values

c. API curl is incorrect

d. Curl location has not been changed to ‘production’ instead of ‘staging’

5. Why am I getting error code 401?

This could be because of incorrect API or token. Make sure you have followed our API documentation for the right token values.

6. Why am I getting the error code 400 or “Bad Request” in Postman?

There are multiple reasons for a “Bad Request” in Postman. You can check for the following probable reasons: -

a. Check if the authToken is correct

b. Check if any parameter is missing in API

c. Header should be passed in this format - application-x-www-form-urlencoded

7. How do I generate authToken?

In order to generate the authToken in Postman, you’d:-

a. Find a ‘key’ in GET API

b. You’d need to copy that key and encode the same using Base64 - https://www.base64encode.org/

c. Put the encoded password in ‘Key’ placeholder

d. Hit the GET API

You’d get an authToken.

8. Where do I use the authToken?

You’d need to put the authToken in the header of SEND API.

9. What all placeholders do I need to change in GET API to generate token?

You’d need to change country, customerid, email and key. Scope will always remain = “NEW”

10. What all placeholders do I need to change in SEND API?

You’d need to change country code, customerid, otplength, and mobilenumber.

Ready to get started?

Safeguard your user accounts and build trust with your customers using SMS verification. Try Verify Now without any credit card.

Message Central Logo Blue
Message Central Team
Hi there
How can we help you today?
Start Whatsapp Chat