vM.

How to Sync Data Between Two Business Applications Using APIs

Author
Vishal Maurya
Published on
Reading time
2 min read

Overview

Synchronizing two systems is easy when nothing fails and records never change. Real integrations must handle timeouts, duplicate events, deletions, schema changes, and updates that happen in both systems. Start by deciding which system owns each field.

Define the direction of synchronization for every entity and field. If both systems can edit the same field, specify a conflict policy such as source-of-truth priority, version checks, or a human review queue. Avoid vague “two-way sync” requirements.

Make synchronization recoverable

  1. Define canonical identifiers and field ownership.
  2. Prefer provider webhooks for timely changes, with periodic reconciliation as a safety net.
  3. Use cursors, timestamps, or version numbers to resume incremental syncs.
  4. Deduplicate events and make writes idempotent.
  5. Handle rate limits with backoff and persist checkpoints only after successful processing.
  6. Monitor lag, rejected records, conflicts, and records that repeatedly fail.

Example: a concrete starting point

def apply_change(change, repository):
    # change_id is stable across retries.
    if repository.was_applied(change.change_id):
        return
    with repository.transaction():
        current = repository.get(change.external_id)
        if current and current.version > change.version:
            repository.record_conflict(change, current)
            return
        repository.upsert(change.external_id, change.payload, version=change.version)
        repository.mark_applied(change.change_id)

The example illustrates the boundary and validation pattern; adapt names, persistence, error handling, and provider-specific details to your application. It is not a complete production system by itself.

Failure cases to test

Timestamp-only sync can miss updates when clocks differ or multiple changes share a timestamp. Deletion needs explicit tombstone or reconciliation behavior. Never assume an API page is complete until pagination and rate-limit behavior are handled.

Before release, test the happy path, invalid input, missing permissions, dependency failure, and a retry or duplicate request where relevant. Record expected behavior so the implementation can be reviewed against the real business requirement.

When to bring in a developer

I can design and implement API-based synchronization between CRM, finance, inventory, and internal systems with retries and reconciliation.

Conclusion

The reliable version of this feature is not just the happy-path demo. It makes ownership, validation, authorization, failure handling, and operational behavior explicit. Start with the smallest useful workflow, measure it against real data, and expand only when the next requirement is clear.

Additional Resources

  • www.rfc-editor.org
  • docs.celeryq.dev