The origin of your page (for example
https://claims.example.com) must be in your account’s allowed origins. Ask Rial to add it. Until it is there the browser blocks the audit, and a live capture never tells your page it finished.<script>:
Audit a photo
1. Your backend mints a one-time token:result is for your UI only: the browser is in the user’s hands, so whatever it reports back can be forged. Read the verdict in your backend with rial.verifications.get(id), or by webhook if you passed webhookUrl to prepare.
- A token is good for one file and expires after an hour (
expiresInSecondsinprepare). audittakes aFile,BloborUint8Array: JPEG, PNG, WebP, HEIC or HEIF, up to 20 MB.- It waits up to 60 seconds for the verdict (
timeoutMs) and accepts anAbortSignal. - To keep the verdict out of the browser, prepare the audit with
exposeResult: false. The page then gets{ id, status, verdictWithheld: true }.
Live capture
The person takes the photos with their camera in a modal over your site, and your page learns when they are done. The verdict goes to your backend, never to the page. 1. Your backend creates the verification:rial.verifications.get(verificationId), or by webhook.
- On a phone the capture fills the screen. On a computer the modal shows a QR, the person finishes on their phone, and
openresolves then. onEventgetsready,started,camera_denied,step_completed,submitted,completed,errorandclose_requested.- If the person closes the modal first,
openrejects withclosed. The verification stays open until it expires, so you can open it again. - One capture at a time per page.
What your page needs
- https (localhost is fine), and
<meta name="viewport" content="width=device-width, initial-scale=1">. - If you send a
Content-Security-Policy:frame-srcmust allowhttps://verify.rial.io(andhttps://sandbox.verify.rial.iofor the sandbox). - If you send a
Permissions-Policy:camera=(self "https://verify.rial.io"), and the same formicrophone,geolocation,accelerometerandgyroscopeif your steps use them.
Redirect instead of the modal
Some in-app browsers and Android WebViews never give an iframe the camera. For those, send the person to the capture page:redirect does not return a result, and coming back to your site afterwards is not supported yet. Read the outcome in your backend.
Errors
Every failure is aRialError with code, step, status and, for most codes, a hint that says what to check.
Sandbox
Mint and upload against the same environment. See Sandbox.
The bundled types need TypeScript 5.7 or newer.