FastHub logo

Bulk SMS API

Send SMS from your own system, check your balance and receive delivery reports. Every request is an HTTPS POST with a JSON body.

Before you start · Send SMS · Replies and errors · Check your balance · Delivery reports

Before you start

Base address: https://bulksms.fasthub.co.tz. Every request needs the header Content-Type: application/json.

Send SMS

POST/api/sms/send

Request

{
  "auth": {
    "clientId": "123456",
    "clientSecret": "your-client-secret"
  },
  "messages": [
    {
      "text": "Your order 4581 is ready for collection.",
      "msisdn": "255712345678",
      "source": "MYSHOP",
      "reference": "9f3c2a7d5b8e4c1aa0d6e2f4b7c9d013"
    }
  ]
}
FieldRequiredDescription
auth.clientIdYesYour client ID. client_id is also accepted.
auth.clientSecretYesYour client secret. client_secret is also accepted.
messagesYesOne or more messages. Up to 50 in one request, unless we have agreed a different limit with you.
textYesThe message text. It cannot be empty.
msisdnYesThe recipient's number in international form, without +. Example: 255712345678.
sourceYesYour registered sender ID.
referenceFor delivery reportsYour own identifier for this message, at least 20 characters. Use a different value for each message. Delivery reports carry it back to you. Without it, you do not receive a report for each message.
codingNoGSM7 for plain text or UCS2 for other characters, such as emoji or Arabic script.
flashNotrue shows the message on the screen without saving it. The default is false.

Example with curl

curl -X POST https://bulksms.fasthub.co.tz/api/sms/send \
  -H "Content-Type: application/json" \
  -d '{"auth":{"clientId":"123456","clientSecret":"your-client-secret"},
       "messages":[{"text":"Hello from FastHub","msisdn":"255712345678","source":"MYSHOP",
                    "reference":"9f3c2a7d5b8e4c1aa0d6e2f4b7c9d013"}]}'

Replies and errors

Replies are JSON in this shape. status tells you whether we accepted the request.

{
  "status": true,
  "message": "Successfully submitted 1 message(s) to broker.",
  "data": null,
  "balance": 125000.0
}

An accepted request means the messages are in our queue. The delivery report tells you whether each message reached the phone.

HTTP codemessageWhat to do
200Successfully submitted N message(s) to broker.Nothing. Wait for the delivery reports.
400Validation errorsA field is missing or wrong. data lists each problem.
400Invalid credentialsCheck the client ID and the client secret. Send the secret exactly as we gave it.
400client N is disabledYour API configuration is switched off. Contact us.
400Status inactiveYour account is not active. Contact us.
400List should contain not more than N messagesSplit the messages into smaller requests.
500Something went wrong!We could not read the request. Check that the body is valid JSON, has an auth block, and uses only the fields on this page.
400Something went wrong…Try again later. If it continues, contact us.

Check your balance

POST/api/account/balance
{
  "auth": {
    "clientId": "123456",
    "clientSecret": "your-client-secret"
  }
}

The reply:

{
  "status": true,
  "message": "Account balance",
  "balance": 125000.0,
  "data": {
    "name": "My Shop Limited",
    "email": "[email protected]",
    "currency": "TZS"
  }
}

Wrong credentials return HTTP 400 with Invalid credentials used.

Delivery reports

We send the final status of each message to your system. Give us a callback address (an HTTPS address on your server), and ask us to switch callbacks on for your API configuration.

We send a POST with this body:

{
  "statuses": [
    {
      "status": "DELIVRD",
      "reference": "9f3c2a7d5b8e4c1aa0d6e2f4b7c9d013",
      "description": "Delivered",
      "msisdn": "255712345678"
    }
  ]
}
statusMeaning
DELIVRDThe phone received the message.
UNDELIVWe or the network could not deliver or route the message.
EXPIREDThe phone was unreachable until the message expired.
REJECTDWe or the network refused the message, for example a repeated message, empty text or a number that has opted out.
DELETEDThe network deleted the message before delivery.
UNKNOWNThe network did not report a final state.
ACCEPTDThe network accepted the message on the phone's behalf.
FAILEDWe could not send the message.

Reply within 5 seconds; we do not read the status code or the body of your reply. If we cannot reach your server, or it does not reply in time, we send the report again every 30 seconds, for up to 24 hours. Your server can therefore receive the same report more than once. Match each report to your message by its reference, and ignore a report you have already processed.

Accounts set up for our older API receive a different body, with one letter for each status: {"receipts": [{"status": "D", "msisdn": "255712345678", "reference_id": "…"}]}. One letter can stand for more than one status. Contact us to move to the format above.

Need help? Call 0800 712 354 or email [email protected].