Skip to main content

Overview

After a user completes an authorization flow, Nango creates a connection that stores their credentials for a specific integration. This guide covers the operations you can perform on connections from your backend using the Node SDK or REST API. Install the Node SDK if you haven’t already:
Initialize the client with your secret key:

List connections

Retrieve a list of all connections in your environment, optionally filtered by connection ID, integration, or tags:
Example response:

Get a connection and its credentials

Retrieve a specific connection including its current, valid credentials. Nango automatically refreshes OAuth tokens before returning them if they are expired or close to expiry.
For OAuth 2.0 connections, the credentials object includes access_token and raw (the full token response from the provider). For API key connections, it includes apiKey. For basic auth, it includes username and password. Force a token refresh by passing forceRefresh: true:
Get just the access token (OAuth 2.0) or API key as a string:

Delete a connection

Deleting a connection removes all credentials and associated data. This cannot be undone.
Deleting a connection also deletes all data synced through Nango for that connection. Use re-authorization instead if you want to update credentials without losing data. See Implement auth.

Set and update metadata

Metadata is arbitrary key-value data you can attach to a connection. Use it to store per-connection configuration, such as a user’s preferences or API-specific settings. Set metadata (replaces all existing metadata):
Update metadata (merges with existing metadata, overriding only specified keys):
Read metadata from a connection:
You can also type the return value:

Connection tags

Tags are key-value strings that attribute a connection to entities in your system — users, organizations, workspaces, and so on. They are set when creating a connect session and copied to the resulting connection.

Why use tags?

Nango uses random UUIDs as connection IDs. Tags bridge the gap between a Nango connection ID and the entities in your application. Their primary purpose is attribution: when a user completes auth, Nango sends a webhook containing the tags you set, letting you match the connectionId with the right user or org. Tags are also useful for:
  • Filtering connections via listConnections() to find all connections for a given user or organization
  • Navigating the Nango dashboard — all tags are displayed on the Connections page
  • Routing webhooks or background jobs based on connection context
Most apps start with these three tags:
You can add any additional routing identifiers your application needs, such as workspace_id, project_id, or plan.

Set tags when creating a session

Read tags from an auth webhook

Auth webhooks from Nango include the tags you set:
Use these values to store connectionId alongside the corresponding entity in your database.

Filter connections by tags

The filter uses an AND match: a connection must contain all provided tag key-value pairs to be returned.

Update tags on an existing connection

To update tags after a connection is created, patch the connection. Updating tags replaces the entire tag object, so include all tags you want to keep:

Special tag keys

Two tag keys receive special treatment in the Nango dashboard:

Tag rules and limits

  • Keys are automatically lowercased (End_User_Email becomes end_user_email)
  • Keys must start with a letter and contain only alphanumerics, underscores, hyphens, periods, or slashes
  • Keys can be up to 64 characters long
  • Values must be non-empty strings up to 255 characters long
  • A maximum of 10 tag keys per connection are allowed
  • Avoid storing secrets or large free-form payloads in tags

Next steps

Implement auth

Set up the full authorization flow for your users.

Connect UI

Customize the Connect UI and use connect links.