Skip to main content

Provider GL Sync Estimate

GET 

/api/ledger/reconciliation/inventory/sync-estimate

A pre-flight, zero-API estimate for the unified provider GL sync (Lane 2): how many Xero calls the operation would cost for the chosen window against how many remain in today's API budget, so the user can weigh it before spending any of it. Computed locally from the cached journal cadence (distinct journals over their date span) plus the one Trial Balance anchor call — it makes no calls to the provider.

Authorization

Any valid API token can call this endpoint — no specific scope required. Manage tokens.

Authentication: Requires Bearer token.

Query parameters:

  • connection_id (integer, required): accounting connection id whose journals/budget are estimated.
  • from (date, optional): window start (Y-m-d). Clamped up to the Inventory Start Date — an earlier value never lowers the window below the opening-balance anchor. Defaults to the Inventory Start Date.
  • to (date, optional, after_or_equal:from): window end (Y-m-d). Defaults to today.

Response (data):

  • can_sync (boolean): false when the Inventory Start Date is unset (no lower bound to anchor against); reason explains why.
  • reason (string|null): why the sync can't run, when can_sync is false.
  • cadence_known (boolean): false on a first-ever sync (nothing cached to extrapolate from) — then estimated_calls is null.
  • estimated_calls (integer|null): total projected Xero calls (pages + probes + anchor). Null when cadence is unknown.
  • estimated_pages (integer|null): projected forward Journals pages (incl. the terminating empty page).
  • estimated_probe_calls (integer): binary-search probe calls to locate a start offset below the cache (0 when resuming above the cache or from empty).
  • anchor_calls (integer): 0 or 1 — the metered Trial Balance call, charged only when no anchor has been captured for the opening day yet.
  • journals_per_day (number|null): the cached cadence the page count is extrapolated from.
  • daily_remaining (integer|null): Xero calls left in today's budget (from the connection's tracked usage; null if not tracked yet).
  • daily_limit (integer): Xero's per-organisation daily API cap (5000).
  • daily_reset_at (string|null): ISO8601 timestamp when the daily budget resets.
  • over_budget (boolean): true when estimated_calls exceeds daily_remaining.
  • inventory_start_date (string|null): Y-m-d lower bound of the window.
  • window_from (string|null): Y-m-d clamped window start actually estimated.
  • window_to (string): Y-m-d window end actually estimated.
  • cached_from / cached_to (string|null): Y-m-d span of journals already cached.

Request

Responses

OK

Response Headers
    Content-Type