@nangohq/node.
Installation
- npm
- yarn
- pnpm
Constructor
Your secret key from the Nango dashboard. Go to Settings > Environment Settings to find it. Never expose this key in client-side code.
The URL of your Nango instance. Defaults to
https://api.nango.dev (Nango Cloud). For local development use http://localhost:3003. For self-hosted instances, use your instance URL.Rate limits
The SDK is rate-limited on a per-account basis. When the limit is exceeded the API returns a429 Too Many Requests status code with a Retry-After header indicating how many seconds to wait.
Providers
listProviders
Returns all available API providers in the Nango catalog.Optional query parameters to filter providers.
getProvider
Returns a specific provider by name.The provider name (e.g.
github, slack, salesforce). See providers.yaml for all IDs.Integrations
listIntegrations
Returns all integrations configured in your Nango environment.getIntegration
Returns a specific integration by its unique key.The integration ID (unique key) as shown in the Nango dashboard.
Include additional sensitive data. Allowed value:
webhook.createIntegration
Creates a new integration.The provider ID (e.g.
github). See providers.yaml for all IDs.A unique identifier for this integration within your environment.
A human-readable name shown in the Connect UI.
Provider-specific credentials such as OAuth client ID and secret.
updateIntegration
Patches an existing integration. All fields are optional.The integration ID to update.
Fields to update. Accepts
display_name and credentials.deleteIntegration
Deletes an integration and all its connections.The integration unique key to delete.
Connect sessions
createConnectSession
Creates a short-lived session token (valid for 30 minutes) used to open the Connect UI for a specific end user.Key-value tags copied onto the created connection and included in auth webhooks. Use
end_user_id, end_user_email, and organization_id for standard attribution.Restrict the session to specific integration IDs. When omitted, all integrations are available.
Default configuration per integration. Useful for pre-populating connection config or allowing users to supply their own OAuth credentials.
createReconnectSession
Creates a session token to re-authorize an existing connection (e.g. when credentials have expired).The ID of the existing connection to reconnect.
The integration ID for the connection.
Tags to update on the connection during reconnection.
This method is only compatible with connections originally created with a session token.
Connections
listConnections
Returns a list of connections (without credentials).Filter to a specific connection ID. May return multiple connections with the same ID across different integrations.
Filter by one or more integration IDs.
Filter by tag key-value pairs associated with connections.
Maximum number of connections to return.
getConnection
Returns a specific connection with its credentials. Nango automatically refreshes expired tokens before returning.The integration ID.
The connection ID.
When
true, forces a token refresh even if the current token is still valid. Defaults to false. Do not use at high traffic.When
true, includes the refresh token in the response. Defaults to false.deleteConnection
Deletes a specific connection.The integration ID.
The connection ID to delete.
waitForConnection
Polls until a connection is created for the given end user and integration. Useful in agentic workflows where you start an OAuth flow and need to wait for it to complete.The integration ID to wait for.
The
end_user_id tag value to match against.patchConnection
Updates metadata or tags on an existing connection.getMetadata
Returns the custom metadata stored on a connection.The integration ID.
The connection ID.
setMetadata
Replaces the entire metadata object on one or more connections.The integration ID.
One or more connection IDs to update.
The metadata to store. Replaces all existing metadata.
updateMetadata
Merges metadata into one or more connections without replacing existing keys.The integration ID.
One or more connection IDs to update.
The metadata keys to set. Only specified keys are updated; existing keys are preserved.
Proxy
Make authenticated HTTP requests to external APIs through Nango’s proxy. Nango automatically injects credentials, handles retries, and routes the request to the correct provider.The API endpoint path (e.g.
/repos/octocat/hello-world).The integration ID used to look up credentials.
The connection ID whose credentials to inject.
Additional request headers. These are forwarded with a
Nango-Proxy- prefix internally.Query parameters to append to the request URL.
The request body for POST, PUT, and PATCH requests.
Number of retries on failure (with exponential backoff). Defaults to
0.Additional HTTP status codes to retry on, in addition to
5xx, 429, and network errors.Override the provider’s default base URL. Required only if the base URL is not configured in providers.yaml.
The expected response type. Defaults to
json.Syncs
listRecords
Returns synced records for a model. Supports pagination via cursors.The integration ID.
The connection ID.
The model name as defined in your integration functions.
The sync variant to fetch records from. Defaults to the base variant.
Pagination cursor from a previous response’s
_nango_metadata.cursor. Pass this to fetch only records that changed since the last cursor.Maximum number of records to return. Defaults to
100.Comma-separated filter for record state. Options:
added, updated, deleted.ISO 8601 timestamp. Only returns records modified after this time.
Filter to specific record IDs.
triggerSync
Triggers a one-off execution of one or more syncs.The integration ID.
Syncs to trigger. Pass an empty array to trigger all syncs.
The connection ID. When omitted, the sync triggers for all applicable connections.
When
true, clears the sync checkpoint and starts fresh.When
true, deletes all cached records before triggering. Must be combined with reset: true.startSync
Starts the schedule for one or more syncs. If already running, this has no effect.pauseSync
Pauses the schedule for one or more syncs.syncStatus
Returns the current status of one or more syncs.updateSyncConnectionFrequency
Overrides the sync frequency for a specific connection.The integration ID.
The sync name, or an object with
name and variant.The connection ID to update the frequency for.
The new frequency string (e.g.
'every hour', 'every 30 minutes'). Uses vercel/ms notation. Minimum: 5 minutes. Pass null to revert to the default.pruneRecords
Removes record payloads from Nango’s cache up to a given cursor. Record metadata is retained. Useful to reduce storage when you no longer need historical payloads.Actions
triggerAction
Triggers an action synchronously and returns the result.The integration ID.
The connection ID.
The name of the action to trigger.
Input data passed to the action’s
exec function.triggerActionAsync
Triggers an action asynchronously and returns an ID to poll for the result.getAsyncActionResult
Retrieves the result of an async action.Webhooks
verifyIncomingWebhookRequest
Verifies that an incoming webhook request originates from Nango using HMAC-SHA256.The raw HTTP body as a string. Do not parse it before passing.
The HTTP request headers. The method looks for
x-nango-hmac-sha256.Integration functions
getScriptsConfig
Returns the configuration for all deployed integration functions. Useful for feeding integration metadata to an AI model.The output format. Defaults to
'nango'.