Sending
Send SMS
POST /api/v1/sms/send: send one message, with idempotency and scheduling.
/api/v1/sms/sendScope: sms:sendRequest#
| Field | Type | Description |
|---|---|---|
torequired | string | Bangladeshi mobile number in any common format. |
messagerequired | string | Message text, up to 10 segments (about 1,530 GSM-7 characters or 670 Unicode characters). |
sender_idoptional | string | An approved sender ID of your account. Defaults to your default sender, or the shared non-masking number. |
typeoptional | "transactional" | "promotional" | Defaults to transactional. Promotional messages skip opted-out recipients and respect quiet hours. |
referenceoptional | string | Your own reference (max 100 characters), returned in webhooks. |
schedule_atoptional | ISO 8601 string | Send later, up to 30 days ahead. Charged when accepted. |
curl -X POST https://sms.marketian.net/api/v1/sms/send \
-H "Authorization: Bearer $MZSMS_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-10234-otp" \
-d '{
"to": "+8801XXXXXXXXX",
"message": "Your verification code is 123456",
"sender_id": "YOURBRAND",
"type": "transactional"
}'Response#
202 Accepted with the message ID, status queued, segment count and the amount charged.
{
"success": true,
"data": {
"message_id": "5b0f2c7e-7a55-4b1e-9d0a-3c1d2e4f6a70",
"to": "+8801XXXXXXXXX",
"status": "queued",
"segments": 1,
"encoding": "GSM7",
"cost": "0.35",
"currency": "BDT"
},
"meta": { "requestId": "req_8f2k1m0q7x3v9b2n" }
}Segments and cost#
The cost is segments × rate. Plain Latin text is GSM-7: 160 characters for one segment, 153 per segment when longer. Any Bangla or emoji character switches the whole message to Unicode: 70 characters, or 67 per segment. Characters such as { } [ ] ~ \ | ^ € count as two in GSM-7. Exact limits are set per provider by the platform operator.
Idempotency#
Network failures happen. Send an Idempotency-Key header (any unique string up to 255 characters, such as your order ID plus purpose). If you retry with the same key and the same body within 24 hours, you receive the original response with an Idempotent-Replayed: true header and no second message is sent. Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT.
Estimate before sending#
/api/v1/sms/estimateScope: sms:sendReturns encoding, segments and cost for a message without sending or charging anything.
curl -X POST https://sms.marketian.net/api/v1/sms/estimate \
-H "Authorization: Bearer $MZSMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "message": "প্রিয় গ্রাহক, আপনার অর্ডারটি আজ ডেলিভারি হবে।", "recipients": 250, "type": "promotional" }'