Introduction
Zealcube SMS API
Base URL
https://smsapi.zealcube.com/
Authenticating requests
To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_TOKEN}".
All authenticated endpoints are marked with a requires authentication badge in the documentation below.
Endpoints
API Auth Token
Generate API Authentication token
To generate the API Auth token, make a POST request to /login with your email and Password.
This Token will be used in the authorization header of each API request you need to submit.
Example request:
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://smsapi.zealcube.com/login',
[
'headers' => [
'Accept' => 'application/json',
],
'json' => [
'email' => 'username@example.com',
'password' => 'P@31dW0Red',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://smsapi.zealcube.com/login'
payload = {
"email": "username@example.com",
"password": "P@31dW0Red"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
curl --request POST \
"https://smsapi.zealcube.com/login" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"username@example.com\",
\"password\": \"P@31dW0Red\"
}"
const url = new URL(
"https://smsapi.zealcube.com/login"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "username@example.com",
"password": "P@31dW0Red"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Received response:
Request failed with error:
SMS units balance
requires authentication
Generate API Authentication token
Example request:
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://smsapi.zealcube.com/balance',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://smsapi.zealcube.com/balance'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
curl --request GET \
--get "https://smsapi.zealcube.com/balance" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://smsapi.zealcube.com/balance"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (401):
Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Send SMS
requires authentication
Send messages to your clients.
Example request:
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://smsapi.zealcube.com/sendsms',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
],
'json' => [
'from' => 'ZEALCUBE',
'phone' => '254712345678',
'message' => 'Welcome to Zealcube',
'message_id' => 'e52e9-99ba-d6d',
'webhook_url' => 'https://zealcube.com/sms-webhook',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://smsapi.zealcube.com/sendsms'
payload = {
"from": "ZEALCUBE",
"phone": "254712345678",
"message": "Welcome to Zealcube",
"message_id": "e1k5c2e9-99ba-4d6d",
"webhook_url": "https:\/\/zealcube.com\/sms-webhook"
}
headers = {
'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
curl --request POST \
"https://smsapi.zealcube.com/sendsms" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"ZEALCUBE\",
\"phone\": \"254712345678\",
\"message\": \"Welcome to Zealcube\",
\"message_id\": \"e1k5c2e9-99ba-4d6d\",
\"webhook_url\": \"https:\\/\\/zealcube.com\\/sms-webhook\"
}"
const url = new URL(
"https://smsapi.zealcube.com/sendsms"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"from": "ZEALCUBE",
"phone": "254712345678",
"message": "Welcome to Zealcube",
"message_id": "e1k5c2e9-99ba-4d6d",
"webhook_url": "https:\/\/zealcube.com\/sms-webhook"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Received response:
Request failed with error:
Batch SMS
requires authentication
Enables sending multiple messages (batch) via a single API request
Example request:
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://smsapi.zealcube.com/batch-sms',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
],
'json' => [
'from' => 'ZEALCUBE',
'messages' => [
[
'message' => 'just another test message',
'phone' => '254712345678',
],
[
'message' => 'test message',
'phone' => '254712345679',
'message_id' => 'custom_messageID',
],
],
'webhook_url' => 'https://zealcube.com/sms-webhook',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://smsapi.zealcube.com/batch-sms'
payload = {
"from": "ZEALCUBE",
"messages": [
{
"message": "just another test message",
"phone": "254712345678"
},
{
"message": "test message",
"phone": "254712345679",
"message_id": "custom_messageID"
}
],
"webhook_url": "https:\/\/zealcube.com\/sms-webhook"
}
headers = {
'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
curl --request POST \
"https://smsapi.zealcube.com/batch-sms" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"ZEALCUBE\",
\"messages\": [
{
\"message\": \"just another test message\",
\"phone\": \"254712345678\"
},
{
\"message\": \"test message\",
\"phone\": \"254712345679\",
\"message_id\": \"custom_messageID\"
}
],
\"webhook_url\": \"https:\\/\\/zealcube.com\\/sms-webhook\"
}"
const url = new URL(
"https://smsapi.zealcube.com/batch-sms"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"from": "ZEALCUBE",
"messages": [
{
"message": "just another test message",
"phone": "254712345678"
},
{
"message": "test message",
"phone": "254712345679",
"message_id": "custom_messageID"
}
],
"webhook_url": "https:\/\/zealcube.com\/sms-webhook"
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Received response:
Request failed with error: