284 endpoints across 37 groups.
Each endpoint's auth requirement is shown on its row.
Create an account, verify it and register a business.
/api/v1/auth/loginValidate credentials and issue a JWT access token plus an httpOnly refresh-token cookie. Returns the user and businessId (null if onboarding incomplete). Constant-time dummy hash verify on unknown emails to prevent timing-based enumeration./api/v1/auth/registerCreate the first user account. Hashes the password with argon2, creates a Users row with roles=[] and BusinessId=NULL, and fires AUTH_REGISTER + fire-and-forget welcome email. No tokens are issued — the client is expected to redirect to login./api/v1/auth/refreshRotate the refresh token. Reads the httpOnly refreshToken cookie (or body fallback for native clients), verifies RS256 signature, checks typ='refresh', re-fetches the user to detect deactivation and post-iat password changes, and issues a fresh access+refresh pair./api/v1/auth/logoutClear the refresh-token cookie. Idempotent — returns 200 even when the cookie is absent or malformed. Decodes (does not verify) the cookie to write an AUTH_LOGOUT audit event with the userId/businessId when present./api/v1/auth/setup-statusReturns whether any user has been registered yet — used by the frontend to gate the registration form vs. invite-only flow./api/v1/auth/register-invitedComplete registration for a user who received an invite link. Validates the invite token in Redis (invite:{token}), creates the user with the invite's roles and organizationId, deletes the token (single-use), and fires AUTH_REGISTER + welcome email./api/v1/auth/change-passwordVerify the caller's current password, hash the new one, and issue a fresh access+refresh token pair. Sets Users.PasswordChangedAt to invalidate all existing refresh tokens. Rate-limited via 'default' bucket./api/v1/auth/forgot-passwordRequest a 6-digit OTP reset code. Always returns 200 with a generic message — silently no-ops for unknown emails (anti-enumeration). Generates a code, SHA-256-hashes it into PasswordResetTokens, and XADDs the raw code to the auth:password-reset Redis Stream for the email worker. Rate-limited via 'default' bucket./api/v1/auth/reset-passwordConfirm a password reset. Validates the OTP against the stored SHA-256 hash, checks expiry, deletes the token (single-use), hashes the new password with argon2, and sets PasswordChangedAt to invalidate every existing refresh token. All failure modes return the same RESET_TOKEN_INVALID code. Rate-limited via 'default' bucket./api/v1/auth/verify-emailConfirm the 6-digit sign-up verification code emailed at registration. The code is single-use; on success the account is marked verified, `EMAIL_VERIFICATION_CONFIRMED` is audited and the welcome email is sent fire-and-forget. Every failure mode (unknown email, no pending code, expired, wrong code) returns the same error to prevent enumeration. Rate limited (auth bucket)./api/v1/auth/resend-verification-emailRe-send the sign-up verification code. Responds 200 identically for unknown or already-verified emails (anti-enumeration); 429 VERIFICATION_TOO_MANY_REQUESTS only when a pending code is still inside the resend cooldown. Rate limited (auth bucket)./api/v1/businesses/registerFirst-user business registration with TaxCore verification. Validates the supplied PFX/PAC/UID against V-SDC, creates the business, promotes the calling user to Administrator, and returns fresh JWT tokens. No role guard — the caller has no businessId yet./api/v1/businessesReturns the single business the authenticated user belongs to. Users without a businessId receive an empty list. Returned as an APIResponse list shape for FE consistency./api/v1/businesses/:businessIdPartially update non-credential business settings — name, address fields, currencyCode, and the demo Xero tenant id used for Training routing. At least one field must be provided./api/v1/businesses/:businessId/taxcore-configUpdate V-SDC credentials for a business. multipart/form-data — every field optional, at least one required. When `pac` is supplied, the server verifies it against V-SDC `/status` (mTLS) before persisting. When `businessUID` is also supplied, `status.uid` is cross-checked against it./api/v1/businesses/:businessId/default-certificateRegistration wizard step 2 shortcut. Creates a Certificate row against the business's default Location and mirrors the same fields into the legacy `Businesses.Vsdc*` columns so the consumer's fallback path keeps working./api/v1/businesses/:businessId/settings/auto-email-receiptToggle the per-connector "Auto-email receipts" flag. Enabling requires a configured notification email. Fires `AUTO_EMAIL_RECEIPT_ENABLED` / `AUTO_EMAIL_RECEIPT_DISABLED` audit./api/v1/businesses/:businessId/settings/auto-print-receiptSet the per-connector "Auto-print receipts" config. Default is on for every connector; the stored map records only non-default entries. Optional allow-lists restrict which transaction and invoice types auto-print (null/absent = all). Fires `AUTO_PRINT_RECEIPT_ENABLED` / `AUTO_PRINT_RECEIPT_DISABLED` audit./api/v1/businesses/:businessId/settings/receipt-email-formatChoose which document the receipt email attaches for a connector: thermal slip or A4 invoice. An explicit null clears the entry back to the `a4` default. Does not control whether an email is sent. Fires `RECEIPT_EMAIL_FORMAT_UPDATED` audit./api/v1/businesses/:businessId/email-receipt-configUpdate the business notification email and/or the invoice types that trigger an auto-email. At least one field is required; absent keys are left unchanged. Clearing the notification email while auto-email receipts are enabled is rejected. Fires `EMAIL_RECEIPT_CONFIG_UPDATED` audit.Locations, certificates, invoices and fiscalisation.
/api/v1/businesses/:businessId/locationsCreate a new Location for the business. locationType defaults server-side; isDefault optionally promotes this Location to the business's default (existing default cleared atomically)./api/v1/businesses/:businessId/locations/:locationIdFetch a single Location scoped to the business./api/v1/businesses/:businessId/locations/:locationIdPartial update of a Location. isDefault=true is routed through the dedicated setDefault path so the previous default is cleared atomically. status='inactive' soft-disables the Location./api/v1/businesses/:businessId/locations/:locationId/proposal-statusAccept or reject a manifest-discovered Location proposal. accepted clears ProposalStatus so the row becomes a normal active location; rejected sets ProposalStatus='rejected' and keeps the row so later manifest syncs do not re-propose it. Fires LOCATION_PROPOSAL_ACCEPTED / LOCATION_PROPOSAL_REJECTED audit events./api/v1/businesses/:businessId/locations/:locationId/certificatesList all Certificates registered against a Location. Returns the PUBLIC projection — VSDC credentials (PFX filename, password, PAC) are stripped; `hasCertificate: boolean` indicates cert presence./api/v1/businesses/:businessId/locations/:locationId/certificatesUpload a new V-SDC certificate for a Location. multipart/form-data: PFX file + password + PAC + UID. The server RC2→3DES-converts the PFX, verifies the PAC against V-SDC /status, cross-checks UID against status.uid, writes the file under CERT_STORAGE_DIR/{uuid}.pfx, and persists a Certificates row. PFX bytes are cleaned up if persistence fails. PFX file max 5 MB./api/v1/businesses/:businessId/locations/:locationId/certificates/:certificateIdFetch a single Certificate (public projection — credential fields stripped)./api/v1/businesses/:businessId/locations/:locationId/certificates/:certificateIdPatch a Certificate's metadata — name and/or status (active|revoked). Re-activating (status='active') is rejected with 409 CERTIFICATE_LOCATION_ALREADY_ACTIVE when the Location already holds another active certificate: one active certificate per Location./api/v1/businesses/:businessId/locations/:locationId/certificates/:certificateId/revokeRevoke a Certificate (sets Status='revoked'). Convenience action — equivalent to PATCH with status='revoked'./api/v1/certificates/inspectParse-only inspection of a V-SDC PFX certificate. multipart/form-data: PFX file + password. Returns the certificate's subject/issuer attributes and validity without calling TaxCore, writing the file, or touching the database. Used by the upload sheet and registration wizard before a PAC is entered. PFX file max 5 MB./api/v1/businesses/:businessId/invoices/batchesPaginated list of import batches for the business. Each batch row carries row counts (imported/failed) and the originating file metadata. Registered before /:invoiceId so the literal 'batches' segment never collides with the dynamic id./api/v1/businesses/:businessId/invoices/daily-fiscal-reportDaily fiscal report. Signed-type classification (TAXCORE-922): every figure reads what V-SDC SIGNED (InvoicePayments.WireInvoiceType / WireTransactionType, with the wire mapper's fallbacks), through one shared filter shared with /payment-records — so any figure equals the records behind it. Cancellations are identified by CancelsPaymentId; a cancelled original still counts as a sale and its cancellation as the refund it signed, netting to 0. byPaymentType is split by tender. Adds byReceiptType, byReceiptCode (per TaxCore code NS/AS/NR/AR/CS/CR/PS/PR/TS/TR with its cancellations), byPaymentTypeNet (Normal + Advance, refunds subtracting), saleRefundTotals.saleCount/refundCount and cancellations.byTransactionType; every earlier field keeps its shape. Window precedence fromDay/toDay > dateFromMs/dateToMs > legacy ISO dateFrom/dateTo. Fires DAILY_FISCAL_REPORT_GENERATED with the resolved window and scope./api/v1/businesses/:businessId/invoices/daily-fiscal-report/export.csvThe daily report as CSV: the window (Vanuatu time), the applied scope and completeness, then one "section, bucket, count, amount" row per bucket. Same query as the JSON report. UTF-8 BOM, every cell quoted, formula-trigger text neutralised. Fires RECEIPT_RECORDS_EXPORTED (kind: summary)./api/v1/businesses/:businessId/invoices/payment-recordsOne row per PAYMENT (signed or not) under the shared reporting filter, with each row's TaxCore receiptCode, countsByReceiptType (computed without the receiptType axis) and countsByCode (without receiptType and transactionType), countsByStatus (without status), totalRows and familyLinkedOnly. invoiceId switches on family mode: every receipt on those invoices and every invoice linked by refund / copy / adjustment, window ignored. Registered before /:invoiceId./api/v1/businesses/:businessId/invoices/payment-records/export.csvEvery payment record the filter matches, streamed in 500-row pages. One column per payment method (a split-tender payment shows each tender under its own method) plus a method text column; payment dates in Vanuatu time. Fires RECEIPT_RECORDS_EXPORTED (kind: records, rowCount)./api/v1/businesses/:businessId/invoices/receiptsOne merged PDF of signed receipts. Body is exactly one of { invoiceIds (1–20), includeLinked? } | { paymentIds (1–40) } | { filter: ReceiptRecordsQuery }, plus format (slip | a4) and order (paymentDate | invoice). Capped at 40 rendered pages, counted before rendering. X-Receipts-Rendered / X-Receipts-Skipped headers carry the counts. Fires INVOICE_RECEIPTS_DOWNLOADED with variant and pages./api/v1/businesses/:businessId/invoicesPaginated invoice list for the business. RTK infinite-query compatible. Returns invoices in the same shape as the single-invoice GET (with embedded payments[] and line-items omitted)./api/v1/businesses/:businessId/invoices/:invoiceIdFetch a single invoice with its line items and payments[] embedded. Cross-tenant probing returns 404 since the repo filters by businessId./api/v1/businesses/:businessId/invoices/:invoiceId/paymentsList every payment under a single invoice. Returns the same payments[] array embedded on GET /invoices/:invoiceId plus per-payment fiscal data (FiscalInvoiceNumber, FiscalTimestamp, etc.). Ordered by PaymentDate ASC, CreatedAt ASC. Lets the FE refresh only the payments list after a per-payment action without re-fetching the parent invoice./api/v1/businesses/:businessId/invoices/:invoiceId/payments/:paymentIdDirect drill-down for a single InvoicePayments row. Returns the same InvoicePaymentDTO shape that appears inside the parent invoice's payments[] array. Returns 404 when the payment doesn't belong to the (invoiceId, businessId) pair — protects against cross-tenant or cross-invoice probing./api/v1/businesses/:businessId/invoices/reprocess-unmappedRe-sync blocked invoices. Re-evaluates the business's blocked payments in sequential passes: tax mapping (MISSING_TAX_MAPPING), credit notes waiting on their original (REFERENT_NOT_FISCALISED / REFERENT_DOCUMENT_MISSING), currency (CURRENCY_MISMATCH), then each connector's location / certificate pass (http, xero, lightspeed-x, hike, amicus, sage100, eposnow, sage200evolution, atrex). Released payments are dispatched as fiscalisation jobs of at most 20. `source` limits the run to one provider's invoices; `invoiceIds` limits it to a selection; `tenantId` (with `source=xero`) to one Xero organisation. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. The finished run's `result` is an `APIResponseDataObject<ReprocessSelectionResult>` (`reprocessed`, `nowEligible`, `nowEligibleInvoices`, `nowEligibleQuotes`, `stillBlocked`, `autoFiscalisationJobIds`, `notResyncable`)./api/v1/businesses/:businessId/invoices/cancel-bulkBulk cancel up to MAX_PAYMENTS_PER_FISCALISATION_JOB fiscalised payments in one job. Builds a cancellation row per valid payment, then dispatches every freshly-inserted cancellation in a single FiscalisationJob so the client polls one jobId. Invalid IDs come back in blocked[]; IDs whose original already has a cancellation in flight come back in inFlight[]. Fires INVOICE_PAYMENT_CANCELLATION_REQUESTED audit per dispatched payment./api/v1/businesses/:businessId/invoices/:invoiceId/payments/:paymentId/cancelCancel a single fiscalised payment. Issues a cancellation row (Sale → Refund / Refund → Sale) with the same line items but BuyerTin set to the seller's TIN and ReferentDocumentNumber pointing back at the original SDC fiscal number, then dispatches it through the standard fiscalisation pipeline. Poll the returned jobId — on success the original payment is marked cancelled by the consumer. Fires INVOICE_PAYMENT_CANCELLATION_REQUESTED audit./api/v1/businesses/:businessId/invoices/:invoiceId/payments/:paymentId/copyPer-payment Copy. Inserts a new Invoices row with InvoiceType='COPY', CopiesInvoiceId pointing at the source invoice, totals scaled to the source payment's amount, plus a synthetic InvoicePayments row carrying CopiesPaymentId. Source payment's SDC FiscalInvoiceNumber is the V-SDC referent on the new submission; TransactionType is preserved (Copy of Sale → Sale, Copy of Refund → Refund). One-time per source payment (retry of a failed copy allowed). Immediately dispatches for fiscalisation and fires INVOICE_COPY_REQUESTED audit./api/v1/businesses/:businessId/invoices/:invoiceId/payments/:paymentId/refundPer-payment Refund. Inserts a new Invoices row with TransactionType='REFUND' and InvoiceType inherited from the source (Normal → Normal Refund, Advance → Advance Refund), RefundsInvoiceId pointing at the source invoice, totals scaled to the source payment's amount, plus a synthetic InvoicePayments row carrying RefundsPaymentId. Source payment's SDC FiscalInvoiceNumber is the V-SDC referent on the new submission. Only valid on a fiscalised SALE payment under a Normal or Advance invoice — refunding a refund is rejected. One-time per source payment (retry of a failed refund allowed). FE button is hidden on Normal/Advance (only surfaced for PROFORMA quotes); backend stays permissive so the service-layer REFUNDABLE_TYPES guard remains the source of truth. Fires INVOICE_REFUND_REQUESTED audit./api/v1/businesses/:businessId/invoices/:invoiceId/payments/:paymentId/invoice-pdfRender the fiscal receipt of one signed payment as an inline PDF. `format=a4` (default) is the branded A4 invoice rebuilt from the persisted invoice; `format=slip` renders the thermal slip from the signed fiscal journal./api/v1/businesses/:businessId/invoices/:invoiceId/payments/:paymentId/send-receipt-emailEmail the fiscalised receipt of one payment to the customer and/or the business. At least one address is required; addresses are not persisted. The PDF attachment uses the business's per-connector receipt email format. Delivery is fire-and-forget: responds 202 immediately and audits `RECEIPT_EMAIL_SENT` or `RECEIPT_EMAIL_FAILED` once the send settles./api/v1/businesses/:businessId/invoices/reprocess-credit-notesRe-evaluate every REFUND payment blocked by REFERENT_NOT_FISCALISED or REFERENT_DOCUMENT_MISSING. Where the original invoice is now fiscalised, replaces the stored referent document number with the V-SDC fiscal invoice number and marks the payment eligible. Does not dispatch for fiscalisation itself. Idempotent./api/v1/businesses/:businessId/fiscalisation-jobsTrigger fiscalisation for a batch of payments. Pre-flight eligibility validator re-reads persisted EligibleForFiscalisation / FiscalisationBlockReasons + checks the business's TaxCore config, then partitions the batch into dispatched and blocked. Blocked payments come back with per-payment reason codes so operators can fix the root cause and retry. Batch size capped at MAX_PAYMENTS_PER_FISCALISATION_JOB (currently 10)./api/v1/businesses/:businessId/fiscalisation-jobs/by-invoiceInvoice-level fiscalisation trigger for PROFORMA (quote) rows. Accepts invoiceIds[]; the service translates each to a synthetic payment (idempotent) before delegating to the standard per-payment dispatch. Same partitioned-response contract as POST /fiscalisation-jobs./api/v1/businesses/:businessId/fiscalisation-jobs/:jobIdPoll fiscalisation job status and per-payment results. The Results array carries per-payment fiscal data (FiscalInvoiceNumber, FiscalTimestamp, FiscalVerificationUrl, errorMessage, attempts). IDOR-guarded — a job belonging to another business returns 404. Add ?lite=true to omit the Results array — returns counts + status only, reducing repeated-poll payload from MB → ~200 bytes for large jobs./api/v1/businesses/:businessId/fiscal-records/:requestIdFetches a previously fiscalised invoice directly from the TaxCore V-SDC by its 8-character RequestId (stored in InvoicePayments.FiscalRequestId after fiscalisation). Proxies to TaxCore GET /api/v3/invoices/{requestId} using mTLS (cert + pfxPassword + PAC). The encryptedInternalData field is stripped server-side before the response is returned to the client./api/v1/accounting/sync-from-datePer-business sync lower-bound date — Administrator-only. The stored epoch-ms lower bound is read by all sync paths (manual Sync Now + scheduled workers for Xero/Sage/MYOB) and passed as modifiedSince to the accounting provider. Setting to null restores the default 'full history' behaviour. Webhooks are never filtered. Surfaced on GET /accounting/{xero|sage|myob}/status so the app can render the date picker pre-populated./api/v1/businesses/:businessId/accounting/unmapped-tax-typesList provider tax codes that have arrived on invoices without a confirmed mapping. Populated fire-and-forget by sync services and webhook workers on every invoice ingestion pass. Each row includes providerTaxName and providerRate (nullable). Rows that now have an active TaxRateMappings entry are excluded server-side via NOT EXISTS join — confirming a mapping silently removes the entry; deactivating a mapping makes it reappear. Used by the home-screen banner and the Integrations nav badge to notify admins./api/v1/accounting/auto-fiscaliseToggle the per-business Businesses.AutoFiscaliseInvoices flag (DB default 1). When on, every newly-inserted eligible invoice from any sync path (manual Sync Now, webhook, scheduled poll) is dispatched to TaxCore automatically. Fires AUTO_FISCALISE_ENABLED / AUTO_FISCALISE_DISABLED audit. Reflected on GET /accounting/{provider}/status.autoFiscaliseInvoices so the app can render the switch alongside connection state. Manual fiscalisation via POST /fiscalisation-jobs remains available regardless./api/v1/businesses/:businessId/accounting/blocked-locationsList the locations currently blocking invoice fiscalisation because their signing location could not be resolved (AMICUS branch, generic HTTP store code, EposNow connection location, Sage 200 Evolution API-key location, etc.). One row per (provider, location, kind) actually blocking an invoice. kind 'unmapped' is fixed by mapping the branch/store on the connector screen; 'certificate' by uploading a certificate at that location. LOCATION_SELECTOR_REQUIRED blocks are excluded. Drives the home dashboard banners and integration nav badges./api/v1/businesses/:businessId/taxcore-tax-ratesRead the business's snapshot of V-SDC currentTaxRates, in OrderId order. Read-only: the snapshot is refreshed only as a side effect of the backend's own V-SDC /status calls, never by a client. Feeds the tax-mapping label picker.Integrations with accounting and POS systems. Each section holds everything for one connector: connect/OAuth, sync, tax mappings, webhooks and agent routes.
/api/v1/accounting/xero/startBegin a Xero OAuth2 authorisation flow for the caller's business. Generates a PKCE verifier + state, persists them in OAuthStates, and returns the Xero authorisation URL the app/browser must redirect to. Rate-limited (10/min open bucket)./api/v1/accounting/xero/callbackOAuth callback target hit by the user's browser after Xero consent. Validates the state (constant-time), exchanges the authorisation code, upserts XeroConnections rows for every tenant returned, and either 302-redirects (desktop) or serves a 200 text/html bridge page (mobile UA) that opens the native `vsms://auth/xero/...` deep link./api/v1/accounting/xero/statusConnection summary for the caller's business — whether a Xero connection exists, the active tenant, the list of authorised tenants (no tokens), and the current `autoFiscaliseInvoices` flag./api/v1/accounting/xero/tenantsList every Xero tenant authorised for the caller's business. Each entry carries `isActive` to indicate which tenant is the current target of sync / webhooks./api/v1/accounting/xero/connectionHard-disconnect Xero for the caller's business — deletes every XeroConnections row, drops encrypted tokens, fires `XERO_DISCONNECTED` audit./api/v1/accounting/xero/tax-mappingsList all Xero tax-type to V-SDC tax-label mappings for the business (active and inactive). Active rows ordered first, then alphabetically. `isActive: boolean` per row so the admin UI can surface a Restore action on soft-deleted entries./api/v1/accounting/xero/tax-mappings/auto-mapFetch Xero `/TaxRates` from the active tenant + V-SDC `/status`, then return match suggestions with `needsReview` flags + alternatives. Does NOT persist — the admin confirms each suggestion via PUT. Rate-limited (10/min open bucket)./api/v1/accounting/xero/tax-mappingsCreate or update one Xero tax-type to V-SDC label mapping (MERGE on (businessId, 'xero', providerTaxType)). Re-activates an existing inactive row instead of inserting a duplicate. Fires `XERO_TAX_MAPPING_UPDATED` audit./api/v1/accounting/xero/tax-mappings/:providerTaxTypeSoft-delete a Xero tax mapping — sets `IsActive=0`. Row is retained for history and can be re-activated via the restore endpoint. Idempotent./api/v1/accounting/xero/tax-mappings/:providerTaxType/restoreRe-activate a previously soft-deleted Xero tax mapping (`IsActive=0` → `1`). Idempotent./webhooks/xeroXero-initiated webhook delivery. Verifies HMAC-SHA256 over the raw request body using `XERO_WEBHOOK_SIGNING_KEY` (constant-time compared to the base64 `x-xero-signature` header). Valid signature → fan each event to the `xero:webhook:events` Redis Stream and respond `200` within Xero's 5-second ack budget. Xero's intent-to-receive handshake (`events: []`) flows through the same code path. NOT mounted under `/api/v1`./api/v1/accounting/xero/syncPull-sync PAID invoices from the active Xero tenant: fetch via `XeroProvider.getInvoices`, normalise to `AccountingInvoice[]`, persist to `Invoices` table (`Source='xero'`) with one `ImportBatches` row per call. Idempotency key = `SHA-256(businessId:xeroTenantId:xeroInvoiceId)`. When `AutoFiscaliseInvoices=1`, newly-inserted eligible invoices are chunked (10) and dispatched as fiscalisation jobs. Returns the `AccountingInvoice[]` plus a summary message including `jobIds=`. HTTP caching disabled. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. 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./api/v1/accounting/xero/connections/:connectionId/locationMap one Xero organisation (connection) to the VSMS Location whose certificate signs its invoices. locationId is required but nullable: null clears the mapping and returns the organisation to the business-default fallback. A non-null assignment triggers a best-effort re-sync of the backlog that became signable. Returns the refreshed tenant list for the business. Assigning a location starts the business-wide blocked-invoice re-sync as a background run and replies without waiting for it; if a re-sync is already running, none is started./api/v1/accounting/xero/organisations/refreshRe-read the organisations on the stored Xero authorisation. Adds any the grant now covers as PENDING (not syncing until accepted) and refreshes the name and short code of those already held. It can only see organisations the existing authorisation already includes: granting access to a further organisation in Xero still needs the admin to reconnect./api/v1/accounting/xero/connections/:connectionId/rejectDecline one connected Xero organisation: it is forced disabled and stays that way until accepted again. Refused while a signing location is assigned - clear the mapping first./api/v1/accounting/xero/connections/:connectionId/acceptAccept one Xero organisation: a PENDING one (newly authorised, not yet reviewed) or a rejected one coming back. Either way it becomes live - enabled and syncing - and unmapped, so its invoices are held until an admin assigns a signing location./api/v1/accounting/sage/startBegin a Sage OAuth2 authorisation flow for the caller's business. Generates PKCE + state, persists in OAuthStates, returns the Sage authorisation URL. Rate-limited (10/min open bucket)./api/v1/accounting/sage/callbackSage OAuth callback. Validates state, exchanges the code, upserts a single SageConnections row (Sage has one business per token — no tenant selection), then 302 redirects (desktop) or serves a 200 text/html bridge page (mobile) opening `vsms://auth/sage/{success|failure}`./api/v1/accounting/sage/statusSage connection summary — whether a Sage connection exists, the connected Sage business, and the current `autoFiscaliseInvoices` flag./api/v1/accounting/sage/connectionSoft-deactivate the Sage connection for the caller's business (`IsActive=0`). Rows are retained for history; the user may re-authorise via `/sage/start`. Fires `SAGE_DISCONNECTED` audit./api/v1/accounting/sage/tax-mappingsList all Sage tax-type to V-SDC tax-label mappings for the business (`Provider='sage'`). Mirrors `/accounting/xero/tax-mappings`./api/v1/accounting/sage/tax-mappings/auto-mapPull Sage tax-rates + V-SDC `/status` and return match suggestions. Does NOT persist. Rate-limited (10/min open bucket)./api/v1/accounting/sage/tax-mappingsCreate or update one Sage tax-mapping. Re-activates an inactive row on match. Fires `SAGE_TAX_MAPPING_UPDATED` audit (resource type `SAGE_CONNECTION`)./api/v1/accounting/sage/tax-mappings/:providerTaxTypeSoft-delete a Sage tax-mapping (`IsActive=0`). Idempotent./api/v1/accounting/sage/tax-mappings/:providerTaxType/restoreRe-activate a deactivated Sage tax-mapping (`IsActive=1`). Idempotent./api/v1/accounting/sage/syncPull-sync invoices from the active Sage connection. Fetches OUTSTANDING / OVERDUE / PAID via three API calls merged client-side, normalises, persists to `Invoices` (`Source='sage'`). Idempotency key = `SHA-256(businessId:sageBusinessId:sageInvoiceId)`. `modifiedSince` is silently ignored (Sage's `sales_invoices` has no date filter). Auto-fiscalisation behaviour matches Xero. HTTP caching disabled. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. 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./api/v1/accounting/sage200evolution/tax-mappingsList all Sage 200 Evolution tax-mappings for the business (`Provider='sage200evolution'`). The path-param `:id` everywhere else in this surface is the Sage `idTaxRate` (the provider tax type)./api/v1/accounting/sage200evolution/tax-mappings/:idUpsert a single Sage 200 Evolution mapping. `:id` is the Sage `idTaxRate` (provider tax type). Body carries the V-SDC label + optional metadata./api/v1/accounting/sage200evolution/tax-mappings/:idSoft-delete a Sage 200 Evolution mapping (`IsActive=0`). Idempotent./api/v1/accounting/sage200evolution/tax-mappings/:id/restoreRe-activate a deactivated Sage 200 Evolution mapping (`IsActive=1`). Note: uses POST (unlike the Xero/Sage/MYOB restore endpoints which use PATCH). Idempotent./api/v1/businesses/:businessId/accounting/sage200evolution/syncOn-premise Sage 200 Evolution agent push. Scope-bound to `sage200evolution`. Per-row register→till routing via `Tills.PosRegisterId`; unrouted invoices return `outcomes[].outcome='register_unmapped'` and fire `SAGE200_RECEIPT_UNROUTED` audit. Supports advance-sale deposits (one `AccountingInvoicePayment` per `_etblInvoiceDeposits` row, fan-out to N `NormalizedInvoicePayment`s)./api/v1/businesses/:businessId/accounting/sage200evolution/register-manifestSage 200 Evolution register discovery. The agent posts its warehouse (`WhseMst`) and till snapshot. The cloud upserts one `Locations` row per warehouse keyed on the warehouse code and auto-accepts every newly created one, then upserts one `Tills` row per register keyed on `PosRegisterId` with a null `MachineId` (no hostname is available to auto-bind a print agent). Existing rows are not overwritten apart from source-wins renames and till moves. Fires `SAGE200_MANIFEST_RECEIVED` plus per-row rename/move audits./api/v1/accounting/sage200evolution/tax-mappings/seed-from-agentSage 200 Evolution agent tax-rate seed. The sales agent posts its `dbo.TaxRate` snapshot on startup and whenever a push response carries `requestTaxRateSeed`. Every not-yet-confirmed code is written as a PROPOSAL (`UnmappedTaxTypes`) with its name and rate; nothing is auto-confirmed into `TaxRateMappings`. Already-confirmed codes are skipped unless the source rate or name has drifted, in which case the mapping is deactivated for admin review. The business comes from the API key (no path businessId); only `requireApiKey` runs, with no scope check./api/v1/accounting/sage200evolution/tax-mappings/request-seedAdmin request for a Sage 200 Evolution tax-rate re-seed. Sets an in-memory per-business flag; the next Sage 200 Evolution agent push response carries `requestTaxRateSeed: true`, prompting the agent to call seed-from-agent again. Business is taken from the JWT. Fires `SAGE200_TAX_MAPPING_SEED_REQUESTED`./api/v1/businesses/:businessId/accounting/sage100/syncOn-premise Sage 100 agent push. Headless agent POSTs a batch of normalised `AccountingInvoice[]` for the business; the helper inserts → dedupes → auto-fiscalises (when the flag is on). API key must have `scope=sage100` (enforced by `requireScope`); empty array is allowed (used by the agent's first-run dry-run wizard)./api/v1/accounting/sage100/tax-mappingsList Sage 100 tax-mappings for the business (`Provider='sage100'`)./api/v1/accounting/sage100/tax-mappingsUpsert one Sage 100 tax-mapping. Same body shape as the other tax-mapping CRUD surfaces./api/v1/accounting/sage100/tax-mappings/:providerTaxTypeSoft-delete a Sage 100 tax-mapping (`IsActive=0`). Idempotent./api/v1/accounting/sage100/tax-mappings/:providerTaxType/restoreRe-activate a deactivated Sage 100 mapping (`IsActive=1`). Idempotent./api/v1/businesses/:businessId/accounting/sage100/register-manifestSage 100 branch and register discovery. The agent posts its `F_DEPOT` depots and optionally its `F_CAISSE` registers. The cloud upserts one `Locations` row per depot, left `proposed` for admin review (not auto-accepted), and, when `tills` is non-empty, one `Tills` row per register keyed on `PosRegisterId` at its depot's location with a null `MachineId`. `tills` defaults to `[]`, which is what every measured install and any older agent sends. Fires `SAGE100_MANIFEST_RECEIVED` plus per-row rename/move audits./api/v1/accounting/sage100/tax-mappings/seed-from-agentSage 100 agent tax-rate seed. The sales agent posts its `dbo.F_TAXE` snapshot on startup and whenever a push response carries `requestTaxRateSeed`. Every not-yet-confirmed code is written as a PROPOSAL (`UnmappedTaxTypes`) with its name and rate; nothing is auto-confirmed into `TaxRateMappings`. Already-confirmed codes are skipped unless the source rate or name has drifted, in which case the mapping is deactivated for admin review. Drift is checked on percentage taxes only; levies are skipped. The business comes from the API key (no path businessId); only `requireApiKey` runs, with no scope check./api/v1/accounting/sage100/tax-mappings/request-seedAdmin request for a Sage 100 tax-rate re-seed. Sets an in-memory per-business flag; the next Sage 100 agent push response carries `requestTaxRateSeed: true`, prompting the agent to call seed-from-agent again. Business is taken from the JWT. Fires `SAGE100_TAX_MAPPING_SEED_REQUESTED`./api/v1/businesses/:businessId/accounting/sage100/branch-mappingsList every Sage 100 depot the admin should see: the union of currently discovered depots and stored mappings, so a mapping whose depot vanished from the source is still visible. Each row carries branchId, branchName, locationId (null when unmapped), status ('active' | 'inactive'), discoveredLocationId and proposalStatus./api/v1/businesses/:businessId/accounting/sage100/branch-mappings/resync-blockedRe-evaluate every invoice blocked by depot-certificate routing and dispatch the ones that can now be signed. A parallel action to POST /invoices/reprocess-unmapped, which is scoped to unmapped tax codes and cannot see these block reasons. Quotes (PROFORMA) that become eligible are counted but not dispatched. 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`)./api/v1/businesses/:businessId/accounting/sage100/branch-mappings/request-manifestAsk the Sage 100 sales agent to re-send its depots and registers, so a depot or register added on the Sage 100 side appears without restarting the agent. Sets a request that the agent receives as `requestManifest: true` on its next push; the agent then re-sends asynchronously, so the new rows appear shortly after this call returns./api/v1/businesses/:businessId/accounting/sage100/branch-mappings/backfillSeed depot mappings from what already-fiscalised invoices attest to, and report which target locations hold no usable certificate. Idempotent and never overwrites an admin's own mapping; a depot whose history names several signing locations is skipped ('conflicting_history') rather than guessed./api/v1/businesses/:businessId/accounting/sage100/branch-mappings/:branchIdAssign this Sage 100 depot to a business Location (re-activating the mapping if it was revoked). The mapping decides which certificate signs the depot's invoices. locationId is required and non-null; several depots may map to one Location. Un-mapping is done with PATCH .../revoke./api/v1/businesses/:businessId/accounting/sage100/branch-mappings/:branchId/revokeStop this Sage 100 depot routing invoices without deleting the mapping or its history. The depot's next invoice blocks (LOCATION_NOT_MAPPED) rather than falling back to the business default; already-fiscalised invoices are untouched. There is no un-revoke endpoint: re-assigning a location through PUT re-activates the mapping./api/v1/businesses/:businessId/accounting/sage300/syncOn-premise Sage 300 agent push. Same shape as the Sage 100 endpoint but scope-bound to `sage300`./api/v1/accounting/sage300/tax-mappingsList Sage 300 tax-mappings for the business (`Provider='sage300'`)./api/v1/accounting/sage300/tax-mappings/:providerTaxTypeSoft-delete a Sage 300 tax-mapping (`IsActive=0`). Idempotent./api/v1/accounting/sage300/tax-mappings/:providerTaxType/restoreRe-activate a deactivated Sage 300 mapping (`IsActive=1`). Idempotent./api/v1/accounting/myob/startBegin a MYOB AccountRight Live OAuth2 authorisation flow. Generates PKCE + state, returns the MYOB authorisation URL. Rate-limited (10/min open bucket)./api/v1/accounting/myob/callbackMYOB OAuth callback. Validates state, exchanges the code, upserts a MyobConnections row per discovered company file, then 302-redirects (desktop) or serves a 200 text/html bridge page (mobile) opening `vsms://auth/myob/{success|failure}`./api/v1/accounting/myob/statusMYOB connection summary — whether a connection exists, the file list, and the current `autoFiscaliseInvoices` flag./api/v1/accounting/myob/filesList every MYOB company file authorised for the caller's business, each carrying `isActive` indicating the current sync target./api/v1/accounting/myob/files/:myobFileId/activateSwitch the active MYOB company file for the caller's business. Fires `MYOB_FILE_ACTIVATED` audit./api/v1/accounting/myob/connectionSoft-deactivate all MYOB connections for the caller's business (`IsActive=0`). Rows are retained for history. Fires `MYOB_DISCONNECTED` audit./api/v1/accounting/myob/tax-mappingsList all MYOB tax-mappings for the business (`Provider='myob'`). Mirrors `/accounting/sage/tax-mappings`./api/v1/accounting/myob/tax-mappings/auto-mapPull MYOB tax codes + V-SDC `/status` and return match suggestions. Does NOT persist. Rate-limited (10/min open bucket)./api/v1/accounting/myob/tax-mappingsCreate or update one MYOB tax-mapping. Fires `MYOB_TAX_MAPPING_UPDATED` audit./api/v1/accounting/myob/tax-mappings/:providerTaxTypeSoft-delete a MYOB tax-mapping (`IsActive=0`). Idempotent./api/v1/accounting/myob/tax-mappings/:providerTaxType/restoreRe-activate a deactivated MYOB tax-mapping (`IsActive=1`). Idempotent./api/v1/accounting/myob/syncPull-sync `Closed` invoices from the active MYOB company file. Fetches `/Sale/Invoice/Service` and `/Sale/Invoice/Item` merged by UID, normalises, persists to `Invoices` (`Source='myob'`). Idempotency key = `SHA-256(businessId:myobFileId:myobInvoiceId)`. Auto-fiscalisation behaviour matches Xero. HTTP caching disabled. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. 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./api/v1/businesses/:businessId/accounting/amicus/syncOn-premise AMICUS agent push. Scope-bound to `amicus`. Per-row register→till routing (null till → sign-but-don't-print), `PosSaleId` persisted on `Invoices`, refund referent resolution via `originalPosSaleId`. Supports split-tender (one payment with `tenders[]`). Unrouted invoices return `outcomes[].outcome='register_unmapped'` and fire `AMICUS_RECEIPT_UNROUTED` audit./api/v1/accounting/amicus/tax-mappingsList AMICUS tax-mappings for the business (`Provider='amicus'`)./api/v1/accounting/amicus/tax-mappings/:providerTaxTypeSoft-delete an AMICUS tax-mapping (`IsActive=0`). Idempotent./api/v1/accounting/amicus/tax-mappings/:providerTaxType/restoreRe-activate a deactivated AMICUS mapping (`IsActive=1`). Idempotent./api/v1/businesses/:businessId/accounting/amicus/register-manifestAMICUS register discovery. The sales agent posts its `dbo.Sites` + `dbo.Tills` snapshot (incrementally: only rows changed since its watermark). The cloud upserts one `Locations` row per site, left `proposed` for admin review, and one `Tills` row per till keyed on `PosRegisterId`, with `MachineId` hostname-normalised. A till's site is resolved from the payload first, then by a DB lookup of the existing location. Existing rows are never overwritten except for source-wins renames and till site moves. Fires `AMICUS_MANIFEST_RECEIVED` plus per-row rename/move audits./api/v1/accounting/amicus/tax-mappings/seed-from-agentAMICUS agent tax-rate seed. The sales agent posts its `dbo.SalesTax` snapshot on startup and whenever a push response carries `requestTaxRateSeed`. Every not-yet-confirmed code is written as a PROPOSAL (`UnmappedTaxTypes`) with its name and rate; nothing is auto-confirmed into `TaxRateMappings`. Already-confirmed codes are skipped unless the source rate or name has drifted, in which case the mapping is deactivated for admin review. The backend also appends the synthetic `VAT-EXCL` exempt sentinel to the proposals (never un-confirming an existing mapping). The business comes from the API key (no path businessId); only `requireApiKey` runs, with no scope check./api/v1/accounting/amicus/tax-mappings/request-seedAdmin request for a AMICUS tax-rate re-seed. Sets an in-memory per-business flag; the next AMICUS agent push response carries `requestTaxRateSeed: true`, prompting the agent to call seed-from-agent again. Business is taken from the JWT. Fires `AMICUS_TAX_MAPPING_SEED_REQUESTED`./api/v1/businesses/:businessId/accounting/amicus/branch-mappingsList every AMICUS branch the admin should see: the union of currently discovered branches and stored mappings, so a mapping whose branch vanished from the source is still visible. Each row carries branchId, branchName, locationId (null when unmapped), status ('active' | 'inactive'), discoveredLocationId and proposalStatus./api/v1/businesses/:businessId/accounting/amicus/branch-mappings/resync-blockedRe-evaluate every invoice blocked by branch-certificate routing and dispatch the ones that can now be signed. A parallel action to POST /invoices/reprocess-unmapped, which is scoped to unmapped tax codes and cannot see these block reasons. Quotes (PROFORMA) that become eligible are counted but not dispatched. 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`)./api/v1/businesses/:businessId/accounting/amicus/branch-mappings/request-manifestAsk the AMICUS sales agent to re-send its sites and tills, so a branch or till added on the AMICUS side appears without restarting the agent. Sets a request that the agent receives as `requestManifest: true` on its next push; the agent then re-sends asynchronously, so the new rows appear shortly after this call returns./api/v1/businesses/:businessId/accounting/amicus/branch-mappings/backfillSeed branch mappings from what already-fiscalised invoices attest to, and report which target locations hold no usable certificate. Idempotent and never overwrites an admin's own mapping; a branch whose history names several signing locations is skipped ('conflicting_history') rather than guessed./api/v1/businesses/:businessId/accounting/amicus/branch-mappings/:branchIdAssign this AMICUS branch to a business Location. The mapping decides which certificate signs the branch's invoices, so a write changes fiscalisation behaviour for its future sales. locationId is required and non-null; clearing is the separate DELETE./api/v1/businesses/:businessId/accounting/amicus/branch-mappings/:branchIdClear the mapping for this AMICUS branch. Idempotent: clearing an absent mapping is still 204. The branch's future invoices then block rather than falling back to the business default certificate./api/v1/businesses/:businessId/accounting/atrex/syncOn-premise Atrex agent push. Same shape as the other agent sync routes but scope-bound to `atrex`. A pushed row with `voided: true` is a cancellation signal for an already-pushed source invoice (identified by `posSaleId`) rather than a new sale. When an admin has requested an Atrex tax-rate re-seed, the response carries `requestTaxRateSeed: true`; an empty `invoices` array is allowed./api/v1/accounting/atrex/tax-mappings/seed-from-agentAtrex agent tax-rate seed. The sales agent posts its `TaxCat` snapshot on startup and whenever a push response carries `requestTaxRateSeed`. Every not-yet-confirmed code is written as a PROPOSAL (`UnmappedTaxTypes`) with its name and rate; nothing is auto-confirmed into `TaxRateMappings`. Already-confirmed codes are skipped unless the source rate or name has drifted, in which case the mapping is deactivated for admin review. Also refreshes the business's V-SDC tax-rate snapshot, best-effort. The business comes from the API key (no path businessId); only `requireApiKey` runs, with no scope check./api/v1/accounting/atrex/tax-mappings/request-seedAdmin request for a Atrex tax-rate re-seed. Sets an in-memory per-business flag; the next Atrex agent push response carries `requestTaxRateSeed: true`, prompting the agent to call seed-from-agent again. Business is taken from the JWT. Fires `ATREX_TAX_MAPPING_SEED_REQUESTED`./api/v1/accounting/atrex/tax-mappingsList Atrex tax-mappings for the caller's business (`Provider='atrex'`). Registered by the generic per-provider loop in AccountingAgentTaxMappingsRoute./api/v1/accounting/atrex/tax-mappingsUpsert one Atrex tax-mapping (provider tax code to V-SDC label). Same body shape as the other tax-mapping CRUD surfaces; the service validates the V-SDC label./api/v1/accounting/atrex/tax-mappings/:providerTaxTypeSoft-delete a Atrex tax-mapping (`IsActive=0`). Idempotent./api/v1/accounting/atrex/tax-mappings/:providerTaxType/restoreRe-activate a deactivated Atrex mapping (`IsActive=1`). Idempotent./api/v1/accounting/hike/startBegin a Hike OAuth2 authorisation flow. Returns the Hike authorisation URL. Rate-limited (10/min `open` bucket)./api/v1/accounting/hike/callbackHike redirects the operator's browser here after consent. Validates `state`, exchanges `code`, upserts the store connection, then redirects to the app deep link (302 on desktop browsers; on mobile an HTML bridge page that navigates to the deep link). On failure the redirect carries a sanitised error code, never the message. Mounted without the JWT guard because no app session exists on this request./api/v1/accounting/hike/statusConnection summary: every Hike store connection (no tokens), outlet filter list, `autoFiscaliseInvoices`, `autoFiscaliseConnector`, `syncFromDate`./api/v1/accounting/hike/connections/:connectionIdDisconnect ONE Hike store. Per connection, never business-wide: a business may hold several Hike stores./api/v1/accounting/hike/connections/:connectionId/outlets/syncRefresh the outlet catalogue from Hike for one connection. An outlet with no mapped Location BLOCKS its sales rather than inheriting a default./api/v1/accounting/hike/connections/:connectionId/outletsList the connection's Hike outlets with their mapped VSMS Location (if any)./api/v1/accounting/hike/connections/:connectionId/outlets/:outletId/locationAssign (or clear) the VSMS Location for one Hike outlet. `locationId: null` clears the mapping, which BLOCKS that outlet's sales./api/v1/accounting/hike/outlets/resync-blockedRe-sync Hike invoices blocked by outlet routing (LOCATION_NOT_MAPPED / LOCATION_CERTIFICATE_MISSING) and dispatch the ones that can now be signed. BUSINESS-WIDE (no `:connectionId`): the same pass the dashboard action runs. Clears only the two location reasons. 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`)./api/v1/accounting/hike/registers/syncSync Hike registers as print tills. BUSINESS-WIDE (no `:connectionId`): the Receipt Printers tab is scoped per connector, so one call refreshes every Hike store's tills./api/v1/accounting/hike/connections/:connectionId/syncManual Sync Now for ONE Hike store (per connection, not per business). Pulls sales, normalises and persists to `Invoices` (`Source='hike'`); with auto-fiscalise on, newly-inserted eligible invoices are dispatched as fiscalisation jobs. Both query params omitted = resume from the connection's own watermark. `modifiedSince` is a one-off lower bound that wins over the watermark and is not persisted; `dateTo` bounds the run and stops the watermark advancing. The response message is `fetched=X inserted=Y duplicates=Z laybyPayments=N refundsLinked=M[ jobIds=...]`. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. The finished run's `result` is the old synchronous body: `APIResponseDataObject<SyncHikeInvoicesResult>` with the counters `message`./api/v1/accounting/hike/sync-allSync All for Hike: 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./api/v1/accounting/hike/tax-mappingsList all per-business Hike tax-id → V-SDC label mappings (`Provider='hike'`), active and deactivated./api/v1/accounting/hike/tax-mappings/seedPull the Hike tax catalogue for one connection and seed unmapped rows. Rate-limited (10/min `open` bucket)./api/v1/accounting/hike/tax-mappingsCreate or update one Hike tax mapping. `vsdcTaxLabel` is validated against the business's LIVE V-SDC label set./api/v1/accounting/hike/tax-mappings/:providerTaxTypeSoft-delete (`IsActive = 0`, row retained)./api/v1/accounting/hike/tax-mappings/:providerTaxType/restoreRe-activate a deactivated mapping (`IsActive = 1`)./webhooks/hike/:connectionId/:hashHike-initiated webhook delivery. Hike sends no signature, so `:hash` is verified (constant-time) against the connection id; a mismatch answers a bare 403 and writes a `HIKE_WEBHOOK_AUTH_FAILED` audit. A valid delivery is acked 200 BEFORE any work, then the sale id is enqueued on the Hike webhook Redis Stream for `HikeWebhookWorker`. Hike wraps the payload in a single top-level key named after the event (e.g. `Invoice_Created`); an unreadable body is acked and dropped./api/v1/accounting/hike/connections/:connectionId/outlets/:outletId/rejectDecline a discovered Hike outlet; its sales are held exactly like an unmapped outlet's. Refused while the outlet is mapped — clear the mapping first. Idempotent when already rejected./api/v1/accounting/hike/connections/:connectionId/outlets/:outletId/acceptAccept a previously rejected Hike outlet back: it returns to the ordinary unmapped state for the admin to map. Nothing is released by accepting; held sales are freed by the re-sync once a Location is assigned. No-op for an outlet that is not rejected./api/v1/businesses/:businessId/accounting/whmcs/connectConnect a WHMCS install. The body carries the install's API credentials, so no response from this router is ever cached (`Cache-Control: no-store`). One install per business: connecting the SAME address again updates its credentials in place, a different address is refused until the existing install is disconnected. The credentials are probed against WHMCS first./api/v1/businesses/:businessId/accounting/whmcs/statusConnection summary: every WHMCS install of the business (no secrets) and the business `syncFromDate`./api/v1/businesses/:businessId/accounting/whmcs/connections/:connectionId/syncSync now for one install: reads its invoices and persists them. A foreign or disconnected connection answers the same 404 as an unknown one. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. The finished run's `result` is the old synchronous body: `APIResponseDataObject<SyncWhmcsInvoicesResult>`./api/v1/businesses/:businessId/accounting/whmcs/tax-rates/syncReads the newest invoices of every active install for the tax codes they use and offers the codes that have no mapping yet for mapping. Fans out to WHMCS, so it is rate limited like Sync now./api/v1/businesses/:businessId/accounting/whmcs/connections/:connectionId/hookThe WHMCS add-on's hook URL and signing secret for one install. The secret is a credential: admin-only, scoped to the caller's business and never cached./api/v1/businesses/:businessId/accounting/whmcs/connections/:connectionId/locationSet which VSMS Location's certificate signs this install's invoices. `null` clears it, which BLOCKS the install's invoices - it never falls back to a default./api/v1/businesses/:businessId/accounting/whmcs/connections/:connectionId/rejectReject an install that has no location: it will not be fiscalised and stops asking for attention. Refused while a location is assigned - clear it first. Idempotent when already rejected./api/v1/businesses/:businessId/accounting/whmcs/connections/:connectionId/acceptTake a rejected install back: clears the rejection so it asks for a location again./api/v1/businesses/:businessId/accounting/whmcs/connections/:connectionIdDisconnect one WHMCS install, addressed by its connection id (never business-wide)./webhooks/whmcs/:connectionIdReceives one delivery from the WHMCS PHP add-on. The signature is checked before anything is read or written, and every refusal looks the same (a bare 401). An invoice event is queued as a wake-signal; tax-rule, deleted-transaction and deleted-invoice events are handled here. A delivery that cannot be queued answers 503, so it is never silently lost. Mounted under `/webhooks`, not the API base, so the JWT check never sees it./api/v1/accounting/whmcs/tax-mappingsList all per-business WHMCS tax-code to V-SDC label mappings (`Provider='whmcs'`), active and deactivated./api/v1/accounting/whmcs/tax-mappings/:providerTaxTypeSoft-delete (`IsActive = 0`, row retained)./api/v1/accounting/whmcs/tax-mappings/:providerTaxType/restoreRe-activate a deactivated mapping (`IsActive = 1`)./api/v1/accounting/lightspeed-x/callbackOAuth 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./api/v1/accounting/lightspeed-x/startBegin 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./api/v1/accounting/lightspeed-x/statusConnection 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`./api/v1/accounting/lightspeed-x/connections/:connectionId/syncManual "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./api/v1/accounting/lightspeed-x/sync-allSync 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./api/v1/accounting/lightspeed-x/connections/:connectionId/locationAssign (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./api/v1/accounting/lightspeed-x/connections/:connectionId/outletsList 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./api/v1/accounting/lightspeed-x/connections/:connectionId/outlets/:outletId/locationAssign (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./api/v1/accounting/lightspeed-x/connections/:connectionId/outlets/:outletId/rejectDecline a discovered outlet. A rejected outlet's sales are held exactly like an unmapped outlet's. Idempotent when already rejected./api/v1/accounting/lightspeed-x/connections/:connectionId/outlets/:outletId/acceptAccept a previously rejected outlet, returning it to the normal mapping flow./api/v1/accounting/lightspeed-x/outlets/resync-blockedBusiness-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`)./api/v1/accounting/lightspeed-x/register-tillsThis 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)./api/v1/accounting/lightspeed-x/registers/syncPull 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./api/v1/accounting/lightspeed-x/connections/:connectionIdDisconnect 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./api/v1/accounting/lightspeed-x/tax-mappingsList 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./api/v1/accounting/lightspeed-x/tax-mappings/auto-mapFetch 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)./api/v1/accounting/lightspeed-x/tax-mappingsCreate or update one Lightspeed tax-type to V-SDC label mapping for the business./api/v1/accounting/lightspeed-x/tax-mappings/:providerTaxTypeDeactivate a Lightspeed tax mapping. The row is retained and can be re-activated via the restore endpoint./api/v1/accounting/lightspeed-x/tax-mappings/:providerTaxType/restoreRe-activate a previously deactivated Lightspeed tax mapping./webhooks/lightspeed-xLightspeed-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`./api/v1/businesses/:businessId/accounting/eposnow/connectConnect an EposNow account to one VSMS Location. Rejects Epos Key/Secret pairs already active on another connection, live-validates the credentials against EposNow, then persists the connection and generates the outgoing webhook Key/Secret (returned once). Subject to the connector licence gate and the connection-limit gate when wired, and the 10/min open rate limit./api/v1/businesses/:businessId/accounting/eposnow/statusList every EposNow connection for the business, one row per connection (active, deactivated or needing reconnect), newest first. Soft-deleted history is returned separately in `deletedConnections`. Never exposes tokens or hashes./api/v1/businesses/:businessId/accounting/eposnow/connections/:connectionId/devicesReturn the raw, unfiltered device list EposNow reports for one active connection, so an admin can bind a physical device to a printer. Calls EposNow live with the connection's stored credentials./api/v1/businesses/:businessId/accounting/eposnow/connections/:connectionId/locationRe-point a connection at a different VSMS Location (the one whose certificate signs its sales). The location is required and cannot be cleared. Fires `EPOSNOW_CONNECTION_LOCATION_ASSIGNED` audit with the previous and new location./api/v1/businesses/:businessId/accounting/eposnow/discoverBusiness-wide location and device auto-discovery. Uses the first active connection whose credentials still work to pull EposNow's locations (upserted as Locations, new ones auto-accepted) and all devices (upserted as tills), and back-fills the EposNow location id on connections that lack it. Fires location/till audit events./api/v1/businesses/:businessId/accounting/eposnow/connections/history/:connectionIdSoft-delete an already-disconnected connection from the working list into the 'deleted' history. Nothing is removed from the database. Fires `EPOSNOW_CONNECTION_DELETED` audit./api/v1/businesses/:businessId/accounting/eposnow/connections/:connectionIdDeactivate an EposNow connection. Idempotent: an absent or already-inactive connection returns 204 without a second audit event. Fires `EPOSNOW_DISCONNECTED` audit when a live connection is deactivated./api/v1/businesses/:businessId/accounting/eposnow/connections/:connectionId/reconnectRe-enter the Epos Key/Secret for an existing connection, live-validate them against EposNow and reactivate it. Guards against credentials already used by another active connection and against credentials belonging to a different EposNow location unless confirmed. No new webhook credentials are generated. Rate-limited (10/min open bucket)./api/v1/businesses/:businessId/accounting/eposnow/connections/:connectionId/regenerate-credentialsRotate the outgoing webhook Key/Secret for an active connection. The stored EposNow Epos Key/Secret are untouched and nothing is validated against EposNow. The new pair is returned once. Fires `EPOSNOW_CREDENTIALS_REGENERATED` audit. Rate-limited (10/min open bucket)./api/v1/businesses/:businessId/accounting/eposnow/connections/:connectionId/syncManual Sync Now for one EposNow connection. Pulls transactions from EposNow, inserts new invoices and dispatches auto-fiscalisation jobs when enabled. Has database side effects, so HTTP caching is disabled (Cache-Control: no-store). The optional window is one-shot and never persisted; the next ordinary sync resumes from the connection's LastSyncedAt watermark. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. 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./api/v1/businesses/:businessId/accounting/eposnow/sync-allSync All for EposNow: 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./api/v1/accounting/eposnow/tax-mappingsList the EposNow tax-type to V-SDC tax-label mappings for the business (active and inactive)./api/v1/accounting/eposnow/tax-mappings/auto-mapFetch EposNow tax rates (from the first active connection) and the current V-SDC rates and return mapping suggestions. Does not persist mappings; the admin confirms each via PUT. As a best-effort side effect it drift-checks confirmed mappings and seeds unseen tax codes, including the synthetic EPOSNOW_TAX_EXCL code, as proposals under 'Other tax codes'; failures there never fail the response. Rate-limited (10/min open bucket)./api/v1/accounting/eposnow/tax-mappingsCreate or update one EposNow tax-type to V-SDC label mapping (MERGE on businessId, 'eposnow', providerTaxType)./api/v1/accounting/eposnow/tax-mappings/:providerTaxTypeSoft-delete an EposNow tax mapping (sets IsActive=0). The row is retained and can be re-activated via the restore endpoint./api/v1/accounting/eposnow/tax-mappings/:providerTaxType/restoreRe-activate a previously soft-deleted EposNow tax mapping (IsActive 0 to 1)./webhooks/eposnow/:businessId/:connectionIdEposNow-initiated outgoing-webhook receiver. Not JWT-authenticated: the Authorization Basic credential (base64 of outgoingApiKey:outgoingApiSecret) is checked against the connection's stored SHA-256 hash. A valid delivery is acked 200 immediately and a wake-signal (transaction id) is fanned to the EposNow webhook Redis stream; the worker re-fetches the canonical transaction. A body with no resolvable numeric transaction id is acked 200 and dropped./api/v1/businesses/:businessId/fiscaliseMain ingestion endpoint. Persists the invoice + dispatches it to V-SDC and sync-waits up to ~10 s for the fiscal response. Returns 200 with `fiscalInvoiceNumber` + QR/URL/hash when the consumer reaches a terminal state inside the window; 202 with a `statusUrl` when the timeout elapses with payments still in-flight; 201 when the invoice was imported but not dispatched — with a `triggerUrl` for PROFORMA bodies (call it to fiscalise the quote), or with a `statusUrl` and no `triggerUrl` for a NORMAL/ADVANCE sale whose connector auto-fiscalise is off (an admin fiscalises it from the app). Every `paymentResults[]` entry carries `eligibleForFiscalisation` + `fiscalisationBlockReasons` so an imported-awaiting-fiscalisation invoice is distinguishable from a blocked one./api/v1/businesses/:businessId/tax-ratesDeclare the caller's tax table — the push-connector equivalent of "list all tax rates". VSMS Connect cannot pull an integrator's tax catalogue, so the caller declares each code it will use and a business admin maps every one to a V-SDC label before the first invoice arrives. Each not-yet-mapped code is recorded as a PROPOSAL for admin confirmation; nothing is ever auto-confirmed, and a confirmed mapping's V-SDC label is never rewritten by a caller. Re-declaring a confirmed code whose rate has drifted flags that mapping for admin re-review (its invoices block until re-mapped); a name-only change is a non-blocking metadata refresh. Not idempotency-keyed — a re-declaration is always processed. Modelled on the on-premise agents' seed-from-agent flow./api/v1/businesses/:businessId/storesDeclare your own store codes, so you never have to store a VSMS Connect location GUID. Each declared code is recorded against the business for review; an admin then MAPS it to one of their own Locations, and that location's certificate signs the store's sales. Idempotent — re-declaring a code never overwrites what the admin has already set, so it is safe to send your full store list on every deploy. Send this BEFORE your first invoice: until a code is mapped, invoices carrying it are accepted but blocked with HTTP_STORE_NOT_MAPPED rather than signed at another location. Not idempotency-keyed: a re-declaration is always processed./api/v1/businesses/:businessId/storesRead back what your declared store codes currently resolve to, so you can confirm the mapping before relying on it. Returns only stores declared through this connector — never the business's other locations, which you have no code for. Check this before going live: a store that is not yet `mapped` does NOT route, and every invoice carrying its code is accepted and BLOCKED rather than signed at another location./api/v1/businesses/:businessId/fiscalise/:invoiceIdRetrieve one invoice by its VSMS Connect `invoiceId` — the connector's only retrieval endpoint. Lookup is by the server-issued `invoiceId` GUID (echoed in every POST /fiscalise response), NOT the caller's `invoiceNumber` and NOT the SDC `fiscalInvoiceNumber`; there is no lookup-by-number and no list/search endpoint, so the integrator must persist the `invoiceId` it gets back. Idempotent — returns the same `FiscaliseSuccessResponse` shape as `POST /fiscalise` (per-payment `status`, `fiscalInvoiceNumber` null until signed, plus `eligibleForFiscalisation`/`fiscalisationBlockReasons`), so a caller polling after a 202 gets a drop-in replacement once the consumer reaches a terminal state./api/v1/businesses/:businessId/fiscalise/:invoiceId/triggerExplicit dispatch for a PROFORMA imported via POST /fiscalise's 201 path. Delegates to the existing `triggerFiscalisationByInvoiceIds` primitive — non-PROFORMA invoices are rejected with 422 INVOICE_NOT_QUOTE./api/v1/businesses/:businessId/fiscalise/cancelSubmit a V-SDC cancellation document for a previously-fiscalised payment. Name the target by `fiscalInvoiceNumber` (the SDC number) OR by your own `invoiceNumber` (+ optional `transactionType`/`externalPaymentId`), resolved against that number's sale/refund/copy family (TAXCORE-639). Because a cancel signs a reversing document the invoiceNumber path is fail-closed — an ambiguous target returns 422 naming the candidates, never guessed. Delegates to the per-payment `cancelPayment` primitive (sibling InvoicePayments row with `CancelsPaymentId`) and waits for the cancellation receipt to be signed before responding — so the caller gets back the full `fiscalJournal` + QR + signed hash in one round-trip and can print without polling. Falls through to 202 + `statusUrl` if the sync-wait window elapses./api/v1/accounting/http/tax-mappingsList generic HTTP connector tax-mappings for the caller's business (`Provider='http'`). Registered by the generic per-provider loop in AccountingAgentTaxMappingsRoute./api/v1/accounting/http/tax-mappingsUpsert one generic HTTP connector tax-mapping (provider tax code to V-SDC label). Same body shape as the other tax-mapping CRUD surfaces; the service validates the V-SDC label./api/v1/accounting/http/tax-mappings/:providerTaxTypeSoft-delete a generic HTTP connector tax-mapping (`IsActive=0`). Idempotent./api/v1/accounting/http/tax-mappings/:providerTaxType/restoreRe-activate a deactivated generic HTTP connector mapping (`IsActive=1`). Idempotent./api/v1/businesses/:businessId/accounting/http/store-mappingsList every generic-HTTP store the admin should see: the union of declared stores (Locations discovered from the integrator's store declarations) and stored mappings, so a mapping whose store code disappeared from the declarations stays visible. Each row carries storeCode, storeName, locationId (null when unmapped), status and discoveredLocationId./api/v1/businesses/:businessId/accounting/http/store-mappings/:storeCodePoint a store code at a business Location. The mapping decides which certificate signs that store's invoices./api/v1/businesses/:businessId/accounting/http/store-mappings/:storeCodeClear the mapping for a store code. Idempotent: clearing an absent mapping is still 204./api/v1/businesses/:businessId/accounting/sync/statusReturn the last-push timestamp per on-premise source (sage100, sage300, sage200evolution, amicus) for the business. Reads `ImportBatches.CreatedAt` per source via `findLatestCreatedAtBySources`; null when the source has never pushed./api/v1/businesses/:businessId/accounting/agent/heartbeatOn-premise sales-agent heartbeat, sent at most about every 30 s. Any provider scope is accepted. The controller stores the normalised heartbeat in Redis per API-key id with a 600 s TTL (read back by the push-status endpoint), and best-effort records the key's last-seen time and reported `version` in the database. Neither write can fail the request./api/v1/businesses/:businessId/accounting/agent/contextReturns the app-side location the calling API key is scoped to, so the sales-agent setup wizard can show which app location the agent maps to. Any provider scope is accepted. `location` is null when the key has no location or it does not resolve.Receipt printers, print jobs and the print agent.
/api/v1/businesses/:businessId/print/tillsList every registered till for the business — name, machine id, `IsDefault`, `IsOnline`, `LastSeenAt`, and optional `LocationId`./api/v1/businesses/:businessId/print/tills/:tillId/nameRename a till. Fires `TILL_RENAMED` audit (resource type `TILL`)./api/v1/businesses/:businessId/print/tills/:tillId/testDispatch a test PrintJob (`type='TEST'`) to the till. The agent picks it up on its next poll or via the SSE wake stream. Fires `TEST_PRINT_SENT` audit./api/v1/businesses/:businessId/print/tills/setup-tokenGenerate a one-time setup token used by the print agent's first-run wizard to claim a permanent TillToken. Optionally binds the resulting till to a specific Location (TAXCORE-246) — single-location merchants omit and the claim resolves to the business default. Fires `TILL_SETUP_TOKEN_GENERATED` audit./api/v1/businesses/:businessId/print/default-tillSet the default till for the business. Future auto-print jobs that don't carry an explicit till routing key target this till. Fires `TILL_DEFAULT_SET` audit./api/v1/businesses/:businessId/print/jobsList print jobs for the business, optionally filtered by status./api/v1/businesses/:businessId/print/jobs/:id/retryReset a `FAILED` or `STALE` print job back to `PENDING` so the agent will pick it up again. Fires `PRINT_JOB_RETRIED` audit./api/v1/businesses/:businessId/print/tills/:tillId/pos-register-idManually point a claimed till at a physical register, or clear the assignment with an explicit null. The value is free text (max 100 chars) and is not validated against any provider device. Fires `TILL_REGISTER_ASSIGNED` audit./api/v1/businesses/:businessId/print/tills/:tillId/devices/:tillDeviceIdDismiss a stale device from a till's device list. Soft operation: the row is kept with `ForgottenAt` set, removes no access, and is revived if the device heartbeats again. Fires `TILL_DEVICE_FORGOTTEN` audit./api/v1/businesses/:businessId/print/tills/:tillId/devices/:tillDeviceId/disconnectCut one OAuth-paired (`mcp`) device off by revoking every live grant its client holds, so it stops collecting receipts until paired again. Unbinds the till if it still names that client, and retires the till's push registration when no other device remains attached. The device row is kept (use the DELETE route to forget it). Revoking zero grants is still a success. Fires `TILL_DEVICE_DISCONNECTED` audit./api/v1/businesses/:businessId/print/tills/:tillId/revoke-setup-tokenRevoke a claimed till's TillToken and issue a fresh one-time setup token, forcibly cutting off a running print agent (lost device, reinstall, suspected leak). Fires `TILL_TOKEN_REVOKED` and `TILL_SETUP_TOKEN_GENERATED` (mode `revoke_and_reissue`) audits./api/v1/businesses/:businessId/print/jobs/retry-allReset every failed (`FAILED` / `STALE`) print job for one till back to pending. Scoped to a till, not the business. Zero matches is not an error. Fires `PRINT_JOBS_BULK_RETRIED` audit./api/v1/businesses/:businessId/print/jobs/dismiss-allSoft-dismiss every failed print job for one till so they leave the failed list. Zero matches is not an error. Fires `PRINT_JOBS_BULK_DISMISSED` audit./api/v1/businesses/:businessId/print/jobs/:id/dismissSoft-dismiss one failed print job (status becomes `DISMISSED`, still listable via the status filter). A print job is not a fiscal record, so this only means the paper receipt did not print. Fires `PRINT_JOB_DISMISSED` audit./api/v1/print/agent/claimPrint-agent first-run setup. Exchanges the one-time SetupToken (issued via `POST /print/tills/setup-token`) for a permanent TillToken — the SetupToken itself IS the credential for this single call. Returns the till + plaintext token (only time it is returned). Fires `TILL_CLAIMED` audit./api/v1/print/agent/jobsReturn PENDING print jobs for the authenticated till. Polled by the agent as a fallback to the SSE wake channel./api/v1/print/agent/jobs/streamLong-lived SSE channel — emits a `wake` event whenever a new PrintJob is published for this till so the agent can fetch + print without waiting for the next poll tick. Keep-alive `:keepalive` comment every 25 s to beat reverse-proxy idle timeouts./api/v1/print/agent/jobs/:id/ackAgent ack — mark a print job `PRINTED` (success) or `FAILED` (USB / printer error). The repository asserts the job belongs to the authenticated till and is still in a settable state./api/v1/print/agent/heartbeatPeriodic heartbeat — updates `Tills.IsOnline=1` and `LastSeenAt=now`. Sent by the agent on every poll tick / SSE reconnect./api/v1/print/agent/push-tokenRegister (or refresh) the Expo push token the authenticated till's device can be notified at. The till is taken from the TillToken, never the request. Idempotent — agents re-register on every launch./api/v1/print/agent/push-tokenRetire every active push token for the authenticated till, called when a device unpairs. The till is taken from the TillToken. Idempotent — retiring nothing is still a 204.Users, invites, API keys, audit log, MCP access and the operator console.
/api/v1/usersList all users belonging to the authenticated caller's business (businessId taken from the JWT, not the URL)./api/v1/usersCreate a new user inside the caller's business. Argon2-hashes the password, derives username from the email local part, inserts into Users + UserRoles, and fires USER_CREATED + welcome email (fire-and-forget)./api/v1/users/:userIdPartial update of a user inside the caller's business. Patch may include roles, isActive, firstName, lastName, email, and/or password. Admin-removal safeguards prevent removing your own Administrator role or removing the last administrator. Fires USER_DEACTIVATED on isActive=false, USER_UPDATED otherwise./api/v1/invitesCreate a one-time invite. Generates a UUID token, stores `invite:{uuid}` in Redis with TTL INVITE_TTL_SECONDS (default 72h) holding { email, roles, organizationId=businessId, invitedBy=actorUserId }, and sends an invite email. On email failure the Redis token is deleted to avoid orphans./api/v1/invites/:tokenValidate an invite token and return its metadata so the registration page can pre-fill the email and show the role(s). Public — invite recipients have no account yet./api/v1/businesses/:businessId/api-keysGenerate a new static API key for on-premise agents (Sage 100/300/200 Evolution, Amicus). Stores SHA-256(rawKey) + an 8-char prefix; returns the raw 64-hex-char key exactly once. Optional scope binds the key to one AccountingProviderType; optional locationId scopes it to one Location (validated against the business). Fires API_KEY_CREATED./api/v1/businesses/:businessId/api-keysList all API keys for a business (active + revoked). Raw secret is never returned — only label, prefix, scope, locationId, createdAt, lastUsedAt, revokedAt./api/v1/businesses/:businessId/api-keys/:keyIdSoft-revoke an API key (sets RevokedAt). Idempotent — re-calling on an already-revoked key is a no-op. Fires API_KEY_REVOKED on first revocation./api/v1/businesses/:businessId/audit-eventsPaginated audit log for a business. Supports filters by eventType (comma-separated → IN clause), outcome (comma-separated), actorType, provider, resourceType, resourceId, dateFrom/dateTo (epoch ms), and a search term (matches ResourceId, ActorName, ActorEmail or the event name with %term%). Each item carries actorName (an agent's API key label or a user's full name — never an email), actorType, outcome, provider, requestId and a one-line summary. Returns items + total + stats (fiscalised/failed/actors counts). Fires VIEW_AUDIT_LOG fire-and-forget after the response is sent./api/v1/businesses/:businessId/audit-events/exportStream all matching audit events as CSV (Content-Disposition: attachment; filename=audit-log-<businessId>-<yyyy-mm-dd>.csv). Same filters as the list endpoint; Administrator only (requireAdmin). Registered before /:id so Express does not treat 'export' as an id param./api/v1/businesses/:businessId/audit-events/:idFetch a single audit log entry by its BIGINT AuditLogId. Scoped to the business./api/v1/businesses/:businessId/audit-events/:id/relatedThe audit events that share the requested event's request id, oldest first and including the event itself — for example an agent push, the fiscalisation jobs it dispatched and the receipts they printed. Capped at 100. An event with no request id answers with an empty list rather than an error. Scoped to the business./api/v1/mcp/connectionReturn the public MCP server URL, transport, and tool list. Does NOT require an MCP token — only a valid JWT. Used by the app to display connection details before the user creates their first token./api/v1/mcp/tokensIssue a 90-day RS256 personal-access token (typ='mcp') for AI agents. jti = McpTokens.McpTokenId UUID. Only SHA-256(rawToken) is persisted; the raw token is returned ONCE on creation and never again./api/v1/mcp/tokensList the caller's active MCP tokens (non-revoked, non-expired). Raw token hash is never exposed — only id, name, createdAt, lastUsedAt, expiresAt./api/v1/mcp/tokens/:tokenIdSoft-revoke an MCP token (sets RevokedAt). Idempotent — re-calling on an already-revoked token is a no-op./api/v1/mcp/agent-configReturn a Claude Desktop / mcp.json configuration snippet referencing the MCP server URL and a placeholder Authorization header. The raw token is not returned — the user must substitute the value they saved at creation time./api/v1/operator/businessesList every business (cross-tenant) with its licence-key id, licensed connectors and connector limits, plus platform-wide stats (total businesses, businesses created this calendar month, total licence keys, total users). Operator-only; no Administrator bypass./api/v1/operator/businesses/:businessId/usersList all users belonging to the given business (cross-tenant read for operators)./api/v1/operator/licence-keysList all business licence keys. Each entry is `unused` or `used` (by `UsedAt`) with creation and use timestamps and the business that used it; the key hash or plaintext is never returned./api/v1/operator/licence-keysGenerate a single-use business licence key. Only its argon2id hash is persisted; the plaintext is returned once and is required to register a business via `POST /api/v1/businesses/register`. Fires `LICENCE_KEY_GENERATED` audit (resource type `CONFIG`, actor = the operator)./api/v1/operator/licence-keys/:idRevoke a licence key that has not been used. Fires `LICENCE_KEY_REVOKED` audit (resource type `CONFIG`)./api/v1/operator/businesses/:businessId/licensed-connectorsFull-replace of a business's licensed-connector allow-list. Operator-only; the business's own Administrator has no equivalent write path. Fires `LICENSED_CONNECTORS_UPDATED` audit with before and after values./api/v1/operator/businesses/:businessId/connector-limitsUpsert one connector's resource limits (max API keys, max connections) for a business. A null or omitted field means unlimited. Fires `CONNECTOR_LIMITS_UPDATED` audit with before and after values./api/v1/operator/businesses/:businessId/connectorsPer-connector health rollup for a business: last activity, last error, total and error counts, and per-document-type counts (sales, refunds, copies, quotes, training). Connectors that are configured but have no activity yet are included with zeroed counts, appended after the activity-bearing ones./api/v1/operator/businesses/:businessId/connectors/:connector/activityPaginated, newest-first invoice activity feed for one connector of a business, with a status summary. Supports status, invoice-number search and document-type filters./api/v1/operator/businesses/:businessId/connector-invoice-bucketsInvoice counts bucketed by day, month or year and by status over a lookback window, for the operator invoices-over-time chart. Optionally narrowed to one connector. Buckets are zero-filled and ordered oldest to newest.Health and discovery endpoints.
/healthLiveness probe. Returns `{ ok: true }` for a bare call. When `?services` is present (any value), the response also includes `services: { redis: boolean }` reflecting `Redis.testConnection()`. Unversioned (does NOT live under /api/v1)./.well-known/apple-app-site-associationiOS Universal Links association file. Returns a JSON payload listing the app's TeamID + bundleIdentifier under `applinks.details` with path scope `/go*`. Served unauthenticated and OUTSIDE the /api/v1 prefix — the OS fetches it directly over HTTPS. TeamID is a deploy-time placeholder./.well-known/assetlinks.jsonAndroid App Links assetlinks. Returns a JSON array delegating common.handle_all_urls to the app's android_app namespace with package_name + sha256_cert_fingerprints. Served unauthenticated and OUTSIDE the /api/v1 prefix. Package name and fingerprint are deploy-time placeholders./api/v1/businesses/:businessId/background-runs/:runIdStatus of a background run started by a re-sync or Sync Now endpoint. Poll until `status` is no longer `running`: `done` carries `result` (the body the start endpoint used to return synchronously), `failed` carries `errorCode`, and `interrupted` means the backend stopped before the run finished (safe to start again). A run of another business, or one older than its retention (15 min after finishing), returns 404.