Skip to main content
Syncs let you maintain an up-to-date local copy of data from any external API. Nango runs your sync function on a schedule, stores the results in its encrypted cache, detects additions, updates, and deletes, and notifies your backend via webhook whenever new data is available.

When to use syncs

Syncs are ideal when you want to:
  • Store a copy of external API data in your app and keep it up to date
  • Detect changes in APIs that don’t offer webhooks
  • Combine polling and webhooks for a reliable, real-time stream of changes
Common examples include syncing contacts from CRMs (HubSpot, Salesforce, Attio), files from cloud drives (Google Drive, SharePoint, Box), or call transcripts from video tools (Gong, Fathom, Zoom).

Key facts

  • Syncs run in Nango’s infrastructure, scoped to a connection
  • You control the code: which data to fetch, how to transform it, and what the data model looks like
  • All platform features are available: data validation, per-customer config, retries, and rate-limit handling
  • Syncs support checkpoints to save progress, resume after failures, and fetch only changed data
  • Synced records are encrypted at rest and in transit
  • The minimum polling interval is 15 seconds
  • All sync runs and API calls are logged in the Nango dashboard

Build a sync

Step 1 — Set up your integrations folder

If you don’t have a nango-integrations folder yet, follow the functions setup guide.

Step 2 — Start dev mode

Keep this terminal open. It continuously compiles your functions and prints syntax errors as you work.

Step 3 — Create the sync file

Sync files live inside a syncs/ folder nested under the integration folder. For a sync that fetches Salesforce contacts:
Paste the following scaffold into your sync file:
salesforce-contacts.ts
Also import the new file in index.ts:
index.ts

Step 4 — Implement your sync

Write your fetch-and-save logic inside the exec method. Here is a complete Salesforce contacts sync using incremental fetches with checkpoints:
salesforce-contacts.ts

SDK methods available in syncs

Step 5 — Test locally

Because this is a dry run, records are printed to the console rather than saved to Nango’s cache. To see memory and CPU diagnostics:

Step 6 — Deploy

To deploy a single sync:
Data retention: Records not updated for 30 days have their payload pruned (metadata is retained). Records from syncs not executed for 60 days are permanently deleted. Fetch records from Nango promptly after receiving webhook notifications and store them in your own system.

Use a sync from your backend

Receive Nango webhooks

Set up a webhook endpoint in your app and configure Nango to notify it. When a sync completes, Nango sends a webhook with the payload containing providerConfigKey, connectionId, model, and modifiedAfter.

Fetch records

Use the Node SDK or REST API to fetch the latest records after receiving a webhook:
Each record includes _nango_metadata with last_action (ADDED, UPDATED, or DELETED), first_seen_at, last_modified_at, and a cursor for pagination.

Cursor-based pagination

Rather than relying solely on webhook timestamps (which can be missed), track the cursor from the last record you fetched. Pass it on subsequent requests to fetch only records modified after that point:

Manage syncs from your backend

Trigger a one-off sync run

Start or pause a sync schedule

Check sync status

Sync configuration reference