Guide on how to detect deleted records with syncs
nango.batchDelete()
(full reference) inside the sync functions.
nango.batchDelete()
if the external API supports one of the following:
GET /entities/deleted?since=...
)is_deleted
, archived
, etc.deleteRecordsFromPreviousExecutions
function. (full reference).
deleteRecordsFromPreviousExecutions
does not work with incremental syncs because fetching the data incrementally prevents performing a diff and automatically detecting deletions.deleteRecordsFromPreviousExecutions
, Nango compares the new list with the old one.record._metadata.deleted === true
.deleteRecordsFromPreviousExecutions
Nango only performs deletion detection (the “diff”) if a sync run completes successfully without any uncaught exceptions.If you’re using deleteRecordsFromPreviousExecutions
, exception handling becomes critical:deleteRecordsFromPreviousExecutions
(e.g. you catch and swallow an exception), Nango will attempt the diff on an incomplete dataset.deleteRecordsFromPreviousExecutions
is not being called:try/catch
, re-throw exceptions that indicate incomplete data.deleteRecordsFromPreviousExecutions
safelyIf some records are incorrectly marked as deleted due to calling deleteRecordsFromPreviousExecutions
improperly, you can trigger a full resync (via the UI or API) to restore the correct data state.However, because deleteRecordsFromPreviousExecutions
relies on logic in your sync functions, mistakes there can lead to false deletions.We strongly recommend not performing irreversible destructive actions (like hard-deleting records in your system) based solely on deletions reported by Nango. A full resync should always be able to recover from issues.Symptom | Likely cause |
---|---|
Records that still exist in the source API are shown as deleted in Nango | sync didn’t save all records (silent failures) before calling deleteRecordsFromPreviousExecutions |
You never see deleted records | Check if deletion detection is implemented for the sync. |