Skip to content
Documentation menu

Documentation

Error codes

Every error uses the same envelope, an HTTP status plus a typed body. Switch on error.type to handle them.

Every error uses the same envelope: an HTTP status plus a typed body. Switch on error.type to handle them programmatically.

{
  "error": {
    "type": "InsufficientFundsError",
    "message": "Not enough balance to send."
  }
}

Reference

StatusTypeMeaning
422ValidationErrorMissing or malformed request body.
422InvalidRecipientErrorrecipient is not a valid phone or email.
401HTTPExceptionMissing, invalid, or revoked API key.
404HTTPExceptionotp_id not found, or not on your company.
409NoEnabledChannelErrorNo enabled channel can reach this recipient. Configure your channels first.
403GeoBlockedErrorThe recipient’s country is blocked.
403IpReputationBlockedErrorThe declared client_ip is a known abuse source (see send).
403SendPolicyBlockedErrorOne of your own Security rules refused the send: a deny-listed IP, a missing client_ip, or a blocked IP type. Do not retry; see Security.
402InsufficientFundsErrorNot enough balance to send.
429RateLimitExceededErrorToo many requests. The message names the bucket: policy is one of your own Security rules; recipient, company, key, cooldown and client_ip are ours. Wait for Retry-After.
409ResendNotAllowedErrorThe OTP’s send attempts are spent, or no enabled channel is left for the recipient.
429ResendCooldownErrorResend attempted within the cooldown window. Retry-After carries the seconds left.
422InvalidIdempotencyKeyErrorThe idempotency-key header is longer than 128 characters.

Handling errors

  • 401 means the key is wrong or revoked. Check Authentication.
  • 402 and 403 are account, destination, or client-IP policy limits, not code bugs; surface a clear message and stop retrying.
  • 429 is rate limiting or a resend cooldown; back off and try again later. A message of Rate limit exceeded: client_ip means your requests are not passing the end user’s IP; add client_ip to send for the normal limits. A message ending in policy is one of your own Security rules; Recent events on the Security page says which.
  • 409 means there is no channel to use: on send your app has none enabled, and on resend the OTP’s attempts are spent. Start a new send if appropriate.
  • 422 is a validation problem in the request: fix the body (or the idempotency-key header) and retry. Retrying the same request unchanged will fail the same way.