Verify Phone Number
POST Method
The Verify Phone Number API allows you to verify a newly added WhatsApp Business phone number associated with one of your existing WABA IDs. The phone number is verified through the six digits OTP through SMS or voice.
Prerequisites
- Know Your Customer (KYC) approval is mandatory. For more information on submission and approval, see Completing the Know Your Customer page.
- For prepaid customers, the credit balance should be sufficient to purchase numbers, make and receive calls, and monthly subscription charges. For more information on balance details, see Adding Credits page.
- You must have Proof of Business/Business Address and Proof of Identification (Individual/Company-Signatory) depending on the regulations of that particular region or country.
- Before you get started, Create an API Key. To view the API Key and the SID, see View API Key and SID.
A prerequisite for using Kaleyra WhatsApp APIs is to have an active WhatsApp plan on Kaleyra platform. - To set up a WhatsApp account on Kaleyra platform, see Manual Signup
and Embedded Signup. - An active WhatsApp for Business API plan that includes:
- A WhatsApp verified and approved profile.
- A WABA ID onboarded on Kaleyra WhatsApp API.
API Domain and Value
| api_domain | Value |
|---|---|
| IN pod | api.in.kaleyra.io |
| SG Pod | api.ap.kaleyra.io |
| EU Pod | api.eu.kaleyra.io |
| NA pod | api.na.kaleyra.io |
API Request to Verify Phone Number
To verify the phone number, use the https://<api_domain>/v2/<sid>/whatsapp/<waba_id>/number/verify endpoint with the following request method:
The following is the request format to verify a phone number:
curl -L -X POST 'https://<api_domain>/v2/<sid>/whatsapp/<waba_id>/number/verify' \
-H 'api-key: <api-key>' \
-H 'Content-Type: <content-type>' \
-d '{
"id" : <phone_number_id>,
"phone_number" : "<phone_number_with_cc>",
"otp" : "<OTP>"
}'The following is the sample request format to verify a phone number:
curl -L -X POST 'https://api.in.kaleyra.io/v2/HXAP16XXXXXX97IN/whatsapp/1090XXXXXXXXXXX/number/verify' \
-H 'api-key: AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX3' \
-H 'Content-Type: application/json' \
-d '{
"id" : 678997654XXXXX,
"phone_number" : "+9197654XXXXX",
"otp" : "67XX42"
}'URL Parameters and Headers
The following is the list of parameters and headers to send the outgoing message request:
| Parameter / Headers | Data Type | Description | Example | Mandatory? |
|---|---|---|---|---|
sid | String | Account SID (Security Identifier). | HXAP16XXXXXX97IN | Yes |
waba_id | String | WhatsApp Business Account. For more information, see step 1 to step 3 of Adding a new WABA ID. | 1090XXXXXXXXXXX | Yes |
api-key | String | API key generated from kaleyra.io account. | AXXXXXXXXXXXXXXXXXXXX3 | Yes |
content-type | String | Indicates the format of the content the API will be processing. | The only allowed value is application/json. | Yes |
The following is the list of attributes to be used in the payload to verify the phone number:
| Parameter | Data Type | Description | Example | Mandatory? |
|---|---|---|---|---|
id | String | Phone Number ID received in the response of Phone number addition API. | 678997654XXXXX | Yes |
phone_number | String | Phone number to be added with country code. | +9197654XXXXX | Yes |
otp | String | The six digit OTP you have received as SMS or Voice Call to the Phone number to be verified. | 67XX42 | Yes |
Sample Success Response
The following is the sample success response:
{
"code": "WA200",
"message": "Request Processed Successfully",
"data": "7654XXXXXXXXXX",
"error": {}
}Sample Failure Response
The following are the failure responses:
{
"code": "RBC001",
"message": "Incorrect SID or API key.",
"data": [],
"error": {
"body": "Incorrect SID or API key.",
"error": "record not found"
}
}{
"code": "WA401",
"message": "Waba_id is not present or does not belong to the account.",
"data": {},
"error": {
"waba_id": "Waba_id is not present or does not belong to the account."
}
}{
"code": "WA400",
"message": "Refer to correct payload format",
"data": {},
"error": {
"payload": "Incorrect payload format"
}
}{
"code": "WA400",
"message": "Incorrect OTP format",
"data": {},
"error": {
"error": "Incorrect OTP format"
}
}{
"code": "WA400",
"message": "invalid phone number",
"data": [],
"error": {
"phone_number": "invalid phone number"
}
}{
"code": "WA500",
"message": "wa phone number already approved",
"data": [],
"error": {
"error": "wa phone number already approved"
}
}{
"code": "WA500",
"message": "Please try again later",
"data": {},
"error": {
"error": "Internal server error"
}
}Updated about 18 hours ago
