DocumentationAPI Reference
Help CenterAPI ChangelogOpenAPI SpecStatus
Documentation

Client Callbacks

onComplete

The onComplete callback is called when the inquiry has completed the inquiry flow and the individual clicks on the complete button to close the flow.

ParameterTypeDescription
{ inquiryId, status, fields }ObjectObject containing information about the completed inquiry.

inquiryId is the ID of of the inquiry used in this instance of the flow.

status is the status of the completed inquiry (e.g. 'completed', 'failed').

fields is a map of field values. See Fields documentation.

onLoad & onReady

The onLoad callback is called when the iframe finishes loading and is ready to be displayed. It does not take any arguments.

The onReady callback is called when the inquiry flow is ready for user interaction. It does not take any arguments.

onCancel

The onCancel callback is called when an individual cancels the inquiry flow before completion.

ParameterTypeDescription
{ inquiryId, sessionToken }ObjectObject containing information about the canceled inquiry.

inquiryId is the ID of of the inquiry used in this instance of the flow.

sessionToken is a token that can be used to resume the inquiry.

Values will be undefined if the flow is canceled before an inquiry is created.

onError

The onError callback is called in response to errors in the inquiry flow that prevent the inquiry flow from being usable. These generally occur on initial load.

ParameterTypeDescription
{ status, code }ObjectError object.

status is the HTTP error status, if applicable. The code will be 0 if the error was an application error.

code is a short string describing the error.

Below is a list of Persona error codes.

Error codesStatusMeaning
'application_error'0An internal error occurred in the Persona web application. Please contact support.
'invalid_config'400The persona client was initialized with invalid arguments.
'unauthenticated'409An inquiry was resumed without a valid sessionToken. Retrieve one from the external API and pass it to the client.
'inactive_template'422An attempt was made to create an inquiry from an inactive template. Activate the template before attempting to create inquiries.
'unknown'numberCatch-all error.

onEvent

The onEvent callback is called at certain points in the Persona flow. It takes two arguments, an eventName string and a metadata object.

🚧

Do not use this for critical flows

onEvent exists for analytics purposes but the events passed through are potentially lossy. If your business logic depends on granular verification and inquiry status changes, we recommend using Webhooks.

ParameterTypeDescription
eventNameStringA string representing the event that has just occurred in the Persona flow.
metadataObjectAn object containing information about the event.

Example metadata for a verification status change event:

{
  "id": "ver_rMkwDnyoZy6b1jDSofjUtL5z",
  "status": "<submitted|passed|failed>"
}

Other supported events include:

startThe individual has begun progressing through the flow after clicking 'Continue' on the start screen.

Dynamic Flow Templates will send this event at the same time as 'ready', and it will not indicate user interaction.
country-selectDeprecated. The individual confirmed the country of their ID.

Dynamic Flow Templates will not send this event.
verification-changeDeprecated. The status of an in-progress verification changed.

Dynamic Flow templates will not send this event.
document-camera-selectThe individual is opening the camera for the government ID verification.
document-camera-captureThe individual took a photo for the government ID verification.
document-uploadThe individual uploaded a government ID photo.
selfie-camera-selectThe individual is opening the camera for the selfie verification.
selfie-camera-captureThe individual took a photo for the selfie verification.
selfie-record-uploadThe individual uploaded a selfie photo. We allow uploads when their browser does not support embedded video.
load-camera-failedThe inquiry flow failed to load the camera during a government ID capture, selfie, or document upload flow. This can happen due to missing permissions or a hardware error.
one-time-link-sentThe individual sent a one time link to their mobile device.
one-time-link-startThe individual resumed their flow on their mobile device using a one-time link.
one-time-link-exitThe individual returned to their initial device after sending a link to their mobile device.
completeThe individual is exiting the flow after verifying their identity.