Most API integrations work in the first demo. Two apps, one script, data moves from A to B and everyone is happy. A few weeks later someone notices duplicate deals in the CRM, a batch of orders that never arrived, and nobody can say when it started.
I've spent around 15 years building large systems, a good part of it on fraud-decisioning platforms where a missed or duplicated event really matters. The integrations that lasted all had the same few pieces. None of them are clever. They are simply the parts that get skipped when an integration is built in an afternoon.
I recently built a small demo of these ideas on sample data: a sync that reads orders from a paginated API and writes them into a CRM. I'll use it as the running example.
Piece 1: Handle pagination and rate limits on purpose
Every real API pages its results and limits how fast you can call it. The script that "worked in testing" often read the first page and stopped, or hit a 429 on page two and crashed. Treat the next-page token as part of the contract, and treat a 429 as "wait and try again", not as a failure. In the demo, page two returned a 429 on the first attempt; the sync waited, retried and carried on.
Piece 2: Retry temporary failures, and only those
A 502 or 503 from the other side is usually temporary. Retrying with a growing delay (exponential backoff) fixes most of them without anyone noticing. A 400 or a validation error won't get better on retry, so don't loop on it. Cap the attempts, log every retry, and fail loudly when the cap is reached.
Piece 3: Make every write idempotent
This is the piece that prevents duplicates. Every record you write should carry a stable ID from the source system, and the write should be an upsert on that ID: create if new, update if changed, do nothing if identical. Then re-running the sync, after a crash halfway through or because someone clicked "run" twice, is always safe. In the demo, the second run created nothing new and updated only the one order that had changed upstream.
Piece 4: Validate, and send bad records somewhere visible
Source data is messy: an email that isn't an email, a negative total, a missing field. The two common mistakes are crashing the whole run on one bad record, or quietly skipping it. Better: check each record against simple rules, write the good ones, and put the bad ones on a review list with the reason. A person fixes them at the source and the next run picks them up. It's the same principle I use in FinMoment, my AI bookkeeping pipeline: anything uncertain goes to a review queue instead of being guessed.
Piece 5: End every run with a summary someone reads
An integration that fails silently is worse than none. Each run should produce one short message: records read, created, updated, unchanged, sent to review, and retries needed. Send it where the team already looks, email or chat. When the numbers look odd, someone notices the same day instead of a month later.
Where it runs
For most small jobs a scheduled script is enough. When the volume grows or the steps multiply, I put it on AWS Lambda, with Step Functions when there are several stages that each need their own retries. I've run both in production. Either way, the client owns the code and gets a short runbook.
The short version
Before you call an integration done, ask five questions. Does it read every page? Does it survive a 429 and a 503? Can I run it twice safely? Where do bad records go? How will I know it failed? If any answer is "not sure", that's the work that's left.
I build custom API integrations, AI document pipelines and Claude agents with human approval gates. If you'd like to see these ideas in a real product, I'm happy to walk you through FinMoment on a call. You can find me on Upwork: https://www.upwork.com/freelancers/~0146d40003db2cffd3
Top comments (0)