Send SMS with Unicode

POST Method

Description

Send an SMS with Unicode characters using this API.

Refer to the Understanding SMS length document to know more about Unicode characters.

Base URL

<https://api.kaleyra.io/v1/><SID>

To send an SMS with Unicode content, follow the below steps.

  1. Signup or Login to Kaleyra.io and create your API key.

Refer to the Create an API Key page for steps to create your API key. To view the API Key and the SID, see View API Key and SID.

📘

Note:

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

  1. API command to send the SMS with Unicode content

Request Format

To send an SMS with Unicode characters, use the /messages endpoints.

curl -X POST "https://api.kaleyra.io/v1/<SID>/messages" \
     -H "api-key: <API_KEY>" \
     -d "to=<TO_NUMBER>" \
     -d "type=<TYPE>" \
     -d "sender=<SENDER_ID>" \
     -d "body=你好,世界" \
     -d "unicode=1"

📘

Note:

  • Ensure to replace the parameter values with the proper inputs in the above code.
  • You can add multiple recipients in the "to" parameters separated by comma (,) delimiter.

Parameters and Variables

Below is the list of parameters and variables used:

ParameterVariableDescriptionExampleMandatory
SIDStringAccount SID (Security Identifier)HXXXXXXX071USTrue
API_KEYStringAPI Key generated by Kaleyra.ioAc4XXXXX21fTrue
TO_NUMBERIntegerRecipient's MSISDN+1XXXXXXXXXX,+1XXXXXXXXXXTrue
TYPEStringRoute typeOTP/DEFAULT/MKT/TXNFalse
SENDER_IDStringOriginator/Alphanumeric IDKLRHXATrue
  1. Response Format

This section provides you the success and failure JSON response format for different scenarios.

Success Response

{
  "id": "648xxx2c-xxxx-xxxx-80c5-3c2xxxb391",
  "sender": "KLRHXA",
  "type": "DEFAULT",
  "body": "你好,世",
  "createdDateTime": "2019-11-04 10:42:23+00:00",
  "totalCount": 1,
  "unicode": 1,
  "data": [
    {
      "message_id": "648xxx2c-xxxx-xxxx-80c5-3c2xxxb391: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 SMS Error Codes page for detailed information.

Sample Request

curl -X POST "https://api.kaleyra.io/v1/HXXXXXXX071US/messages" \
     -H "api-key:Ac4XXXXX21f" \
     -d "to=+1XXXXXXXXXX,+1XXXXXXXXXX" \
     -d "type=OTP/DEFAULT/MKT/TXN" \
     -d "sender=KLRHXA" \
     -d "body=你好,世界" \
     -d "unicode=1"