Sandbox
Build and test with a jtsms_test_ key. Nothing reaches a phone and nothing is charged.
The sandbox is the same API at the same address. Use a jtsms_test_ key and every send is simulated: same checks, same answers, same webhooks, but no SMS and no charge.
Get a test key
In the dashboard open API keys, choose Create key and pick test. Test messages are kept apart from live ones: a live key cannot read them.
What is different
- The message id starts with
test_. - The answer has
"environment": "test"and"livemode": false. costshows what a live send would cost.balance_afterisnull. Your balance does not change.- The
liveblock tells you whether a live key could do the same send.
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;{
"id": "test_bacec39cde5f46288cc7c82e9c142e19",
"status": "queued",
"environment": "test",
"livemode": false,
"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": null,
"scheduled_at": null,
"note": "Sandbox message - simulated, not sent to a real network and not billed.",
"options": { "flash": false, "validity_period": null, "priority": 0, "binary": false },
"live": {
"country": "NG",
"availability": "live",
"country_enabled": true,
"note": "Enabled for live sends.",
"sender_approved": true
}
}About a second later the message reaches its final status and your webhook is called, with "livemode": false.
Choose the outcome
The last four digits of the number decide what happens. Any other number is delivered.
| Number ends in | Result |
|---|---|
0000 | undelivered |
0001 | delivered |
0002 | sent, with no final report |
0003 | failed, rejected by the network |
0404 | failed, unknown subscriber |
0009 | HTTP 402, code insufficient_balance |
For example, +2348030000003 always fails. GET /v1/sandbox/info returns this list.
What works in the sandbox
| Feature | With a test key |
|---|---|
| Send, now or scheduled | Simulated. A scheduled test message can be cancelled. |
| Send-bulk | Simulated. schedule_mode: scheduled is refused (sandbox_no_schedule). |
| Batch and campaigns | Simulated, with reports. Approval is skipped. |
| Verify | Simulated. The code comes back in sandbox_code. See Verify. |
| Two-way | POST /v1/two-way/simulate pretends someone texted you. |
| Retry | Refused (sandbox_no_retry). |
Try one message without a key
Signed in to the dashboard, the Sandbox page shows the same simulation. POST /v1/sandbox/simulate is the route behind it. It stores nothing and returns the timeline at once.
curl -X POST "https://api.sms.jtnoble.com/v1/sandbox/simulate" \
-H "Authorization: Bearer $JTSMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"+2348030001111","text":"Hello"}'const resp = await fetch('https://api.sms.jtnoble.com/v1/sandbox/simulate', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"to":"+2348030001111","text":"Hello"}),
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.post(
"https://api.sms.jtnoble.com/v1/sandbox/simulate",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
json={"to":"+2348030001111","text":"Hello"},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/sandbox/simulate');
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":"Hello"}',
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;Going live
Replace the jtsms_test_ key with a jtsms_live_ key. Nothing else changes.
See the sandbox routes.