Kaleyra Cloud API Documentation

Send OTP SMS

POST Method.

Description

Kaleyra provides API that simplifies sending critical and high priority SMS containing a one-time password. Use this API to send OTP SMS to your customers in no time.

1. Signup or Login to KCloud and create your API key.

Refer to the Create an API Key page for steps to create your API key.

📘

Note:

After you sign up, your account will be on the trial version. You must complete the KYC to access all the features in KCloud.

2. Send OTP (One Time Password)

Execute the following API command to send an OTP SMS.

curl -X POST "https://api.kaleyra.io/v1/<SID>/messages" \
     -H "api-key: <API_KEY>" \
     -d "to=<TO_NUMBER>" \
     -d "type=OTP" \
     -d "sender=<SENDER_ID>" \
     -d "body=Hello! Your OTP is 1234."

Ensure to replace the parameter values with the proper inputs in the above code. The below table has a list of parameters and their information.

Replace

With

Example

Mandatory

<SID>

Account SID (Security Identifier)

HXXXXXXX071US

True

<TO_NUMBER>

Recipient's MSISDN (only one recipient in single request allowed)

+1XXXXXXXXXX

True

<SENDER_ID>

Originator/Alphanumeric ID (default KLRHXA)

KLRHXA

True

<API_KEY>

API Key generated by Kaleyra Cloud

Ac4XXXXX21f

True

3. Below is the response sample.

{
  "id": "ee8aXXXX-XXXX-XXXX-XXXX-9b717XXXX30d",
  "sender": "KLRHXA",
  "type": "OTP",
  "body": "Hello! Your OTP is 1234.",
  "createdDateTime": "2019-11-04 10:42:23+00:00",
  "totalCount": 1,
  "data": [
    {
      "message_id": "ee8aXXXX-XXXX-XXXX-XXXX-9b717XXXX30d:1",
      "recipient": "1XXXXXXXXXX"
    }
  ],
  "dlrurl": null,
  "error": {}
}

📘

Note:

In case of an error, ensure that the parameter values are correct in the above code. Refer to the Understand Error Codes page for detailed information.

Updated 13 days ago



Send OTP SMS


POST Method.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.