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.
- 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.
- 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:
Parameter | Variable | Description | Example | Mandatory |
---|---|---|---|---|
SID | String | Account SID (Security Identifier) | HXXXXXXX071US | True |
API_KEY | String | API Key generated by Kaleyra.io | Ac4XXXXX21f | True |
TO_NUMBER | Integer | Recipient's MSISDN | +1XXXXXXXXXX,+1XXXXXXXXXX | True |
TYPE | String | Route type | OTP/DEFAULT/MKT/TXN | False |
SENDER_ID | String | Originator/Alphanumeric ID | KLRHXA | True |
- 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"
Updated about 1 year ago