For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Help CenterOpenAPI SpecStatus
OverviewInquiriesTransactionsRelaysAPI ReferenceChangelog
OverviewInquiriesTransactionsRelaysAPI ReferenceChangelog
  • Overview
    • Relay Overview
    • Getting Started
  • Widget
    • Usage
  • Integration Methods
    • Server SDK
  • References
    • Relay Widget SDK
    • Server SDK
    • Gateway Service
    • API
    • Schemas
LogoLogo
Help CenterOpenAPI SpecStatus
On this page
  • Installation
  • Constructors
  • new Relay(container, options)
  • Methods
  • client.destroy()
References

Relay Widget SDK Reference

Was this page helpful?
Previous

Server SDK Reference

Next
Built with

This page documents the full client-side API for the Persona Relay SDK.

Installation

Available on npm: @persona/relay

npm
yarn
$npm install @persona/relay

Constructors

new Relay(container, options)

1new Relay(container: string | HTMLElement, options: RelayOptions)

Arguments

ArgumentTypeRequiredDescription
containerstring | HTMLElementtrueA CSS selector string (e.g. '#relay-container') or a direct DOM element reference to mount the widget into
accessTokenstringtrueThe relay session access token returned by your server
onComplete() => voidfalseCalled when relay verification completes successfully
onError(error: RelayError) => voidfalseCalled when a configuration or network error occurs
onExpire() => voidfalseCalled when the relay session expires
theme'light' | 'dark' | 'auto'falseColor theme for the widget. Defaults to 'auto', which follows the user’s OS color scheme preference

RelayError

FieldTypeDescription
codestringMachine-readable error code
messagestringOptional human-readable error description

Methods

client.destroy()

Unmounts the widget, removes all iframes from the DOM, and cleans up all event listeners and observers. Call this when the widget is no longer needed.

1// React example
2useEffect(() => {
3 const client = new Relay('#relay-container', { ... });
4 return () => client.destroy();
5}, []);