Docs menu

Insurtech brokers

Add the script tag

Add Kinro's commercial insurance quote experience to your web app with one script tag. Prefill and webhooks are optional upgrades.

View as Markdown

Add Kinro's commercial insurance quote experience to your website or web app with one script tag. Customers answer only the questions Kinro needs, review live carrier quotes in your page, and continue to Kinro checkout when they're ready to buy.

1. Get your partner ID

Ask your Kinro partnership contact for:

  • Your public partner ID (ap_... or prt_...). It is safe to put in browser HTML.
  • Allowed origins. Register every staging and production https:// origin that will load the widget. Kinro rejects requests from other origins.
  • Partner tokens, only if you will prefill or receive webhooks: separate test and live kinro_pk_* tokens, kept on your server.
  • Activation. Kinro activates your partner account after the integration review in Sandbox & go-live. On your registered sites, anonymous visitors can open the widget only after activation; before it, the widget emits error with code: "unauthorized".

2. Add the script tag

Include embed.js on your approved origins:

html
<script
  src="https://kinro.com/partners/embed.js"
  data-partner="YOUR_PARTNER_ID"
  defer
></script>

Script attributes

AttributeRequiredDescription
data-partnerRequiredYour public partner ID (ap_... or prt_...).
data-customer-tokenOptionalShort-lived kct_* token minted on your server via upsert_lead (mint_customer_token: true). Held strictly in memory.
data-launcherOptionalbutton shows a floating quote button; none hides it. Defaults to button, or none when [data-kinro-inline] is present on the page.
data-placementOptionalPlacement label such as onboarding_checklist or insurance_tab (up to 80 characters).
data-openOptionalSet to true to open the popup modal immediately after the script loads.
data-nonceOptionalContent Security Policy (CSP) nonce applied to the widget's <style> elements.
data-mcp-urlOptionalKinro endpoint the widget talks to. Set it to https://api-preview.kinro.com/mcp to test against the preview endpoint; leave it out in production.

3. Place inline or open from your own UI

To render the quote experience directly inside a page section, add a container with data-kinro-inline:

html
<div data-kinro-inline data-placement="insurance_tab"></div>

A container can set its own data-partner when one page hosts quote experiences for more than one of your partner IDs; otherwise the script's data-partner applies.

The inline widget grows with its content up to 680px, then scrolls inside, with the question box always in view. To change that height, set --kinro-max-height on the container, for example style="--kinro-max-height: 560px".

When a step asks for a phone number or email, the widget shows Kinro's contact disclosure above the submit button. The contact details are saved only when submitted under it. A visitor who opened the widget without a customer_token becomes a lead at that moment: a live lead on your registered sites, a test lead on a local development page. Before that, nothing appears in list_leads.

Customers can submit a follow-up while the widget is waiting for an answer. If the wait expires, Check for replies reads the conversation again without submitting the question again.

The widget runs the whole conversation with Kinro. You do not need to send or poll conversation messages yourself. Your server can optionally prefill customer details, receive webhooks and list leads and policies.

JavaScript API (window.Kinro)

For single-page apps (React, Next.js, Vue) or custom trigger buttons, use window.Kinro:

MethodDescription
Kinro.mount(element, { placement?, customerToken?, nonce? })Mounts an inline quote view inside element. Mounting again replaces the previous instance cleanly.
Kinro.unmount(element)Unmounts and cleans up the inline view when your component unmounts.
Kinro.open({ placement?, customerToken? })Opens the modal dialog.
Kinro.close()Closes the modal dialog and restores keyboard focus to the element that opened it.
Kinro.toggle(options?)Opens or closes the modal dialog.
Kinro.isOpen()Returns true while the modal dialog is open.
Kinro.on(event, handler) / Kinro.off(event, handler)Subscribes or unsubscribes to lifecycle events.

4. Lifecycle events

Subscribe to events to track funnel progression in your analytics or refresh expired customer tokens:

