Retry OTP for Phone Number
POST Method
The Retry OTP for Phone Number API allows you to request a new One-Time Password (OTP) if you did not receive the initial code sent to your phone number. When triggered, the system generates a fresh OTP to verify your new WhatsApp Business Number and resend it to the same mobile number via the desired channel (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 Retry OTP for Phone Number
To retry OTP for phone number, use the https://<api_domain>/v2/<sid>/whatsapp/<waba_id>/number/retry_otp endpoint with the following request method:
The following is the request format to retry OTP for phone number:
curl --location --request POST 'https://<api_domain>/v2/<SID>/whatsapp/<waba_id>/number/retry_otp' \
-H 'api-key: <api-key>' \
-H 'Content-Type: <content-type>' \
-d '{
"id" : "<phone_number_id>",
"phone_number" : "<phone_number_with_cc>",
"type_verification" : "<type_verification>"
}'
The following is the sample request format to retry OTP for phone number:
curl --location --request POST 'https://api.in.kaleyra.io/v2/HXAP16XXXXXX97IN/whatsapp/766XXXXXXXXXX/number/retry_otp' \
-H 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3' \
-H 'Content-Type: application/json' \
-d '{
"id" : "678997654XXXXX",
"phone_number" : "+9197654XXXXX",
"type_verification" : "SMS"
}'
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 | The waba_id associated with the WhatsApp Business Account. For more information, see step 1 to step 3 of Adding a new WABA ID. | 766XXXXXXXXXX | Yes |
api-key | String | API key generated from kaleyra.io account. | Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3 | 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 retry OTP for phone number in JSON format:
| Parameter | Data Type | Description | Example | Mandatory? |
|---|---|---|---|---|
id | Integer | Phone Number ID received via Phone Number Addition API. | 678997654XXXXX | Yes |
phone_number | String | Phone Number to be added along with country code. | +9197654XXXXX | Yes |
type_verification | String | OTP required via SMS or VOICE. The supported value is SMS or VOICE. | SMS | Yes |
Sample Success Response
The following is the sample success response.
{
"code": "WA200",
"message": "Request Processed Successfully",
"data": true,
"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": "key: 'cloudapinumberotpretryrequest.type_verification' error:field validation for 'type_verification' failed on the 'isvalidtypeverification' tag",
"data": [],
"error": {
"type_verification": "key: 'cloudapinumberotpretryrequest.type_verification' error:field validation for 'type_verification' failed on the 'isvalidtypeverification' tag"
}
}{
"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
