Moorsyl Docs

Delivery & Error Codes

Reference for SMS delivery statuses, verification session statuses, webhook events, and API error codes.

This page is the single reference for every status value and error code you may encounter when using Moorsyl. Use it to understand what happened to a message or verification session and how to react to it in your code.

SMS delivery statuses

Every SMS has a status field that progresses through the following states:

StatusMeaning
pendingMessage accepted and queued, not yet picked up by a worker
processingA worker has claimed the message and is submitting it to the carrier
sentCarrier acknowledged receipt — the message is on its way to the handset
failedAll delivery attempts exhausted; the message will not be retried

A failed message includes an errorText field with the reason returned by the carrier or the Moorsyl worker (for example, "Carrier rejected message"). This field is also present in the sms.failed webhook event.

State transitions

pending → processing → sent
                     ↘ failed (after max retries)

A message moves from processing back to pending if the worker crashes or times out, so it can be picked up again. Once sent or failed, the status is terminal.

Verification session statuses

Every session returned by /api/verify/get has a status field:

StatusMeaning
pendingCode was sent; waiting for the user to submit it
approvedUser entered the correct code — session is now closed
expiredSession TTL elapsed before the user submitted a valid code
canceledSession was explicitly canceled (for example, a new code was requested for the same number)

approved, expired, and canceled are all terminal — a session in one of these states cannot transition further.

Webhook events

EventFired when
sms.sentCarrier acknowledged the message
sms.failedMessage permanently failed after all retries
verify.sentA one-time code was sent to a phone number
verify.approvedThe user entered the correct code
verify.failedThe session expired or max attempts were exceeded

See Webhooks for payload shapes and signature verification.

API error codes

All Moorsyl API endpoints return standard HTTP status codes. The response body always contains a machine-readable code field alongside a human-readable message.

{
  "code": "UNAUTHORIZED",
  "message": "Invalid or missing API key"
}
StatusCodeMeaningCommon cause
400BAD_REQUESTThe request body is invalidWrong phone number format, empty message body, body over 1 600 characters, missing required field
401UNAUTHORIZEDAPI key is missing or not recognizedSending a request without x-api-key, or using a key that has been deleted
402PAYMENT_REQUIREDInsufficient balanceOrganization balance is zero or too low to cover the message cost
403FORBIDDENAPI key exists but cannot perform this actionKey is not linked to an active organization, or a publishable key was used where a secret key is required
404NOT_FOUNDResource not foundverificationId does not exist or belongs to a different organization
429TOO_MANY_REQUESTSRate limit exceededPer-phone, per-org, or IP-level rate limit hit — back off and retry
500INTERNAL_SERVER_ERRORUnexpected server errorTransient — retry with exponential back-off; contact support if it persists

Retry guidance

ErrorRetry?Strategy
400 BAD_REQUESTNoFix the request payload before retrying
401 UNAUTHORIZEDNoCheck your API key
402 PAYMENT_REQUIREDNoTop up your balance first
403 FORBIDDENNoCheck key type and organization status
404 NOT_FOUNDNoVerify the ID is correct
429 TOO_MANY_REQUESTSYesWait and retry with exponential back-off
500 INTERNAL_SERVER_ERRORYesRetry with exponential back-off

For persistent issues not explained by the codes above, contact support@moorsyl.com.

On this page