EventWhen it firesPayload
readyScript initialized and window.Kinro is available{}
openedPopup modal opened{ placement }
closedPopup modal closed (button, backdrop, Escape, or Kinro.close()){ placement }
application_startedCustomer began interacting with the form{ placement, display }
application_submittedCustomer submitted a step's answers{ placement, display }
quote_readyLive carrier quote cards rendered in the widget{ placement, display }
portal_openedCustomer clicked a quote's checkout button to open Kinro checkout{ placement, display, quoteId? }
errorInvalid partner ID, expired/invalid customer token, or network error{ code, placement?, display? }

display is "popup" or "inline".

The error event's code is one of:

CodeMeaningWhat to do
unknown_partnerdata-partner is not a valid partner ID. The widget does not start.Copy the partner ID from your Kinro contact exactly.
unauthorizedKinro refused the request: your partner is not activated yet, this page's origin is not registered, or a live token was sent from a local page.Before activation, open the widget with a customer_token. Otherwise ask Kinro to register the origin.
invalid_customer_tokenThe customer_token is malformed or unknown.Mint a fresh token on your server and remount.
session_expiredThe customer's session expired.Mint a fresh token on your server and remount.
unavailableKinro could not be reached or returned a server error.The widget lets the customer retry. Report repeated errors to Kinro.

Handling expired customer tokens

If a customer's kct_* token has expired when they open the widget, embed.js falls back gracefully and emits an error event with code: "invalid_customer_token" or code: "session_expired". Fetch a fresh token from your backend and remount or reopen:

js
window.Kinro.on("error", async (event) => {
  if (
    event.code === "invalid_customer_token" ||
    event.code === "session_expired"
  ) {
    const { customer_token } = await fetch("/api/kinro-token").then((r) =>
      r.json(),
    );
    window.Kinro.mount(slotElement, { customerToken: customer_token });
  }
});

5. Skip questions your app already knows

Optional. If your customers are signed in to your platform, send what you know about their business from your server, and the widget opens with it filled in. Send anything you have, even one or two fields. Kinro asks the customer for the rest.

  1. From your server, call upsert_lead with your external_id for the customer, whatever data you have, and mint_customer_token: true.
  2. Pass the returned customer_token (kct_*) to window.Kinro.mount(el, { customerToken }) or window.Kinro.open({ customerToken }).
  3. Keep the token in memory only. Never put a customer_token in a URL, a cookie or localStorage.

See Prefill for example payloads, every recognized field, updates, documents and consent.

6. Checkout flow

Quote cards render directly inside your embedded widget with carrier names, pricing, and proposal PDFs. When the customer clicks Continue to checkout, Kinro opens the quote checkout page in a new tab and emits portal_opened.

7. Content Security Policy (CSP)

If your site enforces a strict Content-Security-Policy, allow Kinro's script and API origins and pass your page's style nonce via data-nonce:

http
Content-Security-Policy:
  script-src 'self' https://kinro.com;
  connect-src 'self' https://api.kinro.com;
  style-src 'self' 'nonce-YOUR_PAGE_NONCE';
html
<script
  src="https://kinro.com/partners/embed.js"
  data-partner="YOUR_PARTNER_ID"
  data-nonce="YOUR_PAGE_NONCE"
  defer
></script>

If you test against Kinro's preview endpoint, also allow https://api-preview.kinro.com/mcp in connect-src.

8. Develop locally

You can build and test the integration on your own machine before you register any site. A local page only ever creates sandbox test leads:

  • Local pages work without registration. The widget runs on http://localhost and http://127.0.0.1, on any port, with your partner ID. Use plain http: https://localhost is treated like any other site and must be registered.
  • The anonymous widget runs in the sandbox there. A visitor who opens the widget on a local page without a customer_token creates a test lead, before and after your partner is activated.
  • Use your test token. Mint customer tokens with your test token. A live token sent from a local page is refused with 403. Your server sends no browser origin, so a local server process using the live token would create live leads: keep the live token out of local development.
  • Webhooks still need a public HTTPS URL. Kinro cannot reach your machine directly: expose your local server with a tunnel and register the tunnel's https:// URL as your test webhook.

To test against the preview endpoint, add data-mcp-url; see Sandbox & go-live.