Skip to main content
A connect session is a short-lived token (30 minutes) that you create server-side and pass to your frontend to initialize the Connect UI. The session encodes which end user is authenticating, which integrations they can connect to, and any connection defaults. This design keeps your secret key off the frontend: your server mints a session token and the browser only ever sees the short-lived token.
All API requests require a secret key passed as a Bearer token. You can find your secret key in the Settings section of the Nango dashboard.

Create a session

POST /connect/sessions Creates a new connect session. The session expires after 30 minutes. Pass the returned token to the Connect UI in your frontend.
Tags you set on the session are copied onto the connection when the user completes auth. They also appear in auth webhooks, making it easy to identify which user connected.

Request body

object
The end user who is authenticating. Required unless you provide top-level tags.
object
The organization the end user belongs to.
string[]
Limit which integrations the user can connect to. If omitted, all integrations in your environment are available. Each entry is an integration unique_key.
object
Per-integration defaults applied when the user connects. Keys are integration unique_keys.
object
Key-value tags copied onto the resulting connection. Common keys: end_user_id, end_user_email, organization_id. You can also add custom keys. When tags is provided at the top level, end_user becomes optional.
object
Per-integration Connect UI overrides. Keys are integration unique_keys.

Response

object
Example response

Using the session token in your frontend

After you receive the token, initialize the Connect UI on your frontend with it:
Frontend (React example)

Create a reconnect session

POST /connect/sessions/reconnect Creates a session specifically for re-authenticating an existing connection. Use this when a connection’s credentials have expired or been revoked and you need the user to re-authorize. The resulting session opens the Connect UI pre-scoped to the specific connection being repaired, rather than allowing the user to choose any integration.

Request body

string
required
The ID of the existing connection to reconnect.
string
required
The unique key of the integration the connection belongs to.
object
The end user performing the reconnect.
object
Organization the end user belongs to.
object
Per-integration defaults to apply during reconnect. Same shape as Create a session.
object
Tags to apply or update on the connection when reconnect completes.
object
Per-integration Connect UI overrides. Same shape as Create a session.

Response

object
Example response

Get a session

GET /connect/session Retrieves the details of a connect session. Authenticate this request with the session token (not your secret key) as the Bearer token. This endpoint is primarily used by the Connect UI itself to load session configuration. You generally do not need to call it directly.

Headers

string
required
Bearer <SESSION_TOKEN> — the connect session token returned by Create a session.

Response

object
Example response

Delete a session

DELETE /connect/session Immediately invalidates a connect session. The session token can no longer be used to open the Connect UI. Use this if the user cancels the flow on your side before completing auth and you want to clean up.

Headers

string
required
Bearer <SESSION_TOKEN> — the connect session token to invalidate.

Response

Returns 204 No Content on success.

Security and expiry

Session tokens are short-lived (30 minutes) but grant the ability to create connections in your environment. Treat them like sensitive credentials.
  • Never expose your secret key to the browser. Always create sessions server-side and pass only the token to your frontend.
  • Sessions expire after 30 minutes. If a user takes longer than that to complete the flow, create a new session.
  • If you want to invalidate a session early (e.g. user logs out), call Delete a session.
  • Sessions are single-environment: a token from your production environment cannot be used with your development environment’s Connect UI.