Skip to main content

SMS REST API

The SMS REST API lets you send text messages to any mobile number worldwide through a single HTTPS endpoint. It handles encoding, multipart splitting, and delivery tracking automatically — you provide the destination, sender ID, and message body.

Download the SMS Universal Postman Collection.

Quick Start

The fastest way to send an SMS: make a POST request with your API key, destination number, sender, and message text. The API returns a messageId you can use to track delivery.

Base URL

https://lora-api.agiletelecom.com

Authentication

Every request requires an API key passed in the X-Api-Key header. Generate your key from the Agile Telecom portal under Settings > API Keys.

HeaderRequiredDescription
Content-TypeYesMust be application/json
X-Api-KeyYesYour API key from the portal

Environment Variables

These variables are used throughout the examples. Replace them with your actual values.

VariableExampleDescription
BASE_URLhttps://lora-api.agiletelecom.comAPI base URL
API_KEYak_live_*****Your API key
DESTINATION+393471234567Recipient number in international format (with country code)
SENDERMyCompanyAlphanumeric (max 11 chars) or numeric (max 16 digits), registered on the portal

Send an SMS

Send a single text message to a phone number. This is the most common operation — it covers 90% of integration use cases.

Endpoint: POST /api/message-server/sms/send

curl -X POST https://lora-api.agiletelecom.com/api/message-server/sms/send \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{
"destination": "+393471234567",
"sender": "MyCompany",
"body": "Hello from Agile Telecom SMS API!"
}'

Response

On success, the API returns HTTP 202 Accepted:

{
"messageId": "9b3dfde1-7ee6-411f-8f56-6cb18106e0cc",
"simulation": false,
"results": {
"sms": {
"accepted": true,
"unicode": false,
"parts": 1
}
}
}
FieldDescription
messageIdUnique identifier for tracking delivery status via webhooks
simulationfalse = real send, true = dry run (no SMS dispatched)
results.sms.acceptedtrue means the message entered the delivery pipeline
results.sms.unicodeWhether the message required Unicode encoding (emoji, CJK, Arabic, etc.)
results.sms.partsNumber of SMS parts — messages over 160 chars (GSM) or 70 chars (Unicode) are split automatically

Simulation Mode

Test your integration without sending a real SMS. The API validates everything — authentication, sender registration, message encoding — and returns a realistic response, but nothing reaches the recipient's phone.

Set "simulation": true in the request body. All other parameters stay the same.

{
"destination": "+393471234567",
"sender": "MyCompany",
"body": "This SMS will not be sent, it's only a simulation.",
"simulation": true
}
When to Use Simulation

Use simulation mode during development and CI/CD pipeline testing. It validates your payload without consuming credits or reaching real phone numbers.

Scheduled Delivery

Queue an SMS for future delivery. The message is stored server-side and dispatched at the specified date and time. Useful for appointment reminders, marketing campaigns, and time-sensitive notifications.

Add scheduledDate in ISO 8601 format to the request body:

{
"destination": "+393471234567",
"sender": "MyCompany",
"body": "Your appointment is tomorrow at 10:00.",
"scheduledDate": "2025-10-30T18:50:00.000+0000",
"enableNotification": true
}
FieldDescription
scheduledDateDelivery date/time in ISO 8601 format with timezone offset
enableNotificationSet to true to receive delivery callbacks for this message
Timezone

Always include the timezone offset (e.g., +0000 for UTC, +0100 for CET). Without it, the scheduled time may be interpreted incorrectly.

Personalized Messages with Placeholders

Insert dynamic values into your message text. Define placeholder tokens with curly braces in the body, then provide the replacement values in the placeholders object. Ideal for OTP codes, customer names, order numbers, and personalized notifications.

{
"destination": "+393471234567",
"sender": "MyCompany",
"body": "Hello {name}, your code is {code}.",
"placeholders": {
"name": "Luigi",
"code": "123456"
}
}

The recipient receives: "Hello Luigi, your code is 123456."

Placeholder Syntax

Tokens are case-sensitive: \{Name\} and \{name\} are different placeholders. Make sure the keys in placeholders match the tokens in body exactly.

Custom Message ID

By default, the system generates a UUID for each message. If you need to correlate messages with your internal records, pass your own messageId:

