Skip to main content
The Tight Javascript SDK lets you embed Tight pages directly into your web app with no build step and no framework dependency. Load the script, initialize it with an access token, and render a page into an element you already have in your DOM.
Every Tight page supports desktop web, mobile web, and all breakpoints in between.

Get Started

1

Load the SDK

Add tight.js to your page with a <script> tag:
Swap in the production URL when you’re ready to go live. See Environments.
2

Initialize with an access token

3

Render a page

Loading the SDK

Loading the script creates a single global instance at window.Tight. Load it only once per page: a second load logs an error and has no effect.
For convenience, assign window.Tight to a local variable and use that for subsequent calls:

Environments

The script URL selects which Tight API environment the SDK targets: Load the URL for the environment you’d like to target, and use an accessToken issued for that same environment. You can obtain an applicable accessToken via the Tight Authentication Endpoint.
Examples on this page use the sandbox URL. Swap in the production URL when you’re ready to launch.

Initializing the SDK

Call init with an access token before rendering anything. This authenticates the SDK and resets it to a clean state, removing any existing page and listeners.
init does not render a page by itself. Call render afterward to display content.

Refreshing credentials

Access tokens expire after 3600 seconds. When your token expires or changes, call auth instead of init. It updates the token in place without clearing an already-rendered page or your registered listeners.
Calling init again to refresh a token tears down the rendered page and every registered listener. Use auth for token rotation and reserve init for first-time setup or switching users.

Rendering a page

Call render to display a page inside a container element in your document.
Calling render again with a different page value updates the displayed page. Calling it with a different containerId moves the page to that container.

Supported page values

Listening for events

Use registerListener to react to actions that happen inside the rendered page, such as a form opening or a workflow completing. You might route a user back to your own invoicing product, gate functionality behind your own paywall, or send analytics when a user opens a dashboard tile.
To stop listening, call unregisterListener with the same key:

Supported event keys

Each listener receives a payload describing the result of the action, including whether it succeeded and any associated data or error details.

Full example