Match every record on a stored source ID so each write is an update-or-insert, send batches throttled below the target’s rate limit, and approve a dry-run reconciliation report first. A backfill of a few hundred thousand records usually takes one to four weeks; Smplfy builds it at $85 an hour or fixed from $1,500.
How do I backfill years of historical records without creating duplicates or hitting API limits?
Is this a one-time migration or a backfill for an ongoing sync?
Decide this first, because it changes how the matching key is stored and how long the code has to live. A one-time migration moves history once and the old system is retired. A backfill seeds a new sync with history, then the same code keeps both systems in step afterwards.
| Attribute | One-time migration | Backfill plus ongoing sync |
|---|---|---|
| Old system after | Archived or shut off | Stays live |
| Matching key | Needed during the load, can be kept for audit | Must be stored permanently on both sides |
| Cutover | A freeze window, often a weekend | No freeze; the sync picks up where the backfill stops |
| What breaks first | Records edited in the old system during the load | New records created by both the backfill and the live sync |
| Code lifespan | Run once, kept for reruns | Maintained for as long as the sync runs |
The most common duplicate source in a backfill-plus-sync is the overlap: the live sync starts on Monday, the backfill finishes on Wednesday, and both create the same Tuesday invoice. Run both through the same upsert logic on the same key and the overlap stops mattering.
How matching keys prevent duplicates
Duplicates appear when a load matches on name or email, or does not match at all and creates every row. The fix is to write the source system’s own record ID into a field on the target and match on that field every time.
- Salesforce: create a custom field marked as an External ID and use upsert against it, so the API updates the record if it exists and creates it if not.
- HubSpot: a custom property can be set to require unique values; store the source ID there and search on it before writing.
- QuickBooks Online: there is no upsert on your own key, so keep a mapping table of source ID to QuickBooks ID and check it before every create.
Records already in the target with no source ID need a fallback rule: email for contacts, normalized company name plus postal code for accounts. Fallback matches go to a review list rather than being merged automatically, because a wrong merge is harder to undo than a duplicate.
Load parents before children: companies, then contacts, then deals, then invoices and payments. A payment that arrives before its customer exists either fails or creates an orphan, and orphans are the duplicates nobody finds for months. We built this pattern for Fundz: a HubSpot, Salesforce and Gmail connector framework with OAuth, incremental sync, deduplication and rate-limit handling across tenants.
Batching without hitting API limits: a worked example
Raw throughput is rarely the problem. Daily caps, shared limits and partial failures are. Here is the arithmetic for an illustrative load; the limit numbers are placeholders, so check your vendor’s published limits before planning.
| Step | Figure |
|---|---|
| Records to load (eight years) | 22,000 customers + 180,000 invoices = 202,000 |
| Batch endpoint size | 100 records per call |
| API calls needed | 2,020 |
| Assumed limit | 100 calls per 10 seconds |
| Backfill throttled to | 8 calls per 10 seconds, leaving headroom for live traffic |
| Run time | About 42 minutes |
The run takes under an hour; getting it right takes weeks. The time goes into the handling around each batch:
- Throttle well below the limit. The rate limit is shared with every other integration on the account, so a backfill at full speed can stall your live syncs.
- Back off on a `429` response. Wait for the time in the
Retry-Afterheader if the API sends one, then retry the same batch. - Handle partial batches. Many batch endpoints accept 97 of 100 records and reject three; log the three with the error and continue.
- Checkpoint. Record the last batch that succeeded so a crash at batch 1,400 resumes at 1,401 instead of starting over.
- Watch daily caps. Some platforms cap calls per 24 hours; a large load may need to run across several nights.
The dry-run reconciliation report
Before anything is written, run the whole backfill in read-only mode and produce a report someone on your team signs off. It should show:
- Counts per object in the source, and how many would be created, updated or skipped in the target.
- How each record matched: by stored ID, by fallback rule, or no match.
- Records that would fail validation, such as a missing required field or a picklist value the target does not accept.
- Children with no parent, listed by source ID.
- Control totals: invoice amounts and payment amounts by year, source against target.
After the real run, produce the same report against what was actually written. If eight years of invoice totals match to the cent and the counts agree, the backfill is done. If they do not, the report shows exactly which records to look at.
Typical timelines and cost
These are general ranges for calendar time from start to signed-off reconciliation, not quotes.
| Scope | Typical time | What moves it |
|---|---|---|
| One object, no relationships, clean data | A few days to one week | Data cleanup needed before import |
| Several related objects, one-time migration | One to three weeks | Number of objects and custom fields to map |
| Backfill plus ongoing two-system sync | Two to four weeks or more | Two-way writes, conflict rules, daily API caps |
Smplfy charges $85 an hour, or a fixed price from $1,500. A typical two-system integration runs $1,500–$6,000; the top of that range is when custom fields need mapping rules and the error handling has to cover partial failures and retries.
When to do it yourself, hire it out, or skip it
- Use the vendor’s import tool (HubSpot’s import, Salesforce Data Import Wizard or Data Loader) when it is one or two objects, the data is clean, and no sync follows.
- Have it built in code when several related objects move, a sync runs afterwards, or financial totals must reconcile to the cent.
- Do not backfill everything. If nobody opens records older than two years, export the full history to a read-only archive and load only open records and recent years. That is often the cheapest correct answer.
Frequently asked questions
Can I just use the CSV import built into my CRM?
Yes, for one or two objects with clean data and no ongoing sync. Native imports struggle with parent-child relationships, records already in the target, and reruns after a partial failure. Once a sync follows the backfill, the same matching logic should drive both.
How many years of history should I backfill?
Load what your team actually opens and what reporting needs, often open records plus the last two or three years. Older history can go to a read-only archive export. Each extra year adds records to map, validate and reconcile.
What happens if the backfill fails halfway through?
With checkpointing and upserts on a stored source ID, you restart from the last successful batch and nothing duplicates. Records that were already written are updated in place rather than created again. Without those two things, a halfway failure usually means deleting and starting over.
Will a backfill slow down our live integrations?
It can, because most platforms share one rate limit across every integration on the account. Throttle the backfill to a fraction of the limit and run large loads overnight. Watch for daily call caps, which can split a big load across several nights.
What if the first project doesn’t work out?
The first project has a fixed scope, and you read a written scope before committing. A retainer starts only if you choose one. Charlie scopes every project and makes the architecture calls, and Smplfy’s own engineers build it.
Want a scoped estimate for your backfill?
Tell us which systems are involved, roughly how many records and years per object, and what is manual today. We’ll send a free short written scope or set up a 20-minute call. Start a conversation.