Skip to content
Relay docsThe Plaid of insurance — one connection between every carrier and every agency system.

For partners

Add Relay to your AMS in an afternoon

Create a link token, open Link, exchange the public token, and receive your first event.

You need your sandbox client_id and secret from Get started. Everything here works the same in live, with live keys.

1. Create a link token on your server

import { Relay } from "@emerald-relay/node";

const relay = new Relay({ clientId: process.env.RELAY_CLIENT_ID, secret: process.env.RELAY_SECRET });

const { link_token } = await relay.link.createToken({
  client_user_ref: user.id,        // your user ID, echoed back on the install
  products: ["POLICY", "EDOC", "COMMISSION"],
  mode: "create",
});

2. Open Link in your app

import { useRelayLink } from "@emerald-relay/link-react";

const { open, ready } = useRelayLink({
  token: linkToken,
  onSuccess: (publicToken, metadata) =>
    fetch("/api/exchange", { method: "POST", body: JSON.stringify({ publicToken }) }),
});

In the sandbox, the email code is always 123456 and agency code TEST-0001 verifies instantly. See sandbox reference for the other magic values.

3. Exchange the public token

const { access_token, install_id } = await relay.link.exchange(publicToken);
// Store access_token server-side. It's the agency's credential for your app.

4. Receive events

Add a webhook endpoint in the Partner console, then follow Verify webhooks. Or skip webhooks and poll /events/sync with a cursor.