Skip to main content

Overview

The otp.failed event is triggered when an OTP delivery attempt fails. This event always has rejected: true and includes error details along with a resend endpoint for retrying the OTP delivery.

Example Payload

{
  "eventType": "otp.failed",
  "issuerId": "680a65a4da4a16c0ea64face",
  "requestId": "68c6b2c3d4e5f6789012345",
  "subjectId": "68c6b2c3d4e5f6789012346",
  "subjectInternalId": "user_otp_001",
  "rejected": true,
  "decisionDate": "2024-01-15T22:45:00.000Z",
  "metadata": {
    "contact": "+1234567890",
    "errorCode": "INVALID_PHONE_NUMBER",
    "errorMessage": "The phone number format is invalid for the selected country",
    "resendEndpoint": "/v0/request/resend/507f1f77bcf86cd799439011"
  }
}

Base Fields

All OTP failed events include these common fields:
FieldTypeRequiredDescription
eventTypestringYesAlways "otp.failed"
issuerIdstringYesOrganization/issuer identifier
requestIdstringYesRequest identifier
subjectIdstringYesSubject (user) identifier
subjectInternalIdstringNoInternal subject identifier
rejectedbooleanYesAlways true for OTP failed events
decisionDateDateYesTimestamp when the OTP failure was recorded

OTP Failure Metadata

The metadata field is required and contains OTP failure details:
FieldTypeRequiredDescription
contactstringYesContact information (phone number or email)
errorCodestringYesSpecific error code indicating the failure reason
errorMessagestringYesHuman-readable error message
resendEndpointstringYesAPI endpoint to resend the OTP

Handling OTP Failures

When you receive an otp.failed event:
  1. Log the error - Record the errorCode and errorMessage for debugging
  2. Notify the user - Inform the user about the delivery failure
  3. Retry if needed - Use the resendEndpoint to attempt OTP delivery again
The resendEndpoint provides a direct API path to retry the OTP delivery without requiring the original request details.