/api/v1/accounting/lightspeed-x/callback
auth: none (Lightspeed-initiated browser redirect)OAuth callback hit by the user's browser after Lightspeed consent; mounted without the JWT guard because no app session exists on this request. Validates `state` (single-use), exchanges `code` for the store identified by `domain_prefix`, and upserts the connection. Desktop User-Agents get a 302 to the web success/failure page; mobile User-Agents get a 200 HTML bridge page that opens the native deep link and falls back to the web URL. Failures never surface as an API error: the redirect carries a sanitised error code.
handlers: LightspeedXAuthController.callback
| name | required | default | description |
|---|---|---|---|
code querystring | no | — | Authorisation code returned by Lightspeed on success. |
state querystring | no | — | OAuth state issued by `/start`; an unknown, expired or reused value yields LIGHTSPEED_INVALID_STATE in the failure redirect. |
domain_prefix querystring | no | — | Store domain prefix Lightspeed appends to the redirect. |
error querystring | no | — | Set by Lightspeed when consent is denied or the flow fails; routes to the failure redirect. |
error_description querystring | no | — | Human-readable error from Lightspeed (logged only). |
redirecttext/html/api/v1/accounting/lightspeed-x/start
auth: jwt (administrator) + connector licence gate; 10/min rate limit (`open` bucket)Begin a Lightspeed X-Series OAuth2 authorisation flow (no PKCE — X-Series does not support it). Returns the authorisation URL for the user to open. The licence gate applies only when one is wired on the deployment.
handlers: LightspeedXAuthController.start
No parameters.
APIResponseDataObject<LightspeedXStartResponse>APIErrorAPIError/api/v1/accounting/lightspeed-x/status
auth: jwt (any authenticated member of the business)Connection summary: every active Lightspeed store connection (no tokens) with its store name, assigned location and connection-issue state, plus the outlet filter list, `autoFiscaliseInvoices`, `autoFiscaliseConnector` and `syncFromDate`.
handlers: LightspeedXAuthController.status
No parameters.
APIResponseDataObject<LightspeedXStatusResponse>APIError/api/v1/accounting/lightspeed-x/connections/:connectionId/sync
auth: jwt (administrator | view_invoices | submit_invoices)Manual "Sync Now" for ONE store. Pulls sales for the named connection (scope-checked against the business), persists new ones and dispatches auto-fiscalisation when enabled; advances the connection watermark. Replaces the former business-level `GET /accounting/lightspeed-x/sync`. The response message summarises `fetched`, `inserted`, `duplicates`, `voided` and any `jobIds`. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. `modifiedSince` / `dateTo` are validated (`YYYY-MM-DD` or ISO-8601 datetime). The finished run's `result` is the old synchronous body: `data` is now an empty list, `totalRows` the fetched count and `message` the counters string.
handlers: LightspeedXAuthController.sync
| name | required | default | description |
|---|---|---|---|
connectionId pathstring (uuid) | yes | — | Lightspeed connection id (one per connected store). |
modifiedSince querystring | no | — | Date bound forwarded to the sync as the invoice filter (bare `YYYY-MM-DD`). When omitted the backend resumes from its own watermark. |
dateTo querystring | no | — | Upper date bound forwarded to the sync as the invoice filter. |
APIResponseDataObject<BackgroundRunAcceptedDTO>APIErrorAPIErrorAPIError/api/v1/accounting/lightspeed-x/sync-all
auth: jwt (administrator | view_invoices | submit_invoices)Sync All for Lightspeed X: syncs the listed connections one after another in ONE background run, never two at once, so a multi-store backlog does not load the provider or the database in parallel. Each connection takes its own sync lock as it is reached; one already syncing is reported `skipped`, and one failing does not stop the rest. Replies `202 { runId }`; the finished run's `result` is an `APIResponseDataObject<SyncAllResultDTO>` whose `connections[]` hold each connection's status and the body its single Sync Now would have returned.
handlers: LightspeedXAuthController.syncAll
| name | required | default | description |
|---|---|---|---|
connectionIds bodyuuid[] (1-50) | yes | — | The connections to sync, in order. |
modifiedSince bodystring | no | — | Optional lower bound, same format as the single-connection sync. |
dateTo bodystring | no | — | Optional upper bound, same format as the single-connection sync. |
APIResponseDataObject<BackgroundRunAcceptedDTO>APIErrorAPIError/api/v1/accounting/lightspeed-x/connections/:connectionId/location
auth: jwt (administrator)Assign (or clear) the VSMS Location one connected store fiscalises under, so its invoices sign with that location's certificate. `locationId: null` clears the assignment. Assigning also back-fills `LocationId` on that store's already-synced invoices that have none (assign-only; clearing does not un-file history). Reconnecting a store preserves the assignment.
handlers: LightspeedXAuthController.setLocation
| name | required | default | description |
|---|---|---|---|
connectionId pathstring (uuid) | yes | — | Lightspeed connection id (one per connected store). |
locationId bodystring (uuid) | null | yes | — | Location to assign; `null` clears. Required — omission is rejected. |
APIResponseDataObject<LightspeedXConnectionSummary>APIErrorAPIErrorAPIErrorAPIError/api/v1/accounting/lightspeed-x/connections/:connectionId/outlets
auth: jwt (administrator)List the connection's outlets with each one's mapped VSMS Location (null = unmapped, which blocks its sales). Returns the union of live outlets and stored mappings, so a mapping whose outlet was deleted in Lightspeed stays visible, flagged inactive.
handlers: LightspeedXAuthController.listOutlets
| name | required | default | description |
|---|---|---|---|
connectionId pathstring (uuid) | yes | — | Lightspeed connection id (one per connected store). |
APIResponseDataList<object>APIErrorAPIErrorAPIError/api/v1/accounting/lightspeed-x/connections/:connectionId/outlets/:outletId/location
auth: jwt (administrator)Assign (or clear) the VSMS Location for ONE outlet. `locationId: null` clears the mapping, which BLOCKS that outlet's sales. Saves the mapping only; held invoices are released by `outlets/resync-blocked`. Refused while the outlet is rejected.
handlers: LightspeedXAuthController.setOutletLocation
| name | required | default | description |
|---|---|---|---|
connectionId pathstring (uuid) | yes | — | Lightspeed connection id (one per connected store). |
outletId pathstring | yes | — | Lightspeed's own outlet id (not validated as a UUID). |
locationId bodystring (uuid) | null | yes | — | Location to map; `null` clears. Required — omission is rejected. |
outletName bodystring | null | no | — | Outlet name as the caller sees it (max 255), stored as a display snapshot; never used for routing. |
emptyAPIErrorAPIErrorAPIErrorAPIError/api/v1/accounting/lightspeed-x/connections/:connectionId/outlets/:outletId/reject
auth: jwt (administrator)Decline a discovered outlet. A rejected outlet's sales are held exactly like an unmapped outlet's. Idempotent when already rejected.
handlers: LightspeedXAuthController.rejectOutlet
| name | required | default | description |
|---|---|---|---|
connectionId pathstring (uuid) | yes | — | Lightspeed connection id (one per connected store). |
outletId pathstring | yes | — | Lightspeed's own outlet id (not validated as a UUID). |
emptyAPIErrorAPIErrorAPIErrorAPIError/api/v1/accounting/lightspeed-x/connections/:connectionId/outlets/:outletId/accept
auth: jwt (administrator)Accept a previously rejected outlet, returning it to the normal mapping flow.
handlers: LightspeedXAuthController.acceptOutlet
| name | required | default | description |
|---|---|---|---|
connectionId pathstring (uuid) | yes | — | Lightspeed connection id (one per connected store). |
outletId pathstring | yes | — | Lightspeed's own outlet id (not validated as a UUID). |
emptyAPIErrorAPIErrorAPIError/api/v1/accounting/lightspeed-x/outlets/resync-blocked
auth: jwt (administrator)Business-wide: re-evaluate every Lightspeed invoice blocked by outlet-certificate routing (unmapped outlet or no usable certificate) and dispatch the ones the current mappings now allow. Mapping an outlet does not do this automatically. Audits `LIGHTSPEED_OUTLET_BLOCKED_RESYNCED`. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. The finished run's `result` is an `APIResponseDataObject` of the re-sync counts (`reprocessed`, `nowEligible`, `nowEligibleInvoices`, `nowEligibleQuotes`, `stillBlocked`, `autoFiscalisationJobIds`).
handlers: LightspeedXAuthController.resyncOutletBlocked
No parameters.
APIResponseDataObject<BackgroundRunAcceptedDTO>APIErrorAPIErrorAPIError/api/v1/accounting/lightspeed-x/register-tills
auth: jwt (administrator)This business's Lightspeed register-tills grouped under their outlet, for the Receipt Printers tab. Business-wide across all connected stores (receipt-printer scope is per connector).
handlers: LightspeedXAuthController.listRegisterTills
No parameters.
APIResponseDataList<object>APIError/api/v1/accounting/lightspeed-x/registers/sync
auth: jwt (administrator)Pull every active connection's registers and upsert one claimable print till per register. Business-wide. A register whose location resolves to nothing (outlet mapping, then the connection location, then the business default) is skipped and counted.
handlers: LightspeedXAuthController.syncRegisters
No parameters.
APIResponseDataObject<LightspeedRegisterSyncResult>APIError/api/v1/accounting/lightspeed-x/connections/:connectionId
auth: jwt (administrator)Disconnect ONE Lightspeed store: best-effort deregisters its `sale.update` webhook, then deactivates that connection. Per connection, never business-wide — a business may hold several stores.
handlers: LightspeedXAuthController.disconnect
| name | required | default | description |
|---|---|---|---|
connectionId pathstring (uuid) | yes | — | Lightspeed connection id (one per connected store). |
APIResponseDataObject<{ deactivatedCount: number }>APIErrorAPIError/api/v1/accounting/lightspeed-x/tax-mappings
auth: jwt (administrator)List all Lightspeed X-Series tax-type to V-SDC tax-label mappings for the business (active and inactive). Mappings are per business and shared across all of its connected stores.
handlers: LightspeedXTaxMappingsController.list
No parameters.
APIResponseDataList<TaxRateMappingDTO>APIError/api/v1/accounting/lightspeed-x/tax-mappings/auto-map
auth: jwt (administrator)Fetch the live Lightspeed tax rates and V-SDC `/status`, then return match suggestions. Does NOT persist mappings — the admin confirms each via PUT. Best-effort side effects: drift-checks confirmed mappings against the fetched rates and records never-seen codes as proposals under unmapped tax types; failures there never fail the response. Rate-limited (10/min open bucket).
handlers: LightspeedXTaxMappingsController.autoMap
No parameters.
APIResponseDataList<TaxRateMappingSuggestion>APIErrorAPIError/api/v1/accounting/lightspeed-x/tax-mappings
auth: jwt (administrator)Create or update one Lightspeed tax-type to V-SDC label mapping for the business.
handlers: LightspeedXTaxMappingsController.upsert
| name | required | default | description |
|---|---|---|---|
providerTaxType bodystring | yes | — | Lightspeed tax code. Trimmed, 1–100 chars. |
providerTaxName bodystring | null | no | — | Human-readable tax name (max 500). |
providerRate bodynumber | null | no | — | Lightspeed rate for display. |
vsdcTaxLabel bodystring | yes | — | Target V-SDC tax label. Trimmed, 1–10 chars. |
vsdcRate bodynumber | null | no | — | V-SDC rate for display. |
APIResponseDataObject<TaxRateMappingDTO>APIErrorAPIError/api/v1/accounting/lightspeed-x/tax-mappings/:providerTaxType
auth: jwt (administrator)Deactivate a Lightspeed tax mapping. The row is retained and can be re-activated via the restore endpoint.
handlers: LightspeedXTaxMappingsController.remove
| name | required | default | description |
|---|---|---|---|
providerTaxType pathstring | yes | — | Lightspeed tax code to deactivate (1–100 chars). |
emptyAPIErrorAPIError/api/v1/accounting/lightspeed-x/tax-mappings/:providerTaxType/restore
auth: jwt (administrator)Re-activate a previously deactivated Lightspeed tax mapping.
handlers: LightspeedXTaxMappingsController.restore
| name | required | default | description |
|---|---|---|---|
providerTaxType pathstring | yes | — | Lightspeed tax code to re-activate (1–100 chars). |
emptyAPIErrorAPIError/webhooks/lightspeed-x
auth: hmac (x-signature)Lightspeed-initiated `sale.update` delivery. Verifies HMAC-SHA256 over the raw body with the OAuth app's client secret (constant-time compare against the `signature=<hex>` value of the `X-Signature` header). A valid delivery is acknowledged `200` before anything else, then the sale id and store `domain_prefix` are fanned to a Redis stream; the worker re-fetches the canonical sale, so the payload is only a wake signal. Accepts JSON or form-urlencoded bodies; non-`sale.update` or unroutable deliveries are acknowledged and skipped. NOT mounted under `/api/v1`.
handlers: LightspeedXWebhookController.handle
| name | required | default | description |
|---|---|---|---|
x-signature headerstring | yes | — | `signature=<hex>,algorithm=HMAC-SHA256` — HMAC-SHA256 of the raw request body. |
type bodystring | no | — | Event type; only `sale.update` is processed. |
payload bodyobject | string | no | — | Sale object (or its JSON string): `id`, `domain_prefix`, `updated_at`, `payments`, `user`, line items and `return_for` are used. |
domain_prefix bodystring | no | — | Store prefix, if not carried inside the payload. |
emptyemptyAPIErrorAPIError