S
FlashSMS
|API Docs
Sign InGet Started

API Reference

API Documentation

Welcome to the FlashSMS API. Integrate SMS messaging into any application using our simple REST API.

Base URLhttps://your-domain.com/api/v1

Send SMS

Send to one or many recipients with a single API call

Check Balance

Monitor your credit balance programmatically

Track Delivery

Get real-time delivery status for every message

Authentication

All API requests require an API key. Generate keys from your dashboard.

Keep Your API Key Secure
Never expose your API key in client-side code or public repositories. Use environment variables on your server.

Request Headers

bash
# Recommended
Authorization: Bearer bms_live_your_api_key_here

# Alternative
X-API-Key: bms_live_your_api_key_here

Permissions

ScopeAccess
sms:sendSend SMS messages and estimate costs
sms:readView SMS history, status, and delivery reports
balance:readCheck account credit balance
contacts:readList contacts and contact groups
contacts:writeCreate, update, delete contacts and groups
senders:readList your approved sender IDs
templates:readList your SMS templates
templates:writeCreate, update, delete SMS templates
transactions:readView credit transaction history

Send SMS

Send SMS messages to one or more recipients. Each message costs 1 credit per recipient.

POST/api/v1/sms/send

Request Body

Recipient Sources
Provide at least one of: recipients, groupId, groupIds, contactIds, or sendToAllContacts. You can combine multiple sources — duplicates are removed automatically.
ParameterTypeRequiredDescription
recipientsstring[]OptionalExplicit phone numbers (Ghana: 0XXXXXXXXX or 233XXXXXXXXX)
groupIdstringOptionalSend to all contacts in a single group
groupIdsstring[]OptionalSend to all contacts across multiple groups
contactIdsstring[]OptionalSend to specific contacts by their ID
sendToAllContactsbooleanOptionalSend to your entire contact list
messagestringRequiredSMS content (max 918 chars for multi-part SMS)
senderIdstringOptionalApproved sender ID. Defaults to your first approved ID.
campaignNamestringOptionalLabel for tracking this campaign in your history
isScheduledbooleanOptionalSet true to schedule for later delivery
scheduleDatestringOptionalISO 8601 datetime for scheduled delivery

Example Request

bash
curl -X POST 'https://your-domain.com/api/v1/sms/send' \
  -H 'Authorization: Bearer bms_live_your_api_key' \
  -H 'Content-Type: application/json' \
  -d '{
    "recipients": ["0201234567", "0241234567"],
    "message": "Hello from FlashSMS!",
    "senderId": "MyBrand",
    "campaignName": "Welcome Campaign"
  }'

Response

json
{
  "success": true,
  "data": {
    "messageId": "cmjveqxgf0001jr04abc123",
    "recipientsSent": 2,
    "invalidRecipients": [],
    "creditsUsed": 2,
    "remainingCredits": 998,
    "scheduled": false,
    "scheduleDate": null
  }
}
Phone Number Formats
Numbers are auto-normalised. Accepted formats: 0201234567 +233201234567 233201234567

Check Balance

Retrieve your current SMS credit balance.

GET/api/v1/balance

Example Request

bash
curl 'https://your-domain.com/api/v1/balance' \
  -H 'Authorization: Bearer bms_live_your_api_key'

Response

json
{
  "success": true,
  "data": {
    "balance": 1000,
    "currency": "credits",
    "accountName": "John Doe",
    "accountPhone": "0201234567"
  }
}

SMS History

Retrieve your message history with pagination and filters.

GET/api/v1/sms

Query Parameters

ParameterTypeRequiredDescription
pagenumberOptionalPage number (default: 1)
limitnumberOptionalItems per page (default: 20, max: 100)
statusstringOptionalFilter: PENDING · SENT · DELIVERED · FAILED
startDatestringOptionalFrom date (ISO 8601)
endDatestringOptionalTo date (ISO 8601)

Example Request

bash
curl 'https://your-domain.com/api/v1/sms?page=1&limit=20&status=DELIVERED' \
  -H 'Authorization: Bearer bms_live_your_api_key'

Response

