Send SMS
The Send SMS API allows you to send SMS messages to one or multiple recipients using the Cellcast platform.
Parameters for Send SMS API
Headers Parameters
Parameters | Description |
---|---|
Authorization | Please add provided Bearer token - linked to your Cellcast account. Check here |
Content-Type | application/json |
Request Body Parameters
Name | Example | Description |
---|---|---|
sender | +61400000000 | String (Required): The sender number of your message. |
message | SMS Text goes here | String (Required): The content of the message. Use "\r\n" in the string (with double quotes) to add a new line. |
contacts | ["+61400000000"] | JSON encoded array (Required): List of recipient numbers. For multiple recipients: ["+61400000000", "+61400000001"] . Supports up to 1000 numbers in one API call. |
countryCode | "61" | String (Required): The country code. |
Code Samples
Post https://api.smartsmsapi.com/createsms
bash
curl --location 'https://api.smartsmsapi.com/createsms' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{API_KEY}}' \
--data '{
"sender": "+61400000000",
"message": "Hey K,\r\n How Are you??",
"contacts": ["+61400000001", "+61400000002"],
"countryCode": "61"
}'
js
const axios = require('axios');
const url = 'https://api.smartsmsapi.com/development/createsms';
const data = {
sender: "+61400000000",
message: "Hey K,\r\n How Are you??",
contacts: ["+61400000001", "+61400000002"],
countryCode: "61"
};
const headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer {{API_KEY}}'
};
axios.post(url, data, { headers })
.then(response => {
console.log('Response:', response.data);
})
.catch(error => {
console.error('Error:', error.response ? error.response.data : error.message);
});
Replace with the actual API key that you own.
Responses
200 Success
json
{
"code": 200,
"data": [
{
"id": "676523cb03fc5a0000000000",
"receiver": "+61400000001",
"status": "queued",
"type": "CAMPAIGN",
"created": "2024-12-20T07:59:07.058Z"
},
{
"id": "676523cb03fc5a0000000000",
"receiver": "+61400000002",
"status": "queued",
"type": "CAMPAIGN",
"created": "2024-12-20T07:59:07.060Z"
}
],
"message": "Success send message",
"stack": null
}
400 Bad Request
json
{
"code": 400,
"message": "Contacts are required. They should start with 61 and must be 11 digits, e.g. 614xxxxxxxx",
"stack": "APIError: Contacts are required."
}
401 Unauthorized
json
{
"code": 401,
"data": null,
"message": "Invalid Token",
"stack": "APIError: Invalid Token"
}