The Session Object
The API creates a Session object once for each recipient within the code expiry time. A session can have multiple attempts to deliver the OTP.Attributes
A 36-character string that uniquely identifies a session.
ID of the application used to trigger the session.
The destination phone number (in E.164 format).
Current status. Values:
in-progress, verified, expired.The last channel used for the session.
Language translation used for the session.
Details of all attempts made during a session.
Details of all charges incurred during a session.
UTC time when the session was created.
UTC time when the session was last updated.
Create a Session
Send an OTP via SMS or voice.Arguments
The phone number to send the OTP to.
UUID of the Verify application. Defaults to default application.
Delivery channel. Values:
sms, voice. Default: sms.URL for status callbacks.
HTTP method for callbacks. Values:
GET, POST. Default: POST.Language code (e.g.,
en_US, es, fr_FR). Default: en.Brand name to replace
${brand_name} in templates.Android app hash for SMS Retriever API integration.
OTP length (4-8). Overrides application default.
Example
Response
Validate a Session
Validate the OTP entered by the user.Arguments
The OTP to validate.
You can attempt no more than 10 validations per session to prevent brute-force attacks.
Example
Response
Retrieve a Session
Get details of a specific session.Example
Response
List All Sessions
Retrieve a list of sessions based on filter criteria over the last 90 days.The default rate limit is 20 requests per minute. Exceeding this limit returns “too many requests” error.
Query Parameters
Filter by application UUID.
Filter by status. Values:
in-progress, verified, expired.Filter by destination number (E.164 format).
Filter by subaccount.
Results per page. Max: 20. Default: 20.
Number of results to skip. Default: 0.
Filter by session initiation time. Format:
YYYY-MM-DD HH:MM. Supports variants: session_time__gt, session_time__gte, session_time__lt, session_time__lte.Filter by brand name.
Filter by app hash.
Example
Response
Status Callbacks
Set up a server endpoint to receive real-time status updates for your verification sessions. Specify the callback URL when creating a session.Callback Attributes
Unique session identifier.
Session status. Values:
in-progress, expired.Unique identifier for the SMS/call attempt.
Sequence number of the attempt.
Channel used. Values:
sms, voice.Attempt status. SMS:
queued, sent, delivered, failed, undelivered. Voice: in-progress, completed, ringing.Error code from the channel.
Destination phone number.
UTC time when the attempt was created.
Callback Behavior
Plivo automatically retries webhooks three times if HTTP 200 is not returned:
- First retry: 60 seconds after original attempt
- Second retry: 120 seconds after first retry
- Third retry: 240 seconds after second retry
Related
- Overview - Quick start guide and concepts