API Docs

Credits

Check balances and buy SMS credit from your own system.

Check what you have left and buy more SMS credit from your own system — for example an automatic top-up when the balance drops, or a reseller shop where your customers pay by mobile money.

Check balance

GET/users/self/balanceAPI key

Returns your SMS and WhatsApp balances, so you can check before a large send instead of reacting to a failure.

Response data
sms_balanceintegerrequired
SMS units left. See billing.
whatsapp_balancenumberrequired
WhatsApp wallet balance, in USD.
withdraw_balancenumberoptional
Reseller earnings available to withdraw (resellers only).
balance_thresholdintegeroptional
The low-balance alert level set in the portal.
curl https://sms.nbmbrand.com/api/v1/users/self/balance \
  -H "Authorization: Bearer $API_KEY"
Response
200 OK
{
  "success": true,
  "status_code": 200,
  "status_text": "OK",
  "message": "balance has been fetched",
  "data": {
    "sms_balance": 8420,
    "whatsapp_balance": 12.5,
    "withdraw_balance": 0,
    "balance_threshold": 100
  }
}

Browse bundles

GET/bundles/allAPI key

Lists the price tiers you can buy at. Each bundle has items: tiers of { from, to, price }, where price is the price per SMS (TZS) for a purchase whose quantity is between from and to.

The bundle that applies to you is the one assigned to your account, otherwise the one for your account type, otherwise the platform default. The paginated GET /bundles?condition=buy takes the same filter.

Query
conditionstringrequired
Use buy for bundles you can purchase.
curl "https://sms.nbmbrand.com/api/v1/bundles/all?condition=buy" \
  -H "Authorization: Bearer $API_KEY"
Response
200 OK
{
  "success": true,
  "status_code": 200,
  "status_text": "OK",
  "message": "bundles have been fetched",
  "data": [
    {
      "id": "3f2a1e2a-4b0e-4e9a-9a2e-1a2b3c4d5e6f",
      "name": "standard",
      "items": [
        {
          "from": 1,
          "to": 5000,
          "price": 20
        },
        {
          "from": 5001,
          "to": 100000,
          "price": 17
        },
        {
          "from": 100001,
          "to": 1000000,
          "price": 15
        }
      ],
      "is_default": true,
      "type": "customer"
    }
  ]
}

Buy credit

POST/purchasesAPI key

Creates a pending purchase. With customer_phone_number, a mobile-money payment prompt (USSD push) is sent to that phone; the payer approves it with their PIN. Without a phone number, arrange payment another way and confirm with Check purchase status.

Body
quantityintegerrequired
SMS units to buy.
amountnumberrequired
Total price (TZS). Must be at least quantity × price for your tier, or the request is refused.
customer_namestringoptional
Shown on the purchase and receipt.
customer_emailstringoptional
Receipt is emailed here.
customer_phone_numberstringoptional
Mobile-money number to send the payment prompt to (M-Pesa, Airtel Money, Mixx by Yas, HaloPesa).
pending
paid
Errors
StatuserrorWhen it happens
400validation_errorquantity or amount missing or zero.
400creation_errorAmount is below your tier price for this quantity, or no tier covers it.
401invalid_tokenMissing or invalid API key.
curl -X POST https://sms.nbmbrand.com/api/v1/purchases \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "quantity": 10000,
    "amount": 200000,
    "customer_name": "Asha Mushi",
    "customer_email": "asha@example.com",
    "customer_phone_number": "0712345678"
  }'
Response
201 Created
{
  "success": true,
  "status_code": 201,
  "status_text": "Created",
  "message": "purchase has been created",
  "data": {
    "id": "6b2f6e2a-4b0e-4e9a-9a2e-1a2b3c4d5e6f",
    "generated_number": "104822",
    "reference": "104822",
    "quantity": 10000,
    "amount": 200000,
    "status": "pending",
    "customer_name": "Asha Mushi",
    "customer_email": "asha@example.com",
    "customer_phone_number": "255712345678",
    "created_at": "2026-11-20T08:12:41Z"
  }
}

Check purchase status

POST/purchases/statusAPI key

Asks the payment provider again about a pending purchase. A background job already does this about every 30 seconds, so you only need it if you prefer polling to webhooks.

Returns 200 OK once paid. Still pending — or the payment failed — returns 400 with creation_error; wait and check later instead of retrying in a tight loop.

Body
iduuidrequired
Purchase id.
curl -X POST https://sms.nbmbrand.com/api/v1/purchases/status \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "6b2f6e2a-4b0e-4e9a-9a2e-1a2b3c4d5e6f"
  }'
Response
200 OK
{
  "success": true,
  "status_code": 200,
  "status_text": "OK",
  "message": "purchase has been paid",
  "data": {
    "id": "6b2f6e2a-4b0e-4e9a-9a2e-1a2b3c4d5e6f",
    "generated_number": "104822",
    "reference": "104822",
    "quantity": 10000,
    "amount": 200000,
    "status": "paid",
    "customer_name": "Asha Mushi",
    "customer_email": "asha@example.com",
    "customer_phone_number": "255712345678",
    "created_at": "2026-11-20T08:12:41Z"
  }
}

List purchases

GET/purchasesAPI key

Your purchases, newest first. GET /purchases/search?search=… accepts the same filters, and GET /purchases/{id} fetches one.

Query
statusstringoptional
pending or paid.
page / limit / sort_by / sort_dir—optional
curl "https://sms.nbmbrand.com/api/v1/purchases?status=paid&limit=20" \
  -H "Authorization: Bearer $API_KEY"