JT Noble SMS documentation home

Send an SMS

POST /v1/messages/send sends one SMS to a number in any of the 53 countries. To send to many numbers, use send-bulk.

POST https://api.sms.jtnoble.com/v1/messages/send
Authorization: Bearer jtsms_live_YOUR_KEY
Content-Type: application/json

Request body

FieldTypeRequiredMeaning
tostringYesMobile number in international format, for example +2348030000000.
textstringYesThe message. Long text is split into segments, at most 10. See encoding.
sender_idstringNoSender name, up to 11 characters. It must be approved on your account. Without it, the default sender is used. See Sender IDs.
schedule_modestringNonow (default) or scheduled.
scheduled_atstringWhen scheduledISO 8601 time with a time zone. At least 5 minutes and at most 7 days ahead.

The fields flash, validity_period, priority and binary exist but are not on sale yet: using them answers HTTP 400 with code feature_not_enabled.

curl -X POST "https://api.sms.jtnoble.com/v1/messages/send" \
  -H "Authorization: Bearer $JTSMS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"+2348030000000","text":"Your order 1042 is ready.","sender_id":"MYSHOP"}'
const resp = await fetch('https://api.sms.jtnoble.com/v1/messages/send', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({"to":"+2348030000000","text":"Your order 1042 is ready.","sender_id":"MYSHOP"}),
});
console.log(resp.status, await resp.text());
import os
import requests

resp = requests.post(
    "https://api.sms.jtnoble.com/v1/messages/send",
    headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
    json={"to":"+2348030000000","text":"Your order 1042 is ready.","sender_id":"MYSHOP"},
    timeout=30,
)
print(resp.status_code, resp.text)
<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/messages/send');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => '{"to":"+2348030000000","text":"Your order 1042 is ready.","sender_id":"MYSHOP"}',
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;

Response

HTTP 200:

{
  "id": "6f1c2b9e-1d2a-4c55-9a0e-2b7f0c1d3e4f",
  "status": "submitted",
  "segments": 1,
  "encoding": "GSM7",
  "recipients": 1,
  "price_per_sms": 35.0,
  "cost": 35.0,
  "cost_currency": "USD",
  "route_cost": 35.0,
  "route_currency": "USD",
  "route": "NG",
  "balance_after": 4965.0,
  "scheduled_at": null,
  "options": { "flash": false, "validity_period": null, "priority": 0, "binary": false }
}
FieldMeaning
idMessage id. Use it to look up the message and to match webhooks.
statussubmitted (sent to the network), scheduled, unknown or failed.
segmentsNumber of parts. You pay per segment.
encodingGSM7 or UCS2.
price_per_smsYour price per segment.
cost, cost_currencyWhat your balance was charged.
routeThe destination country route, for example NG.
balance_afterYour balance after this message.

Each segment is charged at the price for the destination country, for example USD 0.0116 to Nigeria on the Basic price. The pricing page lists every country; your dashboard shows the price for your account.

Send each message once

Network problems can make you retry a request. Add an Idempotency-Key header with a unique value per message, for example your order id:

Idempotency-Key: order-1042-ready

If you send the same key again, you get the first result back, with "idempotent_replay": true. You are not charged twice.

Message status

StatusMeaningCharged
queuedAccepted, waiting to go out.Yes
scheduledWaiting for its scheduled time.Yes
submittedHanded to the network.Yes
sentThe network took it and gave no final report.Yes
deliveredThe phone received it.Yes
undeliveredThe network could not deliver it.Refunded
failedNot delivered.Refunded
unknownThe gateway did not confirm the send. We find out what happened, then settle it.Held until settled
cancelledA scheduled message you cancelled.Refunded

A message with no report after 24 hours becomes unknown.

Rules that apply

  • Numbers in the 53 countries only. Other countries get HTTP 422 code destination_not_allowed. A wrong number gets HTTP 400 with invalid_phone or invalid_phone_length.
  • Your balance must cover the full message. If not, HTTP 402 code insufficient_balance. The attempt shows in your message log as failed and costs nothing.
  • A number that replied STOP to you is refused with HTTP 403 code recipient_opted_out.
  • A number on the do-not-disturb list is refused with HTTP 403 code recipient_dnd.
  • More than 10 segments is refused with HTTP 413 code message_too_long.
  • The default rate limit is 20 requests per second per key. Above it, HTTP 429 code rate_limited.

Price before you send

POST /v1/messages/rate takes to (one number, or up to 1000) and text, and returns the encoding, segment count and total cost. Nothing is sent and nothing is charged. POST /v1/messages/validate checks numbers the same way, without a price.

curl -X POST "https://api.sms.jtnoble.com/v1/messages/rate" \
  -H "Authorization: Bearer $JTSMS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"+2348030001111","text":"Your order 1042 is ready."}'
const resp = await fetch('https://api.sms.jtnoble.com/v1/messages/rate', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({"to":"+2348030001111","text":"Your order 1042 is ready."}),
});
console.log(resp.status, await resp.text());
import os
import requests

resp = requests.post(
    "https://api.sms.jtnoble.com/v1/messages/rate",
    headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
    json={"to":"+2348030001111","text":"Your order 1042 is ready."},
    timeout=30,
)
print(resp.status_code, resp.text)
<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/messages/rate');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => '{"to":"+2348030001111","text":"Your order 1042 is ready."}',
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;

See all message routes.

On this page