Developer platform
Add reliable messaging to your product
Send transactional SMS through REST, manage API credentials, and diagnose requests without leaving the MainMsg workspace.
curl -X POST https://api.mainmsg.com/api/v1/messages/send \
-H "Authorization: Bearer $MAINMSG_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"channel": "sms",
"sender": "APEXRETAIL",
"body": "Your order has shipped!",
"recipients": ["255712345678"]
}'Build reliable SMS into your product
A focused REST API for transactional SMS. Create a project, issue a secure API key, and send messages with a predictable request contract.
01
Create a project
Keep each application and environment isolated.
02
Generate a key
Store the bearer token in server-side secrets.
03
Send and monitor
Queue SMS and inspect every request in API logs.
Send SMS
Queue one or more transactional messages.
Endpoint
https://api.mainmsg.com/api/v1/messages/send
curl --request POST "https://api.mainmsg.com/api/v1/messages/send" \
--header "Authorization: Bearer $MAINMSG_API_KEY" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '{
"channel": "sms",
"sender": "APEXRETAIL",
"body": "Your order has shipped.",
"recipients": ["255712345678"]
}'Bearer authentication
Pass a live API key with every request. Inactive, expired, or revoked keys are rejected.
Delivery prerequisites
- Approved sender ID
- Available SMS credits
- Server-side API key storage
Request contract
Submit a JSON body with Content-Type and Accept set to application/json.
| Parameter | Type | Required | Details |
|---|---|---|---|
| channel | string | Required | Use sms. |
| sender | string | Required | An approved sender ID available to your organization (maximum 50 characters). |
| body | string | Conditional | Message content, up to 5,000 characters. Required unless template_id is provided. |
| template_id | integer | Optional | An active SMS template ID. Its saved content is used when supplied. |
| recipients | array | Required | 1–1,000 Tanzanian MSISDNs in 2556XXXXXXXX or 2557XXXXXXXX format. |
{
"channel": "sms",
"sender": "APEXRETAIL",
"body": "Your order has shipped.",
"recipients": ["255712345678"]
}Successful response
A valid request is accepted for asynchronous delivery and returns HTTP 202.
{
"success": true,
"message": "Messages queued for delivery.",
"data": null
}Production checklist
Review these before directing live traffic to the API.
- Use a separate project and key for each integration or environment.
- Never include credentials in browser or mobile application code.
- Rotate a compromised key immediately from the API keys area.
- Use request logs to validate rollout and investigate errors.
Ready to improve how your business communicates?
Create your organization, choose a plan, and start sending reliable messages through campaigns or APIs.