API Documentation v1
Send SMS, Voice OTP and Voice Calls from your own application over a simple JSON REST API.
Authentication
Create a key in API Keys. Keys are stored hashed, so the full key is shown only once when you create it — save it safely.
Send the key with every request in one of these headers:
Send the key in a header (recommended). For quick integrations the GET endpoints — including send-sms and send-voice-otp — also accept ?api_key=… in the link ("Direct URL" tab); keep such links on your server only.
Authorization: Bearer YOUR_API_KEY
# or
X-API-Key: YOUR_API_KEY
Base URL, format & limits
https://paksender.com/api/v1
- Send JSON bodies with
Content-Type: application/jsonandAccept: application/json. - Phone numbers in international format:
+923001234567(local03001234567is converted to +92 automatically). - Rate limit: 60 requests / minute. Exceeding it returns HTTP
429. - All amounts are in PKR. You are charged only when a request is accepted (
"status": "success").
Response envelope
{
"status": "success",
"message": "SMS sent successfully",
"data": { ... }
}
{
"status": "error",
"message": "Invalid receiver number. Use international format, e.g. +923001234567.",
"error_code": "INVALID_NUMBER"
}
Always branch your code on error_code (stable), not on message (human text, may change). See Error codes.
Your pricing
| SMS | ₨4.30 | per SMS part |
| Voice OTP | ₨5.00 | per call · refunded if not answered |
| Voice Call | ₨4.00 | per call |
| ₨0.30 | per email | |
| My SIM SMS | ₨0.5000 | software fee per SMS part · refunded if the phone can't send |
These are your rates — an admin may set a custom rate for your account. My SIM is different from normal SMS: the message goes out from your own phone & SIM (your own package pays for the SMS), and Pak Sender charges only the small software fee shown above. See Prices for the full list, or call GET /sim for your live SIM fee.
How SMS parts are counted
| Text type | 1 part | Each part of a long SMS | Example |
|---|---|---|---|
| Standard (GSM-7: English letters, digits, common symbols) | 160 chars | 153 chars | 200 chars = 2 parts |
| Unicode (Urdu, Arabic, emoji, curly quotes …) | 70 chars | 67 chars | 85 chars = 2 parts |
A single Unicode character switches the whole message to Unicode. The characters ^ { } \ [ ] ~ | € count as 2 in standard text. Maximum message length: 800 characters. Use estimate-cost to check before sending.
Send SMS
POST /messages/send-sms
| Parameter | Type | Required | Description |
|---|---|---|---|
| receiver_number | string | Yes | Receiver in international format, e.g. +923001234567. |
| message | string | Yes | Text, max 800 characters. |
| sender_id | string | No | Sender name/number approved for your account (max 20). Leave empty to use the default sender. |
Response 200
{
"status": "success",
"message": "SMS sent successfully",
"data": {
"message_id": 1024,
"reference_id": "4d6a6b31",
"status": "sent",
"parts": 1,
"cost": 4.30,
"remaining_balance": 245.70
}
}
Keep message_id to check the delivery status later. status: "sent" means accepted by the network; it becomes delivered when the handset confirms.
curl -X POST "https://paksender.com/api/v1/messages/send-sms" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"receiver_number": "+923001234567",
"message": "Your OTP code is 123456"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/messages/send-sms');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'receiver_number' => '+923001234567',
'message' => 'Your OTP code is 123456',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
https://paksender.com/api/v1/messages/send-sms?api_key=YOUR_API_KEY&receiver_number=%2B923001234567&message=Your+OTP+code+is+123456
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"receiver_number":"+923001234567","message":"Your OTP code is 123456"}' \
"https://paksender.com/api/v1/messages/send-sms"
import requests
r = requests.post(
"https://paksender.com/api/v1/messages/send-sms",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"receiver_number": "+923001234567",
"message": "Your OTP code is 123456",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/messages/send-sms', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"receiver_number": "+923001234567",
"message": "Your OTP code is 123456"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/messages/send-sms')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"receiver_number" => "+923001234567",
"message" => "Your OTP code is 123456"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
Send Voice OTP
POST /messages/send-voice-otp
Places a phone call that reads your verification code aloud (digits and letters are both supported). Write the message the same way as an SMS — the code is detected automatically.
| Parameter | Type | Required | Description |
|---|---|---|---|
| receiver_number | string | Yes | Receiver in international format. |
| message | string | Yes | Text containing the code, max 200 characters, e.g. Your verification code is 4821. |
"refunded": true.curl -X POST "https://paksender.com/api/v1/messages/send-voice-otp" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"receiver_number": "+923001234567",
"message": "Your verification code is 4821"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/messages/send-voice-otp');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'receiver_number' => '+923001234567',
'message' => 'Your verification code is 4821',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
https://paksender.com/api/v1/messages/send-voice-otp?api_key=YOUR_API_KEY&receiver_number=%2B923001234567&message=Your+verification+code+is+4821
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"receiver_number":"+923001234567","message":"Your verification code is 4821"}' \
"https://paksender.com/api/v1/messages/send-voice-otp"
import requests
r = requests.post(
"https://paksender.com/api/v1/messages/send-voice-otp",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"receiver_number": "+923001234567",
"message": "Your verification code is 4821",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/messages/send-voice-otp', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"receiver_number": "+923001234567",
"message": "Your verification code is 4821"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/messages/send-voice-otp')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"receiver_number" => "+923001234567",
"message" => "Your verification code is 4821"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
Response is the same as Send SMS. Final result: delivered = answered, expired = not answered, failed = busy / rejected / failed.
Send Voice Call
POST /messages/send-voice-call
Calls the receiver and plays a pre-approved recording, optionally followed by dynamic values read aloud (IVR templates). Ask support to approve a recording and get its recording_id.
| Parameter | Type | Required | Description |
|---|---|---|---|
| receiver_number | string | Yes | Receiver in international format. |
| recording_id | integer | Yes | ID of your approved recording, e.g. 10001. |
| caller_id | string | No | Number shown on the receiver's phone, if one is assigned to you. Default: platform caller ID. |
| max_voice_repeat | integer 1–5 | No | How many times the recording plays before hanging up. Default 1. |
| max_call_attempts | integer 1–3 | No | How many times to retry if not answered. Default 2. |
| call_template | integer | No | Call-flow template. 2 (default) = play the recording. Use another ID only if support set up a custom flow for you. |
| call_parameters | object | No | Values for the template, keys must be var1, var2, … (max 10), e.g. {"var1":"1234"}. |
curl -X POST "https://paksender.com/api/v1/messages/send-voice-call" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"receiver_number": "+923001234567",
"recording_id": 10001,
"max_voice_repeat": 2,
"max_call_attempts": 2,
"call_parameters": {
"var1": "1234"
}
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/messages/send-voice-call');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'receiver_number' => '+923001234567',
'recording_id' => 10001,
'max_voice_repeat' => 2,
'max_call_attempts' => 2,
'call_parameters' => [
'var1' => '1234',
],
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"receiver_number":"+923001234567","recording_id":10001,"max_voice_repeat":2,"max_call_attempts":2,"call_parameters":{"var1":"1234"}}' \
"https://paksender.com/api/v1/messages/send-voice-call"
import requests
r = requests.post(
"https://paksender.com/api/v1/messages/send-voice-call",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"receiver_number": "+923001234567",
"recording_id": 10001,
"max_voice_repeat": 2,
"max_call_attempts": 2,
"call_parameters": {
"var1": "1234",
},
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/messages/send-voice-call', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"receiver_number": "+923001234567",
"recording_id": 10001,
"max_voice_repeat": 2,
"max_call_attempts": 2,
"call_parameters": {
"var1": "1234"
}
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/messages/send-voice-call')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"receiver_number" => "+923001234567",
"recording_id" => 10001,
"max_voice_repeat" => 2,
"max_call_attempts" => 2,
"call_parameters" => {
"var1" => "1234"
}
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
If the receiver presses a key during the call, it is returned as key_pressed in message status.
Estimate cost
POST /messages/estimate-cost — nothing is sent or charged
curl -X POST "https://paksender.com/api/v1/messages/estimate-cost" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"message_type": "sms",
"message": "Your OTP code is 123456",
"recipients": 1
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/messages/estimate-cost');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'message_type' => 'sms',
'message' => 'Your OTP code is 123456',
'recipients' => 1,
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"message_type":"sms","message":"Your OTP code is 123456","recipients":1}' \
"https://paksender.com/api/v1/messages/estimate-cost"
import requests
r = requests.post(
"https://paksender.com/api/v1/messages/estimate-cost",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"message_type": "sms",
"message": "Your OTP code is 123456",
"recipients": 1,
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/messages/estimate-cost', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"message_type": "sms",
"message": "Your OTP code is 123456",
"recipients": 1
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/messages/estimate-cost')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"message_type" => "sms",
"message" => "Your OTP code is 123456",
"recipients" => 1
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
| message_type | sms | voice_otp | voice_call (required) |
| message | Required for sms |
| recipients | Number of receivers (default 1) |
{
"status": "success",
"message": "Estimate calculated",
"data": {
"message_type": "sms",
"encoding": "UNICODE",
"characters": 85,
"parts": 2,
"rate_per_unit": 4.30,
"cost_per_recipient": 8.60,
"recipients": 1,
"total_cost": 8.60,
"currency": "PKR",
"balance": 245.70
}
}
Message status
GET /messages/{message_id}/status
curl -X GET "https://paksender.com/api/v1/messages/4d6a6b31/status" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json"
<?php
$ch = curl_init('https://paksender.com/api/v1/messages/4d6a6b31/status');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
],
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
https://paksender.com/api/v1/messages/4d6a6b31/status?api_key=YOUR_API_KEY
wget -qO- \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
"https://paksender.com/api/v1/messages/4d6a6b31/status"
import requests
r = requests.get(
"https://paksender.com/api/v1/messages/4d6a6b31/status",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/messages/4d6a6b31/status', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json'
}
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/messages/4d6a6b31/status')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
res = http.request(req)
puts JSON.parse(res.body)
{
"status": "success",
"message": "Message found",
"data": {
"message_id": 1024,
"reference_id": "4d6a6b31",
"message_type": "sms",
"receiver_number": "+923001234567",
"sender_id": null,
"status": "delivered",
"parts": 1,
"cost": 4.30,
"refunded": false,
"network": "Mobilink-PK",
"country_iso": "PK",
"key_pressed": null,
"error_code": null,
"error_description": null,
"created_at": "2026-09-27T10:15:02.000000Z",
"sent_at": "2026-09-27T10:15:03.000000Z",
"delivered_at": "2026-09-27T10:15:07.000000Z"
}
}
Status values
| pending | Received, being submitted. |
| sent | Accepted by the network, waiting for the handset / call result. |
| delivered | SMS delivered to the handset, or call answered. |
| expired | SMS not delivered in time (phone off / no coverage), or call not answered. |
| failed | Rejected / undeliverable, or call busy / rejected / failed. See error_code. |
List messages
GET /messages?status=delivered&message_type=sms&date_from=2026-09-01&per_page=50
curl -X GET "https://paksender.com/api/v1/messages?status=delivered&message_type=sms&per_page=50" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json"
<?php
$ch = curl_init('https://paksender.com/api/v1/messages?status=delivered&message_type=sms&per_page=50');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
],
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
https://paksender.com/api/v1/messages?api_key=YOUR_API_KEY&status=delivered&message_type=sms&per_page=50
wget -qO- \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
"https://paksender.com/api/v1/messages?status=delivered&message_type=sms&per_page=50"
import requests
r = requests.get(
"https://paksender.com/api/v1/messages",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
params={
"status": "delivered",
"message_type": "sms",
"per_page": 50,
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/messages?status=delivered&message_type=sms&per_page=50', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json'
}
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/messages?status=delivered&message_type=sms&per_page=50')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
res = http.request(req)
puts JSON.parse(res.body)
Optional filters: status, message_type, date_from, date_to (YYYY-MM-DD), per_page (1–100, default 15), page. Each item has the same fields as Message status; the response adds current_page, last_page, total.
Account balance
GET /account/balance
curl -X GET "https://paksender.com/api/v1/account/balance" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json"
<?php
$ch = curl_init('https://paksender.com/api/v1/account/balance');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
],
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
https://paksender.com/api/v1/account/balance?api_key=YOUR_API_KEY
wget -qO- \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
"https://paksender.com/api/v1/account/balance"
import requests
r = requests.get(
"https://paksender.com/api/v1/account/balance",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/account/balance', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json'
}
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/account/balance')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
res = http.request(req)
puts JSON.parse(res.body)
{
"status": "success",
"message": "Balance retrieved",
"data": {
"balance": 245.70,
"currency": "PKR",
"formatted_balance": "₨245.70",
"rates": { "sms": 4.30, "voice_otp": 5.00, "voice_call": 4.00, "email": 0.30 }
}
}
Verification / OTP
Send one-time codes to stop fake sign-ups — delivered as a proper, ready-to-read message (app name + code + expiry), exactly like the OTP an app or website sends. Two ways to use it:
- Managed — we generate the code, build the message, deliver it and verify it (
/startthen/verify). The code is stored hashed and never returned. - Delivery — your own app generated the code; we only deliver it (
/send). You verify it on your side.
Channels: sim, sms (short-code), email.
sim is open (SIM permission only, no KYC); sms (short-code) needs the SMS permission + approved KYC;
email is open (needs an active SMTP connection). No special "api" permission is required for these endpoints.
1) Managed — start POST /v1/verifications/start
Generates the code, composes the message and sends it.
| Parameter | Required | Description |
|---|---|---|
channel | Yes | sim | sms | email |
recipient | Yes | Phone number (sim/sms) or e-mail address (email) |
app_name | No | Your app / brand name shown in the message (alias: brand) |
expire_time | No | Minutes until the code expires, 1–30 (default 10). Aliases: ttl_minutes, expiry_minutes |
length | No | Number of digits, 4–8 (default 6) |
template | No | Custom message. Placeholders: {code}, {app}, {minutes} |
sender_id | No | SMS sender ID (sms channel, if your account allows one) |
subject | No | E-mail subject line (email channel) |
curl -X POST https://paksender.com/api/v1/v1/verifications/start \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channel": "sms",
"recipient": "03001234567",
"app_name": "MyApp",
"expire_time": 5,
"length": 6
}'
The recipient receives a proper OTP message, e.g.:
482913 is your verification code for MyApp. It is valid for 5 minutes. Do not share this code with anyone.
Response — note the code itself is never returned, only a request_id:
{
"status": "success",
"message": "Verification code sent",
"data": {
"request_id": "vr_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"status": "pending",
"channel": "sms",
"recipient": "03001234567",
"expires_in": 300,
"cost": 1.50
}
}
Want your own wording? Pass template:
"template": "Your {app} login code is {code} ({minutes} min)".
2) Managed — verify POST /v1/verifications/verify
Check the code the user typed, against the request_id from step 1.
curl -X POST https://paksender.com/api/v1/v1/verifications/verify \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "request_id": "vr_xxxxxxxxxxxx", "code": "482913" }'
{ "status": "success", "message": "Code verified", "data": { "status": "verified", "verified": true } }
On failure: CODE_INVALID (includes attempts_remaining), CODE_EXPIRED, CODE_LOCKED (after 5 wrong tries), or VERIFICATION_NOT_FOUND.
3) Delivery — send your own code POST /v1/verifications/send
Your app already made the code — we only deliver it. Pass either code (we wrap it into a proper message) or a full message.
| Parameter | Required | Description |
|---|---|---|
channel | Yes | sim | sms | email |
recipient | Yes | Phone or e-mail |
code | Either | Your code — we wrap it as "<code> is your verification code for <app>…" |
message | Either | Full ready text to send as-is (use instead of code) |
app_name | No | Brand shown when using code |
curl -X POST https://paksender.com/api/v1/v1/verifications/send \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channel": "email",
"recipient": "user@example.com",
"code": "123456",
"app_name": "MyApp"
}'
{ "status": "success", "message": "Code delivered", "data": { "request_id": "vr_...", "status": "sent", "cost": 0.50 } }
GET link-style also works for quick tests:
https://paksender.com/api/v1/v1/verifications/send?api_key=YOUR_API_KEY&channel=sms&recipient=03001234567&code=123456&app_name=MyApp
Invoices API
Generate an invoice from your template and send it to your customer by email (through your own SMTP) or SMS — once, or automatically on a schedule. Same API key and response format as above. Each invoice is charged like a normal email / SMS.
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /invoices | Generate + send now |
| POST | /invoices/bulk | Many recipients, each with own lines |
| POST | /entries | Record daily payments / vouchers per customer |
| POST | /entries/report | Send a statement of new entries now |
| GET | /invoices | List (filters: channel, status, schedule_id, external_ref, per_page) |
| GET | /invoices/{id} | One invoice |
| GET | /invoice-templates | Your invoice templates (optional ?channel=email|sms) |
| GET | /smtp | Your active SMTP usernames (for smtp) |
| POST | /invoice-schedules | Create a recurring / scheduled invoice |
| GET | /invoice-schedules | List schedules |
| GET | /invoice-schedules/{id} | Schedule + its recent invoices |
| PATCH | /invoice-schedules/{id} | Update fields, or status: paused / active / cancelled |
| POST | /invoice-schedules/{id}/run | Send one invoice now |
| DELETE | /invoice-schedules/{id} | Delete a schedule (sent invoices stay) |
Send an invoice now
POST /invoices
| Parameter | Required | Description |
|---|---|---|
| channel | Yes | email or sms |
| customer_name | Yes | Customer name |
| customer_email | email: Yes | Where the email invoice goes |
| customer_phone | sms: Yes | Where the SMS invoice goes, e.g. +923001234567 |
| items | Yes | Array of {product, description, qty, price} (max 50) |
| tax_percent / discount | No | Tax % and a fixed discount |
| smtp | Your SMTP username (or from-email) from Email Marketing → SMTP Settings — or several: "a@x.com,b@x.com" or ["a@x.com","b@x.com"]. With several, every email uses the account with the most sends left today, accounts at their daily limit are skipped, and a failed send is retried on the next account. Empty = all your active SMTPs. | |
| sender_id | No | SMS sender ID (sms only) |
| invoice_template_id | No | Template to use (default template if empty) — or send your own body (+ subject for email) |
| invoice_date / due_date | No | YYYY-MM-DD |
| notes, business_name, business_email | No | Shown on the invoice; business_email is the reply-to |
| external_ref | No | Your order / customer ID — returned in responses and webhooks |
| callback_url | No | We POST invoice.sent / invoice.failed here (see Webhooks) |
curl -X POST "https://paksender.com/api/v1/invoices" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"channel": "email",
"smtp": "billing@yourdomain.com",
"customer_name": "Hamza Khan",
"customer_email": "hamza@example.com",
"items": [
{
"product": "Web hosting",
"description": "1 year",
"qty": 1,
"price": 12000
},
{
"product": "Domain",
"qty": 1,
"price": 3500
}
],
"discount": 500,
"due_date": "2026-10-15",
"external_ref": "ORDER-1042",
"callback_url": "https://your-app.com/webhooks/invoices"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/invoices');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'channel' => 'email',
'smtp' => 'billing@yourdomain.com',
'customer_name' => 'Hamza Khan',
'customer_email' => 'hamza@example.com',
'items' => [
[
'product' => 'Web hosting',
'description' => '1 year',
'qty' => 1,
'price' => 12000,
],
[
'product' => 'Domain',
'qty' => 1,
'price' => 3500,
],
],
'discount' => 500,
'due_date' => '2026-10-15',
'external_ref' => 'ORDER-1042',
'callback_url' => 'https://your-app.com/webhooks/invoices',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"channel":"email","smtp":"billing@yourdomain.com","customer_name":"Hamza Khan","customer_email":"hamza@example.com","items":[{"product":"Web hosting","description":"1 year","qty":1,"price":12000},{"product":"Domain","qty":1,"price":3500}],"discount":500,"due_date":"2026-10-15","external_ref":"ORDER-1042","callback_url":"https://your-app.com/webhooks/invoices"}' \
"https://paksender.com/api/v1/invoices"
import requests
r = requests.post(
"https://paksender.com/api/v1/invoices",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"channel": "email",
"smtp": "billing@yourdomain.com",
"customer_name": "Hamza Khan",
"customer_email": "hamza@example.com",
"items": [
{
"product": "Web hosting",
"description": "1 year",
"qty": 1,
"price": 12000,
},
{
"product": "Domain",
"qty": 1,
"price": 3500,
},
],
"discount": 500,
"due_date": "2026-10-15",
"external_ref": "ORDER-1042",
"callback_url": "https://your-app.com/webhooks/invoices",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/invoices', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"channel": "email",
"smtp": "billing@yourdomain.com",
"customer_name": "Hamza Khan",
"customer_email": "hamza@example.com",
"items": [
{
"product": "Web hosting",
"description": "1 year",
"qty": 1,
"price": 12000
},
{
"product": "Domain",
"qty": 1,
"price": 3500
}
],
"discount": 500,
"due_date": "2026-10-15",
"external_ref": "ORDER-1042",
"callback_url": "https://your-app.com/webhooks/invoices"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/invoices')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"channel" => "email",
"smtp" => "billing@yourdomain.com",
"customer_name" => "Hamza Khan",
"customer_email" => "hamza@example.com",
"items" => [
{
"product" => "Web hosting",
"description" => "1 year",
"qty" => 1,
"price" => 12000
},
{
"product" => "Domain",
"qty" => 1,
"price" => 3500
}
],
"discount" => 500,
"due_date" => "2026-10-15",
"external_ref" => "ORDER-1042",
"callback_url" => "https://your-app.com/webhooks/invoices"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
{
"status": "success",
"message": "Invoice INV-2026-00017 e-mailed to hamza@example.com.",
"data": {
"invoice": {
"id": 17, "invoice_no": "INV-2026-00017", "channel": "email", "status": "sent",
"customer": { "name": "Hamza Khan", "email": "hamza@example.com", "phone": null },
"items": [ { "product": "Web hosting", "description": "1 year", "qty": 1, "price": 12000, "line_total": 12000 }, ... ],
"subtotal": 15500, "tax_percent": 0, "tax": 0, "discount": 500, "total": 15000, "currency": "PKR",
"cost": 0.50, "schedule_id": null, "source": "api", "external_ref": "ORDER-1042",
"sent_at": "2026-09-29T10:15:03+00:00"
}
}
}
Recurring / scheduled invoices
POST /invoice-schedules — all the fields of Send an invoice now, plus:
| frequency | Yes | once, daily, weekly, monthly or custom |
| interval_days | custom | Every N days (1–365) |
| start_at | Yes | First send, YYYY-MM-DD HH:MM in timezone |
| end_at | No | No sends after this date/time |
| max_runs | No | Stop after this many invoices |
| timezone | No | Default Asia/Karachi |
| source_url | No | Live data: we GET this URL before every send and use the returned customer / items / amounts (see below). Then items may be empty. |
| name | No | Label shown in your dashboard |
curl -X POST "https://paksender.com/api/v1/invoice-schedules" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"channel": "sms",
"customer_name": "Ali Traders",
"customer_phone": "+923001234567",
"items": [
{
"product": "Monthly maintenance",
"qty": 1,
"price": 5000
}
],
"frequency": "monthly",
"start_at": "2026-10-01 10:00",
"max_runs": 12,
"external_ref": "CUST-88"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/invoice-schedules');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'channel' => 'sms',
'customer_name' => 'Ali Traders',
'customer_phone' => '+923001234567',
'items' => [
[
'product' => 'Monthly maintenance',
'qty' => 1,
'price' => 5000,
],
],
'frequency' => 'monthly',
'start_at' => '2026-10-01 10:00',
'max_runs' => 12,
'external_ref' => 'CUST-88',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"channel":"sms","customer_name":"Ali Traders","customer_phone":"+923001234567","items":[{"product":"Monthly maintenance","qty":1,"price":5000}],"frequency":"monthly","start_at":"2026-10-01 10:00","max_runs":12,"external_ref":"CUST-88"}' \
"https://paksender.com/api/v1/invoice-schedules"
import requests
r = requests.post(
"https://paksender.com/api/v1/invoice-schedules",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"channel": "sms",
"customer_name": "Ali Traders",
"customer_phone": "+923001234567",
"items": [
{
"product": "Monthly maintenance",
"qty": 1,
"price": 5000,
},
],
"frequency": "monthly",
"start_at": "2026-10-01 10:00",
"max_runs": 12,
"external_ref": "CUST-88",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/invoice-schedules', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"channel": "sms",
"customer_name": "Ali Traders",
"customer_phone": "+923001234567",
"items": [
{
"product": "Monthly maintenance",
"qty": 1,
"price": 5000
}
],
"frequency": "monthly",
"start_at": "2026-10-01 10:00",
"max_runs": 12,
"external_ref": "CUST-88"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/invoice-schedules')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"channel" => "sms",
"customer_name" => "Ali Traders",
"customer_phone" => "+923001234567",
"items" => [
{
"product" => "Monthly maintenance",
"qty" => 1,
"price" => 5000
}
],
"frequency" => "monthly",
"start_at" => "2026-10-01 10:00",
"max_runs" => 12,
"external_ref" => "CUST-88"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
Pause / resume / cancel: PATCH /invoice-schedules/{id} with {"status":"paused"}, {"status":"active"} or {"status":"cancelled"}. Any other field (items, frequency, start_at, end_at, max_runs…) can be updated the same way.
Live data from your software (source_url)
Right before each scheduled send we call GET source_url?schedule_id=…&external_ref=… with headers X-Webhook-Schedule and X-Webhook-Signature (= HMAC-SHA256 of the schedule id with your webhook secret). Reply with JSON — every field is optional, missing ones keep the schedule's saved values:
{
"customer_name": "Ali Traders",
"customer_phone": "+923001234567",
"items": [ { "product": "Usage — September", "qty": 1, "price": 7350 } ],
"tax_percent": 0,
"discount": 0,
"due_date": "2026-10-10",
"notes": "Pay via JazzCash 0300-1234567",
"skip": false
}
Return {"skip": true} to skip this period (nothing is sent or charged). If the URL fails, that send is marked failed and the next period is tried as scheduled.
Invoices, receipts & statements (several dates + amounts)
Every endpoint accepts doc_type: invoice (default), receipt or statement (a report with many dated lines). Each line in items may have its own date:
"doc_type": "statement",
"items": [
{ "date": "2026-09-27", "product": "Payment received", "price": 70 },
{ "date": "2026-09-28", "product": "Payment received", "price": 80 },
{ "date": "2026-09-29", "product": "Voucher #12", "price": 150 }
]
Numbers get their own series: INV-2026-…, RCT-2026-…, STM-2026-…. Extra placeholders: {{document_title}}, {{period_from}}, {{period_to}}, {{entries_count}}.
Many recipients in one call
POST /invoices/bulk — up to 100 documents; each person gets their own (today Ali Rs 70, Sara Rs 80…). Shared fields (channel, doc_type, smtp, sender_id, invoice_template_id, notes, callback_url) apply to all.
curl -X POST "https://paksender.com/api/v1/invoices/bulk" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"channel": "sms",
"doc_type": "receipt",
"documents": [
{
"customer_name": "Ali",
"customer_phone": "+923001111111",
"items": [
{
"date": "2026-09-29",
"product": "Payment",
"price": 70
}
],
"external_ref": "A-1"
},
{
"customer_name": "Sara",
"customer_phone": "+923002222222",
"items": [
{
"date": "2026-09-29",
"product": "Payment",
"price": 80
}
],
"external_ref": "S-9"
}
]
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/invoices/bulk');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'channel' => 'sms',
'doc_type' => 'receipt',
'documents' => [
[
'customer_name' => 'Ali',
'customer_phone' => '+923001111111',
'items' => [
[
'date' => '2026-09-29',
'product' => 'Payment',
'price' => 70,
],
],
'external_ref' => 'A-1',
],
[
'customer_name' => 'Sara',
'customer_phone' => '+923002222222',
'items' => [
[
'date' => '2026-09-29',
'product' => 'Payment',
'price' => 80,
],
],
'external_ref' => 'S-9',
],
],
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"channel":"sms","doc_type":"receipt","documents":[{"customer_name":"Ali","customer_phone":"+923001111111","items":[{"date":"2026-09-29","product":"Payment","price":70}],"external_ref":"A-1"},{"customer_name":"Sara","customer_phone":"+923002222222","items":[{"date":"2026-09-29","product":"Payment","price":80}],"external_ref":"S-9"}]}' \
"https://paksender.com/api/v1/invoices/bulk"
import requests
r = requests.post(
"https://paksender.com/api/v1/invoices/bulk",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"channel": "sms",
"doc_type": "receipt",
"documents": [
{
"customer_name": "Ali",
"customer_phone": "+923001111111",
"items": [
{
"date": "2026-09-29",
"product": "Payment",
"price": 70,
},
],
"external_ref": "A-1",
},
{
"customer_name": "Sara",
"customer_phone": "+923002222222",
"items": [
{
"date": "2026-09-29",
"product": "Payment",
"price": 80,
},
],
"external_ref": "S-9",
},
],
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/invoices/bulk', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"channel": "sms",
"doc_type": "receipt",
"documents": [
{
"customer_name": "Ali",
"customer_phone": "+923001111111",
"items": [
{
"date": "2026-09-29",
"product": "Payment",
"price": 70
}
],
"external_ref": "A-1"
},
{
"customer_name": "Sara",
"customer_phone": "+923002222222",
"items": [
{
"date": "2026-09-29",
"product": "Payment",
"price": 80
}
],
"external_ref": "S-9"
}
]
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/invoices/bulk')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"channel" => "sms",
"doc_type" => "receipt",
"documents" => [
{
"customer_name" => "Ali",
"customer_phone" => "+923001111111",
"items" => [
{
"date" => "2026-09-29",
"product" => "Payment",
"price" => 70
}
],
"external_ref" => "A-1"
},
{
"customer_name" => "Sara",
"customer_phone" => "+923002222222",
"items" => [
{
"date" => "2026-09-29",
"product" => "Payment",
"price" => 80
}
],
"external_ref" => "S-9"
}
]
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
{ "status": "success", "message": "2 of 2 sent",
"data": { "sent": 2, "failed": 0,
"results": [ { "index": 0, "ok": true, "message": "Invoice RCT-2026-00005 sent by SMS.", "invoice": { ... } }, ... ] } }
Daily entries → automatic reports
Push each customer's payments / vouchers / sales as they happen. We keep them until they are reported, then send ONE statement with all new lines — on demand or on a schedule (daily, weekly, monthly, every N days, until a date). The same line is never reported twice.
| POST | /entries | Add one line, or {"entries":[…]} (max 500). Fields: customer_ref*, description*, amount*, date, qty, customer_name, customer_phone, customer_email, external_id (a line with an existing external_id is skipped — safe to retry). |
| GET | /entries | List (customer_ref, status=unreported|reported, date_from, date_to) — or ?summary=1 for unreported totals per customer. |
| DELETE | /entries/{id} | Delete a line that was not reported yet. |
| POST | /entries/report | Send statement(s) now: channel + customer_ref / customer_refs[] / all: true; optional until (date), smtp, sender_id, invoice_template_id, notes, callback_url. |
curl -X POST "https://paksender.com/api/v1/entries" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"entries": [
{
"customer_ref": "CUST-12",
"customer_name": "Ali",
"customer_phone": "+923001111111",
"date": "2026-09-29",
"description": "Payment received",
"amount": 70,
"external_id": "PAY-9001"
},
{
"customer_ref": "CUST-12",
"date": "2026-09-29",
"description": "Voucher #12",
"amount": 150,
"external_id": "VCH-12"
}
]
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/entries');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'entries' => [
[
'customer_ref' => 'CUST-12',
'customer_name' => 'Ali',
'customer_phone' => '+923001111111',
'date' => '2026-09-29',
'description' => 'Payment received',
'amount' => 70,
'external_id' => 'PAY-9001',
],
[
'customer_ref' => 'CUST-12',
'date' => '2026-09-29',
'description' => 'Voucher #12',
'amount' => 150,
'external_id' => 'VCH-12',
],
],
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"entries":[{"customer_ref":"CUST-12","customer_name":"Ali","customer_phone":"+923001111111","date":"2026-09-29","description":"Payment received","amount":70,"external_id":"PAY-9001"},{"customer_ref":"CUST-12","date":"2026-09-29","description":"Voucher #12","amount":150,"external_id":"VCH-12"}]}' \
"https://paksender.com/api/v1/entries"
import requests
r = requests.post(
"https://paksender.com/api/v1/entries",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"entries": [
{
"customer_ref": "CUST-12",
"customer_name": "Ali",
"customer_phone": "+923001111111",
"date": "2026-09-29",
"description": "Payment received",
"amount": 70,
"external_id": "PAY-9001",
},
{
"customer_ref": "CUST-12",
"date": "2026-09-29",
"description": "Voucher #12",
"amount": 150,
"external_id": "VCH-12",
},
],
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/entries', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"entries": [
{
"customer_ref": "CUST-12",
"customer_name": "Ali",
"customer_phone": "+923001111111",
"date": "2026-09-29",
"description": "Payment received",
"amount": 70,
"external_id": "PAY-9001"
},
{
"customer_ref": "CUST-12",
"date": "2026-09-29",
"description": "Voucher #12",
"amount": 150,
"external_id": "VCH-12"
}
]
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/entries')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"entries" => [
{
"customer_ref" => "CUST-12",
"customer_name" => "Ali",
"customer_phone" => "+923001111111",
"date" => "2026-09-29",
"description" => "Payment received",
"amount" => 70,
"external_id" => "PAY-9001"
},
{
"customer_ref" => "CUST-12",
"date" => "2026-09-29",
"description" => "Voucher #12",
"amount" => 150,
"external_id" => "VCH-12"
}
]
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X POST "https://paksender.com/api/v1/entries/report" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"channel": "sms",
"customer_ref": "CUST-12"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/entries/report');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'channel' => 'sms',
'customer_ref' => 'CUST-12',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"channel":"sms","customer_ref":"CUST-12"}' \
"https://paksender.com/api/v1/entries/report"
import requests
r = requests.post(
"https://paksender.com/api/v1/entries/report",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"channel": "sms",
"customer_ref": "CUST-12",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/entries/report', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"channel": "sms",
"customer_ref": "CUST-12"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/entries/report')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"channel" => "sms",
"customer_ref" => "CUST-12"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X POST "https://paksender.com/api/v1/invoice-schedules" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"channel": "sms",
"use_entries": true,
"customer_ref": "CUST-12",
"customer_name": "Ali",
"customer_phone": "+923001111111",
"frequency": "daily",
"start_at": "2026-09-29 21:00",
"end_at": "2026-12-31 23:59"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/invoice-schedules');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'channel' => 'sms',
'use_entries' => true,
'customer_ref' => 'CUST-12',
'customer_name' => 'Ali',
'customer_phone' => '+923001111111',
'frequency' => 'daily',
'start_at' => '2026-09-29 21:00',
'end_at' => '2026-12-31 23:59',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"channel":"sms","use_entries":true,"customer_ref":"CUST-12","customer_name":"Ali","customer_phone":"+923001111111","frequency":"daily","start_at":"2026-09-29 21:00","end_at":"2026-12-31 23:59"}' \
"https://paksender.com/api/v1/invoice-schedules"
import requests
r = requests.post(
"https://paksender.com/api/v1/invoice-schedules",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"channel": "sms",
"use_entries": True,
"customer_ref": "CUST-12",
"customer_name": "Ali",
"customer_phone": "+923001111111",
"frequency": "daily",
"start_at": "2026-09-29 21:00",
"end_at": "2026-12-31 23:59",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/invoice-schedules', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"channel": "sms",
"use_entries": true,
"customer_ref": "CUST-12",
"customer_name": "Ali",
"customer_phone": "+923001111111",
"frequency": "daily",
"start_at": "2026-09-29 21:00",
"end_at": "2026-12-31 23:59"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/invoice-schedules')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"channel" => "sms",
"use_entries" => true,
"customer_ref" => "CUST-12",
"customer_name" => "Ali",
"customer_phone" => "+923001111111",
"frequency" => "daily",
"start_at" => "2026-09-29 21:00",
"end_at" => "2026-12-31 23:59"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
A schedule with use_entries: true sends only the new lines each time; if there are none it skips (no message, no charge) unless send_empty: true.
Webhooks (callback_url)
After every send we POST JSON to callback_url with headers X-Webhook-Event (invoice.sent / invoice.failed) and X-Webhook-Signature = HMAC-SHA256 of the raw body with your webhook secret (Invoices → Recurring Invoices).
<?php
$raw = file_get_contents('php://input');
$expected = hash_hmac('sha256', $raw, 'YOUR_WEBHOOK_SECRET');
if (!hash_equals($expected, $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '')) {
http_response_code(401); exit;
}
$event = json_decode($raw, true); // ['event' => 'invoice.sent', 'invoice' => [...], 'sent_at' => ...]
// e.g. mark ORDER-1042 as "invoice sent": $event['invoice']['external_ref']
http_response_code(200);
Invoice errors use the same error codes (VALIDATION_ERROR, INSUFFICIENT_BALANCE, KYC_REQUIRED, FEATURE_DISABLED, NOT_FOUND, SEND_FAILED).
My SIM — send from your own phone
Connect an Android phone running SMS Gateway for Android (setup: SMS → My SIM). Then every SMS — /messages/send-sms, bulk, invoices, auto-billing, automations — can go out from your own SIM. Only the platform software fee is charged (₨0.50 per SMS part — this is separate from the normal SMS price, and an admin can set a custom rate per customer); it is refunded if the phone could not send. GET /sim returns your exact SIM fee (fee_per_sms, fee_default, fee_custom).
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /messages/send-sms | Add "route": sim (only my SIM), platform (normal SMS), auto (SIM, else normal SMS). Without it your account's mode is used. The response shows route and device. |
| GET | /sim | Mode, fee, today's counts and your phones |
| PUT | /sim/mode | off | sim | sim_first |
| POST | /sim/phones | Connect a phone: name, username, password (from the app), optional server_url (private server), device_id, sim_number 1|2, daily_limit, priority |
| PATCH | /sim/phones/{id} | Change name, SIM slot, daily limit, priority, active |
| POST | /sim/phones/{id}/check | Test the login and see when the phone was last online |
| DELETE | /sim/phones/{id} | Remove a phone |
curl -X POST "https://paksender.com/api/v1/sim/phones" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Shop phone (Jazz)",
"username": "ABCDEF",
"password": "abcdefghijkl",
"sim_number": 1,
"daily_limit": 300
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/sim/phones');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Shop phone (Jazz)',
'username' => 'ABCDEF',
'password' => 'abcdefghijkl',
'sim_number' => 1,
'daily_limit' => 300,
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"name":"Shop phone (Jazz)","username":"ABCDEF","password":"abcdefghijkl","sim_number":1,"daily_limit":300}' \
"https://paksender.com/api/v1/sim/phones"
import requests
r = requests.post(
"https://paksender.com/api/v1/sim/phones",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"name": "Shop phone (Jazz)",
"username": "ABCDEF",
"password": "abcdefghijkl",
"sim_number": 1,
"daily_limit": 300,
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/sim/phones', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Shop phone (Jazz)",
"username": "ABCDEF",
"password": "abcdefghijkl",
"sim_number": 1,
"daily_limit": 300
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/sim/phones')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"name" => "Shop phone (Jazz)",
"username" => "ABCDEF",
"password" => "abcdefghijkl",
"sim_number" => 1,
"daily_limit" => 300
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X PUT "https://paksender.com/api/v1/sim/mode" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"mode": "sim_first"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/sim/mode');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'mode' => 'sim_first',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=PUT \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"mode":"sim_first"}' \
"https://paksender.com/api/v1/sim/mode"
import requests
r = requests.put(
"https://paksender.com/api/v1/sim/mode",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"mode": "sim_first",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/sim/mode', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"mode": "sim_first"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/sim/mode')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Put.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"mode" => "sim_first"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X POST "https://paksender.com/api/v1/messages/send-sms" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"receiver_number": "+923001234567",
"message": "Your OTP is 482913. Do not share it.",
"route": "sim"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/messages/send-sms');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'receiver_number' => '+923001234567',
'message' => 'Your OTP is 482913. Do not share it.',
'route' => 'sim',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"receiver_number":"+923001234567","message":"Your OTP is 482913. Do not share it.","route":"sim"}' \
"https://paksender.com/api/v1/messages/send-sms"
import requests
r = requests.post(
"https://paksender.com/api/v1/messages/send-sms",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"receiver_number": "+923001234567",
"message": "Your OTP is 482913. Do not share it.",
"route": "sim",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/messages/send-sms', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"receiver_number": "+923001234567",
"message": "Your OTP is 482913. Do not share it.",
"route": "sim"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/messages/send-sms')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"receiver_number" => "+923001234567",
"message" => "Your OTP is 482913. Do not share it.",
"route" => "sim"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
SIM_NOT_CONFIGURED (409, no phone), SIM_LIMIT_REACHED (429, all phones at their daily limit), SIM_SEND_FAILED (502, phone/gateway refused — reason included), INSUFFICIENT_BALANCE (fee). Delivery status (sent → delivered / failed) arrives from the phone and shows in GET /messages/{id} and your message history.Auto-billing (set up once, fully automatic)
Turn it on once, then your software only pushes sales. Every day / week / month at your time, every customer with new sales gets one invoice or statement — on the first channel that works in your order (e.g. WhatsApp → SMS → Email). Failed ones are retried every hour (3×), each sale is billed only once, and you get a summary e-mail plus an optional webhook. Same settings on the website: Invoices → Auto-billing.
| Method | Endpoint | Purpose |
|---|---|---|
| PUT | /auto-billing | Turn on + schedule: frequency daily|weekly|monthly, send_time HH:MM (PKT), weekday 1-7, monthday 1-28, channels in order, doc_type, whatsapp {template…}, smtp, sender_id, notify_owner, callback_url |
| GET | /auto-billing | Settings, next run, last run summary, customers waiting |
| POST | /entries | Push sales (up to the batch limit). external_id stops duplicates. Add "send":"now" to bill these customers immediately. |
| POST | /auto-billing/run | Send everything waiting right now |
| POST | /invoices | "channel":"auto" — one invoice now, by the first channel that works |
curl -X PUT "https://paksender.com/api/v1/auto-billing" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"frequency": "daily",
"send_time": "21:00",
"channels": [
"whatsapp",
"sms",
"email"
],
"doc_type": "statement",
"whatsapp": {
"template": "monthly_statement"
},
"notify_owner": true,
"callback_url": "https://yourshop.com/webhooks/billing"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/auto-billing');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'frequency' => 'daily',
'send_time' => '21:00',
'channels' => [
'whatsapp',
'sms',
'email',
],
'doc_type' => 'statement',
'whatsapp' => [
'template' => 'monthly_statement',
],
'notify_owner' => true,
'callback_url' => 'https://yourshop.com/webhooks/billing',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=PUT \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"enabled":true,"frequency":"daily","send_time":"21:00","channels":["whatsapp","sms","email"],"doc_type":"statement","whatsapp":{"template":"monthly_statement"},"notify_owner":true,"callback_url":"https://yourshop.com/webhooks/billing"}' \
"https://paksender.com/api/v1/auto-billing"
import requests
r = requests.put(
"https://paksender.com/api/v1/auto-billing",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"enabled": True,
"frequency": "daily",
"send_time": "21:00",
"channels": [
"whatsapp",
"sms",
"email",
],
"doc_type": "statement",
"whatsapp": {
"template": "monthly_statement",
},
"notify_owner": True,
"callback_url": "https://yourshop.com/webhooks/billing",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/auto-billing', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"enabled": true,
"frequency": "daily",
"send_time": "21:00",
"channels": [
"whatsapp",
"sms",
"email"
],
"doc_type": "statement",
"whatsapp": {
"template": "monthly_statement"
},
"notify_owner": true,
"callback_url": "https://yourshop.com/webhooks/billing"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/auto-billing')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Put.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"enabled" => true,
"frequency" => "daily",
"send_time" => "21:00",
"channels" => [
"whatsapp",
"sms",
"email"
],
"doc_type" => "statement",
"whatsapp" => {
"template" => "monthly_statement"
},
"notify_owner" => true,
"callback_url" => "https://yourshop.com/webhooks/billing"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X POST "https://paksender.com/api/v1/entries" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"entries": [
{
"customer_ref": "CUST-1",
"customer_name": "Ali Khan",
"customer_phone": "+923001234567",
"customer_email": "ali@example.com",
"description": "Milk 2L",
"amount": 400,
"external_id": "sale-9001"
},
{
"customer_ref": "CUST-2",
"customer_name": "Sara",
"customer_phone": "+923007654321",
"description": "Eggs (12)",
"amount": 300,
"external_id": "sale-9002"
}
]
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/entries');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'entries' => [
[
'customer_ref' => 'CUST-1',
'customer_name' => 'Ali Khan',
'customer_phone' => '+923001234567',
'customer_email' => 'ali@example.com',
'description' => 'Milk 2L',
'amount' => 400,
'external_id' => 'sale-9001',
],
[
'customer_ref' => 'CUST-2',
'customer_name' => 'Sara',
'customer_phone' => '+923007654321',
'description' => 'Eggs (12)',
'amount' => 300,
'external_id' => 'sale-9002',
],
],
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"entries":[{"customer_ref":"CUST-1","customer_name":"Ali Khan","customer_phone":"+923001234567","customer_email":"ali@example.com","description":"Milk 2L","amount":400,"external_id":"sale-9001"},{"customer_ref":"CUST-2","customer_name":"Sara","customer_phone":"+923007654321","description":"Eggs (12)","amount":300,"external_id":"sale-9002"}]}' \
"https://paksender.com/api/v1/entries"
import requests
r = requests.post(
"https://paksender.com/api/v1/entries",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"entries": [
{
"customer_ref": "CUST-1",
"customer_name": "Ali Khan",
"customer_phone": "+923001234567",
"customer_email": "ali@example.com",
"description": "Milk 2L",
"amount": 400,
"external_id": "sale-9001",
},
{
"customer_ref": "CUST-2",
"customer_name": "Sara",
"customer_phone": "+923007654321",
"description": "Eggs (12)",
"amount": 300,
"external_id": "sale-9002",
},
],
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/entries', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"entries": [
{
"customer_ref": "CUST-1",
"customer_name": "Ali Khan",
"customer_phone": "+923001234567",
"customer_email": "ali@example.com",
"description": "Milk 2L",
"amount": 400,
"external_id": "sale-9001"
},
{
"customer_ref": "CUST-2",
"customer_name": "Sara",
"customer_phone": "+923007654321",
"description": "Eggs (12)",
"amount": 300,
"external_id": "sale-9002"
}
]
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/entries')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"entries" => [
{
"customer_ref" => "CUST-1",
"customer_name" => "Ali Khan",
"customer_phone" => "+923001234567",
"customer_email" => "ali@example.com",
"description" => "Milk 2L",
"amount" => 400,
"external_id" => "sale-9001"
},
{
"customer_ref" => "CUST-2",
"customer_name" => "Sara",
"customer_phone" => "+923007654321",
"description" => "Eggs (12)",
"amount" => 300,
"external_id" => "sale-9002"
}
]
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X POST "https://paksender.com/api/v1/invoices" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"channel": "auto",
"customer_name": "Ali Khan",
"customer_phone": "+923001234567",
"customer_email": "ali@example.com",
"items": [
{
"product": "Shoes",
"qty": 2,
"price": 1500
}
],
"external_ref": "ORDER-1042"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/invoices');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'channel' => 'auto',
'customer_name' => 'Ali Khan',
'customer_phone' => '+923001234567',
'customer_email' => 'ali@example.com',
'items' => [
[
'product' => 'Shoes',
'qty' => 2,
'price' => 1500,
],
],
'external_ref' => 'ORDER-1042',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"channel":"auto","customer_name":"Ali Khan","customer_phone":"+923001234567","customer_email":"ali@example.com","items":[{"product":"Shoes","qty":2,"price":1500}],"external_ref":"ORDER-1042"}' \
"https://paksender.com/api/v1/invoices"
import requests
r = requests.post(
"https://paksender.com/api/v1/invoices",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"channel": "auto",
"customer_name": "Ali Khan",
"customer_phone": "+923001234567",
"customer_email": "ali@example.com",
"items": [
{
"product": "Shoes",
"qty": 2,
"price": 1500,
},
],
"external_ref": "ORDER-1042",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/invoices', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"channel": "auto",
"customer_name": "Ali Khan",
"customer_phone": "+923001234567",
"customer_email": "ali@example.com",
"items": [
{
"product": "Shoes",
"qty": 2,
"price": 1500
}
],
"external_ref": "ORDER-1042"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/invoices')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"channel" => "auto",
"customer_name" => "Ali Khan",
"customer_phone" => "+923001234567",
"customer_email" => "ali@example.com",
"items" => [
{
"product" => "Shoes",
"qty" => 2,
"price" => 1500
}
],
"external_ref" => "ORDER-1042"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
autopilot.run is signed with X-Webhook-Signature (same secret as invoice webhooks).WhatsApp Business API
Send WhatsApp messages from your software with the same API key. Needs an active WhatsApp plan that includes Developer API, and a connected official WhatsApp Cloud API number. Every message counts against your plan's monthly limit.
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /whatsapp/send | Text, image / document / video, or approved template |
| POST | /whatsapp/campaigns | One message to many numbers (each sent once) |
| GET | /whatsapp/campaigns/{id} | Progress + every number's status |
| GET | /whatsapp/messages | Sent & received messages (direction, status, phone, since_id) |
| GET | /whatsapp/messages/{id} | One message (status: sent → delivered → read / failed) |
| GET | /whatsapp/templates | Approved templates of a Cloud API number |
| GET | /whatsapp/accounts | Your connected numbers (account_id) |
| GET | /whatsapp/subscription | Plan, end date, limits and usage |
/whatsapp/send parameters: to (required), account_id (optional — first connected number), type = text | image | video | audio | document | template, message (text or caption), media_url (public https), filename, template, language (default en_US), params (template variables in order), header_image.
curl -X POST "https://paksender.com/api/v1/whatsapp/send" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"to": "+923001234567",
"message": "Assalam o Alaikum! Your order #1042 is confirmed. - Pak Sender"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/whatsapp/send');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'to' => '+923001234567',
'message' => 'Assalam o Alaikum! Your order #1042 is confirmed. - Pak Sender',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"to":"+923001234567","message":"Assalam o Alaikum! Your order #1042 is confirmed. - Pak Sender"}' \
"https://paksender.com/api/v1/whatsapp/send"
import requests
r = requests.post(
"https://paksender.com/api/v1/whatsapp/send",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"to": "+923001234567",
"message": "Assalam o Alaikum! Your order #1042 is confirmed. - Pak Sender",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/whatsapp/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"to": "+923001234567",
"message": "Assalam o Alaikum! Your order #1042 is confirmed. - Pak Sender"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/whatsapp/send')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"to" => "+923001234567",
"message" => "Assalam o Alaikum! Your order #1042 is confirmed. - Pak Sender"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X POST "https://paksender.com/api/v1/whatsapp/send" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"to": "+923001234567",
"type": "template",
"template": "order_update",
"language": "en_US",
"params": [
"Ali",
"1042",
"15 Oct"
]
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/whatsapp/send');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'to' => '+923001234567',
'type' => 'template',
'template' => 'order_update',
'language' => 'en_US',
'params' => [
'Ali',
'1042',
'15 Oct',
],
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"to":"+923001234567","type":"template","template":"order_update","language":"en_US","params":["Ali","1042","15 Oct"]}' \
"https://paksender.com/api/v1/whatsapp/send"
import requests
r = requests.post(
"https://paksender.com/api/v1/whatsapp/send",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"to": "+923001234567",
"type": "template",
"template": "order_update",
"language": "en_US",
"params": [
"Ali",
"1042",
"15 Oct",
],
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/whatsapp/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"to": "+923001234567",
"type": "template",
"template": "order_update",
"language": "en_US",
"params": [
"Ali",
"1042",
"15 Oct"
]
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/whatsapp/send')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"to" => "+923001234567",
"type" => "template",
"template" => "order_update",
"language" => "en_US",
"params" => [
"Ali",
"1042",
"15 Oct"
]
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X POST "https://paksender.com/api/v1/whatsapp/send" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"to": "+923001234567",
"type": "document",
"media_url": "https://yourshop.com/invoices/1042.pdf",
"filename": "Invoice-1042.pdf",
"message": "Your invoice"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/whatsapp/send');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'to' => '+923001234567',
'type' => 'document',
'media_url' => 'https://yourshop.com/invoices/1042.pdf',
'filename' => 'Invoice-1042.pdf',
'message' => 'Your invoice',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"to":"+923001234567","type":"document","media_url":"https://yourshop.com/invoices/1042.pdf","filename":"Invoice-1042.pdf","message":"Your invoice"}' \
"https://paksender.com/api/v1/whatsapp/send"
import requests
r = requests.post(
"https://paksender.com/api/v1/whatsapp/send",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"to": "+923001234567",
"type": "document",
"media_url": "https://yourshop.com/invoices/1042.pdf",
"filename": "Invoice-1042.pdf",
"message": "Your invoice",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/whatsapp/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"to": "+923001234567",
"type": "document",
"media_url": "https://yourshop.com/invoices/1042.pdf",
"filename": "Invoice-1042.pdf",
"message": "Your invoice"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/whatsapp/send')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"to" => "+923001234567",
"type" => "document",
"media_url" => "https://yourshop.com/invoices/1042.pdf",
"filename" => "Invoice-1042.pdf",
"message" => "Your invoice"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X POST "https://paksender.com/api/v1/whatsapp/campaigns" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Eid offer",
"type": "template",
"template": "eid_offer",
"language": "en_US",
"params": [
"{name}",
"20%"
],
"recipients": [
{
"phone": "+923001111111",
"name": "Ali"
},
{
"phone": "+923002222222",
"name": "Sara"
}
],
"send_at": "2026-11-11 09:00"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/whatsapp/campaigns');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Eid offer',
'type' => 'template',
'template' => 'eid_offer',
'language' => 'en_US',
'params' => [
'{name}',
'20%',
],
'recipients' => [
[
'phone' => '+923001111111',
'name' => 'Ali',
],
[
'phone' => '+923002222222',
'name' => 'Sara',
],
],
'send_at' => '2026-11-11 09:00',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"name":"Eid offer","type":"template","template":"eid_offer","language":"en_US","params":["{name}","20%"],"recipients":[{"phone":"+923001111111","name":"Ali"},{"phone":"+923002222222","name":"Sara"}],"send_at":"2026-11-11 09:00"}' \
"https://paksender.com/api/v1/whatsapp/campaigns"
import requests
r = requests.post(
"https://paksender.com/api/v1/whatsapp/campaigns",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"name": "Eid offer",
"type": "template",
"template": "eid_offer",
"language": "en_US",
"params": [
"{name}",
"20%",
],
"recipients": [
{
"phone": "+923001111111",
"name": "Ali",
},
{
"phone": "+923002222222",
"name": "Sara",
},
],
"send_at": "2026-11-11 09:00",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/whatsapp/campaigns', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Eid offer",
"type": "template",
"template": "eid_offer",
"language": "en_US",
"params": [
"{name}",
"20%"
],
"recipients": [
{
"phone": "+923001111111",
"name": "Ali"
},
{
"phone": "+923002222222",
"name": "Sara"
}
],
"send_at": "2026-11-11 09:00"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/whatsapp/campaigns')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"name" => "Eid offer",
"type" => "template",
"template" => "eid_offer",
"language" => "en_US",
"params" => [
"{name}",
"20%"
],
"recipients" => [
{
"phone" => "+923001111111",
"name" => "Ali"
},
{
"phone" => "+923002222222",
"name" => "Sara"
}
],
"send_at" => "2026-11-11 09:00"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
Templates (create from your software)
Messages to customers who haven't written to you in 24 hours must use an approved template. Create one with a single call — ready-made: invoice_issued, payment_receipt, payment_reminder, monthly_statement, thank_you, loyalty_points, discount_voucher, order_update, new_offer (GET /whatsapp/templates/presets lists their text and data keys). Meta usually approves in minutes; check with GET /whatsapp/templates. Delete: DELETE /whatsapp/templates/{name}.
curl -X POST "https://paksender.com/api/v1/whatsapp/templates" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"preset": "discount_voucher"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/whatsapp/templates');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'preset' => 'discount_voucher',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"preset":"discount_voucher"}' \
"https://paksender.com/api/v1/whatsapp/templates"
import requests
r = requests.post(
"https://paksender.com/api/v1/whatsapp/templates",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"preset": "discount_voucher",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/whatsapp/templates', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"preset": "discount_voucher"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/whatsapp/templates')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"preset" => "discount_voucher"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X POST "https://paksender.com/api/v1/whatsapp/templates" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "order_shipped",
"language": "en_US",
"category": "UTILITY",
"header_type": "text",
"header_text": "Order shipped",
"body": "Hi {{1}}, your order {{2}} has been shipped and will arrive on {{3}}. Thank you!",
"body_examples": [
"Ali",
"#1042",
"15 Oct"
],
"footer": "Reply STOP to unsubscribe",
"buttons": [
{
"type": "URL",
"text": "Track order",
"value": "https://yourshop.com/track"
}
]
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/whatsapp/templates');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'order_shipped',
'language' => 'en_US',
'category' => 'UTILITY',
'header_type' => 'text',
'header_text' => 'Order shipped',
'body' => 'Hi {{1}}, your order {{2}} has been shipped and will arrive on {{3}}. Thank you!',
'body_examples' => [
'Ali',
'#1042',
'15 Oct',
],
'footer' => 'Reply STOP to unsubscribe',
'buttons' => [
[
'type' => 'URL',
'text' => 'Track order',
'value' => 'https://yourshop.com/track',
],
],
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"name":"order_shipped","language":"en_US","category":"UTILITY","header_type":"text","header_text":"Order shipped","body":"Hi {{1}}, your order {{2}} has been shipped and will arrive on {{3}}. Thank you!","body_examples":["Ali","#1042","15 Oct"],"footer":"Reply STOP to unsubscribe","buttons":[{"type":"URL","text":"Track order","value":"https://yourshop.com/track"}]}' \
"https://paksender.com/api/v1/whatsapp/templates"
import requests
r = requests.post(
"https://paksender.com/api/v1/whatsapp/templates",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"name": "order_shipped",
"language": "en_US",
"category": "UTILITY",
"header_type": "text",
"header_text": "Order shipped",
"body": "Hi {{1}}, your order {{2}} has been shipped and will arrive on {{3}}. Thank you!",
"body_examples": [
"Ali",
"#1042",
"15 Oct",
],
"footer": "Reply STOP to unsubscribe",
"buttons": [
{
"type": "URL",
"text": "Track order",
"value": "https://yourshop.com/track",
},
],
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/whatsapp/templates', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "order_shipped",
"language": "en_US",
"category": "UTILITY",
"header_type": "text",
"header_text": "Order shipped",
"body": "Hi {{1}}, your order {{2}} has been shipped and will arrive on {{3}}. Thank you!",
"body_examples": [
"Ali",
"#1042",
"15 Oct"
],
"footer": "Reply STOP to unsubscribe",
"buttons": [
{
"type": "URL",
"text": "Track order",
"value": "https://yourshop.com/track"
}
]
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/whatsapp/templates')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"name" => "order_shipped",
"language" => "en_US",
"category" => "UTILITY",
"header_type" => "text",
"header_text" => "Order shipped",
"body" => "Hi {{1}}, your order {{2}} has been shipped and will arrive on {{3}}. Thank you!",
"body_examples" => [
"Ali",
"#1042",
"15 Oct"
],
"footer" => "Reply STOP to unsubscribe",
"buttons" => [
{
"type" => "URL",
"text" => "Track order",
"value" => "https://yourshop.com/track"
}
]
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
Send a ready-made template by just giving its data — the values fill themselves (or pass params in order; they may contain {{key}} from data):
curl -X POST "https://paksender.com/api/v1/whatsapp/send" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"to": "+923001234567",
"template": "loyalty_points",
"data": {
"name": "Ali",
"points": 45,
"total_points": 320
}
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/whatsapp/send');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'to' => '+923001234567',
'template' => 'loyalty_points',
'data' => [
'name' => 'Ali',
'points' => 45,
'total_points' => 320,
],
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"to":"+923001234567","template":"loyalty_points","data":{"name":"Ali","points":45,"total_points":320}}' \
"https://paksender.com/api/v1/whatsapp/send"
import requests
r = requests.post(
"https://paksender.com/api/v1/whatsapp/send",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"to": "+923001234567",
"template": "loyalty_points",
"data": {
"name": "Ali",
"points": 45,
"total_points": 320,
},
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/whatsapp/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"to": "+923001234567",
"template": "loyalty_points",
"data": {
"name": "Ali",
"points": 45,
"total_points": 320
}
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/whatsapp/send')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"to" => "+923001234567",
"template" => "loyalty_points",
"data" => {
"name" => "Ali",
"points" => 45,
"total_points" => 320
}
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
Invoices & customer messages on WhatsApp
POST /invoices with "channel":"whatsapp". Optional: whatsapp_template, whatsapp_params (array or "a | b", may use invoice fields like {{customer_name}} {{invoice_no}} {{total}} {{due_date}}), whatsapp_header, whatsapp_document (PDF link), whatsapp_account_id. Without a template the invoice text is sent (24-hour window only). Schedules (POST /invoices/schedules) take the same fields.
curl -X POST "https://paksender.com/api/v1/invoices" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"channel": "whatsapp",
"customer_name": "Ali Khan",
"customer_phone": "+923001234567",
"items": [
{
"product": "Shoes",
"qty": 2,
"price": 1500
}
],
"due_date": "2026-10-15",
"whatsapp_template": "invoice_issued",
"whatsapp_document": "https://yourshop.com/invoices/1042.pdf"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/invoices');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'channel' => 'whatsapp',
'customer_name' => 'Ali Khan',
'customer_phone' => '+923001234567',
'items' => [
[
'product' => 'Shoes',
'qty' => 2,
'price' => 1500,
],
],
'due_date' => '2026-10-15',
'whatsapp_template' => 'invoice_issued',
'whatsapp_document' => 'https://yourshop.com/invoices/1042.pdf',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"channel":"whatsapp","customer_name":"Ali Khan","customer_phone":"+923001234567","items":[{"product":"Shoes","qty":2,"price":1500}],"due_date":"2026-10-15","whatsapp_template":"invoice_issued","whatsapp_document":"https://yourshop.com/invoices/1042.pdf"}' \
"https://paksender.com/api/v1/invoices"
import requests
r = requests.post(
"https://paksender.com/api/v1/invoices",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"channel": "whatsapp",
"customer_name": "Ali Khan",
"customer_phone": "+923001234567",
"items": [
{
"product": "Shoes",
"qty": 2,
"price": 1500,
},
],
"due_date": "2026-10-15",
"whatsapp_template": "invoice_issued",
"whatsapp_document": "https://yourshop.com/invoices/1042.pdf",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/invoices', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"channel": "whatsapp",
"customer_name": "Ali Khan",
"customer_phone": "+923001234567",
"items": [
{
"product": "Shoes",
"qty": 2,
"price": 1500
}
],
"due_date": "2026-10-15",
"whatsapp_template": "invoice_issued",
"whatsapp_document": "https://yourshop.com/invoices/1042.pdf"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/invoices')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"channel" => "whatsapp",
"customer_name" => "Ali Khan",
"customer_phone" => "+923001234567",
"items" => [
{
"product" => "Shoes",
"qty" => 2,
"price" => 1500
}
],
"due_date" => "2026-10-15",
"whatsapp_template" => "invoice_issued",
"whatsapp_document" => "https://yourshop.com/invoices/1042.pdf"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
Automations & broadcasts: "channel":"whatsapp" (or "whatsapp,email", "whatsapp,sms") with "whatsapp": {"template", "language", "params", "header", "text", "account_id"}. Then every POST /events sends it — thank-you, loyalty points, vouchers, offers.
curl -X POST "https://paksender.com/api/v1/automations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Loyalty points on WhatsApp",
"event": "points_earned",
"channel": "whatsapp",
"audience": "event_customer",
"whatsapp": {
"template": "loyalty_points"
}
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/automations');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Loyalty points on WhatsApp',
'event' => 'points_earned',
'channel' => 'whatsapp',
'audience' => 'event_customer',
'whatsapp' => [
'template' => 'loyalty_points',
],
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"name":"Loyalty points on WhatsApp","event":"points_earned","channel":"whatsapp","audience":"event_customer","whatsapp":{"template":"loyalty_points"}}' \
"https://paksender.com/api/v1/automations"
import requests
r = requests.post(
"https://paksender.com/api/v1/automations",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"name": "Loyalty points on WhatsApp",
"event": "points_earned",
"channel": "whatsapp",
"audience": "event_customer",
"whatsapp": {
"template": "loyalty_points",
},
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/automations', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Loyalty points on WhatsApp",
"event": "points_earned",
"channel": "whatsapp",
"audience": "event_customer",
"whatsapp": {
"template": "loyalty_points"
}
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/automations')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"name" => "Loyalty points on WhatsApp",
"event" => "points_earned",
"channel" => "whatsapp",
"audience" => "event_customer",
"whatsapp" => {
"template" => "loyalty_points"
}
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X POST "https://paksender.com/api/v1/events" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"event": "points_earned",
"customer": {
"name": "Ali",
"phone": "+923001234567"
},
"data": {
"points": 45,
"total_points": 320
}
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/events');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'event' => 'points_earned',
'customer' => [
'name' => 'Ali',
'phone' => '+923001234567',
],
'data' => [
'points' => 45,
'total_points' => 320,
],
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"event":"points_earned","customer":{"name":"Ali","phone":"+923001234567"},"data":{"points":45,"total_points":320}}' \
"https://paksender.com/api/v1/events"
import requests
r = requests.post(
"https://paksender.com/api/v1/events",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"event": "points_earned",
"customer": {
"name": "Ali",
"phone": "+923001234567",
},
"data": {
"points": 45,
"total_points": 320,
},
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/events', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"event": "points_earned",
"customer": {
"name": "Ali",
"phone": "+923001234567"
},
"data": {
"points": 45,
"total_points": 320
}
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/events')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"event" => "points_earned",
"customer" => {
"name" => "Ali",
"phone" => "+923001234567"
},
"data" => {
"points" => 45,
"total_points" => 320
}
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
WHATSAPP_NOT_CONFIGURED (409) = no connected number; PLAN_REQUIRED (402); PLAN_LIMIT (429); TEMPLATE_REJECTED (422, with Meta's reason).PLAN_REQUIRED (402, no plan / plan without API), PLAN_LIMIT (429, monthly limit reached), KYC_REQUIRED, CONTENT_BLOCKED, SEND_FAILED (WhatsApp's reason in message).
Official Cloud API rule: free text only within 24 hours of the customer's last message — otherwise use an approved template. Incoming messages, keyword auto-replies and AI replies appear in the Inbox and in /whatsapp/messages.
Bulk SMS — many numbers in one request
Send the same text to up to 10,000 numbers, or a personal text per number, in one call. The campaign is queued and sent in the background (usually within a minute or two); each SMS is charged like a normal SMS. Needs the SMS + Bulk features and approved KYC.
POST /messages/send-bulk-sms
| Parameter | Required | Description |
|---|---|---|
| receivers | Yes* | Array of numbers, or one string separated by commas / spaces / new lines. Duplicates are removed. |
| message | Yes* | Text for everyone (max 800 characters) |
| messages | Yes* | Instead of receivers + message: [{"to":"+92300…","message":"Hi Ali, your bill is Rs 1,200"}, …] |
| sender_id | No | Your approved sender ID |
| campaign_name | No | Label shown in Bulk Campaigns |
curl -X POST "https://paksender.com/api/v1/messages/send-bulk-sms" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"campaign_name": "Eid greetings",
"receivers": [
"+923001111111",
"03002222222",
"+923003333333"
],
"message": "Eid Mubarak from Pak Sender!"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/messages/send-bulk-sms');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'campaign_name' => 'Eid greetings',
'receivers' => [
'+923001111111',
'03002222222',
'+923003333333',
],
'message' => 'Eid Mubarak from Pak Sender!',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"campaign_name":"Eid greetings","receivers":["+923001111111","03002222222","+923003333333"],"message":"Eid Mubarak from Pak Sender!"}' \
"https://paksender.com/api/v1/messages/send-bulk-sms"
import requests
r = requests.post(
"https://paksender.com/api/v1/messages/send-bulk-sms",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"campaign_name": "Eid greetings",
"receivers": [
"+923001111111",
"03002222222",
"+923003333333",
],
"message": "Eid Mubarak from Pak Sender!",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/messages/send-bulk-sms', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"campaign_name": "Eid greetings",
"receivers": [
"+923001111111",
"03002222222",
"+923003333333"
],
"message": "Eid Mubarak from Pak Sender!"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/messages/send-bulk-sms')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"campaign_name" => "Eid greetings",
"receivers" => [
"+923001111111",
"03002222222",
"+923003333333"
],
"message" => "Eid Mubarak from Pak Sender!"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X POST "https://paksender.com/api/v1/messages/send-bulk-sms" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"to": "+923001111111",
"message": "Ali, your bill is Rs 1,200"
},
{
"to": "+923002222222",
"message": "Sara, your bill is Rs 950"
}
]
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/messages/send-bulk-sms');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'messages' => [
[
'to' => '+923001111111',
'message' => 'Ali, your bill is Rs 1,200',
],
[
'to' => '+923002222222',
'message' => 'Sara, your bill is Rs 950',
],
],
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"messages":[{"to":"+923001111111","message":"Ali, your bill is Rs 1,200"},{"to":"+923002222222","message":"Sara, your bill is Rs 950"}]}' \
"https://paksender.com/api/v1/messages/send-bulk-sms"
import requests
r = requests.post(
"https://paksender.com/api/v1/messages/send-bulk-sms",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"messages": [
{
"to": "+923001111111",
"message": "Ali, your bill is Rs 1,200",
},
{
"to": "+923002222222",
"message": "Sara, your bill is Rs 950",
},
],
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/messages/send-bulk-sms', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"messages": [
{
"to": "+923001111111",
"message": "Ali, your bill is Rs 1,200"
},
{
"to": "+923002222222",
"message": "Sara, your bill is Rs 950"
}
]
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/messages/send-bulk-sms')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"messages" => [
{
"to" => "+923001111111",
"message" => "Ali, your bill is Rs 1,200"
},
{
"to" => "+923002222222",
"message" => "Sara, your bill is Rs 950"
}
]
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
{ "status": "success", "message": "Bulk campaign queued — 3 number(s).",
"data": { "campaign": { "id": 57, "status": "pending", "total": 3, "sent": 0, "failed": 0, "estimated_cost": 12.00 },
"sms_parts": 3, "estimated_cost": 12.00 } }
Progress: GET /messages/bulk/{id} (status pending → processing → completed, sent / delivered / failed / pending counts). Add ?recipients=1 for every number with its own status, delivery, cost and error — filter with &status=sent|delivered|failed|pending, page with &page= (500 per page). Each number is sent exactly once, even if you retry the request · list: /messages/bulk. If your balance does not cover the estimate you get INSUFFICIENT_BALANCE (402) and nothing is queued.
Customer messaging automation
Send thank-you messages, loyalty points, order updates, deals, offers and new-stock alerts to your own customers by SMS, email or both — automatically from your shop / software. You set up automations once (website: Customer Messages → Automations, or the API); after that your software only reports events. Every message is charged like a normal SMS / email.
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /events | Something happened (order.completed, points.earned, sale.started…) → matching automations send |
| POST | /contacts | Add / update one contact or {"contacts":[…]} (max 1000) |
| GET | /contacts | List (tag, external_id, phone, email, limit) |
| DELETE | /contacts/{id} | Delete a contact |
| GET | /automations | List automations |
| POST | /automations | Create an automation |
| PATCH | /automations/{id} | Update (e.g. {"active":false}) |
| DELETE | /automations/{id} | Delete |
| POST | /broadcasts | Offer / sale / new stock to all or a tag — now or at send_at |
| GET | /broadcasts | List · /broadcasts/{id} progress |
| DELETE | /broadcasts/{id} | Cancel (unsent messages are dropped) |
| GET | /notify/logs | Every message (status, channel, event, automation_id, broadcast_id) |
1. Create an automation (once)
| name | Yes | Label |
| event | Yes | Your event key, e.g. order.completed (letters, digits, . _ -) |
| channel | Yes | sms, email or both |
| sms_body | sms/both | SMS text with placeholders |
| email_subject, email_body | email/both | Subject and HTML |
| smtp | One SMTP username, or several ("a,b" / ["a","b"]) to rotate and stay within daily limits. Empty = all active SMTPs. | |
| sender_id | No | SMS sender ID |
| audience | Yes | event_customer (the person in the event) · all · tag |
| audience_tag | tag | e.g. vip |
| delay_minutes | No | Send later, e.g. 1440 = next day (review request) |
| active | No | Default true |
curl -X POST "https://paksender.com/api/v1/automations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Thank you + points",
"event": "order.completed",
"channel": "sms",
"audience": "event_customer",
"sms_body": "Thank you {{first_name}}! Order #{{order_id}} (Rs {{amount}}) confirmed. You earned {{points}} points. - {{business_name}}"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/automations');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Thank you + points',
'event' => 'order.completed',
'channel' => 'sms',
'audience' => 'event_customer',
'sms_body' => 'Thank you {{first_name}}! Order #{{order_id}} (Rs {{amount}}) confirmed. You earned {{points}} points. - {{business_name}}',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"name":"Thank you + points","event":"order.completed","channel":"sms","audience":"event_customer","sms_body":"Thank you {{first_name}}! Order #{{order_id}} (Rs {{amount}}) confirmed. You earned {{points}} points. - {{business_name}}"}' \
"https://paksender.com/api/v1/automations"
import requests
r = requests.post(
"https://paksender.com/api/v1/automations",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"name": "Thank you + points",
"event": "order.completed",
"channel": "sms",
"audience": "event_customer",
"sms_body": "Thank you {{first_name}}! Order #{{order_id}} (Rs {{amount}}) confirmed. You earned {{points}} points. - {{business_name}}",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/automations', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Thank you + points",
"event": "order.completed",
"channel": "sms",
"audience": "event_customer",
"sms_body": "Thank you {{first_name}}! Order #{{order_id}} (Rs {{amount}}) confirmed. You earned {{points}} points. - {{business_name}}"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/automations')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"name" => "Thank you + points",
"event" => "order.completed",
"channel" => "sms",
"audience" => "event_customer",
"sms_body" => "Thank you {{first_name}}! Order #{{order_id}} (Rs {{amount}}) confirmed. You earned {{points}} points. - {{business_name}}"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
2. Send events from your software (every time)
POST /events — event (required), customer (external_id, name, phone, email, tags, fields) and data (any values for the placeholders). The customer is saved to your contacts automatically.
curl -X POST "https://paksender.com/api/v1/events" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"event": "order.completed",
"customer": {
"external_id": "C-12",
"name": "Ali Khan",
"phone": "+923001234567",
"email": "ali@example.com",
"tags": [
"vip"
]
},
"data": {
"order_id": "1042",
"amount": "2,500",
"points": 25
}
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/events');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'event' => 'order.completed',
'customer' => [
'external_id' => 'C-12',
'name' => 'Ali Khan',
'phone' => '+923001234567',
'email' => 'ali@example.com',
'tags' => [
'vip',
],
],
'data' => [
'order_id' => '1042',
'amount' => '2,500',
'points' => 25,
],
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"event":"order.completed","customer":{"external_id":"C-12","name":"Ali Khan","phone":"+923001234567","email":"ali@example.com","tags":["vip"]},"data":{"order_id":"1042","amount":"2,500","points":25}}' \
"https://paksender.com/api/v1/events"
import requests
r = requests.post(
"https://paksender.com/api/v1/events",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"event": "order.completed",
"customer": {
"external_id": "C-12",
"name": "Ali Khan",
"phone": "+923001234567",
"email": "ali@example.com",
"tags": [
"vip",
],
},
"data": {
"order_id": "1042",
"amount": "2,500",
"points": 25,
},
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/events', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"event": "order.completed",
"customer": {
"external_id": "C-12",
"name": "Ali Khan",
"phone": "+923001234567",
"email": "ali@example.com",
"tags": [
"vip"
]
},
"data": {
"order_id": "1042",
"amount": "2,500",
"points": 25
}
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/events')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"event" => "order.completed",
"customer" => {
"external_id" => "C-12",
"name" => "Ali Khan",
"phone" => "+923001234567",
"email" => "ali@example.com",
"tags" => [
"vip"
]
},
"data" => {
"order_id" => "1042",
"amount" => "2,500",
"points" => 25
}
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
{ "status": "success", "message": "Event processed",
"data": { "event": "order.completed", "automations": 1, "sent": 1, "failed": 0, "queued": 0, "skipped": 0, "contact_id": 88 } }
Up to 5 messages are sent immediately; bigger fan-outs (audience all / tag) and delayed ones are sent by the minute cron. automations: 0 means no active automation uses that event (nothing is charged).
3. Offers, sales & new stock to many customers
POST /broadcasts — name, channel, content fields, audience (all | tag | numbers), audience_tag, optional data (placeholders), send_at (YYYY-MM-DD HH:MM, Pakistan time; empty = now).
Any list of numbers / emails (no need to save contacts first): "audience": "numbers" + "recipients" (max 10,000) — plain strings or objects with their own name and placeholder values. Optional "save_tag" saves them as contacts with that tag for next time. People who unsubscribed earlier are still skipped.
curl -X POST "https://paksender.com/api/v1/broadcasts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Eid offer",
"channel": "sms",
"audience": "numbers",
"recipients": [
"+923001111111",
"03002222222",
{
"phone": "+923003333333",
"name": "Sara",
"data": {
"code": "SARA20"
}
}
],
"sms_body": "Eid Mubarak {{first_name}}! Use code {{code}} for 20% off.",
"data": {
"code": "EID20"
},
"save_tag": "eid-2026"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/broadcasts');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Eid offer',
'channel' => 'sms',
'audience' => 'numbers',
'recipients' => [
'+923001111111',
'03002222222',
[
'phone' => '+923003333333',
'name' => 'Sara',
'data' => [
'code' => 'SARA20',
],
],
],
'sms_body' => 'Eid Mubarak {{first_name}}! Use code {{code}} for 20% off.',
'data' => [
'code' => 'EID20',
],
'save_tag' => 'eid-2026',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"name":"Eid offer","channel":"sms","audience":"numbers","recipients":["+923001111111","03002222222",{"phone":"+923003333333","name":"Sara","data":{"code":"SARA20"}}],"sms_body":"Eid Mubarak {{first_name}}! Use code {{code}} for 20% off.","data":{"code":"EID20"},"save_tag":"eid-2026"}' \
"https://paksender.com/api/v1/broadcasts"
import requests
r = requests.post(
"https://paksender.com/api/v1/broadcasts",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"name": "Eid offer",
"channel": "sms",
"audience": "numbers",
"recipients": [
"+923001111111",
"03002222222",
{
"phone": "+923003333333",
"name": "Sara",
"data": {
"code": "SARA20",
},
},
],
"sms_body": "Eid Mubarak {{first_name}}! Use code {{code}} for 20% off.",
"data": {
"code": "EID20",
},
"save_tag": "eid-2026",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/broadcasts', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Eid offer",
"channel": "sms",
"audience": "numbers",
"recipients": [
"+923001111111",
"03002222222",
{
"phone": "+923003333333",
"name": "Sara",
"data": {
"code": "SARA20"
}
}
],
"sms_body": "Eid Mubarak {{first_name}}! Use code {{code}} for 20% off.",
"data": {
"code": "EID20"
},
"save_tag": "eid-2026"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/broadcasts')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"name" => "Eid offer",
"channel" => "sms",
"audience" => "numbers",
"recipients" => [
"+923001111111",
"03002222222",
{
"phone" => "+923003333333",
"name" => "Sara",
"data" => {
"code" => "SARA20"
}
}
],
"sms_body" => "Eid Mubarak {{first_name}}! Use code {{code}} for 20% off.",
"data" => {
"code" => "EID20"
},
"save_tag" => "eid-2026"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
curl -X POST "https://paksender.com/api/v1/broadcasts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "11.11 Sale",
"channel": "both",
"audience": "tag",
"audience_tag": "vip",
"sms_body": "{{business_name}}: 11.11 SALE {{discount}} OFF for you {{first_name}}! {{link}}",
"email_subject": "{{discount}} off - just for you",
"email_body": "<h2>Hi {{first_name}}</h2><p>Our sale starts now!</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
"smtp": [
"offers1@yourshop.com",
"offers2@yourshop.com"
],
"data": {
"discount": "30%",
"link": "https://yourshop.com/sale"
},
"send_at": "2026-11-11 09:00"
}'
<?php
$ch = curl_init('https://paksender.com/api/v1/broadcasts');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => '11.11 Sale',
'channel' => 'both',
'audience' => 'tag',
'audience_tag' => 'vip',
'sms_body' => '{{business_name}}: 11.11 SALE {{discount}} OFF for you {{first_name}}! {{link}}',
'email_subject' => '{{discount}} off - just for you',
'email_body' => '<h2>Hi {{first_name}}</h2><p>Our sale starts now!</p><p><a href="{{unsubscribe_url}}">Unsubscribe</a></p>',
'smtp' => [
'offers1@yourshop.com',
'offers2@yourshop.com',
],
'data' => [
'discount' => '30%',
'link' => 'https://yourshop.com/sale',
],
'send_at' => '2026-11-11 09:00',
]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($res['status'] ?? '') === 'success') {
print_r($res['data']);
} else {
echo $res['error_code'] . ': ' . $res['message'];
}
wget -qO- --method=POST \
--header="Authorization: Bearer YOUR_API_KEY" \
--header="Accept: application/json" \
--header="Content-Type: application/json" \
--body-data='{"name":"11.11 Sale","channel":"both","audience":"tag","audience_tag":"vip","sms_body":"{{business_name}}: 11.11 SALE {{discount}} OFF for you {{first_name}}! {{link}}","email_subject":"{{discount}} off - just for you","email_body":"<h2>Hi {{first_name}}</h2><p>Our sale starts now!</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>","smtp":["offers1@yourshop.com","offers2@yourshop.com"],"data":{"discount":"30%","link":"https://yourshop.com/sale"},"send_at":"2026-11-11 09:00"}' \
"https://paksender.com/api/v1/broadcasts"
import requests
r = requests.post(
"https://paksender.com/api/v1/broadcasts",
headers={"Authorization": "Bearer YOUR_API_KEY", "Accept": "application/json"},
json={
"name": "11.11 Sale",
"channel": "both",
"audience": "tag",
"audience_tag": "vip",
"sms_body": "{{business_name}}: 11.11 SALE {{discount}} OFF for you {{first_name}}! {{link}}",
"email_subject": "{{discount}} off - just for you",
"email_body": "<h2>Hi {{first_name}}</h2><p>Our sale starts now!</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
"smtp": [
"offers1@yourshop.com",
"offers2@yourshop.com",
],
"data": {
"discount": "30%",
"link": "https://yourshop.com/sale",
},
"send_at": "2026-11-11 09:00",
},
timeout=30,
)
print(r.json())
const res = await fetch('https://paksender.com/api/v1/broadcasts', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "11.11 Sale",
"channel": "both",
"audience": "tag",
"audience_tag": "vip",
"sms_body": "{{business_name}}: 11.11 SALE {{discount}} OFF for you {{first_name}}! {{link}}",
"email_subject": "{{discount}} off - just for you",
"email_body": "<h2>Hi {{first_name}}</h2><p>Our sale starts now!</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
"smtp": [
"offers1@yourshop.com",
"offers2@yourshop.com"
],
"data": {
"discount": "30%",
"link": "https://yourshop.com/sale"
},
"send_at": "2026-11-11 09:00"
})
});
const data = await res.json();
console.log(data);
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://paksender.com/api/v1/broadcasts')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer YOUR_API_KEY'
req['Accept'] = 'application/json'
req['Content-Type'] = 'application/json'
req.body = {
"name" => "11.11 Sale",
"channel" => "both",
"audience" => "tag",
"audience_tag" => "vip",
"sms_body" => "{{business_name}}: 11.11 SALE {{discount}} OFF for you {{first_name}}! {{link}}",
"email_subject" => "{{discount}} off - just for you",
"email_body" => "<h2>Hi {{first_name}}</h2><p>Our sale starts now!</p><p><a href=\"{{unsubscribe_url}}\">Unsubscribe</a></p>",
"smtp" => [
"offers1@yourshop.com",
"offers2@yourshop.com"
],
"data" => {
"discount" => "30%",
"link" => "https://yourshop.com/sale"
},
"send_at" => "2026-11-11 09:00"
}.to_json
res = http.request(req)
puts JSON.parse(res.body)
Placeholders & opt-out
{{name}}, {{first_name}}, {{phone}}, {{email}}, {{business_name}}, {{unsubscribe_url}}, plus every key of data and of the contact's fields (e.g. {{points}}, {{total_points}}). Contacts who unsubscribe (link, or "email_opt_out": true / "sms_opt_out": true via /contacts) are skipped automatically — put {{unsubscribe_url}} in promotional emails.
Error codes
| error_code | HTTP | Meaning / what to do |
|---|---|---|
VALIDATION_ERROR | 422 | A parameter is missing or invalid. Details in errors. |
AUTH_ERROR | 401 | API key missing, invalid or revoked. |
ACCOUNT_DISABLED | 403 | Your account is disabled — contact support. |
FEATURE_DISABLED | 403 | API / SMS / voice access is not enabled for your account. |
KYC_REQUIRED | 403 | Complete KYC verification to use SMS & voice. |
INSUFFICIENT_BALANCE | 402 | Not enough balance — recharge your account. |
INVALID_NUMBER | 400 | Receiver number is invalid. Use +923001234567 format. |
UNSUPPORTED_COUNTRY | 400 | Destination country is not supported. |
CONTENT_BLOCKED | 422 | The text contains content that is not allowed (e.g. gambling / betting promotion, scams, blocked links). Nothing is sent or charged — edit the text and try again. For bulk requests the whole campaign is rejected. |
ROUTING_FAILED | 400 | Could not route to the receiver's network. Retry later or contact support. |
TRAFFIC_NOT_ALLOWED | 400 | This traffic type isn't allowed for the destination. |
CONTENT_TOO_LONG | 400 | Message is longer than 800 characters. |
MESSAGE_REQUIRED | 400 | Message text is empty. |
INVALID_SENDER_ID | 400 | Sender ID is not approved/enabled for you — omit it to use the default. |
INVALID_CALLER_ID | 400 | Caller ID is not valid for your account — omit it. |
INVALID_RECORDING | 400 | recording_id not found. |
RECORDING_NOT_APPROVED | 400 | Recording is still waiting for approval. |
MESSAGE_NOT_FOUND | 404 | No message with that ID on your account. |
SERVICE_UNAVAILABLE | 503 | Temporary platform issue. You were not charged — retry after a few minutes. |
INTERNAL_ERROR | 500 | Unexpected error — retry; contact support if it continues. |
| — | 429 | Rate limit exceeded (60/min). Slow down and retry. |
Failed deliveries reported later (after "status":"success") appear in Message status as error_code values such as CALL_UNANSWERED, CALL_BUSY, CALL_REJECTED, DELIVERY_UNDELIV, DELIVERY_EXPIRED.
Best practices
- OTP not received? Don't resend instantly. Wait 30–60 seconds, then offer Voice OTP as a fallback — you're only charged if the call is answered.
- Keep OTP texts short and standard (no emoji/Urdu) so they stay 1 part.
- Store
message_idand poll status for important messages. - On
SERVICE_UNAVAILABLE/INTERNAL_ERROR/ HTTP 429, retry with a delay (e.g. 5s, 30s, 2min). - Legacy endpoints
POST /api/sms/send,GET /api/sms/status/{id},GET /api/sms/balancestill work and behave like the v1 endpoints.