Skip to main content
Learn how to track sync status, handle errors, and retry failed syncs.

Overview

When you create an expense, bill, or invoice, Sync2Books automatically queues it for sync to your connected accounting system. This guide shows you how to monitor the sync process and handle any issues.

Sync Lifecycle

Getting Sync Batch Status

After creating expenses, you receive a syncBatchId. Use this to check the sync status:

Endpoint

Request

Response

Batch Status Values

Item Status Values

Listing Sync Batches

Get All Batches for a Company

Query Parameters

  • page (number, default: 1) - Page number
  • limit (number, default: 20) - Items per page
  • status (string, optional) - Filter by status: pending, processing, completed, failed
  • startDate (string, optional) - Filter batches from this date (ISO 8601)
  • endDate (string, optional) - Filter batches until this date (ISO 8601)

Example

Response

Handling Failed Syncs

Get Failed Items

Example

Response

Retry Failed Items

Request Body

If itemIds is empty or omitted, all failed items will be retried.

Example

Response

Polling Strategy

For real-time status updates, poll the sync batch status:
  1. Initial Poll: Wait 2 seconds after creating expense
  2. Poll Interval: Check every 2-3 seconds
  3. Timeout: Stop polling after 60 seconds (syncs typically complete in 5-15 seconds)
  4. Exponential Backoff: If status is processing, increase interval slightly

Example Implementation (JavaScript)

Webhooks (Coming Soon)

Instead of polling, you can configure webhooks to receive real-time notifications when syncs complete. Contact support for early access.

Common Error Messages

Best Practices

  1. Always check sync status - Don’t assume syncs succeed immediately
  2. Implement retry logic - Handle transient failures gracefully
  3. Log sync errors - Track failed syncs for debugging
  4. Monitor batch completion - Set up alerts for high failure rates
  5. Use webhooks when available - More efficient than polling

Next Steps