Auth and headers
API keys, Idempotency-Key, and the other headers public v1 uses.
Pass the full key in X-API-Key. Keys can be limited by scope, expiry, IP allowlist, and per-key rate limits. See Rate limits for the defaults. Sandbox keys start with msnp_test_; Live keys start with msnp_live_. Live keys are not available on the Flex plan. See Sandbox.
Request: authenticated call
bash
curl -X GET "https://api.messengernepal.com.np/api/v1/sms/sender-ids" \
-H "X-API-Key: msnp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Request headers you send:
X-API-Key(required on authenticated routes) - full secret from API Integration, then API TokenContent-Type: application/json(required on POST bodies)Idempotency-Key(optional on send and OTP send) - client-chosen string so retries do not create a second charge; see belowX-Idempotency-Key- same meaning asIdempotency-Key(either header works)
You can also put idempotencyKey in the JSON body instead of a header. Header wins if both are present. Max length is 128 characters after trim.
What Idempotency-Key means: if your HTTP client times out or retries a POST /send (or OTP send), the platform looks up that key for your organization and environment. A replay of the same key returns the original accepted response and is not charged again. Omit the header only when every call is intentionally a new send; the API then generates an internal key. For bulk to lists, each recipient is stored as your-key:0, your-key:1, and so on.
Request: send with Idempotency-Key
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: order-notify-1001" \
-d '{
"to": "98XXXXXXX",
"message": "Your order ships today."
}'Use a stable business id (order id, invoice id, login attempt id). Do not reuse the same key for a different message or recipient set. OTP send also accepts the header; OTP verify does not need it.
Response headers the API may set:
Retry-After- seconds to wait when the response is HTTP 429 (RATE_LIMIT_EXCEEDED); the JSON body also includesretry_afterContent-Type: application/json- normal success and error bodies
Webhook delivery headers (outbound to your URL, not on API calls you make) are documented on Webhooks: X-Msngr-Signature, X-Msngr-Timestamp, X-Msngr-Event, X-Msngr-Delivery-Id.
Unauthenticated discovery: GET https://api.messengernepal.com.np/api/v1/sms and GET https://api.messengernepal.com.np/api/v1/whatsapp (manifests), plus GET https://api.messengernepal.com.np/api/v1/sms/openapi.json and GET https://api.messengernepal.com.np/api/v1/whatsapp/openapi.json (OpenAPI).
Request: discovery (no key)
bash
curl -X GET "https://api.messengernepal.com.np/api/v1/sms"Common auth failures:
NO_API_KEYif the header is missingINVALID_API_KEYif the key is unknown, revoked, or malformedAPI_KEY_EXPIREDif the key is past expiryIP_RESTRICTEDif the caller IP is not on the allowlistKYC_REQUIREDorKYC_PENDINGif a live key is used before dashboard KYC is approved (individual nagarita or national ID, or company registration plus letterhead cover letter; PAN optional) or the grace period endedLIVE_API_NOT_APPROVEDif live API access was not grantedFLEX_LIVE_API_BLOCKEDif the wallet owner is on Flex (live keys and live API calls require Package or Enterprise)
Response: missing key (401)
json
{
"success": false,
"error": "API key required",
"code": "NO_API_KEY"
}