{
"destination": "+393471234567",
"sender": "MyCompany",
"body": "Order #12345 has been shipped.",
"messageId": "550e8400-e29b-41d4-a716-446655440000"
}

The same ID will appear in delivery callbacks, allowing you to match delivery status to your records.

UDH (User Data Header)

For advanced use cases like WAP Push, Flash SMS, or custom concatenation, you can include raw UDH data in hexadecimal format:

{
"destination": "+393471234567",
"sender": "MyCompany",
"body": "Message with custom UDH",
"udhData": "050003CC0201"
}
Advanced Feature

UDH is intended for developers who need low-level control over SMS PDU headers. Most integrations do not need this — the API handles concatenation automatically.

Delivery Callbacks (Webhooks)

When you configure a delivery URL in the Agile Telecom portal, the system sends an HTTP POST to your endpoint each time a message status changes. This lets you track whether each SMS was actually delivered to the recipient's device.

Webhook Payload

Your endpoint receives a JSON payload like this:

Delivered successfully:

{
"channel": "SMS",
"eventType": "DELIVERY",
"messageId": "813d4183-8d15-4aa3-a820-8d16a435bf77",
"destination": "+393401234567",
"statusCode": 3,
"description": "delivered",
"eventDate": "2025-11-24T16:10:21Z",
"price": 0.075,
"numPart": 1,
"totalParts": 2
}

Undeliverable:

{
"channel": "SMS",
"eventType": "DELIVERY",
"messageId": "813d4183-8d15-4aa3-a820-8d16a435bf77",
"destination": "+393401234567",
"statusCode": 6,
"description": "Undeliverable",
"eventDate": "2025-11-24T16:10:21Z",
"price": 0.075,
"numPart": 1,
"totalParts": 1
}

Webhook Fields

FieldDescription
channelAlways "SMS" for this API
eventTypeAlways "DELIVERY" — fired when the carrier confirms the final status
messageIdMatches the ID returned when you sent the message
destinationRecipient's phone number
statusCodeNumeric delivery status (see table below)
descriptionHuman-readable status label
eventDateISO 8601 timestamp of the delivery event
priceCost charged for this message part
numPartPart number (for multipart SMS)
totalPartsTotal parts in the message

Delivery Status Codes

CodeStatusWhat It Means
1AcceptedMessage entered the delivery pipeline, waiting to be sent
2RejectedValidation failed before sending (invalid sender, restricted destination, etc.)
3DeliveredConfirmed delivered to the recipient's device
4ExpiredDelivery window elapsed — the phone may have been off or unreachable
5DeletedMessage removed before delivery (by policy or on request)
6UndeliverablePermanently failed — number doesn't exist, network error, etc.

Error Codes

If the API rejects your request, it returns one of these error codes alongside an HTTP error status:

CodeMeaningWhat to Check
8Server errorRetry after a brief delay; contact support if persistent
26Sender not authorizedRegister the sender alias in the portal before using it
100IP not allowedYour server IP must be whitelisted — contact support

SMS Encoding Reference

EncodingMax Chars per PartWhen Used
GSM 7-bit160Standard Latin characters, digits, common symbols
Unicode (UCS-2)70Emoji, Chinese/Japanese/Korean, Arabic, Cyrillic, etc.
Multipart GSM153 per partGSM messages over 160 chars (7 chars per part reserved for UDH)
Multipart Unicode67 per partUnicode messages over 70 chars

The API detects the encoding automatically based on your message content. You don't need to specify it.

Sender ID Rules
  • Alphanumeric sender: max 11 characters (letters, digits, spaces). Must be pre-registered in the portal.
  • Numeric sender: max 16 digits. Useful for two-way SMS where recipients can reply.

Postman Collection

The Postman Collection contains pre-configured requests for every example on this page. Import it and set your variables to start testing in seconds.

  1. Download the collection
  2. Import into Postman via File > Import
  3. Set BASE_URL, API_KEY, DESTINATION, and SENDER in the collection variables
  4. Run any request — check the response for messageId and accepted: true
Code Generation

Postman can generate code snippets in 15+ languages. Open any request, click the Code icon (</>) on the right, and select your language.

Support

For technical assistance, contact help@agiletelecom.com.

What's Next?