{"openapi":"3.0.3","info":{"title":"Messenger Nepal Public SMS API","version":"1.0.0","description":"Public SMS API v1. Authenticate with the X-API-Key header. Create Sandbox (`msnp_test_`) keys in the dashboard without KYC on any plan. Live (`msnp_live_`) keys and live send require a Package or Enterprise plan (not Flex), approved dashboard KYC (or an active grace period), plus a separate live API approval. Dashboard KYC is either an individual package (nagarita or national ID) or a company package (company registration and a letterhead cover letter; PAN is optional). Package/Enterprise may be prepaid or a postpaid credit pool; live send still debits shared User.credits. ConnectIPS top-up is a dashboard flow and is blocked while billingMode is postpaid. Sandbox uses the same routes; messages are not delivered to real phones and do not use wallet credits. Review sandbox traffic in the dashboard Sandbox inbox. Path prefix is /api/v1/sms. Default rate limits are 60 requests per minute and 1000 per hour per API key. Send accepts up to 1000 recipients. Live traffic may return KYC_REQUIRED, KYC_PENDING, LIVE_API_NOT_APPROVED, or FLEX_LIVE_API_BLOCKED."},"servers":[{"url":"https://api.messengernepal.com.np","description":"Production"}],"tags":[{"name":"Discovery","description":"Unauthenticated manifest and OpenAPI spec"},{"name":"Send","description":"Send SMS (scope sms:send)"},{"name":"Sender IDs","description":"List approved sender IDs (scope sms:send). Request new IDs in the dashboard."},{"name":"OTP","description":"Send and verify one-time passwords (scope sms:otp)"}],"security":[{"ApiKeyAuth":[]}],"paths":{"/api/v1/sms":{"get":{"tags":["Discovery"],"summary":"API manifest","description":"Lists public v1 endpoints, auth header, and error codes. No API key required.","operationId":"getSmsManifest","security":[],"responses":{"200":{"description":"Manifest","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManifestResponse"}}}}}}},"/api/v1/sms/openapi.json":{"get":{"tags":["Discovery"],"summary":"OpenAPI 3 specification","description":"This document. No API key required.","operationId":"getSmsOpenApi","security":[],"responses":{"200":{"description":"OpenAPI 3 JSON","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/v1/sms/send":{"post":{"tags":["Send"],"summary":"Send SMS with platform default sender","description":"Uses the platform default sender per recipient carrier. Do not send sender_id on this route. Optional template_id or template_name plus variables; the rendered template body wins over message. Scope: sms:send.","operationId":"sendSms","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendRequest"},"examples":{"singleTransactional":{"summary":"Single transactional SMS","value":{"to":"9800000000","message":"Your order ships today.","message_type":"transactional"}},"template":{"summary":"Saved SMS template","value":{"to":"9800000000","template_name":"welcome","variables":{"name":"Ada"}}},"bulk":{"summary":"Bulk recipients","value":{"to":["9800000000","9700000000"],"message":"Store opening tomorrow at 10am.","message_type":"promotional"}}}}}},"responses":{"202":{"$ref":"#/components/responses/SendAccepted"},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Error"}},"x-codeSamples":[{"lang":"bash","label":"cURL","source":"curl -X POST \"/api/v1/sms/send\" \\\n  -H \"X-API-Key: msnp_live_xxx\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: order-notify-1001\" \\\n  -d '{\"to\":\"9800000000\",\"message\":\"Your order ships today.\",\"message_type\":\"transactional\"}'"}]}},"/api/v1/sms/send/with-sender-id":{"post":{"tags":["Send"],"summary":"Send SMS with an explicit sender ID","description":"Requires sender_id in the body. Optional template_id or template_name plus variables; the rendered template body wins over message. Scope: sms:send.","operationId":"sendSmsWithSenderId","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendWithSenderIdRequest"},"examples":{"brandedSender":{"summary":"Branded sender ID","value":{"to":"9800000000","sender_id":"Msngr_test","message":"Your Content Here!"}},"templateWithSender":{"summary":"Template with sender ID","value":{"to":"9800000000","sender_id":"Msngr_test","template_name":"welcome","variables":{"name":"Ada"}}}}}}},"responses":{"202":{"$ref":"#/components/responses/SendAccepted"},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/v1/sms/sender-ids":{"get":{"tags":["Sender IDs"],"summary":"List approved sender IDs","description":"Approved sender IDs available to this API key. Request a new sender ID in the dashboard under Sender IDs. Scope: sms:send.","operationId":"listSenderIds","responses":{"200":{"description":"Approved sender IDs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SenderIdsResponse"},"examples":{"list":{"summary":"Approved sender IDs","value":{"success":true,"data":{"allowed_sender_ids":["Msngr_test","SANDBOX"],"default_sender_id":"Msngr_test","sender_ids":[{"sender_id":"Msngr_test","type":"alphanumeric","access_mode":"shared","status":"approved"}]}}}}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/sms/otp/send":{"post":{"tags":["OTP"],"summary":"Send an OTP SMS","description":"Optional template_id or template_name; OTP templates must contain a {{code}} placeholder. ttl_seconds is clamped to 30-900 (default 300). Scope: sms:otp.","operationId":"sendOtp","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpSendRequest"},"examples":{"defaultBody":{"summary":"Default OTP body","value":{"to":"9800000000","ttl_seconds":300}},"withTemplate":{"summary":"OTP template with {{code}}","value":{"to":"9800000000","template_name":"login_otp","variables":{"app":"Acme"},"ttl_seconds":300}}}}}},"responses":{"202":{"description":"OTP accepted for delivery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpSendResponse"},"examples":{"accepted":{"summary":"OTP accepted","value":{"success":true,"data":{"challenge_id":"ch_8f3a2b1c0d9e","dispatch_id":"661f0a1b2c3d4e5f67890123","message_id":"661f0a1b2c3d4e5f67890123","expires_at":"2026-04-02T08:20:00.000Z","cost":1,"remaining_balance":481,"environment":"live"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Error"}}}},"/api/v1/sms/otp/verify":{"post":{"tags":["OTP"],"summary":"Verify an OTP code","description":"Scope: sms:otp.","operationId":"verifyOtp","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpVerifyRequest"},"examples":{"verify":{"summary":"Verify with challenge_id","value":{"to":"9800000000","code":"123456","challenge_id":"ch_8f3a2b1c0d9e"}}}}}},"responses":{"200":{"description":"Verified","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpVerifyResponse"},"examples":{"verified":{"summary":"Verified","value":{"success":true,"data":{"verified":true,"challenge_id":"ch_8f3a2b1c0d9e","dispatch_id":"661f0a1b2c3d4e5f67890123"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Organization API key from the dashboard API Token page. Shown only once at creation."}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Optional key for send and OTP send. Also accepted as X-Idempotency-Key or as the JSON field idempotencyKey (header wins if both are sent). Max 128 characters. Replaying the same key for the same organization and environment returns the original accepted send and is not charged again. When one request has several recipients, each recipient is stored under that key plus a colon and a zero-based index (key:0, key:1, ...). Omit only when every call is intentionally a new send."}},"schemas":{"ErrorEnvelope":{"type":"object","required":["success","error","code"],"properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string"},"code":{"$ref":"#/components/schemas/ErrorCode"}}},"ErrorCode":{"type":"string","enum":["VALIDATION_ERROR","NO_API_KEY","INVALID_API_KEY","API_KEY_EXPIRED","ORG_INACTIVE","IP_RESTRICTED","INSUFFICIENT_PERMISSIONS","MISSING_TO","MISSING_MESSAGE","INVALID_TO_FORMAT","TOO_MANY_RECIPIENTS","MESSAGE_TOO_LONG","NO_SENDER_ID","INVALID_SENDER_ID","SENDER_ID_NOT_FOUND","SENDER_ID_INACTIVE","SENDER_ID_NOT_APPROVED","SENDER_ACCESS_DENIED","SENDER_ID_NOT_CONFIGURED","DEFAULT_SENDER_NOT_CONFIGURED","SENDER_ID_NOT_ALLOWED","SENDER_NOT_APPROVED_FOR_CARRIER","SENDER_SMPP_ACCOUNT_REQUIRED","INSUFFICIENT_BALANCE","INSUFFICIENT_CREDITS","WALLET_NOT_CONFIGURED","WALLET_OWNER_AMBIGUOUS","ACCESS_DENIED","RATE_LIMIT_EXCEEDED","OTP_NOT_FOUND","OTP_EXPIRED","OTP_INVALID","OTP_LOCKED","OTP_TEMPLATE_MISSING_CODE","OTP_TEMPLATE_NOT_FOUND","TEMPLATE_NOT_FOUND","SERVICE_UNAVAILABLE","KYC_REQUIRED","KYC_PENDING","KYC_REJECTED","LIVE_API_NOT_APPROVED","FLEX_LIVE_API_BLOCKED"]},"DeliveryStatus":{"type":"string","enum":["accepted","sending","sent","delivered","failed","unknown","cancelled","scheduled"]},"RecipientTo":{"oneOf":[{"type":"string","example":"9800000000"},{"type":"array","items":{"type":"string"},"maxItems":1000}],"description":"Single MSISDN, CSV string, or array. Nepal local 10-digit or 977 prefix. Max 1000 recipients."},"SendRequest":{"type":"object","required":["to"],"properties":{"to":{"$ref":"#/components/schemas/RecipientTo"},"message":{"type":"string","description":"Required unless a template is supplied. Ignored when a template renders a body. GSM-7 max 720 septets (160 per SMS). Unicode/UCS-2 max 335 (70 per SMS); one Nepali character forces unicode for the whole body."},"type":{"type":"string","enum":["text","unicode","flash"],"description":"Encoding. Omitted: unicode if any character is outside GSM 03.38 (including one Nepali letter), else text. type=text cannot force GSM for a unicode body."},"message_type":{"type":"string","enum":["promotional","transactional","otp"],"default":"transactional"},"template_id":{"type":"string","description":"Id of an SMS template on your account. The rendered template replaces message."},"template_name":{"type":"string","description":"Name of an SMS template on your account. The rendered template replaces message."},"variables":{"type":"object","additionalProperties":{"type":"string"},"description":"Template placeholder values."},"idempotencyKey":{"type":"string","description":"Alternative to the Idempotency-Key header."}}},"SendWithSenderIdRequest":{"allOf":[{"$ref":"#/components/schemas/SendRequest"},{"type":"object","required":["sender_id"],"properties":{"sender_id":{"type":"string","example":"Msngr_test"}}}]},"AcceptedDispatch":{"type":"object","properties":{"dispatch_id":{"type":"string"},"job_id":{"type":"string"},"message_id":{"type":"string"},"status":{"$ref":"#/components/schemas/DeliveryStatus"},"outbox_status":{"type":"string","nullable":true,"description":"Extra delivery state, when present."},"sender_id":{"type":"string","nullable":true},"recipient":{"type":"string","nullable":true},"cost":{"type":"number","nullable":true},"remaining_balance":{"type":"number","nullable":true},"remaining_credits":{"type":"number","nullable":true},"batch_id":{"type":"string"},"submitted_at":{"type":"string","format":"date-time"},"delivered_at":{"type":"string","format":"date-time"},"failed_at":{"type":"string","format":"date-time"},"error_code":{"type":"string"},"error_message":{"type":"string"},"environment":{"type":"string","enum":["live","sandbox"],"description":"Which key was used: `live` or `sandbox`."},"charged":{"type":"boolean","description":"`false` when the send used a Sandbox key. Not included on Live-key sends."}}},"SendAcceptedSingle":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"SMS accepted for delivery"},"data":{"$ref":"#/components/schemas/AcceptedDispatch"}}},"SendAcceptedBulk":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string"},"data":{"type":"object","properties":{"batch_id":{"type":"string"},"total_count":{"type":"integer"},"accepted_count":{"type":"integer"},"total_cost":{"type":"number"},"remaining_balance":{"type":"number","nullable":true},"remaining_credits":{"type":"number","nullable":true},"dispatches":{"type":"array","items":{"$ref":"#/components/schemas/AcceptedDispatch"}},"dispatch_ids":{"type":"array","items":{"type":"string"}},"job_ids":{"type":"array","items":{"type":"string"}}}}}},"SenderId":{"type":"object","properties":{"sender_id":{"type":"string"},"type":{"type":"string"},"access_mode":{"type":"string"},"status":{"type":"string"},"source_addr_ton":{"type":"string","description":"Address type for the sender ID."},"carriers":{"type":"object","properties":{"ntc":{"type":"string"},"ncell":{"type":"string"}}}}},"SenderIdsResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"sender_ids":{"type":"array","items":{"$ref":"#/components/schemas/SenderId"}},"allowed_sender_ids":{"type":"array","items":{"type":"string"}},"default_sender_id":{"type":"string","nullable":true}}}}},"OtpSendRequest":{"type":"object","required":["to"],"properties":{"to":{"type":"string"},"template_id":{"type":"string"},"template_name":{"type":"string"},"variables":{"type":"object","additionalProperties":{"type":"string"}},"ttl_seconds":{"type":"integer","minimum":30,"maximum":900,"default":300},"sender_id":{"type":"string"}}},"OtpSendResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"challenge_id":{"type":"string"},"dispatch_id":{"type":"string"},"message_id":{"type":"string"},"expires_at":{"type":"string","format":"date-time"},"cost":{"type":"number"},"remaining_balance":{"type":"number","nullable":true}}}}},"OtpVerifyRequest":{"type":"object","required":["to","code"],"properties":{"to":{"type":"string"},"code":{"type":"string"},"challenge_id":{"type":"string"}}},"OtpVerifyResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"verified":{"type":"boolean","example":true},"challenge_id":{"type":"string"},"dispatch_id":{"type":"string","nullable":true}}}}},"ManifestResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string"},"data":{"type":"object","properties":{"version":{"type":"string"},"auth":{"type":"object","properties":{"header":{"type":"string"}}},"endpoints":{"type":"array","items":{"type":"object"}},"errorCodes":{"type":"array","items":{"$ref":"#/components/schemas/ErrorCode"}}}}}}},"responses":{"Error":{"description":"Error envelope { success: false, error, code }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"validation":{"summary":"Validation error","value":{"success":false,"error":"Human-readable message","code":"VALIDATION_ERROR"}},"insufficientCredits":{"summary":"Insufficient credits","value":{"success":false,"error":"Insufficient credits","code":"INSUFFICIENT_CREDITS"}}}}}},"RateLimited":{"description":"Rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until the window resets"}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ErrorEnvelope"},{"type":"object","properties":{"retry_after":{"type":"integer"}}}]},"examples":{"rateLimited":{"summary":"Rate limited","value":{"success":false,"error":"Rate limit exceeded. Try again later.","code":"RATE_LIMIT_EXCEEDED","retry_after":42}}}}}},"SendAccepted":{"description":"Accepted for delivery. One recipient returns a single object. Several recipients return a batch. Configure delivery webhooks in the dashboard, or check history there.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/SendAcceptedSingle"},{"$ref":"#/components/schemas/SendAcceptedBulk"}]},"examples":{"singleLive":{"summary":"Single recipient (live)","value":{"success":true,"message":"SMS accepted for delivery","data":{"dispatch_id":"661f0a1b2c3d4e5f67890123","job_id":"661f0a1b2c3d4e5f67890123","message_id":"661f0a1b2c3d4e5f67890123","status":"accepted","environment":"live","recipient":"9800000000","cost":1,"remaining_balance":482,"remaining_credits":482}}},"singleSandbox":{"summary":"Single recipient (sandbox)","value":{"success":true,"message":"SMS accepted for delivery","data":{"dispatch_id":"661f0a1b2c3d4e5f67890123","job_id":"661f0a1b2c3d4e5f67890123","message_id":"661f0a1b2c3d4e5f67890123","status":"accepted","environment":"sandbox","charged":false,"recipient":"9800000000","cost":1,"remaining_balance":999,"remaining_credits":999}}},"bulk":{"summary":"Bulk recipients","value":{"success":true,"message":"SMS accepted for delivery","data":{"batch_id":"6620aa11bb22cc33dd44ee55","total_count":2,"accepted_count":2,"total_cost":2,"remaining_balance":480,"remaining_credits":480,"dispatch_ids":["661f0a1b2c3d4e5f67890123","661f0a1b2c3d4e5f67890124"],"job_ids":["661f0a1b2c3d4e5f67890123","661f0a1b2c3d4e5f67890124"],"dispatches":[{"dispatch_id":"661f0a1b2c3d4e5f67890123","job_id":"661f0a1b2c3d4e5f67890123","message_id":"661f0a1b2c3d4e5f67890123","status":"accepted","environment":"live","recipient":"9800000000","cost":1},{"dispatch_id":"661f0a1b2c3d4e5f67890124","job_id":"661f0a1b2c3d4e5f67890124","message_id":"661f0a1b2c3d4e5f67890124","status":"accepted","environment":"live","recipient":"9700000000","cost":1}]}}}}}}}}}}