json
{
  "success": true,
  "data": {
    "messages": [
      {
        "id": "cmjveqxgf0001jr04abc123",
        "message": "Hello from FlashSMS! (truncated to 160 chars)",
        "recipientCount": 2,
        "status": "DELIVERED",
        "creditsUsed": 2,
        "senderId": "MyBrand",
        "scheduledAt": null,
        "sentAt": "2024-12-21T10:30:00Z",
        "createdAt": "2024-12-21T10:30:00Z"
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 150,
      "totalPages": 8,
      "hasMore": true
    }
  }
}

Message Status

Check delivery status for a specific message. Use the messageId returned from the send endpoint. Requires the sms:read permission.

GET/api/v1/sms/status/:messageId

Path Parameters

ParameterTypeRequiredDescription
messageIdstringRequiredThe message ID returned from the send endpoint

Response

json
{
  "success": true,
  "data": {
    "id": "cmjveqxgf0001jr04abc123",
    "status": "DELIVERED",
    "recipientCount": 2,
    "message": "Hello from FlashSMS!",
    "senderId": "MyBrand",
    "creditsUsed": 2,
    "scheduledAt": null,
    "sentAt": "2024-12-21T10:30:00Z",
    "createdAt": "2024-12-21T10:30:00Z"
  }
}

Status Values

PENDING

Queued for delivery

SENT

Sent to carrier

DELIVERED

Delivered to device

FAILED

Delivery failed

Estimate Cost

Calculate the credit cost of a message before sending. No SMS is sent and no credits are deducted. Requires the sms:send permission.

POST/api/v1/sms/estimate

Request Body

ParameterTypeRequiredDescription
messagestringRequiredThe SMS message to estimate
recipientCountnumberRequiredNumber of recipients (1–10,000)

Response

json
{
  "success": true,
  "data": {
    "message": {
      "length": 145,
      "parts": 1,
      "encoding": "GSM-7"
    },
    "recipientCount": 500,
    "creditsRequired": 500,
    "currentBalance": 1000,
    "canAfford": true
  }
}

Delivery Report

Retrieve per-recipient delivery status for a message. Use the messageId returned from the send endpoint. Requires sms:read.

GET/api/v1/sms/:messageId/recipients

Path Parameters

ParameterTypeRequiredDescription
messageIdstringRequiredThe message ID returned from the send endpoint

Response

json
{
  "success": true,
  "data": {
    "messageId": "cmjveqxgf0001jr04abc123",
    "status": "DELIVERED",
    "recipientCount": 3,
    "recipients": [
      { "phone": "233201234567", "status": "DELIVERED", "sentAt": "2024-12-21T10:30:00Z" },
      { "phone": "233241234567", "status": "FAILED",    "sentAt": null }
    ],
    "stats": {
      "delivered": 2,
      "failed": 1,
      "pending": 0,
      "deliveryRate": 66.7
    }
  }
}
DLR Availability
Delivery reports are populated asynchronously after the carrier confirms delivery. If recipients shows PENDING for all entries, check again in a few moments.

Contacts

Manage your contact list programmatically. All contacts are scoped to your account. Requires contacts:read or contacts:write.

GET/api/v1/contacts
POST/api/v1/contacts
GET/api/v1/contacts/:contactId
PUT/api/v1/contacts/:contactId
DELETE/api/v1/contacts/:contactId
POST/api/v1/contacts/import

List Contacts — Query Parameters

ParameterTypeRequiredDescription
pagenumberOptionalPage number (default: 1)
limitnumberOptionalItems per page (default: 50, max: 200)
searchstringOptionalSearch by first name, last name, or phone
groupIdstringOptionalFilter contacts belonging to a specific group

Create Contact — Request Body

ParameterTypeRequiredDescription
phonestringRequiredPhone number (Ghana: 0XXXXXXXXX or 233XXXXXXXXX)
firstNamestringOptionalFirst name
lastNamestringOptionalLast name
emailstringOptionalEmail address
groupIdstringOptionalAdd to a group on creation

Bulk Import — Request Body

ParameterTypeRequiredDescription
contactsobject[]RequiredArray of contact objects (max 10,000)
contacts[].phonestringRequiredPhone number for this contact
contacts[].firstNamestringOptionalFirst name
contacts[].lastNamestringOptionalLast name
contacts[].emailstringOptionalEmail address
groupIdstringOptionalAdd all imported contacts to this group

Example Requests

bash
# List contacts
curl 'https://your-domain.com/api/v1/contacts?page=1&limit=50' \
  -H 'Authorization: Bearer bms_live_your_api_key'

# Create a contact
curl -X POST 'https://your-domain.com/api/v1/contacts' \
  -H 'Authorization: Bearer bms_live_your_api_key' \
  -H 'Content-Type: application/json' \
  -d '{"phone": "0201234567", "firstName": "Kofi", "lastName": "Mensah"}'

# Bulk import
curl -X POST 'https://your-domain.com/api/v1/contacts/import' \
  -H 'Authorization: Bearer bms_live_your_api_key' \
  -H 'Content-Type: application/json' \
  -d '{"contacts": [{"phone": "0201234567", "firstName": "Kofi"}, {"phone": "0241234567", "firstName": "Ama"}], "groupId": "grp_abc123"}'

# Delete a contact (soft delete)
curl -X DELETE 'https://your-domain.com/api/v1/contacts/cnt_abc123' \
  -H 'Authorization: Bearer bms_live_your_api_key'

Import Response

json
{
  "success": true,
  "data": {
    "imported": 9,
    "created": 7,
    "skipped": 2,
    "invalid": 1,
    "total": 10
  }
}

Contact Groups

Organise contacts into groups for targeted sending. Requires contacts:read or contacts:write.

GET/api/v1/contacts/groups
POST/api/v1/contacts/groups
DELETE/api/v1/contacts/groups/:groupId

Create Group — Request Body

ParameterTypeRequiredDescription
namestringRequiredUnique group name within your account

Example Requests

bash
# List groups
curl 'https://your-domain.com/api/v1/contacts/groups' \
  -H 'Authorization: Bearer bms_live_your_api_key'

# Create a group
curl -X POST 'https://your-domain.com/api/v1/contacts/groups' \
  -H 'Authorization: Bearer bms_live_your_api_key' \
  -H 'Content-Type: application/json' \
  -d '{"name": "VIP Customers"}'

# Delete a group (contacts are NOT deleted)
curl -X DELETE 'https://your-domain.com/api/v1/contacts/groups/grp_abc123' \
  -H 'Authorization: Bearer bms_live_your_api_key'

List Groups Response

json
{
  "success": true,
  "data": {
    "groups": [
      { "id": "grp_abc123", "name": "VIP Customers", "contactCount": 142, "createdAt": "2024-12-01T09:00:00Z" },
      { "id": "grp_def456", "name": "Newsletter",     "contactCount": 830, "createdAt": "2024-11-15T14:00:00Z" }
    ]
  }
}
Send to a Group
Once you have a group ID, use it directly in the Send SMS endpoint: "groupId": "grp_abc123"

Sender IDs

List your approved sender IDs. Only APPROVED sender IDs are returned. Requires senders:read.

GET/api/v1/sender-ids

Example Request

bash
curl 'https://your-domain.com/api/v1/sender-ids' \
  -H 'Authorization: Bearer bms_live_your_api_key'

Response

json
{
  "success": true,
  "data": {
    "senderIds": [
      { "id": "sid_abc123", "name": "MyBrand", "status": "APPROVED", "createdAt": "2024-10-01T00:00:00Z", "approvedAt": "2024-10-03T12:00:00Z" }
    ]
  }
}

Templates

Manage reusable SMS templates. Only your own templates are accessible — platform system templates are never returned. Requires templates:read or templates:write.

GET/api/v1/templates
POST/api/v1/templates
PUT/api/v1/templates/:templateId
DELETE/api/v1/templates/:templateId

Create / Update Template — Request Body

ParameterTypeRequiredDescription
namestringRequiredUnique template name within your account
contentstringRequiredTemplate text. Use {{variable}} for dynamic fields.

Example Requests

bash
# List templates
curl 'https://your-domain.com/api/v1/templates' \
  -H 'Authorization: Bearer bms_live_your_api_key'

# Create a template
curl -X POST 'https://your-domain.com/api/v1/templates' \
  -H 'Authorization: Bearer bms_live_your_api_key' \
  -H 'Content-Type: application/json' \
  -d '{"name": "Welcome Message", "content": "Hi {{name}}, welcome to our platform!"}'

# Delete a template
curl -X DELETE 'https://your-domain.com/api/v1/templates/tpl_abc123' \
  -H 'Authorization: Bearer bms_live_your_api_key'

Transactions

View your credit transaction history — purchases, usage, refunds, and bonuses. Requires transactions:read.

GET/api/v1/transactions

Query Parameters

ParameterTypeRequiredDescription
pagenumberOptionalPage number (default: 1)
limitnumberOptionalItems per page (default: 20, max: 100)
typestringOptionalFilter by type: PURCHASE · USAGE · REFUND · BONUS · ADJUSTMENT
startDatestringOptionalFrom date (ISO 8601)
endDatestringOptionalTo date (ISO 8601)

Example Request

bash
curl 'https://your-domain.com/api/v1/transactions?page=1&limit=20&type=USAGE' \
  -H 'Authorization: Bearer bms_live_your_api_key'

Response

json
{
  "success": true,
  "data": {
    "transactions": [
      {
        "id": "txn_abc123",
        "type": "USAGE",
        "amount": -50,
        "balance": 950,
        "description": "API SMS: Welcome Campaign (50 recipients)",
        "reference": "cmjveqxgf0001jr04abc123",
        "createdAt": "2024-12-21T10:30:00Z"
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 84,
      "totalPages": 5,
      "hasMore": true
    }
  }
}

Error Handling

All errors return a consistent JSON response with an HTTP status code.

json
{
  "success": false,
  "error": "A description of what went wrong"
}

HTTP Status Codes

StatusMeaningCommon Causes
200SuccessRequest completed successfully
400Bad RequestInvalid parameters, missing fields, bad phone numbers
401UnauthorizedMissing, invalid, or expired API key
402Payment RequiredInsufficient SMS credits
403ForbiddenAPI key lacks the required permission
404Not FoundResource not found (e.g., invalid message ID)
429Too Many RequestsRate limit exceeded — implement exponential backoff
500Server ErrorInternal server error — contact support

Rate Limits

Rate limits ensure fair usage and system stability for all users.

Limits

  • 100 requests per minute per API key
  • 1,000 recipients per single request

Best Practices

  • Implement exponential backoff on 429 responses
  • Check balance before sending bulk campaigns
  • Use campaign names for easy tracking
  • Store API keys in environment variables only

Code Examples

Ready-to-use examples for popular languages and environments.

Node.js
const API_KEY = 'bms_live_your_api_key';
const BASE_URL = 'https://your-domain.com/api/v1';
const headers = {
  'Authorization': `Bearer ${API_KEY}`,
  'Content-Type': 'application/json',
};

async function sendSms(recipients, message, senderId = 'FlashSMS') {
  const res = await fetch(`${BASE_URL}/sms/send`, {
    method: 'POST',
    headers,
    body: JSON.stringify({ recipients, message, senderId }),
  });
  return res.json();
}

async function sendToGroup(groupId, message) {
  const res = await fetch(`${BASE_URL}/sms/send`, {
    method: 'POST',
    headers,
    body: JSON.stringify({ groupId, message }),
  });
  return res.json();
}

async function checkBalance() {
  const res = await fetch(`${BASE_URL}/balance`, { headers });
  return res.json();
}

async function listContacts(page = 1) {
  const res = await fetch(`${BASE_URL}/contacts?page=${page}&limit=50`, { headers });
  return res.json();
}

// Usage
const result = await sendSms(['0201234567'], 'Hello from FlashSMS!');
console.log(`Sent: ${result.data.recipientsSent} messages — ${result.data.creditsUsed} credits used`);

const groupResult = await sendToGroup('grp_abc123', 'Promotion for VIP customers!');
console.log(`Group send: ${groupResult.data.recipientsSent} recipients`);

const { data } = await checkBalance();
console.log(`Balance: ${data.balance} credits`);

Ready to Get Started?

Create your account, generate an API key, and send your first SMS in minutes.

Create AccountSign In
S
© 2026 Codeslaw Global Technologies. All rights reserved.
HomeAPI DocsSign UpSupport