Get Started
This REST API will allow sending a single SMS towards a mobile phone destination in any country in the world.
- REST POST Method: Send single SMS messages using API POST Method. HTTP Basic Authentication and HTTPS encription are used.
POST Requirements
- Host and End-point: Please ask Kaarai’ Support team for production values.
- Authentication: Standard HTTP Basic Authentication («user» : «password» encoded using Base64).
- Encoding: UTF-8 unicode characters.
- Accepts: «application/json»
- Required headers: «Content-Type – application/json»
- Required headers: «Authorization: Basic xxxxxxxxx»
- Responses: «application/json»
POST Inputs
This information must be provided in JSON format in the Body section:
Parameter |
Type |
Required |
Description |
Example |
---|---|---|---|---|
«to» |
String |
Mandatory |
Number of the mobile user that is going to receive the SMS message. Must include the Mobile International Country Code (MCC). |
«573xxxxxxxxx» |
«from» |
String |
Optional |
Number of the Sender ID that is sending the SMS message. If the User is not allowed to provide a Sender ID, a default number will be provided. If the User will need a Dedicated Short Code, please contact the Sales team. |
«8xxxx» |
«text» |
String |
Mandatory |
Text to be send as body in the SMS message. |
«Your OTP code is xxxx» |
POST Example
POST Method request:
POST /v1/send-sms HTTP/1.1
Authorization: Basic 123456789ABC==
Content-Type: application/json
Host: lab.kaaraitech.com:15000
to=573xxxxxxxxx & from=7349 & text=Hello-world
POST Curl request:
curl --request POST \
--url https://lab.kaarai.com:15000/v1/send-sms \
--header 'Accept: application/json' \
--header 'Content-type: application/json' \
--header 'Authorization: Basic 123456789ABC==' \
--data '
{
"to": "573xxxxxxxxx",
"from": "7349",
"text": "Hello-world"
}'
POST Responses
Response |
Description |
Extended Information |
---|---|---|
202 (Accepted) |
The SMS message was accepted for delivery. |
Return «Code 2020: Accepted for delivery» Return «Code 2021: Queued for later delivery» |
400 (Bad Request) |
ERROR: Missing input parameters or invalid values. |
Return «Code 4000: Invalid content-type: xxx» in the case a different content from »application/json» is being used. Return «Code 4001: Missing receiver number, rejected» Return «Code 4002: Missing text message, rejected» Return «Code 4003: Invalid receiver number, rejected» |
403 (Forbidden) |
ERROR: The User/Password combination is invalid. |
Return «Code 4030: Authorization failed for user: xxx» |
403 (Forbidden) |
ERROR: Destination invalid or blocked. |
Return «Code 4031: Not routable. Do not try again» |
404 (Not Found) |
ERROR: The requested URL in the POST method invocation is invalid. |
Return «Code 4040: Unknown request» |
503 (Service Unavailable) |
ERROR: Internal error. |
Return «Code 5030: Temporal failure, try again later» |
Response Example
Positive Response:
HTTP/1.1 202 OK
Content-Type: application/json
{
"message_id": "0123456789ABCDEF0123456789ABCDEF",
"status": {
"code": "0",
"description": "Accepted for delivery"
}
}
Error Response:
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"status": {
"code": "4001",
"description": "Missing receiver number, rejected"
}
}