Embed tax registration intake forms on your site
The Middesk JavaScript SDK lets you embed the tax registration intake flow directly in your application. Your users complete state and local tax registrations without leaving your site, while Middesk handles the form logic, jurisdiction requirements, and submission.

Before you begin
Make sure you have the following:
- A Middesk account with entity management enabled
- A publishable API key (prefixed
pk_) — used in your frontend to initialize the SDK - A secret API key (prefixed
mk_) — used on your server to request passcodes - Your domain registered as an allowed domain
- A passcode for the entity
Your publishable key is safe to include in client-side code. Your secret key must only be used from your server and should never be exposed in frontend code or shared with end users.
Configure allowed domains
Register your application’s domain as an allowed domain before loading the SDK. Requests from unregistered domains are rejected.
To add an allowed domain, go to Developer > SDK Settings in the Middesk dashboard.

Get a passcode
The SDK requires a passcode to authenticate the session for a specific company. Retrieve one from your backend using the GET /v1/partner/passcode endpoint, authenticated with your secret API key.
The endpoint accepts either a company_id or an external_id query parameter to identify the company:
The response includes a passcode field — pass this value as the passcode prop when creating the SDK component:
You cannot provide both company_id and external_id in the same request. If no active passcode exists for the company, one is created automatically.
Install the SDK
Add the Middesk SDK script to your page:
Set up the component
Full example
Component props
Pass props to the intake component through the props object in createComponent.
When you set highlighted_state, the component selects and reorders the matching open registration request. If the state has no open request — because the code is unrecognized or that registration has already been submitted — the component falls back to selecting the first open request and leaves the list in its original order.
Handle events
The onEvent callback receives events from the component as the user interacts with the intake flow. Each event has the following shape:
READY
Emitted when the component has loaded and is ready for user interaction. No payload.
DONE
Emitted when the user has completed all outstanding tax registration requests. No payload.
ERROR
Emitted when the component encounters an error. The payload includes an error object with a code and message.
Example
Component lifecycle methods
The object returned by createComponent exposes the following methods:
Test in sandbox
Use the Middesk sandbox environment to test the embedded tax registration intake flow before going live.
Make sure to add the host you use for sandbox testing (for example, localhost) to your allowed domains. Requests from unregistered domains are rejected even in sandbox.
Create sandbox API keys
Generate a sandbox publishable key (pk_test_) and a sandbox secret key (mk_test_) from Developer in the Middesk dashboard.
Create test registration requests and company
Use the sandbox API to create companies and tax registration requests. See Manage Business Entities > Sandbox Guide for details on creating test data.