Surface deletes from the external API — even when the API itself doesn’t expose them cleanly.
Sometimes you need to know when a record you are syncing has been deleted in the external system. Deletion detection works differently depending on whether your sync function is incremental or full — pick the strategy that matches your sync approach.For incremental syncs, you must actively tell Nango which IDs have been removed. For full syncs (which fetch all records on every run), Nango can compute deletes for you automatically.
When your sync only fetches changed data since the previous run, Nango has no built-in way to know which records disappeared on the provider side.You must actively tell Nango which IDs have been removed by calling nango.batchDelete() (full reference) inside the sync function.
You can use nango.batchDelete() if the external API supports one of the following:
A dedicated “recently deleted” endpoint (e.g. GET /entities/deleted?since=...)
The ability to filter or sort by a deletion timestamp
The ability to filter or sort by last-modified timestamp and records include a flag like is_deleted, archived, etc.
If none of these are available, you cannot detect deletes in an incremental sync. You’ll either need to switch to a full sync or skip deletion detection.
Sync functions that fetch all records on every run can automatically detect deletions.Nango detects removals by computing the diff between what existed before trackDeletesStart and what was saved between trackDeletesStart and trackDeletesEnd (full reference).This works whether your full sync uses checkpoints for resilience or not. If it does, trackDeletesStart should be called before fetching any data and trackDeletesEnd after all records are saved and the checkpoint is cleared.
When trackDeletesStart is called, Nango marks the beginning of the deletion tracking window for the model.
Records saved with batchSave between trackDeletesStart and trackDeletesEnd are tracked.
When trackDeletesEnd is called, Nango compares what existed before trackDeletesStart with what was saved in the window.
Any records missing from the new dataset are marked as deleted (soft delete). They remain accessible from the Nango cache, but with record._metadata.deleted === true.
Be careful with exception handling when usingtrackDeletesStart/trackDeletesEndNango only performs deletion detection (the “diff”) if a sync run completes successfully without any uncaught exceptions.Exception handling is critical:
If your sync doesn’t fetch the full dataset between the two calls (e.g. you catch and swallow an exception), Nango will attempt the diff on an incomplete dataset.
This leads to false positives, where valid records are mistakenly considered deleted.
What You Should DoIf a failure prevents full data retrieval, make sure the sync run fails and trackDeletesEnd is not being called:
Let exceptions bubble up and interrupt the run.
If you’re using try/catch, re-throw exceptions that indicate incomplete data.
How to usetrackDeletesStart/trackDeletesEndsafelyIf some records are incorrectly marked as deleted, you can trigger a full resync (via the UI or API) to restore the correct data state.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.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Nango Docs","colors":{"primary":"#29abe2","light":"#71c0e2","dark":"#217ea6"},"logo":{"light":"https://mintcdn.com/nango/h2zzveDlAs05T6zr/images/Nango-Light-Mode.svg?fit=max\u0026auto=format\u0026n=h2zzveDlAs05T6zr\u0026q=85\u0026s=0c2845b2219705011e11ef4985aa9d91","dark":"https://mintcdn.com/nango/h2zzveDlAs05T6zr/images/Nango-Dark-Mode.svg?fit=max\u0026auto=format\u0026n=h2zzveDlAs05T6zr\u0026q=85\u0026s=850ee557541d6e0b523aa22a086f45c5","href":"https://nango.dev"},"favicon":{"light":"https://mintcdn.com/nango/J3bBfZ1D3NjDI-Wu/favicon-black.svg?fit=max\u0026auto=format\u0026n=J3bBfZ1D3NjDI-Wu\u0026q=85\u0026s=6759e69f959345295eaa1a3b61eff463","dark":"https://mintcdn.com/nango/J3bBfZ1D3NjDI-Wu/favicon-white.svg?fit=max\u0026auto=format\u0026n=J3bBfZ1D3NjDI-Wu\u0026q=85\u0026s=f9b0cb2c74ef91143ca48dea01bb16e0"},"api":{"mdx":{"auth":{"method":"bearer"},"server":["https://api.nango.dev","http://localhost:3003"]}},"appearance":{"default":"system"},"background":{"decoration":"grid","color":{"light":"#ffffff","dark":"#0b0b0c"}},"navbar":{"links":[{"href":"https://github.com/NangoHQ/nango","label":"GitHub","type":"github"},{"href":"https://app.nango.dev","label":"Log In"}],"primary":{"type":"button","label":"Sign Up","href":"https://app.nango.dev/signup"}},"footer":{"socials":{"twitter":"https://twitter.com/NangoHQ","linkedin":"https://www.linkedin.com/company/nangohq","github":"https://github.com/NangoHQ/nango","slack":"https://nango.dev/slack","website":"https://nango.dev/"}},"seo":{"metatags":{"og:type":"website","og:site_name":"Nango Docs"},"indexing":"all"},"fonts":{"family":"Albert Sans"},"integrations":{"gtm":{"tagId":"GTM-N4KVPWR"}},"contextual":{"options":["copy","mcp","cursor","vscode","chatgpt","claude"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"nango","hasAudioNarration":false,"actualSubdomain":"nango","customDomains":["nango.dev"],"gitSource":{"type":"github","owner":"nangohq","repo":"nango","deployBranch":"master","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae2384e062c116bf4115d7c","collectionId":"2228dead-1fde-4e8c-b6e5-5091eee155cb","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae2384e062c116bf4115d7c"},"feedback":{"thumbs":true,"edits":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae2384e062c116bf4115d7c","clientVersion":"0.0.4005","searchFilterCounts":[{"language":"default","tag":"APIs \u0026 Integrations","count":1076},{"language":"default","tag":"1,000+ APIs \u0026 Integrations","count":1073},{"language":"default","tag":"Documentation","count":123},{"language":"default","tag":"Reference","count":69},{"language":"default","tag":"Backend","count":66},{"language":"default","tag":"HTTP API","count":58},{"language":"default","tag":"Guides","count":43},{"language":"default","tag":"Functions","count":30},{"language":"default","tag":"Platform","count":18},{"language":"default","tag":"Getting started","count":11}]},"assistantConfig":{"enableStarterQuestions":false},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":true},"customCss":[{"filePath":"custom.css","content":".agent-quickstart-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:16px 0 24px}.agent-quickstart-actions--single{grid-template-columns:minmax(0,1fr);max-width:720px}.agent-quickstart-action{display:flex;flex-direction:column;gap:6px;width:100%;padding:16px;border:1px solid rgba(0,0,0,.12);background:rgba(255,255,255,.72);color:inherit;font:inherit;text-align:left;cursor:pointer;transition:border-color 140ms ease,background-color 140ms ease,transform 140ms ease}.agent-quickstart-action:focus-visible,.agent-quickstart-action:hover{border-color:rgba(41,171,226,.7);background:rgba(41,171,226,.06);transform:translateY(-1px)}.agent-quickstart-action--primary{border-color:rgba(41,171,226,.4);background:rgba(41,171,226,.08)}.agent-quickstart-action[aria-busy=true]{opacity:.7;cursor:wait}.agent-quickstart-action-title{font-size:15px;font-weight:600;line-height:1.4}.agent-quickstart-action-description{color:#515556;font-size:14px;line-height:1.5}.dark .agent-quickstart-action{border-color:rgba(255,255,255,.14);background:rgba(255,255,255,.04)}.dark .agent-quickstart-action:focus-visible,.dark .agent-quickstart-action:hover{border-color:rgba(41,171,226,.8);background:rgba(41,171,226,.12)}.dark .agent-quickstart-action-description{color:rgba(255,255,255,.68)}.agent-copy-toast{position:fixed;right:24px;bottom:24px;z-index:250;max-width:min(320px,calc(100vw - 48px));padding:10px 12px;border:1px solid rgba(0,0,0,.1);background:#111827;color:#fff;font-size:14px;line-height:1.4;opacity:0;pointer-events:none;transform:translateY(8px);transition:opacity 140ms ease,transform 140ms ease}.agent-copy-toast[data-visible=true]{opacity:1;transform:translateY(0)}.agent-copy-toast[data-kind=error]{background:#7f1d1d}@media (max-width:640px){.agent-quickstart-actions{grid-template-columns:1fr}.agent-copy-toast{right:16px;bottom:16px;max-width:calc(100vw - 32px)}}.rounded,.rounded-2xl,.rounded-3xl,.rounded-full,.rounded-lg,.rounded-md,.rounded-sm,.rounded-xl,[class~=rounded-2xl],[class~=rounded-3xl],[class~=rounded-lg],[class~=rounded-md],[class~=rounded-sm],[class~=rounded-xl],button,code,input,kbd,pre,select,textarea{border-radius:4px!important}[class*=background-decoration]{opacity:.02!important;z-index:0!important;pointer-events:none}#navbar a[href=\"https://github.com/NangoHQ/nango\"] span.truncate,#sidebar-content .pointer-events-none.sticky{display:none!important}@media (max-width:767px){a[href=\"https://github.com/NangoHQ/nango\"]{display:none!important}}[id^=headlessui-dialog-]:not([id*=panel]){z-index:200!important}[id^=headlessui-dialog-panel],[id^=headlessui-dialog-panel] [class*=bg-background],[id^=headlessui-dialog-panel] [class*=bg-white],[id^=headlessui-dialog-panel]>div,details,summary{border-radius:4px!important}details[open]>summary{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}@media (min-width:768px){#navbar{position:fixed!important;top:0!important;left:0!important;right:0!important;width:100%!important;z-index:30!important}}.dark #navbar{background-color:#0b0b0c!important;border-bottom:1px solid rgba(255,255,255,.08)!important}html:not(.dark) #navbar{background-color:#fff!important;border-bottom:1px solid rgba(0,0,0,.08)!important}#navbar [class*=border-b]{border-bottom:none!important}.dark #sidebar-content{background-color:#0b0b0c!important}.dark :has(>#sidebar-content){border-right:1px solid rgba(255,255,255,.08)!important}html:not(.dark) :has(>#sidebar-content){border-right:1px solid rgba(0,0,0,.08)!important}#navigation-items{padding-top:20px!important}#navigation-items img[src$=\"/images/mcp.svg\"]{opacity:.38}.dark #navigation-items img[src$=\"/images/mcp.svg\"]{filter:invert(1);opacity:.58}#table-of-contents{scrollbar-width:none}#table-of-contents::-webkit-scrollbar{width:0;background:0 0}#table-of-contents:hover{scrollbar-width:thin}#table-of-contents:hover::-webkit-scrollbar{width:6px}#table-of-contents:hover::-webkit-scrollbar-thumb{background-color:rgba(128,128,128,.4);border-radius:4px}#table-of-contents:hover::-webkit-scrollbar-thumb:hover{background-color:rgba(128,128,128,.6)}#table-of-contents a{padding:4px 8px!important;border-radius:4px!important;display:block!important}html:not(.dark) #table-of-contents a{color:#515556!important}html:not(.dark) #table-of-contents a:hover{color:#000!important}.dark #table-of-contents a{color:rgba(255,255,255,.6)!important}.dark #table-of-contents a:hover{color:#fff!important}#table-of-contents .toc-item[data-depth=\"1\"]>a{padding-left:24px!important}#table-of-contents .toc-item[data-depth=\"2\"]>a{padding-left:40px!important}.dark #table-of-contents:not(:has(.toc-item[data-active=true])) .toc-item[data-scroll-active=true]>a{background-color:rgba(255,255,255,.07);color:rgba(255,255,255,.9);font-weight:500}html:not(.dark) #table-of-contents:not(:has(.toc-item[data-active=true])) .toc-item[data-scroll-active=true]>a{background-color:rgba(0,0,0,.06);color:#000;font-weight:500}@media (min-width:1024px){body:has([data-page-href*=\"updates/changelog\"]) :has(>#sidebar-content){width:184px!important;border-right:0!important;pointer-events:none!important}body:has([data-page-href*=\"updates/changelog\"]) #sidebar-content{display:none!important}body:has([data-page-href*=\"updates/changelog\"]) .update-container{margin-left:-184px!important;width:calc(100% + 184px)!important;max-width:none!important}}[data-page-href*=\"updates/changelog\"] .update-container+hr{margin-top:1rem!important;margin-bottom:1rem!important}.nav-logo,img.nav-logo,svg.nav-logo{height:36px!important;width:auto!important;max-width:none!important}#content-area{position:relative;z-index:1}@media (min-width:768px){#content-area{padding-top:6rem!important}#content-area>div:first-child{margin-top:1.5rem!important}#content-side-layout{margin-top:6rem!important}}[data-component-part=scroll-area-viewport]:has(>[data-component-part=scroll-area-content]>div>select[aria-label='Select base URL']){overflow:visible!important;mask-image:none!important}[data-component-part=scroll-area-content]:has(>div>select[aria-label='Select base URL']){min-width:0!important;flex-wrap:wrap!important;column-gap:2px!important;row-gap:2px!important}[data-component-part=scroll-area-content]:has(>div>select[aria-label='Select base URL'])>div:last-child{display:contents!important}.dark #navigation-items>ul{padding-bottom:20px!important;border-bottom:1px solid rgba(255,255,255,.08)!important;margin-bottom:0!important}html:not(.dark) #navigation-items>ul{padding-bottom:20px!important;border-bottom:1px solid rgba(0,0,0,.08)!important;margin-bottom:0!important}.dark a.nav-anchor>div[style*=background]{background:rgba(255,255,255,.1)!important}html:not(.dark) a.nav-anchor>div[style*=background]{background:rgba(0,0,0,.06)!important}.dark #sidebar-group a,.dark #sidebar-group button,.dark a.nav-anchor{color:rgba(255,255,255,.55)!important}.dark a.nav-anchor[class*=text-primary]{color:rgba(255,255,255,.9)!important}.dark a.nav-anchor:hover{color:#fff!important}html:not(.dark) #sidebar-group a,html:not(.dark) #sidebar-group button,html:not(.dark) a.nav-anchor{color:rgba(0,0,0,.7)!important}html:not(.dark) a.nav-anchor[class*=text-primary]{color:rgba(0,0,0,.9)!important}html:not(.dark) a.nav-anchor:hover{color:#000!important}.dark li[data-active=true]>a{background-color:rgba(255,255,255,.07)!important;color:#fff!important;border-radius:4px!important}html:not(.dark) li[data-active=true]>a{background-color:rgba(0,0,0,.06)!important;color:#000!important;border-radius:4px!important}.dark #sidebar-group a:hover,.dark #sidebar-group button:hover{color:rgba(255,255,255,.85)!important;background-color:rgba(255,255,255,.04)!important;border-radius:4px!important}html:not(.dark) #sidebar-group a:hover,html:not(.dark) #sidebar-group button:hover{color:rgba(0,0,0,.85)!important;background-color:rgba(0,0,0,.04)!important;border-radius:4px!important}div:has(>img[src=\"/images/mcp.svg\"])>img{display:none}div:has(>img[src=\"/images/mcp.svg\"])::before{content:\"\";width:1rem;height:1rem;background-color:currentColor;-webkit-mask:url(/images/mcp.svg) center/contain no-repeat;mask:url(/images/mcp.svg) center/contain no-repeat}#sidebar-group a,#sidebar-group button{padding:3px 8px!important;border-radius:4px!important}#sidebar-group li li a,#sidebar-group li li button{padding-left:20px!important}#sidebar-group li li li a,#sidebar-group li li li button{padding-left:32px!important}.sidebar-group-header{padding-left:8px!important}@media (min-width:768px){#sidebar-title,.sidebar-group-header h5{font-size:.7rem!important;text-transform:uppercase!important;letter-spacing:.07em!important;font-weight:600!important}.dark #sidebar-title,.dark .sidebar-group-header h5{color:rgba(255,255,255,.9)!important}html:not(.dark) #sidebar-title,html:not(.dark) .sidebar-group-header h5{color:rgba(0,0,0,.75)!important}}@media (max-width:767px){#sidebar-title,.sidebar-group-header h5{font-size:.9375rem!important;text-transform:none!important;letter-spacing:0!important;font-weight:700!important}.dark #sidebar-title,.dark .sidebar-group-header h5{color:rgba(255,255,255,.95)!important}html:not(.dark) #sidebar-title,html:not(.dark) .sidebar-group-header h5{color:rgba(0,0,0,.9)!important}}#navbar a[href=\"https://app.nango.dev\"],#navbar a[href=\"https://app.nango.dev/signup\"]{padding:7px 16px!important;font-size:.875rem!important;font-weight:500!important;border-radius:4px!important;line-height:1.25rem!important}#navbar a[href=\"https://app.nango.dev\"]{margin-right:-8px!important}#navbar a[href=\"https://app.nango.dev/signup\"]{margin-left:-8px!important;background-color:#29abe3!important;background-image:none!important;border:1px solid #29abe3!important;color:#fff!important}.dark #navbar a[href=\"https://app.nango.dev\"]{display:inline-flex!important;align-items:center!important;background-color:transparent!important;color:#fff!important;border:1px solid rgba(255,255,255,.25)!important;text-decoration:none!important}.dark #navbar a[href=\"https://app.nango.dev\"]:hover{background-color:rgba(255,255,255,.08)!important}#navbar a[href=\"https://app.nango.dev/signup\"] span.absolute,#navbar a[href=\"https://app.nango.dev/signup\"] span[class*=bg-primary],#navbar a[href=\"https://app.nango.dev/signup\"]>span:first-child{display:none!important}#navbar a[href=\"https://app.nango.dev/signup\"]:hover{background-color:#217ea6!important;border-color:#217ea6!important;color:#fff!important}#content-area div.rounded-2xl.pointer-events-auto[class*=bg-background-light],.chat-assistant-floating-input{display:none!important}.sticky:has(>#chat-assistant-sheet){z-index:40!important}"}],"page":{"pagePath":"guides/functions/syncs/deletion-detection","slug":"/guides/functions/syncs/deletion-detection","pageMetadata":{"title":"Deletion detection","sidebarTitle":"Deletion detection","description":"Surface deletes from the external API — even when the API itself doesn't expose them cleanly.","href":"/guides/functions/syncs/deletion-detection"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Surface deletes from the external API — even when the API itself doesn’t expose them cleanly.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Sometimes you need to know when a record you are syncing has been deleted in the external system. Deletion detection works differently depending on whether your sync function is incremental or full — pick the strategy that matches your sync approach.`}),`\n`,_jsx(_components.p,{children:`For incremental syncs, you must actively tell Nango which IDs have been removed. For full syncs (which fetch all records on every run), Nango can compute deletes for you automatically.`}),`\n`,_jsx(Heading,{level:`2`,id:`detecting-deletes-in-incremental-syncs`,children:`Detecting deletes in incremental syncs`}),`\n`,_jsx(_components.p,{children:`When your sync only fetches changed data since the previous run, Nango has no built-in way to know which records disappeared on the provider side.`}),`\n`,_jsxs(_components.p,{children:[`You must actively tell Nango which IDs have been removed by calling `,_jsx(_components.code,{children:`nango.batchDelete()`}),` (`,_jsx(_components.a,{href:`/reference/functions/functions-sdk#delete-records`,children:`full reference`}),`) inside the sync function.`]}),`\n`,_jsx(Heading,{level:`3`,id:`when-can-you-use-this`,children:`When can you use this?`}),`\n`,_jsxs(_components.p,{children:[`You can use `,_jsx(_components.code,{children:`nango.batchDelete()`}),` if the external API supports one of the following:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`A dedicated “recently deleted” endpoint (e.g. `,_jsx(_components.code,{children:`GET /entities/deleted?since=...`}),`)`]}),`\n`,_jsx(_components.li,{children:`The ability to filter or sort by a deletion timestamp`}),`\n`,_jsxs(_components.li,{children:[`The ability to filter or sort by last-modified timestamp and records include a flag like `,_jsx(_components.code,{children:`is_deleted`}),`, `,_jsx(_components.code,{children:`archived`}),`, etc.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`If none of these are available, you cannot detect deletes in an incremental sync. You’ll either need to switch to a full sync or skip deletion detection.`}),`\n`,_jsx(Heading,{level:`3`,id:`example`,children:`Example`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`46`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`46`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`createSync`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'nango'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` z`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'zod'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` AccountSchema`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` z`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`object`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` id:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` z`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` name:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` z`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` default`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createSync`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` description:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Sync Accounts incrementally and handle deletions'`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` frequency:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'every 2 hours'`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` endpoints:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'GET'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`path:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '/accounts'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`group:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Accounts'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }]`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` models:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Account:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` AccountSchema`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` checkpoint:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` z`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`object`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` lastSyncedISO:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` z`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` exec`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`nango`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` checkpoint`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nango`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getCheckpoint`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` now`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Date`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`toISOString`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // (1) Fetch newly created / updated accounts`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` res`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nango`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` endpoint:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '/accounts'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` params:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`checkpoint`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`since:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` checkpoint`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`lastSyncedISO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }) }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nango`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`batchSave`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Account'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // (2) Fetch deletions since the last run (if this is not the first run)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`checkpoint`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` deletedRes`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nango`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` endpoint:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '/accounts/deleted'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` params:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`since:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` checkpoint`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`lastSyncedISO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // (3) Tell Nango which IDs have been deleted in the external system`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` toDelete`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` deletedRes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`map`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`row`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` any`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` row`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }));`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toDelete`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nango`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`batchDelete`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`toDelete`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Account'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // (4) Save checkpoint for next run`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nango`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`saveCheckpoint`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`lastSyncedISO:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` now`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`})`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`detecting-deletes-in-full-syncs`,children:`Detecting deletes in full syncs`}),`\n`,_jsx(_components.p,{children:`Sync functions that fetch all records on every run can automatically detect deletions.`}),`\n`,_jsxs(_components.p,{children:[`Nango detects removals by computing the diff between what existed before `,_jsx(_components.code,{children:`trackDeletesStart`}),` and what was saved between `,_jsx(_components.code,{children:`trackDeletesStart`}),` and `,_jsx(_components.code,{children:`trackDeletesEnd`}),` (`,_jsx(_components.a,{href:`/reference/functions/functions-sdk#detect-deletions-automatically`,children:`full reference`}),`).`]}),`\n`,_jsxs(_components.p,{children:[`This works whether your full sync uses checkpoints for resilience or not. If it does, `,_jsx(_components.code,{children:`trackDeletesStart`}),` should be called before fetching any data and `,_jsx(_components.code,{children:`trackDeletesEnd`}),` after all records are saved and the checkpoint is cleared.`]}),`\n`,_jsx(Heading,{level:`3`,id:`example-2`,children:`Example`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`32`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`32`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`createSync`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'nango'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` z`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'zod'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` TicketSchema`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` z`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`object`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` id:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` z`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` subject:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` z`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` status:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` z`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` default`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createSync`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` description:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Fetch all help-desk tickets'`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` frequency:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'every day'`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` endpoints:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'GET'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`path:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '/tickets'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`group:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Tickets'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }]`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` models:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Ticket:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` TicketSchema`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` exec`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`nango`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Mark the start of deletion tracking`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nango`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`trackDeletesStart`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Ticket'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` tickets`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nango`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`paginate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c{ `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`subject`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }>({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` endpoint:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '/tickets'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` paginate:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'cursor'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`cursor_path_in_response:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'next'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`cursor_name_in_request:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'cursor'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response_path:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'tickets'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` page`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` tickets`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nango`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`batchSave`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`page`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Ticket'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Detect and mark deleted records`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nango`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`trackDeletesEnd`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Ticket'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`})`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`how-the-algorithm-works`,children:`How the algorithm works`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`When `,_jsx(_components.code,{children:`trackDeletesStart`}),` is called, Nango marks the beginning of the deletion tracking window for the model.`]}),`\n`,_jsxs(_components.li,{children:[`Records saved with `,_jsx(_components.code,{children:`batchSave`}),` between `,_jsx(_components.code,{children:`trackDeletesStart`}),` and `,_jsx(_components.code,{children:`trackDeletesEnd`}),` are tracked.`]}),`\n`,_jsxs(_components.li,{children:[`When `,_jsx(_components.code,{children:`trackDeletesEnd`}),` is called, Nango compares what existed before `,_jsx(_components.code,{children:`trackDeletesStart`}),` with what was saved in the window.`]}),`\n`,_jsxs(_components.li,{children:[`Any records missing from the new dataset are marked as deleted (soft delete). They remain accessible from the Nango cache, but with `,_jsx(_components.code,{children:`record._metadata.deleted === true`}),`.`]}),`\n`]}),`\n`,_jsxs(Warning,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Be careful with exception handling when using`}),` `,_jsx(_components.code,{children:`trackDeletesStart`}),`/`,_jsx(_components.code,{children:`trackDeletesEnd`})]}),_jsx(_components.p,{children:`Nango only performs deletion detection (the “diff”) if a sync run completes successfully without any uncaught exceptions.`}),_jsx(_components.p,{children:`Exception handling is critical:`}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`If your sync doesn’t fetch the full dataset between the two calls (e.g. you catch and swallow an exception), Nango will attempt the diff on an incomplete dataset.`}),`\n`,_jsx(_components.li,{children:`This leads to false positives, where valid records are mistakenly considered deleted.`}),`\n`]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`What You Should Do`})}),_jsxs(_components.p,{children:[`If a failure prevents full data retrieval, make sure the sync run fails and `,_jsx(_components.code,{children:`trackDeletesEnd`}),` is not being called:`]}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Let exceptions bubble up and interrupt the run.`}),`\n`,_jsxs(_components.li,{children:[`If you’re using `,_jsx(_components.code,{children:`try/catch`}),`, re-throw exceptions that indicate incomplete data.`]}),`\n`]})]}),`\n`,_jsxs(Tip,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`How to use`}),` `,_jsx(_components.code,{children:`trackDeletesStart`}),`/`,_jsx(_components.code,{children:`trackDeletesEnd`}),` `,_jsx(_components.strong,{children:`safely`})]}),_jsx(_components.p,{children:`If some records are incorrectly marked as deleted, you can trigger a full resync (via the UI or API) to restore the correct data state.`}),_jsx(_components.p,{children:`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.`})]}),`\n`,_jsx(Heading,{level:`2`,id:`troubleshooting-deletion-detection-issues`,children:`Troubleshooting deletion detection issues`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Symptom`}),_jsx(_components.th,{children:`Likely cause`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`Records that still exist in the source API are shown as `,_jsx(_components.code,{children:`deleted`}),` in Nango`]}),_jsxs(_components.td,{children:[`Sync didn’t save all records (silent failures) between `,_jsx(_components.code,{children:`trackDeletesStart`}),` and `,_jsx(_components.code,{children:`trackDeletesEnd`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`You never see deleted records`}),_jsx(_components.td,{children:`Check if deletion detection is implemented for the sync.`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`related-guides`,children:`Related guides`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/guides/functions/syncs/sync-functions`,children:`Sync functions`}),` - implement full and incremental syncs.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/guides/functions/syncs/records-cache`,children:`Records cache`}),` - understand how deleted records are exposed to your app.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/guides/functions/syncs/sync-efficiency`,children:`Sync efficiency`}),` - reduce API work during delete detection.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/reference/functions/functions-sdk#delete-records`,children:`Functions SDK reference`}),` - deletion helper methods.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Deletion detection","sidebarTitle":"Deletion detection","description":"Surface deletes from the external API — even when the API itself doesn't expose them cleanly.","href":"/guides/functions/syncs/deletion-detection"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Detecting deletes in incremental syncs","slug":"detecting-deletes-in-incremental-syncs","depth":2,"children":[{"title":"When can you use this?","slug":"when-can-you-use-this","depth":3,"children":[]},{"title":"Example","slug":"example","depth":3,"children":[]}]},{"title":"Detecting deletes in full syncs","slug":"detecting-deletes-in-full-syncs","depth":2,"children":[{"title":"Example","slug":"example-2","depth":3,"children":[]},{"title":"How the algorithm works","slug":"how-the-algorithm-works","depth":3,"children":[]}]},{"title":"Troubleshooting deletion detection issues","slug":"troubleshooting-deletion-detection-issues","depth":2,"children":[]},{"title":"Related guides","slug":"related-guides","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/nango/66b2950062f9d11d/custom.js"],"subdomain":"nango","siteName":"Nango Docs","title":"Deletion detection - Nango Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-05-04T07:13:53.893Z","originalFileLocation":"guides/functions/syncs/deletion-detection.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Surface deletes from the external API — even when the API itself doesn\u0026#x27;t expose them cleanly.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Nango Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/nango/H6v9PP50zUaxkdQK/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/nango/H6v9PP50zUaxkdQK/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/nango/H6v9PP50zUaxkdQK/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/nango/H6v9PP50zUaxkdQK/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/nango/H6v9PP50zUaxkdQK/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/nango/H6v9PP50zUaxkdQK/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/nango/H6v9PP50zUaxkdQK/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/nango/H6v9PP50zUaxkdQK/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/nango/H6v9PP50zUaxkdQK/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Deletion detection - Nango Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Surface deletes from the external API — even when the API itself doesn\u0026#x27;t expose them cleanly.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Nango Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://nango.dev/docs/guides/functions/syncs/deletion-detection\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://nango.mintlify.app/_mintlify/api/og/v2?division=Sync+functions\u0026amp;title=Deletion+detection\u0026amp;description=Surface+deletes+from+the+external+API+%E2%80%94+even+when+the+API+itself+doesn%27t+expose+them+cleanly.\u0026amp;theme=79d4473b17677a097a22660e\u0026amp;signature=0ace1535d1d39924aa8361b9a48c2f66582283451f3fcc15dfb9df905d61c51b\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Deletion detection - Nango Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Surface deletes from the external API — even when the API itself doesn\u0026#x27;t expose them cleanly.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://nango.mintlify.app/_mintlify/api/og/v2?division=Sync+functions\u0026amp;title=Deletion+detection\u0026amp;description=Surface+deletes+from+the+external+API+%E2%80%94+even+when+the+API+itself+doesn%27t+expose+them+cleanly.\u0026amp;theme=79d4473b17677a097a22660e\u0026amp;signature=0ace1535d1d39924aa8361b9a48c2f66582283451f3fcc15dfb9df905d61c51b\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/nango/H6v9PP50zUaxkdQK/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Nango Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#29abe2\">\u003clink data-mint-head rel=\"canonical\" href=\"https://nango.dev/docs/guides/functions/syncs/deletion-detection\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/guides/functions/syncs/deletion-detection.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://nango.dev/#organization\",\"name\":\"Nango Docs\",\"url\":\"https://nango.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/nango/h2zzveDlAs05T6zr/images/Nango-Light-Mode.svg?fit=max\u0026auto=format\u0026n=h2zzveDlAs05T6zr\u0026q=85\u0026s=0c2845b2219705011e11ef4985aa9d91\"}},{\"@type\":\"WebSite\",\"@id\":\"https://nango.dev/docs#website\",\"name\":\"Nango Docs\",\"url\":\"https://nango.dev/docs\",\"publisher\":{\"@id\":\"https://nango.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://nango.dev/docs/guides/functions/syncs/deletion-detection#webpage\",\"url\":\"https://nango.dev/docs/guides/functions/syncs/deletion-detection\",\"name\":\"Deletion detection\",\"description\":\"Surface deletes from the external API — even when the API itself doesn't expose them cleanly.\",\"dateModified\":\"2026-05-04T07:13:53.893Z\",\"isPartOf\":{\"@id\":\"https://nango.dev/docs#website\"},\"breadcrumb\":{\"@id\":\"https://nango.dev/docs/guides/functions/syncs/deletion-detection#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://nango.dev/docs/guides/functions/syncs/deletion-detection#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Guides\",\"item\":\"https://nango.dev/docs/guides/auth/auth-guide\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Functions\",\"item\":\"https://nango.dev/docs/guides/functions/functions-guide\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Sync functions\",\"item\":\"https://nango.dev/docs/guides/functions/syncs/sync-functions\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Deletion detection\",\"item\":\"https://nango.dev/docs/guides/functions/syncs/deletion-detection\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://nango.dev/docs/guides/functions/syncs/deletion-detection#article\",\"headline\":\"Deletion detection\",\"name\":\"Deletion detection\",\"description\":\"Surface deletes from the external API — even when the API itself doesn't expose them cleanly.\",\"url\":\"https://nango.dev/docs/guides/functions/syncs/deletion-detection\",\"mainEntityOfPage\":{\"@id\":\"https://nango.dev/docs/guides/functions/syncs/deletion-detection#webpage\"},\"dateModified\":\"2026-05-04T07:13:53.893Z\",\"publisher\":{\"@id\":\"https://nango.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://nango.dev/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Nango Docs\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Nango Docs","nav":{"global":null,"tabs":[{"tab":"Documentation","icon":"book-open","groups":[{"group":"Getting started","pages":[{"title":"Introduction","sidebarTitle":"Introduction","href":"/getting-started/intro-to-nango"},{"title":"Quickstart","sidebarTitle":"🚀 Quickstart","href":"/getting-started/quickstart"},{"title":"Coding agent setup","sidebarTitle":"✨ Coding agent setup","href":"/getting-started/coding-agent-setup"},{"group":"Use cases","expanded":false,"pages":[{"title":"Tool calling for AI agents","sidebarTitle":"Tool calling for AI agents","href":"/getting-started/use-cases/tool-calling"},{"title":"Sync external API data","sidebarTitle":"Sync external API data","href":"/getting-started/use-cases/syncs"},{"title":"Run external API operations","sidebarTitle":"Run external API operations","href":"/getting-started/use-cases/actions"},{"title":"Process external webhooks","sidebarTitle":"Process external webhooks","href":"/getting-started/use-cases/webhooks-from-external-apis"},{"title":"Build a unified API","sidebarTitle":"Build a unified API","href":"/getting-started/use-cases/unified-apis"},{"title":"Customize per customer","sidebarTitle":"Customize per customer","href":"/getting-started/use-cases/customer-configuration"},{"title":"React to connection lifecycle events","sidebarTitle":"Connection lifecycle events","href":"/getting-started/use-cases/implement-event-handler"},{"title":"Sample app","sidebarTitle":"Sample app","href":"/getting-started/use-cases/sample-app"}]}]},{"group":"Guides","pages":[{"group":"Auth","expanded":false,"pages":[{"title":"Auth guide","sidebarTitle":"Auth guide","href":"/guides/auth/auth-guide"},{"title":"Share a connect link","sidebarTitle":"Share a connect link","href":"/guides/auth/share-connect-link"},{"title":"Connection tags, configuration, and metadata","sidebarTitle":"Tags, configuration \u0026 metadata","href":"/guides/auth/connection-tags-configuration-metadata"},{"title":"Customize Connect UI","sidebarTitle":"Customize Connect UI","href":"/guides/auth/customize-connect-ui"},{"title":"Token refreshing \u0026 validity","sidebarTitle":"Token refreshing \u0026 validity","href":"/guides/auth/token-refreshing"},{"title":"MCP Auth","sidebarTitle":"MCP Auth","href":"/guides/auth/mcp-auth"}]},{"title":"Agent sessions","sidebarTitle":"Agent sessions","href":"/guides/agent-sessions"},{"group":"Functions","expanded":false,"pages":[{"title":"Functions guide","sidebarTitle":"Functions guide","href":"/guides/functions/functions-guide"},{"group":"Sync functions","pages":[{"title":"Sync function guide","sidebarTitle":"Sync function guide","href":"/guides/functions/syncs/sync-functions"},{"title":"Sync efficiency","sidebarTitle":"Sync efficiency","href":"/guides/functions/syncs/sync-efficiency"},{"title":"Checkpoints","sidebarTitle":"Checkpoints","href":"/guides/functions/syncs/checkpoints"},{"title":"Records cache","sidebarTitle":"Records cache","description":"How Nango stores synced records, detects changes, and lets your app fetch deltas via cursors.","href":"/guides/functions/syncs/records-cache"},{"title":"Deletion detection","sidebarTitle":"Deletion detection","href":"/guides/functions/syncs/deletion-detection"},{"title":"Real-time syncs with webhooks","sidebarTitle":"Real-time syncs","description":"Combine webhooks from external APIs with periodic polling for a reliable, real-time stream of changes.","href":"/guides/functions/syncs/realtime-syncs"},{"title":"Sync partitioning","sidebarTitle":"Sync partitioning","href":"/guides/functions/syncs/sync-partitioning"}]},{"title":"Action functions","sidebarTitle":"Action functions","href":"/guides/functions/action-functions"},{"title":"Webhook functions","sidebarTitle":"Webhook functions","href":"/guides/functions/webhook-functions"},{"title":"Event functions","sidebarTitle":"Event functions","href":"/guides/functions/event-functions"},{"title":"Storage","sidebarTitle":"Storage","href":"/guides/functions/storage"},{"title":"Function logging","sidebarTitle":"Logging","href":"/guides/functions/logging"},{"title":"Rate limits","sidebarTitle":"Rate limits","href":"/guides/functions/rate-limits"},{"title":"Data validation","sidebarTitle":"Data validation","href":"/guides/functions/data-validation"},{"title":"Testing integrations","sidebarTitle":"Testing","href":"/guides/functions/testing"},{"title":"CI/CD for Nango Functions","sidebarTitle":"CI/CD","href":"/guides/functions/ci-cd"},{"title":"Unified APIs with functions","sidebarTitle":"Unified APIs","href":"/guides/functions/unified-apis"}]},{"group":"Platform","expanded":false,"pages":[{"title":"Observability","sidebarTitle":"Observability","href":"/guides/platform/observability"},{"title":"Environments","sidebarTitle":"Environments","href":"/guides/platform/environments"},{"title":"Limits","sidebarTitle":"Limits","href":"/guides/platform/limits"},{"title":"Security","sidebarTitle":"Security","href":"/guides/platform/security"},{"title":"Audit trail","sidebarTitle":"Audit trail","href":"/guides/platform/audit-trail"},{"title":"Proxy requests","sidebarTitle":"Proxy requests","href":"/guides/platform/proxy-requests"},{"title":"Receive webhooks from Nango","sidebarTitle":"Webhooks from Nango","href":"/guides/platform/webhooks-from-nango"},{"title":"External webhook forwarding","sidebarTitle":"External webhook forwarding","href":"/guides/platform/webhook-forwarding"},{"title":"Common issues","sidebarTitle":"Common issues","href":"/guides/platform/common-issues"},{"group":"Self-Hosting","pages":[{"title":"Self-host Nango","sidebarTitle":"Overview","href":"/guides/platform/self-hosting/self-hosting"},{"title":"BYOC","sidebarTitle":"BYOC","href":"/guides/platform/self-hosting/byoc"},{"title":"Self-Managed","sidebarTitle":"Self-Managed","href":"/guides/platform/self-hosting/self-managed"}]},{"group":"Migrations","pages":[{"title":"Migrate to checkpoints","sidebarTitle":"Migrate to checkpoints","href":"/guides/platform/migrations/migrate-to-checkpoints"},{"title":"Migrate from end user","sidebarTitle":"Migrate from end user","href":"/guides/platform/migrations/migrate-from-end-user"},{"title":"Migrate from public key","sidebarTitle":"Migrate from public key","href":"/guides/platform/migrations/migrate-from-public-key"},{"title":"Migrate from Connection MCP to agent sessions","sidebarTitle":"Migrate from Connection MCP","href":"/guides/platform/migrations/migrate-from-connection-mcp"},{"title":"Migrating to Zero YAML","sidebarTitle":"Migrating to Zero YAML","href":"/guides/platform/migrations/migrate-to-zero-yaml"}]},{"title":"Contributing to Nango","sidebarTitle":"Contributing","href":"/contributing"}]}]},{"group":"Reference","pages":[{"group":"Frontend","pages":[{"title":"Frontend SDK","sidebarTitle":"Frontend SDK","icon":"js","href":"/reference/frontend/frontend-sdk"}]},{"group":"Backend","pages":[{"group":"HTTP API","icon":"cloud","pages":[{"title":"API keys","sidebarTitle":"API keys","href":"/reference/backend/http-api/api-keys"},{"title":"Authentication","href":"/reference/backend/http-api/authentication"},{"title":"Rate limits","href":"/reference/backend/http-api/rate-limits"},{"group":"Environments","pages":[{"title":"List environments","openapi":"GET /environments","href":"/reference/backend/http-api/environments/list"},{"title":"Get an environment","openapi":"GET /environments/{environmentUuid}","href":"/reference/backend/http-api/environments/get"},{"title":"Create an environment","openapi":"POST /environments","href":"/reference/backend/http-api/environments/create"},{"title":"Delete an environment","openapi":"DELETE /environments/{environmentUuid}","href":"/reference/backend/http-api/environments/delete"},{"title":"List environment API keys","openapi":"GET /environments/{environmentUuid}/api-keys","href":"/reference/backend/http-api/environments/list-api-keys"},{"title":"Get an environment API key","openapi":"GET /environments/{environmentUuid}/api-keys/{keyUuid}","href":"/reference/backend/http-api/environments/get-api-key"},{"title":"Create an environment API key","openapi":"POST /environments/{environmentUuid}/api-keys","href":"/reference/backend/http-api/environments/create-api-key"},{"title":"Update an environment API key","openapi":"PATCH /environments/{environmentUuid}/api-keys/{keyUuid}","href":"/reference/backend/http-api/environments/update-api-key"},{"title":"Delete an environment API key","openapi":"DELETE /environments/{environmentUuid}/api-keys/{keyUuid}","href":"/reference/backend/http-api/environments/delete-api-key"},{"title":"Rotate the webhook signing key","openapi":"POST /environment/webhook-signing-key/rotate","href":"/reference/backend/http-api/environments/rotate-webhook-signing-key"}]},{"group":"Integrations","pages":[{"title":"List all integrations","openapi":"GET /integrations","href":"/reference/backend/http-api/integration/list"},{"title":"Get an integration","openapi":"GET /integrations/{uniqueKey}","href":"/reference/backend/http-api/integration/get"},{"title":"Create an integration","openapi":"POST /integrations","href":"/reference/backend/http-api/integration/create"},{"title":"Update an integration","openapi":"PATCH /integrations/{uniqueKey}","href":"/reference/backend/http-api/integration/update"},{"title":"Delete an integration","openapi":"DELETE /integrations/{uniqueKey}","href":"/reference/backend/http-api/integration/delete"}]},{"group":"Connect","pages":[{"title":"Create a connect session","openapi":"POST /connect/sessions","href":"/reference/backend/http-api/connect/sessions/create"},{"title":"Create a reconnect session","openapi":"POST /connect/sessions/reconnect","href":"/reference/backend/http-api/connect/sessions/reconnect"},{"title":"Get a connect session","openapi":"GET /connect/session","href":"/reference/backend/http-api/connect/session/get"},{"title":"Delete a connect session","openapi":"DELETE /connect/session","href":"/reference/backend/http-api/connect/session/delete"}]},{"group":"Connections","pages":[{"title":"Import a connection","openapi":"POST /connections","href":"/reference/backend/http-api/connections/post"},{"title":"List connections","openapi":"GET /connections","href":"/reference/backend/http-api/connections/list"},{"title":"Get connection \u0026 credentials","openapi":"GET /connections/{connectionId}","href":"/reference/backend/http-api/connections/get"},{"title":"Patch a connection","openapi":"PATCH /connections/{connectionId}","href":"/reference/backend/http-api/connections/patch"},{"title":"Set connection metadata","openapi":"POST /connections/metadata","href":"/reference/backend/http-api/connections/set-metadata"},{"title":"Edit connection metadata","openapi":"PATCH /connections/metadata","href":"/reference/backend/http-api/connections/update-metadata"},{"title":"Delete a connection","openapi":"DELETE /connections/{connectionId}","href":"/reference/backend/http-api/connections/delete"}]},{"group":"Functions","pages":[{"title":"List functions","openapi":"GET /integrations/{uniqueKey}/functions","href":"/reference/backend/http-api/functions/list"},{"title":"Get a function","openapi":"GET /integrations/{uniqueKey}/functions/{name}","href":"/reference/backend/http-api/functions/get"},{"title":"Get a function's source code","openapi":"GET /integrations/{uniqueKey}/functions/{name}/code","href":"/reference/backend/http-api/functions/code"},{"title":"Delete a function","openapi":"DELETE /integrations/{uniqueKey}/functions/{name}","href":"/reference/backend/http-api/functions/delete"},{"title":"Compile a function","openapi":"POST /functions/compile","href":"/reference/backend/http-api/functions/compile"},{"title":"Dry run a function","openapi":"POST /functions/dryruns","href":"/reference/backend/http-api/functions/dryruns-create"},{"title":"Get dry run results","openapi":"GET /functions/dryruns/{id}","href":"/reference/backend/http-api/functions/dryruns-get"},{"title":"Create a function deployment","openapi":"POST /functions/deployments","href":"/reference/backend/http-api/functions/deployments-create"},{"title":"Get a function deployment","openapi":"GET /functions/deployments/{id}","href":"/reference/backend/http-api/functions/deployments-get"},{"title":"Get integration functions config","openapi":"GET /scripts/config","href":"/reference/backend/http-api/scripts/config"}]},{"group":"Syncs","pages":[{"title":"Get records","sidebarTitle":"Get records","openapi":"GET /records","href":"/reference/backend/http-api/sync/records-list"},{"title":"Prune records","sidebarTitle":"Prune records","openapi":"PATCH /records/prune","href":"/reference/backend/http-api/sync/prune-records"},{"title":"Trigger sync(s)","openapi":"POST /sync/trigger","href":"/reference/backend/http-api/sync/trigger"},{"title":"Start sync(s)","openapi":"POST /sync/start","href":"/reference/backend/http-api/sync/start"},{"title":"Pause sync(s)","openapi":"POST /sync/pause","href":"/reference/backend/http-api/sync/pause"},{"title":"Sync status","openapi":"GET /sync/status","href":"/reference/backend/http-api/sync/status"},{"title":"Override sync connection frequency","openapi":"PUT /sync/update-connection-frequency","href":"/reference/backend/http-api/sync/update-connection-frequency"},{"title":"Get environment variables","openapi":"GET /environment-variables","href":"/reference/backend/http-api/sync/environment-variables"},{"title":"Create sync variant","sidebarTitle":"Create variant","openapi":"POST /sync/{name}/variant/{variant}","href":"/reference/backend/http-api/sync/create-variant"},{"title":"Delete sync variant","sidebarTitle":"Delete variant","openapi":"DELETE /sync/{name}/variant/{variant}","href":"/reference/backend/http-api/sync/delete-variant"}]},{"group":"Actions","pages":[{"title":"Trigger an action","openapi":"POST /action/trigger","href":"/reference/backend/http-api/action/trigger"}]},{"group":"Proxy","pages":[{"title":"Proxy - GET requests","sidebarTitle":"Proxy - GET requests","openapi":"GET /proxy/{anyPath}","href":"/reference/backend/http-api/proxy/get"},{"title":"Proxy - POST requests","sidebarTitle":"Proxy - POST requests","openapi":"POST /proxy/{anyPath}","href":"/reference/backend/http-api/proxy/post"},{"title":"Proxy - PUT requests","sidebarTitle":"Proxy - PUT requests","openapi":"PUT /proxy/{anyPath}","href":"/reference/backend/http-api/proxy/put"},{"title":"Proxy - PATCH requests","sidebarTitle":"Proxy - PATCH requests","openapi":"PATCH /proxy/{anyPath}","href":"/reference/backend/http-api/proxy/patch"},{"title":"Proxy - DELETE requests","sidebarTitle":"Proxy - DELETE requests","openapi":"DELETE /proxy/{anyPath}","href":"/reference/backend/http-api/proxy/delete"}]},{"group":"Providers","pages":[{"title":"List all providers","openapi":"GET /providers","href":"/reference/backend/http-api/providers/list"},{"title":"Get a provider","openapi":"GET /providers/{provider}","href":"/reference/backend/http-api/providers/get"},{"title":"List provider templates","openapi":"GET /providers/{provider}/templates","href":"/reference/backend/http-api/providers/templates"}]}]},{"group":"Backend SDK","icon":"cubes","pages":[{"title":"Node","sidebarTitle":"Node","icon":"node","href":"/reference/backend/backend-sdk/node"},{"title":"Python","sidebarTitle":"Python","icon":"python","href":"/reference/backend/backend-sdk/python"},{"title":"Java","sidebarTitle":"Java","icon":"java","href":"/reference/backend/backend-sdk/java"},{"title":"Ruby","sidebarTitle":"Ruby","icon":"gem","href":"/reference/backend/backend-sdk/ruby"},{"title":"Go","sidebarTitle":"Go","icon":"golang","href":"/reference/backend/backend-sdk/go"},{"title":"Rust","sidebarTitle":"Rust","icon":"rust","href":"/reference/backend/backend-sdk/rust"},{"title":"PHP","sidebarTitle":"PHP","icon":"php","href":"/reference/backend/backend-sdk/php"}]},{"title":"Management MCP","sidebarTitle":"Management MCP","icon":"https://mintlify.s3.us-west-1.amazonaws.com/nango/images/mcp.svg","href":"/reference/backend/management-mcp"}]},{"group":"Functions","pages":[{"title":"Functions CLI","sidebarTitle":"Functions CLI","icon":"terminal","href":"/reference/functions/functions-cli"},{"title":"Functions SDK","sidebarTitle":"Functions SDK","icon":"code","href":"/reference/functions/functions-sdk"}]}]}]},{"tab":"APIs \u0026 Integrations","icon":"plug","pages":[{"title":"APIs \u0026 Integrations","href":"/integrations/overview"}]},{"tab":"Changelog","icon":"bolt","pages":[{"title":"Changelog","href":"/updates/changelog"}]},{"tab":"Support","icon":"slack","href":"https://nango.dev/slack"}]},"title":"Deletion detection - Nango Docs","buildId":"dpl_EARnBX9sYeZdmtDtdMETnj8cZgAL","deploymentId":"dpl_EARnBX9sYeZdmtDtdMETnj8cZgAL","dynamics":[],"chunks":[]}