Error codes

Errors use `{ success: false, error, code }`.

The full list is also on GET https://api.messengernepal.com.np/api/v1/sms and in the OpenAPI spec.

Error envelope

json

{
  "success": false,
  "error": "Human-readable message",
  "code": "VALIDATION_ERROR"
}

Example: insufficient credits (402)

json

{
  "success": false,
  "error": "Insufficient credits",
  "code": "INSUFFICIENT_CREDITS"
}

Example: rate limited (429)

json

{
  "success": false,
  "error": "Rate limit exceeded. Try again later.",
  "code": "RATE_LIMIT_EXCEEDED",
  "retry_after": 42
}
  • NO_API_KEY Missing X-API-Key header
  • INVALID_API_KEY Unknown, revoked, or malformed key
  • API_KEY_EXPIRED Key past its expiry
  • INSUFFICIENT_PERMISSIONS Key is missing the required scope
  • IP_RESTRICTED Caller IP is not on the key allowlist
  • VALIDATION_ERROR Query or body failed validation
  • MISSING_TO Recipient field is missing
  • MISSING_MESSAGE Message body is missing (and no template rendered)
  • TOO_MANY_RECIPIENTS More than 1000 recipients in one request
  • MESSAGE_TOO_LONG Body exceeds GSM 720 septets or unicode 335 (one Nepali character uses unicode)
  • INSUFFICIENT_CREDITS Credits cannot cover the send
  • TEMPLATE_NOT_FOUND template_id or template_name did not match
  • RATE_LIMIT_EXCEEDED Per-key minute or hour limit hit (HTTP 429; see Rate limits)
  • OTP_NOT_FOUND No matching OTP challenge
  • OTP_EXPIRED OTP past ttl_seconds
  • OTP_INVALID Code did not match
  • OTP_LOCKED Too many verify attempts
  • SERVICE_UNAVAILABLE Sending is temporarily unavailable. Retry later.
  • KYC_REQUIRED Live send without approved dashboard KYC (individual or company) or an active grace period
  • KYC_PENDING Live send while KYC is waiting for review
  • LIVE_API_NOT_APPROVED Live send without admin live API approval
  • FLEX_LIVE_API_BLOCKED Live key create/use while the account is on Flex