@nangohq/node.
Installation
- npm
- yarn
- pnpm
Constructor
string
required
Your secret key from the Nango dashboard. Go to Settings > Environment Settings to find it. Never expose this key in client-side code.
string
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.object
Optional query parameters to filter providers.
getProvider
Returns a specific provider by name.string
required
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.string
required
The integration ID (unique key) as shown in the Nango dashboard.
string[]
Include additional sensitive data. Allowed value:
webhook.createIntegration
Creates a new integration.string
required
The provider ID (e.g.
github). See providers.yaml for all IDs.string
required
A unique identifier for this integration within your environment.
string
A human-readable name shown in the Connect UI.
Record<string, string>
Provider-specific credentials such as OAuth client ID and secret.
updateIntegration
Patches an existing integration. All fields are optional.string
required
The integration ID to update.
object
required
Fields to update. Accepts
display_name and credentials.deleteIntegration
Deletes an integration and all its connections.string
required
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.Record<string, string>
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.string[]
Restrict the session to specific integration IDs. When omitted, all integrations are available.
object
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).string
required
The ID of the existing connection to reconnect.
string
required
The integration ID for the connection.
Record<string, string>
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).string
Filter to a specific connection ID. May return multiple connections with the same ID across different integrations.
string | string[]
Filter by one or more integration IDs.
Record<string, string>
Filter by tag key-value pairs associated with connections.
number
Maximum number of connections to return.
getConnection
Returns a specific connection with its credentials. Nango automatically refreshes expired tokens before returning.string
required
The integration ID.
string
required
The connection ID.
boolean
When
true, forces a token refresh even if the current token is still valid. Defaults to false. Do not use at high traffic.boolean
When
true, includes the refresh token in the response. Defaults to false.deleteConnection
Deletes a specific connection.string
required
The integration ID.
string
required
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.string
required
The integration ID to wait for.
string
required
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.string
required
The integration ID.
string
required
The connection ID.
setMetadata
Replaces the entire metadata object on one or more connections.string
required
The integration ID.
string | string[]
required
One or more connection IDs to update.
Record<string, any>
required
The metadata to store. Replaces all existing metadata.
updateMetadata
Merges metadata into one or more connections without replacing existing keys.string
required
The integration ID.
string | string[]
required
One or more connection IDs to update.
Record<string, any>
required
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.string
required
The API endpoint path (e.g.
/repos/octocat/hello-world).string
required
The integration ID used to look up credentials.
string
required
The connection ID whose credentials to inject.
Record<string, string>
Additional request headers. These are forwarded with a
Nango-Proxy- prefix internally.Record<string, string | number>
Query parameters to append to the request URL.
unknown
The request body for POST, PUT, and PATCH requests.
number
Number of retries on failure (with exponential backoff). Defaults to
0.number[]
Additional HTTP status codes to retry on, in addition to
5xx, 429, and network errors.string
Override the provider’s default base URL. Required only if the base URL is not configured in providers.yaml.
'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'
The expected response type. Defaults to
json.Syncs
listRecords
Returns synced records for a model. Supports pagination via cursors.string
required
The integration ID.
string
required
The connection ID.
string
required
The model name as defined in your integration functions.
string
The sync variant to fetch records from. Defaults to the base variant.
string
Pagination cursor from a previous response’s
_nango_metadata.cursor. Pass this to fetch only records that changed since the last cursor.number
Maximum number of records to return. Defaults to
100.string
Comma-separated filter for record state. Options:
added, updated, deleted.string
ISO 8601 timestamp. Only returns records modified after this time.
string[]
Filter to specific record IDs.
triggerSync
Triggers a one-off execution of one or more syncs.string
required
The integration ID.
Array<string | { name: string; variant: string }>
required
Syncs to trigger. Pass an empty array to trigger all syncs.
string
The connection ID. When omitted, the sync triggers for all applicable connections.
boolean
When
true, clears the sync checkpoint and starts fresh.boolean
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.string
required
The integration ID.
string | { name: string; variant: string }
required
The sync name, or an object with
name and variant.string
required
The connection ID to update the frequency for.
string | null
required
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.string
required
The integration ID.
string
required
The connection ID.
string
required
The name of the action to trigger.
unknown
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.string
required
The raw HTTP body as a string. Do not parse it before passing.
Record<string, unknown>
required
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.'nango' | 'openai'
The output format. Defaults to
'nango'.