Skip to main content
This page is for developers adding Baselayer’s business typeahead to their own forms. As someone types, they see matching businesses from official registry records and pick theirs. The pick gives you a business_token, and your KYB search runs on exactly that business, with no typos and no wrong-business matches. Try it in the live demo with your own API key. For how the product works, see Auto.Complete. The SDK’s own site is shown below, with the full guide, styling options and API reference. If the frame is too small, open the SDK site in its own tab.

What’s in the package

The SDK finds a business three ways: by its name, by a person who holds a role at it, or by an address it is filed at. Whichever way, the pick is a business.

Install

React 18 or 19 is optional. The core and the server helper need neither React nor a browser. The package needs Node 20 or later.
The SDK is pre-release (version 0.x). Until 1.0, a breaking change bumps the minor version, so pin the minor version you test with.

How it fits together

  1. When the field is used, the SDK asks your backend for a session.
  2. Your backend creates (mints) the session with your API key (POST /autocomplete/sessions), forwards the page’s Origin, and returns Baselayer’s answer unchanged.
  3. Each keystroke goes straight from the browser to Baselayer with that session. No cookies, no API key.
  4. Picking a row hands your form its business_token.
  5. Your backend sends the token with POST /searches, so the search runs on exactly the business that was picked.
The browser only ever holds a short-lived session (a few minutes) that is tied to your page’s origin and has its own request budget.

1. Add the session endpoint to your backend

Next.js (App Router), in app/api/ac-session/route.ts:
On other backends, use mintForOrigin({ apiKey, origin }) from the same import, and pass its status, headers and body straight through. Put this endpoint behind your own login, like the rest of your API. Every session it mints counts against your organization’s session pool.

2. Add the component

Useful options, with their defaults: For styling, headless hooks and every option, see the SDK site. From your backend, send the token on its own as the body of POST /searches:
Do not send name or address with it. The token stands in for both. A token lasts 15 minutes from when the row was shown, and only works for your organization. If the search refuses it (expired, or the business is gone), drop the token and search by the name and address as typed. The SDK’s refusedThePin(status, code) tells you when to do that. Auto.Complete is enabled per organization. Contact your Baselayer representative to turn it on.