Inatum SMS

Inatum SMS API

Send and verify verification codes, security alerts and notifications by SMS, with built-in fraud protection. A test key lets you try everything without sending SMS or paying.

Postman collection

  1. In Postman, click Import and choose the downloaded file.
  2. In the collection variables, replace api_key with your test key (isk_test_…).
  3. Run “Envoyer un code” (send a code): its identifier is reused automatically by the verify and message status requests.

Get started in 4 steps

  1. Create a test key in API keys (type “Test”). It starts with isk_test_: no SMS is sent, nothing is billed, and the response contains the code for your tests.
  2. Send a code with POST /v1/otp/send.
  3. Verify the code typed by your user with POST /v1/otp/verify.
  4. Go live: replace the test key with a production key and top up your balance. Nothing else changes.
API address
https://sms.inatum.com
Authentication
Header Authorization: Bearer <your key> on every request
Format
JSON in and out, phone numbers in international format (+224620000000)
Error language
French by default, English with Accept-Language: en

1. Send a code

Inatum SMS generates the code, sends it and stores it hashed: you never see it (except in test mode). Pass your user's IP address in end_user_ip: it greatly strengthens fraud detection.

cURL
curl -X POST https://sms.inatum.com/v1/otp/send \
  -H "Authorization: Bearer $INATUM_SMS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone": "+224620000000", "end_user_ip": "41.223.10.20"}'
Python
import os, requests

r = requests.post(
    "https://sms.inatum.com/v1/otp/send",
    headers={"Authorization": f"Bearer {os.environ['INATUM_SMS_KEY']}"},
    json={"phone": "+224620000000", "end_user_ip": client_ip},
    timeout=10,
)
r.raise_for_status()
otp_id = r.json()["otp_id"]  # keep it for verification
PHP
$ch = curl_init("https://sms.inatum.com/v1/otp/send");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("INATUM_SMS_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "phone" => "+224620000000",
        "end_user_ip" => $_SERVER["REMOTE_ADDR"],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
$otpId = $response["otp_id"];
JavaScript (Node.js)
const r = await fetch("https://sms.inatum.com/v1/otp/send", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.INATUM_SMS_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ phone: "+224620000000", end_user_ip: clientIp }),
});
const { otp_id } = await r.json();

201 response:

{"otp_id": "5f0c…", "message_id": "9a1e…", "phone": "+224620000000",
 "channel": "sms", "status": "pending", "expires_at": "2026-10-03T10:05:00Z",
 "segments": 1, "price": 200, "currency": "GNF", "test": false, "test_code": null}

Options: channel (sms, whatsapp or auto: WhatsApp with SMS as fallback), length (4 to 10 digits), ttl_seconds (60 to 900), template (must contain {code}, may contain {minutes}).

2. Verify the code

Send the otp_id from step 1 and the code typed by the user. verified is true only once: a code that was already used, has expired or was replaced by a new one is rejected.

cURL
curl -X POST https://sms.inatum.com/v1/otp/verify \
  -H "Authorization: Bearer $INATUM_SMS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"otp_id": "5f0c…", "code": "482913"}'
Python
r = requests.post(
    "https://sms.inatum.com/v1/otp/verify",
    headers={"Authorization": f"Bearer {os.environ['INATUM_SMS_KEY']}"},
    json={"otp_id": otp_id, "code": typed_code},
    timeout=10,
)
if r.json()["verified"]:
    log_user_in()
PHP
$ch = curl_init("https://sms.inatum.com/v1/otp/verify");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("INATUM_SMS_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode(["otp_id" => $otpId, "code" => $typedCode]),
]);
$ok = json_decode(curl_exec($ch), true)["verified"];
JavaScript (Node.js)
const r = await fetch("https://sms.inatum.com/v1/otp/verify", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.INATUM_SMS_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ otp_id, code: typedCode }),
});
const { verified } = await r.json();

Response: {"verified": true, "status": "verified", "attempts_remaining": 0}. After too many wrong attempts the code is blocked ("status": "blocked"): offer to request a new one.

3. Track delivery

GET /v1/messages/{message_id} returns the status of a message:

StatusMeaning
QueuedAccepted, being sent
SentHanded over to the carrier
DeliveredReached the phone (carrier receipt)
UndeliveredThe carrier could not deliver it (phone off, number does not exist…), or no delivery confirmation within 24 hours
FailedNever sent: you are refunded automatically

Instead of polling the API, receive every status change on your server with a webhook.

Broadcast tier: send a notification

