API Documentation
Welcome to the FlashSMS API. Integrate SMS messaging into any application using our simple REST API.
https://your-domain.com/api/v1Send 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.
Request Headers
# Recommended
Authorization: Bearer bms_live_your_api_key_here
# Alternative
X-API-Key: bms_live_your_api_key_herePermissions
| Scope | Access |
|---|---|
sms:send | Send SMS messages and estimate costs |
sms:read | View SMS history, status, and delivery reports |
balance:read | Check account credit balance |
contacts:read | List contacts and contact groups |
contacts:write | Create, update, delete contacts and groups |
senders:read | List your approved sender IDs |
templates:read | List your SMS templates |
templates:write | Create, update, delete SMS templates |
transactions:read | View credit transaction history |
Send SMS
Send SMS messages to one or more recipients. Each message costs 1 credit per recipient.
/api/v1/sms/sendRequest Body
recipients, groupId, groupIds, contactIds, or sendToAllContacts. You can combine multiple sources — duplicates are removed automatically.| Parameter | Type | Required | Description |
|---|---|---|---|
| recipients | string[] | Optional | Explicit phone numbers (Ghana: 0XXXXXXXXX or 233XXXXXXXXX) |
| groupId | string | Optional | Send to all contacts in a single group |
| groupIds | string[] | Optional | Send to all contacts across multiple groups |
| contactIds | string[] | Optional | Send to specific contacts by their ID |
| sendToAllContacts | boolean | Optional | Send to your entire contact list |
| message | string | Required | SMS content (max 918 chars for multi-part SMS) |
| senderId | string | Optional | Approved sender ID. Defaults to your first approved ID. |
| campaignName | string | Optional | Label for tracking this campaign in your history |
| isScheduled | boolean | Optional | Set true to schedule for later delivery |
| scheduleDate | string | Optional | ISO 8601 datetime for scheduled delivery |
Example Request
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
{
"success": true,
"data": {
"messageId": "cmjveqxgf0001jr04abc123",
"recipientsSent": 2,
"invalidRecipients": [],
"creditsUsed": 2,
"remainingCredits": 998,
"scheduled": false,
"scheduleDate": null
}
}0201234567 +233201234567 233201234567Check Balance
Retrieve your current SMS credit balance.
/api/v1/balanceExample Request
curl 'https://your-domain.com/api/v1/balance' \
-H 'Authorization: Bearer bms_live_your_api_key'Response
{
"success": true,
"data": {
"balance": 1000,
"currency": "credits",
"accountName": "John Doe",
"accountPhone": "0201234567"
}
}SMS History
Retrieve your message history with pagination and filters.
/api/v1/smsQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | number | Optional | Page number (default: 1) |
| limit | number | Optional | Items per page (default: 20, max: 100) |
| status | string | Optional | Filter: PENDING · SENT · DELIVERED · FAILED |
| startDate | string | Optional | From date (ISO 8601) |
| endDate | string | Optional | To date (ISO 8601) |
Example Request
curl 'https://your-domain.com/api/v1/sms?page=1&limit=20&status=DELIVERED' \
-H 'Authorization: Bearer bms_live_your_api_key'Response
{
"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.
/api/v1/sms/status/:messageIdPath Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| messageId | string | Required | The message ID returned from the send endpoint |
Response
{
"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
Queued for delivery
Sent to carrier
Delivered to device
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.
/api/v1/sms/estimateRequest Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| message | string | Required | The SMS message to estimate |
| recipientCount | number | Required | Number of recipients (1–10,000) |
Response
{
"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.
/api/v1/sms/:messageId/recipientsPath Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| messageId | string | Required | The message ID returned from the send endpoint |
Response
{
"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
}
}
}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.
/api/v1/contacts/api/v1/contacts/api/v1/contacts/:contactId/api/v1/contacts/:contactId/api/v1/contacts/:contactId/api/v1/contacts/importList Contacts — Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | number | Optional | Page number (default: 1) |
| limit | number | Optional | Items per page (default: 50, max: 200) |
| search | string | Optional | Search by first name, last name, or phone |
| groupId | string | Optional | Filter contacts belonging to a specific group |
Create Contact — Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| phone | string | Required | Phone number (Ghana: 0XXXXXXXXX or 233XXXXXXXXX) |
| firstName | string | Optional | First name |
| lastName | string | Optional | Last name |
| string | Optional | Email address | |
| groupId | string | Optional | Add to a group on creation |
Bulk Import — Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| contacts | object[] | Required | Array of contact objects (max 10,000) |
| contacts[].phone | string | Required | Phone number for this contact |
| contacts[].firstName | string | Optional | First name |
| contacts[].lastName | string | Optional | Last name |
| contacts[].email | string | Optional | Email address |
| groupId | string | Optional | Add all imported contacts to this group |
Example Requests
# 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
{
"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.
/api/v1/contacts/groups/api/v1/contacts/groups/api/v1/contacts/groups/:groupIdCreate Group — Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Unique group name within your account |
Example Requests
# 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
{
"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" }
]
}
}"groupId": "grp_abc123"Sender IDs
List your approved sender IDs. Only APPROVED sender IDs are returned. Requires senders:read.
/api/v1/sender-idsExample Request
curl 'https://your-domain.com/api/v1/sender-ids' \
-H 'Authorization: Bearer bms_live_your_api_key'Response
{
"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.
/api/v1/templates/api/v1/templates/api/v1/templates/:templateId/api/v1/templates/:templateIdCreate / Update Template — Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Unique template name within your account |
| content | string | Required | Template text. Use {{variable}} for dynamic fields. |
Example Requests
# 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.
/api/v1/transactionsQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | number | Optional | Page number (default: 1) |
| limit | number | Optional | Items per page (default: 20, max: 100) |
| type | string | Optional | Filter by type: PURCHASE · USAGE · REFUND · BONUS · ADJUSTMENT |
| startDate | string | Optional | From date (ISO 8601) |
| endDate | string | Optional | To date (ISO 8601) |
Example Request
curl 'https://your-domain.com/api/v1/transactions?page=1&limit=20&type=USAGE' \
-H 'Authorization: Bearer bms_live_your_api_key'Response
{
"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.
{
"success": false,
"error": "A description of what went wrong"
}HTTP Status Codes
| Status | Meaning | Common Causes |
|---|---|---|
| 200 | Success | Request completed successfully |
| 400 | Bad Request | Invalid parameters, missing fields, bad phone numbers |
| 401 | Unauthorized | Missing, invalid, or expired API key |
| 402 | Payment Required | Insufficient SMS credits |
| 403 | Forbidden | API key lacks the required permission |
| 404 | Not Found | Resource not found (e.g., invalid message ID) |
| 429 | Too Many Requests | Rate limit exceeded — implement exponential backoff |
| 500 | Server Error | Internal 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.
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.