Skip to content
Documentation menu

Documentation

GET /otp/{otp_id}

Fetch the current state of a verification at any time, one of pending, approved, failed, or expired.

Fetch the current state of an OTP at any time. status is one of pending, approved, failed, or expired.

Use it to check progress at any time. Approval normally comes from the POST /otp/verify response or the otp.approved webhook; this endpoint is the pull alternative.

It is also how you finish a WhatsApp Inbound approve verification: when the send returned completion: "inbound" there is no code to verify, so poll here every 3 to 5 seconds until status leaves pending (or take the webhook). See WhatsApp verification.

curl https://api.otp.com/api/v1/otp/9f3c1b2a-… \
  -H "Authorization: Bearer otp_live_•••"

Path parameter

ParameterDescription
otp_idThe id returned by send.

Response

{
  "otp_id": "9f3c1b2a-…",
  "status": "pending",
  "masked_recipient": "+1****71",
  "completion": "code"
}
FieldDescription
otp_idThe verification this state belongs to.
statusOne of the four below.
masked_recipientThe recipient with most characters masked, safe to log or display.
completionHow this OTP finishes: "code" (verify a code) or "inbound" (a WhatsApp message approves it).

There is no action_url here. The link is returned by send and resend; keep it on your side if you need to show it again, or call resend to get the same one back.

StatusMeaning
pendingWaiting for the user to enter a correct code, or to send the WhatsApp message.
approvedVerified: a correct code was entered, or an inbound WhatsApp message approved it.
failedAttempts were exhausted without a correct code.
expiredThe code, or the WhatsApp link, timed out before it was used.

Common errors

StatusTypeWhen
404HTTPExceptionotp_id not found, or not on your company.

See Error codes for the full list.