For reminders, confirmations and information to your customers, at the "diffusion" rate (the lowest): the same text, by SMS, to 1 to 500 numbers per call. Verification codes stay on /v1/otp/send (Security tier, with anti-fraud).

curl
curl -X POST https://sms.inatum.com/v1/notifications \
  -H "Authorization: Bearer $INATUM_SMS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"recipients": ["+224620000000", "+224660000000"],
       "text": "Your order 1234 is ready. Pick it up at the Kaloum branch."}'

Response: one message_id per recipient (tracked as above), the total price and the currency. A daily quota protects your balance; only write to people who agreed to receive your messages.

4. Webhooks: verify the signature

Every notification is signed: header X-Inatum-Signature: t=<timestamp>,v1=<signature>, where the signature is the HMAC-SHA256 of "<t>." + raw body with your webhook secret. Reject any notification that is badly signed or older than 5 minutes.

Python
import hashlib, hmac, time

def valid_signature(secret: str, header: str, body: bytes) -> bool:
    fields = dict(p.split("=", 1) for p in header.split(","))
    if abs(time.time() - int(fields["t"])) > 300:
        return False  # too old: possible replay
    expected = hmac.new(secret.encode(), f"{fields['t']}.".encode() + body, hashlib.sha256)
    return hmac.compare_digest(expected.hexdigest(), fields["v1"])
PHP
function valid_signature(string $secret, string $header, string $body): bool {
    parse_str(str_replace(",", "&", $header), $fields);
    if (abs(time() - (int) $fields["t"]) > 300) return false;
    $expected = hash_hmac("sha256", $fields["t"] . "." . $body, $secret);
    return hash_equals($expected, $fields["v1"]);
}
JavaScript (Node.js)
const crypto = require("crypto");

function validSignature(secret, header, body /* raw Buffer */) {
  const fields = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  if (Math.abs(Date.now() / 1000 - Number(fields.t)) > 300) return false;
  const expected = crypto.createHmac("sha256", secret)
    .update(`${fields.t}.`).update(body).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(fields.v1));
}

Events: message.sent, message.delivered, message.undelivered, message.failed, message.fallback, fraud.detected, account.low_balance (balance fell below your threshold). The data.test field is true for test traffic.

Protection without SMS: check before you send

Keep your SMS provider: before sending your code, ask the six anti-fraud agents. Inatum sends nothing. Answer in under a second (timeout set with timeout_ms, 800 ms by default).

cURL
curl -X POST https://sms.inatum.com/v1/protect/check \
  -H "Authorization: Bearer $INATUM_SMS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone": "+224620000000", "end_user_ip": "41.223.10.20"}'

{"check_id": "9b1e…", "decision": "allow", "risk_score": 0.08, "signals": [],
 "degraded": false, "test": false, "checks_this_month": 412, "included_this_month": 1000}
Python
try:
    r = requests.post("https://sms.inatum.com/v1/protect/check",
                      headers={"Authorization": f"Bearer {os.environ['INATUM_SMS_KEY']}"},
                      json={"phone": number, "end_user_ip": client_ip}, timeout=1.5)
    advice = r.json() if r.status_code == 200 else {"decision": "allow"}
except requests.RequestException:
    advice = {"decision": "allow"}  # Inatum unreachable: your rule (here, allow)
if advice["decision"] != "block":
    send_code_with_my_provider(number)

# Once the code is entered (or abandoned):
requests.post("https://sms.inatum.com/v1/protect/feedback",
              headers={"Authorization": f"Bearer {os.environ['INATUM_SMS_KEY']}"},
              json={"check_id": advice["check_id"], "outcome": "verified"}, timeout=5)

Errors

Format: {"error": {"code": "…", "message": "…"}}.

HTTPCodeWhat to do
401unauthorizedCheck the API key (revoked or badly copied).
402insufficient_balanceTop up your balance.
403fraud_suspectedRequest blocked by fraud protection (blocking mode): see the Fraud protection page.
422invalid_phoneInvalid number: international format required.
422region_not_allowedCountry not enabled for your account: contact us to open it.
422destination_not_pricedNo price for this country: contact us.
429rate_limitedToo many requests: wait for the time given in the Retry-After header.
503queue_unavailableTemporary outage, you are not charged: try again.

Best practices

Sender names

GET /v1/sendernames lists the sender names validated for your account, the default one first. A new name is requested from support: it must be registered with the operators of each destination country.

curl https://sms.inatum.com/v1/sendernames -H "Authorization: Bearer $INATUM_SMS_KEY"

[{"name": "INATUM", "status": "active", "default": true}]

Limits and priorities