Large lists
How to send 1,000, 2,000, or 5,000 SMS from your own system with POST /send.
There is no campaign upload on the public API. Your system owns the list. You split it into groups of at most 1,000 phone numbers and call POST /send once per group. A 202 means that group is accepted for delivery. It does not mean every phone has received the SMS yet.
Worked example. Three integrators each press Send once in their own product, at the same time, each with their own API key:
- Integrator A has 1,000 SMS. That is 1 request.
- Integrator B has 5,000 SMS. That is 5 requests of 1,000.
- Integrator C has 2,000 SMS. That is 2 requests of 1,000.
Drawing diagram…
Their HTTP calls do not share a rate-limit bucket. Delivery does: after 202, every accepted SMS waits in the same outbound pipe and leaves at carrier speed. Raising how fast you call /send does not make that pipe faster.
Integrate it like this:
- Keep the full list in your database. Do not send it as one JSON body.
- Take the next unpublished slice of at most 1,000 numbers.
- Choose one
Idempotency-Keyfor that slice and store it. Example:campaign-42-chunk-0, thencampaign-42-chunk-1. Max 128 characters. The same key on a retry returns the original accept and is not charged again. - POST the slice to
/send(or/send/with-sender-id) withX-API-Keyand that key.tomay be an array. Send the samemessage(or template) on every slice. - On
202, mark that slice accepted and move to the next slice. - On timeout or HTTP 5xx, POST the same slice again with the same
Idempotency-Key. - On HTTP 429, wait
Retry-Afterseconds, then retry the same slice and the same key. See Rate limits. - On other 4xx, stop that slice and fix the payload. A new key would create a new send.
- Follow live delivery with webhooks, or in the dashboard message history. Sandbox traffic shows in Sandbox inbox.
Drawing diagram…
Request: first group of a 5,000 list
bash
curl -X POST "https://api.messengernepal.com.np/api/v1/sms/send" \
-H "X-API-Key: msnp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: campaign-42-chunk-0" \
-d '{
"to": ["98XXXXXXX", "97XXXXXXX"],
"message": "Store opening tomorrow at 10am.",
"message_type": "promotional"
}'The next group uses Idempotency-Key: campaign-42-chunk-1, and so on, until 5,000 numbers are accepted (five requests when each group is full). One-off messages and OTP stay a single POST /send or POST /otp/send with their own key. You do not batch those into the list above.
Wallet credits are reserved for each request, then used as each message is accepted. A failed later group does not undo groups that already returned 202. Keep enough balance for the whole list before you start, and keep each Idempotency-Key until you have stored the 202.