Bulk and batch
Every bulk and batch route, with request, response, errors and samples in curl, Node, Python and PHP.
See the overview for sign-in and the error shape.
Send personalised messages in one call
POST /v1/messages/batch
Creates a campaign from the recipient list and launches it. Use an Idempotency-Key header: a retry with the same key returns the original batch and never sends twice. Each recipient is rendered with its own vars; invalid, duplicate and opted-out numbers are rejected in the response (never charged). Track with GET /v1/messages/batch/{batch_id} or GET /v1/campaigns/{campaign_id}.
Who can call it: API key with the send scope, or a dashboard session token.
Body (JSON):
| Field | Type | Required | Default | Meaning |
|---|---|---|---|---|
template | string | No | Message with merge fields, e.g. 'Hi {first_name|there}, your balance is {balance}'. Required unless every recipient has text. | |
template_id | integer | No | A saved template instead of template | |
recipients | array of object | No | [{to, name?, vars?}] (max 10000) | |
messages | array of object | No | Full messages [{to, text}] (no template) | |
sender_id | string | No | Sender name, up to 11 characters. It must be approved on your account. Without it the default sender is used. | |
sender_fallback | boolean | No | true | Use the default sender where yours is not approved. |
message_type | string | No | "transactional" | transactional or promotional. |
name | string | No | A name. | |
tags | array of string | No | Labels. | |
default_country | string | No | For local numbers like 0991... | |
schedule | object | No | When to send: mode (now, scheduled, recurring), at, timezone, recurrence. | |
throttle_per_minute | integer | No | Messages per minute, 1 to 20000. | |
callback_url | string | No | Receives the signed campaign.completed event | |
track_links | boolean | No | false | Track link clicks for URLs in template (off by default for batches; campaigns default on) |
curl -X POST "https://api.sms.jtnoble.com/v1/messages/batch" \
-H "Authorization: Bearer $JTSMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"template":"Hello {name}, code {code|none}","recipients":[{"to":"+2348030001131","vars":{"name":"Ada","code":"A1"}}],"name":"Doc batch"}'const resp = await fetch('https://api.sms.jtnoble.com/v1/messages/batch', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"template":"Hello {name}, code {code|none}","recipients":[{"to":"+2348030001131","vars":{"name":"Ada","code":"A1"}}],"name":"Doc batch"}),
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.post(
"https://api.sms.jtnoble.com/v1/messages/batch",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
json={"template":"Hello {name}, code {code|none}","recipients":[{"to":"+2348030001131","vars":{"name":"Ada","code":"A1"}}],"name":"Doc batch"},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/messages/batch');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"template":"Hello {name}, code {code|none}","recipients":[{"to":"+2348030001131","vars":{"name":"Ada","code":"A1"}}],"name":"Doc batch"}',
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;HTTP 202:
{
"batch_id": "c68dccfc-5966-4fc6-9877-1308ef45e1b2",
"campaign_id": 2,
"status": "sending",
"accepted": 1,
"rejected": [],
"rejected_count": 0,
"estimated_cost": 0.0116,
"currency": "USD",
"idempotent_replay": false,
"environment": "test",
"livemode": false
}| HTTP | code | Message |
|---|---|---|
| 400 | recipients_required | Pass recipients (with a template) or messages. |
| 400 | template_required | Pass template (or template_id) or a text per recipient. |
| 400 | text_required | Every entry in messages needs text. |
| 401 | unauthorized | Not authenticated |
| 403 | insufficient_scope | This API key is not authorised for this action. |
| 422 | validation_error | Request validation failed |
| 429 | rate_limited | Too many requests. Try again in a moment. |
Read a batch
GET /v1/messages/batch/{batch_id}
Aggregate status of a bulk batch (returned as batch_id by /messages/send-bulk), plus a paginated list of its member messages - so a developer can track a blast they launched via the API.
Who can call it: API key with the query scope, or a dashboard session token.
| Path value | Type | Meaning |
|---|---|---|
batch_id | string | The batch id. |
| Query | Type | Required | Default | Meaning |
|---|---|---|---|---|
page | integer | No | 0 | Page number, starting at 0. |
limit | integer | No | 50 | Items per page. |
curl -X GET "https://api.sms.jtnoble.com/v1/messages/batch/BATCH_ID" \
-H "Authorization: Bearer $JTSMS_API_KEY"const resp = await fetch('https://api.sms.jtnoble.com/v1/messages/batch/BATCH_ID', {
method: 'GET',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}` },
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.get(
"https://api.sms.jtnoble.com/v1/messages/batch/BATCH_ID",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/messages/batch/BATCH_ID');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY')],
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;HTTP 200:
{
"batch_id": "42cd35f4-4843-4a55-b4e4-ea62a89c093a",
"total": 2,
"counts": {
"delivered": 2
},
"cost": 0,
"cost_currency": null,
"charged": 0,
"charged_currency": null,
"page": 0,
"limit": 50,
"messages": [
{
"id": "test_2cf33e39372f49ee96a54e95135232b7",
"phone": "+2348030001122",
"status": "delivered",
"segments": 1,
"cost": 0,
"cost_currency": "USD",
"error_code": null,
"created_at": "2026-11-07T17:00:53.134928+00:00",
"delivered_at": "2026-11-07T17:00:53.156035+00:00"
},
{
"id": "test_f60e10c99b6843f9a90c606c03ae6201",
"phone": "+2348030001121",
"status": "delivered",
"segments": 1,
"cost": 0,
"cost_currency": "USD",
"error_code": null,
"created_at": "2026-11-07T17:00:53.134923+00:00",
"delivered_at": "2026-11-07T17:00:53.156035+00:00"
}
]
}| HTTP | code | Message |
|---|---|---|
| 401 | unauthorized | Not authenticated |
| 403 | insufficient_scope | This API key is not authorised for this action. |
| 404 | not_found | Batch not found |
| 429 | rate_limited | Too many requests. Try again in a moment. |
Cancel a scheduled batch
POST /v1/messages/batch/{batch_id}/cancel
Cancel a scheduled bulk batch before its send time. Scheduled batches are charged when scheduled, so the full amount is refunded.
Who can call it: API key with the send scope, or a dashboard session token.
| Path value | Type | Meaning |
|---|---|---|
batch_id | string | The batch id. |
curl -X POST "https://api.sms.jtnoble.com/v1/messages/batch/BATCH_ID/cancel" \
-H "Authorization: Bearer $JTSMS_API_KEY"const resp = await fetch('https://api.sms.jtnoble.com/v1/messages/batch/BATCH_ID/cancel', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}` },
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.post(
"https://api.sms.jtnoble.com/v1/messages/batch/BATCH_ID/cancel",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/messages/batch/BATCH_ID/cancel');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY')],
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;HTTP 200:
{
"batch_id": "2d7f4a1e-8c33-4b1a-9c55-0e6f7a2b9d10",
"status": "cancelled",
"refund": {
"amount": 0.0232,
"currency": "USD",
"balance_after": 1.972
}
}| HTTP | code | Message |
|---|---|---|
| 401 | unauthorized | Not authenticated |
| 403 | insufficient_scope | This API key is not authorised for this action. |
| 404 | not_found | Batch not found |
| 409 | not_cancellable | |
| 429 | rate_limited | Too many requests. Try again in a moment. |
Price a bulk send
POST /v1/messages/bulk-precheck
Analyze a bulk send before executing - returns per-country breakdown, total cost in user's wallet currency, and balance after.
Who can call it: Any API key, or a dashboard session token.
Body (JSON):
| Field | Type | Required | Default | Meaning |
|---|---|---|---|---|
contact_list_ids | array of integer | No | [] | Saved contact lists to send to. |
recipients | array of object | No | [] | Numbers in the request. Each has to, and optionally name, vars. |
text | string | Yes | The message. | |
sender_id | string | No | Sender name, up to 11 characters. It must be approved on your account. Without it the default sender is used. |
curl -X POST "https://api.sms.jtnoble.com/v1/messages/bulk-precheck" \
-H "Authorization: Bearer $JTSMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"recipients":[{"to":"+2348030001121","name":"Chinedu","vars":{"balance":"45,000"}},{"to":"08039000122"}],"text":"Dear {first_name|parent}, your balance is USD {balance|0}."}'const resp = await fetch('https://api.sms.jtnoble.com/v1/messages/bulk-precheck', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"recipients":[{"to":"+2348030001121","name":"Chinedu","vars":{"balance":"45,000"}},{"to":"08039000122"}],"text":"Dear {first_name|parent}, your balance is USD {balance|0}."}),
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.post(
"https://api.sms.jtnoble.com/v1/messages/bulk-precheck",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
json={"recipients":[{"to":"+2348030001121","name":"Chinedu","vars":{"balance":"45,000"}},{"to":"08039000122"}],"text":"Dear {first_name|parent}, your balance is USD {balance|0}."},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/messages/bulk-precheck');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"recipients":[{"to":"+2348030001121","name":"Chinedu","vars":{"balance":"45,000"}},{"to":"08039000122"}],"text":"Dear {first_name|parent}, your balance is USD {balance|0}."}',
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;HTTP 200:
{
"total_contacts": 0.0008,
"total_segments": 2,
"total_cost": 0.0232,
"wallet_currency": "USD",
"wallet_balance": 0,
"balance_after": -0.016,
"sufficient_balance": false,
"countries": 1,
"breakdown": [
{
"country_code": "NG",
"country_name": "Nigeria",
"currency": "USD",
"route_code": "NG",
"contacts": 2,
"segments": 2,
"route_cost": 0.0232,
"wallet_cost": 0.0232,
"price_per_segment": 0.0116
}
],
"unroutable": [],
"unroutable_count": 0,
"unavailable_countries": [],
"invalid_count": 0,
"suppressed_count": 0,
"missing_fields": []
}| HTTP | code | Message |
|---|---|---|
| 400 | bad_request | Provide contact_list_ids or recipients |
| 401 | unauthorized | Not authenticated |
| 422 | validation_error | Request validation failed |
| 429 | rate_limited | Too many requests. Try again in a moment. |
Send one message to many numbers
POST /v1/messages/send-bulk
Bulk send. Idempotency-Key (like single send): the key is reserved before anything is charged; a retried call with the same key returns the original batch instead of charging and sending again.
Who can call it: API key with the send scope, or a dashboard session token.
Body (JSON):
| Field | Type | Required | Default | Meaning |
|---|---|---|---|---|
contact_list_ids | array of integer | No | [] | Saved contact lists to send to. |
recipients | array of object | No | [] | Numbers in the request. Each has to, and optionally name, vars. |
text | string | Yes | The message. | |
sender_id | string | No | Sender name, up to 11 characters. It must be approved on your account. Without it the default sender is used. | |
route | string | No | Route code. Only NG exists; leave it out. | |
schedule_mode | string | No | "now" | now (default) or scheduled. |
scheduled_at | string | No | ISO 8601 time with a time zone, 5 minutes to 7 days ahead. | |
drip_rate | integer | No | Messages per minute, 1 to 5000. Needed for drip. | |
flash | boolean | No | false | Flash SMS (message class 0) for every message |
validity_period | integer | No | Minutes (1-4320) before undelivered messages expire | |
priority | integer | No | 0 normal (default) .. 3 highest | |
binary | object | No | Not supported on bulk sends (rejected with invalid_option) | |
skip_unavailable | boolean | No | false | Drop (uncharged) recipients in countries not available yet or with invalid numbers, instead of rejecting the request |
curl -X POST "https://api.sms.jtnoble.com/v1/messages/send-bulk" \
-H "Authorization: Bearer $JTSMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"recipients":[{"to":"+2348030001121","name":"Chinedu","vars":{"balance":"45,000"}},{"to":"+2348030001122","name":"Ada","vars":{"balance":"12,500"}}],"text":"Dear {first_name|parent}, your balance is USD {balance}."}'const resp = await fetch('https://api.sms.jtnoble.com/v1/messages/send-bulk', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"recipients":[{"to":"+2348030001121","name":"Chinedu","vars":{"balance":"45,000"}},{"to":"+2348030001122","name":"Ada","vars":{"balance":"12,500"}}],"text":"Dear {first_name|parent}, your balance is USD {balance}."}),
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.post(
"https://api.sms.jtnoble.com/v1/messages/send-bulk",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
json={"recipients":[{"to":"+2348030001121","name":"Chinedu","vars":{"balance":"45,000"}},{"to":"+2348030001122","name":"Ada","vars":{"balance":"12,500"}}],"text":"Dear {first_name|parent}, your balance is USD {balance}."},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/messages/send-bulk');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"recipients":[{"to":"+2348030001121","name":"Chinedu","vars":{"balance":"45,000"}},{"to":"+2348030001122","name":"Ada","vars":{"balance":"12,500"}}],"text":"Dear {first_name|parent}, your balance is USD {balance}."}',
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;HTTP 200:
{
"batch_id": "42cd35f4-4843-4a55-b4e4-ea62a89c093a",
"total_recipients": 2,
"estimated_cost": 70,
"status": "sending",
"idempotent_replay": null
}| HTTP | code | Message |
|---|---|---|
| 400 | missing_merge_field | Some recipients have no value for this field. |
| 401 | unauthorized | Not authenticated |
| 402 | insufficient_balance | Insufficient balance. |
| 403 | insufficient_scope | This API key is not authorised for this action. |
| 403 | sender_not_approved | This sender ID is not approved on your account. |
| 409 | idempotency_in_progress | A request with this Idempotency-Key is still being processed. |
| 422 | destination_not_allowed | Some recipients are in countries we do not send to. |
| 422 | validation_error | Request validation failed |
| 429 | rate_limited | Too many requests. Try again in a moment. |