Skip to content

Bulk SMS

Send the same message to multiple recipients in a single API call.

Endpoint

POST https://api.galatext.com/api/sms/bulk

Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
x-api-keyYour API keyYes

Request Body

ParameterTypeRequiredDescription
recipientsarrayYesArray of recipient objects (max varies by tier)
messagestringYesMessage content sent to all recipients
senderIdstringNoSender ID (default: GALATEX)
referencestringNoOptional batch reference for reconciliation

Recipient Object

FieldTypeRequiredDescription
phoneNumberstringYesPhone number in E.164 format
variablesobjectNoTemplate variables for personalized messages

Batch Size Limits

TierMax Recipients per Call
Free100
Starter1,000
Business10,000
EnterpriseCustom

Example Request

bash
curl -X POST https://api.galatext.com/api/sms/bulk \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "recipients": [
      { "phoneNumber": "+254712345678" },
      { "phoneNumber": "+254723456789" },
      { "phoneNumber": "+254734567890" }
    ],
    "message": "Thank you for choosing our service! Your account is now active.",
    "senderId": "YOURBRAND"
  }'

Personalized Bulk SMS

Use template variables with in the message to personalize each message:

bash
curl -X POST https://api.galatext.com/api/sms/bulk \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "recipients": [
      {
        "phoneNumber": "+254712345678",
        "variables": { "name": "Alice", "code": "A1B2C3" }
      },
      {
        "phoneNumber": "+254723456789",
        "variables": { "name": "Bob", "code": "D4E5F6" }
      }
    ],
    "message": "Hi {{name}}, your verification code is {{code}}.",
    "senderId": "YOURBRAND"
  }'

JavaScript (fetch)

js
const response = await fetch('https://api.galatext.com/api/sms/bulk', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': process.env.GALATEXT_API_KEY
  },
  body: JSON.stringify({
    recipients: [
      { phoneNumber: '+254712345678' },
      { phoneNumber: '+254723456789' }
    ],
    message: 'Welcome to our platform!',
    senderId: 'YOURBRAND'
  })
});

const data = await response.json();
console.log(data);

Python

python
import requests

response = requests.post(
    'https://api.galatext.com/api/sms/bulk',
    headers={
        'Content-Type': 'application/json',
        'x-api-key': 'YOUR_API_KEY'
    },
    json={
        'recipients': [
            {'phoneNumber': '+254712345678'},
            {'phoneNumber': '+254723456789'}
        ],
        'message': 'Welcome to our platform!',
        'senderId': 'YOURBRAND'
    }
)

data = response.json()
print(data)

Response

Success (202 Accepted)

json
{
  "success": true,
  "data": {
    "batchId": "batch_xyz789abc012",
    "totalRecipients": 3,
    "totalSegments": 3,
    "totalCredits": 3,
    "creditsRemaining": 1496,
    "messages": [
      {
        "messageId": "msg_abc111",
        "phoneNumber": "+254712345678",
        "status": "PENDING"
      },
      {
        "messageId": "msg_abc112",
        "phoneNumber": "+254723456789",
        "status": "PENDING"
      },
      {
        "messageId": "msg_abc113",
        "phoneNumber": "+254734567890",
        "status": "PENDING"
      }
    ]
  }
}
FieldDescription
batchIdUnique identifier for the batch
totalRecipientsNumber of recipients in the request
totalCreditsTotal credits deducted
messagesArray of individual message statuses

Partial Success

If some recipients fail validation, the API returns a partial success:

json
{
  "success": true,
  "data": {
    "batchId": "batch_xyz789abc012",
    "totalRecipients": 3,
    "successful": 2,
    "failed": 1,
    "errors": [
      {
        "index": 2,
        "phoneNumber": "+254invalid",
        "error": {
          "code": "INVALID_PHONE_NUMBER",
          "message": "Phone number is not in valid E.164 format"
        }
      }
    ],
    "messages": [
      { "messageId": "msg_abc111", "phoneNumber": "+254712345678", "status": "PENDING" },
      { "messageId": "msg_abc112", "phoneNumber": "+254723456789", "status": "PENDING" }
    ]
  }
}

Error Codes

StatusError CodeDescription
400BAD_REQUESTMalformed request body
401UNAUTHORIZEDMissing or invalid API key
402INSUFFICIENT_CREDITSAccount balance too low
413PAYLOAD_TOO_LARGEToo many recipients for your tier
422EMPTY_RECIPIENTSRecipients array is empty

Best Practices

  • Batch in chunks — Stay within your tier's limit per request
  • Validate phone numbers — Pre-validate E.164 format client-side
  • Use variables — Personalize messages for better engagement
  • Store batchId — Reference for delivery tracking
  • Respect quiet hours — Avoid sending promotional SMS after 9 PM

Powered by Galatex Softwares