Skip to main content
A connection represents one end user’s authenticated session with an external provider through an integration. It stores the user’s credentials (OAuth tokens, API keys, etc.) securely and refreshes them automatically when needed. Every connection belongs to an integration and is identified by a connection_id you assign (typically your internal user ID) plus the provider_config_key of its integration.
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.

List connections

GET /connections Returns a paginated list of connections. You can filter by connection ID, end user, integration, and custom tags.

Query parameters

string
Exact match on the connection ID. Can return multiple connections across different integrations if the same ID is used.
string
Filter by integration unique key (e.g. slack-production). Accepts a comma-separated list for multiple integrations.
string
Filter connections belonging to a specific end user ID.
string
Filter connections belonging to end users in a specific organization.
Search in connection ID or end user profile (name, email).
number
default:"100"
Maximum number of connections to return per page.
number
default:"0"
Page number for pagination (zero-indexed).

Response

ApiPublicConnection[]
Example response

Get a connection

GET /connections/:connectionId Returns a single connection including its live credentials. Nango automatically refreshes expired access tokens before returning the response.
Always fetch credentials just before you use them. Nango refreshes tokens on this call, so you always get a valid, non-expired credential.
The shape of the credentials field depends on the provider’s auth type (OAuth 2, OAuth 1, API key, Basic auth, etc.). Use the Proxy if you want Nango to inject credentials into requests for you.

Path parameters

string
required
The connection ID to retrieve.

Query parameters

string
required
The unique key of the integration this connection belongs to. Required because the same connection_id can exist across multiple integrations.
boolean
default:"false"
Force a new token fetch from the provider even if the current token is still valid.
boolean
default:"false"
Include the refresh token in the response (OAuth 2 only).
boolean
default:"false"
Refresh the JWT token for GitHub App or GitHub App OAuth connections.

Response

number
required
Internal numeric ID of the connection.
string
required
Your identifier for this connection.
string
required
The integration’s unique key.
string
required
The provider slug (e.g. slack).
object
Provider-specific connection configuration set during auth (e.g. subdomain, instance URL).
object | null
Custom metadata you have attached to this connection.
object
Key-value tags attached to this connection.
object
required
The live credentials for this connection. Shape depends on auth type.
array
Active errors on this connection.
string
ISO 8601 creation timestamp.
string
ISO 8601 last-updated timestamp.
Example response (OAuth 2)

Import a connection

POST /connections Imports existing credentials into Nango without going through an OAuth flow. Use this for bulk migrations when onboarding to Nango.
This endpoint is intended for one-off bulk imports of existing tokens. For new connections, use the Connect UI or the frontend SDK to run the OAuth flow.

Request body

string
required
The unique key of the integration to create the connection under.
string
Your identifier for this connection. If omitted, Nango generates one.
object
required
The credentials to import. The required fields depend on the provider’s auth type.
object
Custom metadata to attach to the connection.
object
Provider-specific configuration (e.g. subdomain, instance_url).
object
End user to associate with this connection.
object
Key-value tags to attach to the connection (e.g. { "plan": "enterprise" }).

Response

Returns the created connection object including its credentials. See Get a connection for the full response shape.

Update a connection

PATCH /connections/:connectionId Updates the end user profile or tags on a connection. Does not modify credentials.

Path parameters

string
required
The connection ID to update.

Query parameters

string
required
The unique key of the integration this connection belongs to.

Request body

object
Updated end user information to associate with this connection.
object
Key-value tags to set on the connection. This replaces the existing tag set.

Response

Example response

Delete a connection

DELETE /connections/:connectionId Permanently deletes a connection and its stored credentials.

Path parameters

string
required
The connection ID to delete.

Query parameters

string
required
The unique key of the integration this connection belongs to.

Response

Example response

Set connection metadata

POST /connections/metadata Replaces the metadata on one or more connections entirely. Existing metadata is overwritten.
This replaces the entire metadata object. Use Update metadata (PATCH) to merge changes without overwriting existing keys.

Request body

string | string[]
required
The connection ID to update, or an array of connection IDs to update in bulk.
string
required
The unique key of the integration the connection(s) belong to.
object
required
The new metadata to set. Must be a JSON object. All existing metadata keys are replaced.

Response

Returns the body you sent as confirmation.
Example response

Update connection metadata

PATCH /connections/metadata Merges the provided metadata into the connection’s existing metadata. Only the keys you provide are updated; all other keys remain unchanged.

Request body

string | string[]
required
The connection ID to update, or an array of connection IDs to update in bulk.
string
required
The unique key of the integration the connection(s) belong to.
object
required
The metadata keys to update. Only these keys are changed; existing keys not included here are preserved.

Response

Returns the body you sent as confirmation.
Example response

Reading metadata

To read a connection’s metadata, fetch the connection using Get a connection. The metadata field is included in the response.
Node SDK