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
| Parameter | Description |
|---|---|
otp_id | The id returned by send. |
Response
{
"otp_id": "9f3c1b2a-…",
"status": "pending",
"masked_recipient": "+1****71",
"completion": "code"
}
| Field | Description |
|---|---|
otp_id | The verification this state belongs to. |
status | One of the four below. |
masked_recipient | The recipient with most characters masked, safe to log or display. |
completion | How 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.
| Status | Meaning |
|---|---|
pending | Waiting for the user to enter a correct code, or to send the WhatsApp message. |
approved | Verified: a correct code was entered, or an inbound WhatsApp message approved it. |
failed | Attempts were exhausted without a correct code. |
expired | The code, or the WhatsApp link, timed out before it was used. |
Common errors
| Status | Type | When |
|---|---|---|
404 | HTTPException | otp_id not found, or not on your company. |
See Error codes for the full list.