← All articles

Detect changes for incremental sync

Use two calls when you keep a copy of Sage 50 data in another system. GET /api/sync/table-status tells you which parts of the company file Sage last changed. modifiedSince and activitySince on the sales and purchase lists return only the invoices that changed after a time you choose.

Prerequisites

Before you poll for changes, make sure you have:

Authentication

Pass your API key in the x-api-key request header:

x-api-key: YOUR_API_KEY

See which areas changed

GET /api/sync/table-status

Each row is one tracked part of the company file:

Field Meaning
area Plain-language name, such as Sales invoices, Purchase invoices, Customers, or Vendors
tableName Sage internal table name. Unknown when the table is not mapped
lastChangedAt When Sage last recorded a change in this area
lastChangedByUserId Sage user id associated with that change

Compare lastChangedAt for Sales invoices or Purchase invoices with the timestamp of your last sync. If it is older, you can skip listing those invoices.

[
  {
    "area": "Sales invoices",
    "tableName": "tCusTr",
    "lastChangedAt": "2026-10-07T14:32:00",
    "lastChangedByUserId": "SYSADMIN"
  },
  {
    "area": "Purchase invoices",
    "tableName": "tVenTr",
    "lastChangedAt": "2026-10-06T09:15:00",
    "lastChangedByUserId": "SYSADMIN"
  }
]

List sales invoices that changed

GET /api/sales accepts the same filters as before, plus two change filters. Both values are date-times.

modifiedSince returns invoices whose content was edited on or after that time (amounts, lines, and so on). Applying a payment alone does not count.

activitySince returns invoices with any update on or after that time, including payments.

GET /api/sales?modifiedSince=2026-10-01T00:00:00
GET /api/sales?activitySince=2026-10-01T00:00:00&customerId=42

Each row includes lastModifiedAt and lastActivityAt with the same meaning as those filters. lastModifiedAt is when the invoice itself was last edited. lastActivityAt is when anything last changed, including payments.

You can combine these with customerId, paymentStatus, dateFrom, dateTo, invoiceNumber, and daysLateMin / daysLateMax. Use top (default 50, max 1000) and skip to page.

List purchase invoices that changed

GET /api/purchases uses the same two filters and returns the same two timestamps.

GET /api/purchases?modifiedSince=2026-10-01T00:00:00
GET /api/purchases?activitySince=2026-10-01T00:00:00&vendorId=17

modifiedSince ignores a payment that does not edit the invoice. activitySince includes payments. Other filters are vendorId, dateFrom, dateTo, and invoiceNumber.

Next steps