/api/v1/businesses/:businessId/accounting/sage100/sync
auth: apikeyOn-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).
handlers: AccountingAgentSyncController.syncSage100
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. Must match the API key's `BusinessId`. |
Authorization headerstring | yes | — | `ApiKey <key>` — validated by `requireApiKey` against `ApiKeys.KeyHash`. |
invoices bodyPushInvoice[] | yes | — | Array of pushed invoices. Each entry mirrors `AccountingInvoice` with optional `posSaleId`/`posRegisterId`/`originalPosSaleId`/`cashierId`/payment `tenders[]`. Empty array allowed. |
APIResponseDataObject<PushInvoicesResponse>APIErrorAPIError/api/v1/accounting/sage100/tax-mappings
auth: jwt (administrator)List Sage 100 tax-mappings for the business (`Provider='sage100'`).
handlers: AccountingAgentTaxMappingsController.listFor('sage100')
No parameters.
APIResponseDataList<TaxRateMappingDTO>/api/v1/accounting/sage100/tax-mappings
auth: jwt (administrator)Upsert one Sage 100 tax-mapping. Same body shape as the other tax-mapping CRUD surfaces.
handlers: AccountingAgentTaxMappingsController.upsertFor('sage100')
| name | required | default | description |
|---|---|---|---|
providerTaxType bodystring | yes | — | Sage 100 tax-code. |
providerTaxName bodystring | null | no | — | Human-readable tax name. |
providerRate bodynumber | null | no | — | Provider tax rate. |
vsdcTaxLabel bodystring | yes | — | V-SDC label. |
vsdcRate bodynumber | null | no | — | V-SDC rate percent. |
APIResponseDataObject<TaxRateMappingDTO>APIError/api/v1/accounting/sage100/tax-mappings/:providerTaxType
auth: jwt (administrator)Soft-delete a Sage 100 tax-mapping (`IsActive=0`). Idempotent.
handlers: AccountingAgentTaxMappingsController.removeFor('sage100')
| name | required | default | description |
|---|---|---|---|
providerTaxType pathstring | yes | — | Sage 100 tax-code to deactivate. |
empty/api/v1/accounting/sage100/tax-mappings/:providerTaxType/restore
auth: jwt (administrator)Re-activate a deactivated Sage 100 mapping (`IsActive=1`). Idempotent.
handlers: AccountingAgentTaxMappingsController.restoreFor('sage100')
| name | required | default | description |
|---|---|---|---|
providerTaxType pathstring | yes | — | Sage 100 tax-code to re-activate. |
empty/api/v1/businesses/:businessId/accounting/sage100/register-manifest
auth: apikeySage 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.
handlers: AccountingAgentSyncController.registerSage100Manifest
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. Must match the API key's `BusinessId`; a mismatch is rejected with 403. |
Authorization headerstring | yes | — | `ApiKey <key>` — validated by `requireApiKey` against the stored key hash. |
capturedAt bodynumber | yes | — | Epoch-ms time the agent captured the snapshot. |
depots body{ branchId: string; code?: string|null; name: string; city?: string|null; isPrimary?: boolean }[] | yes | — | Sage 100 depots. |
tills body{ posRegisterId: string; tillName: string; branchId: string }[] | no | [] | Sage 100 registers. A register whose depot cannot be resolved is skipped. |
APIResponseDataObject<{ branchesCreated; branchesExisting; branchesRenamed; tillsCreated; tillsExisting; tillsRenamed; tillsMoved }>APIErrorAPIErrorAPIErrorAPIError/api/v1/accounting/sage100/tax-mappings/seed-from-agent
auth: apikeySage 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.
handlers: Sage100TaxMappingsController.seedFromAgent
| name | required | default | description |
|---|---|---|---|
Authorization headerstring | yes | — | `ApiKey <key>` — validated by `requireApiKey` against the stored key hash. |
taxRates body{ code: string; name?: string|null; rate?: number|null; rateKind?: number|null; group?: string|null }[] | yes | — | Sales-side rows from `dbo.F_TAXE`. Each `TA_Code` is proposed on its own; `rateKind` non-zero marks a fixed-amount levy, which is proposed with a null rate and its amount in the name. `group` is accepted but no longer used for keying. |
APIResponseDataObject<{ proposed: { code: string; name: string|null; rate: number|null }[]; alreadyMapped: number; driftDetected: number }>APIErrorAPIError/api/v1/accounting/sage100/tax-mappings/request-seed
auth: jwt (administrator)Admin 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`.
handlers: Sage100TaxMappingsController.requestSeed
No parameters.
APIResponseDataObject<{ requested: true }>APIErrorAPIErrorAPIError/api/v1/businesses/:businessId/accounting/sage100/branch-mappings
auth: jwt (administrator); requireBusinessAccess enforces :businessId = caller's business (administrator bypasses)List 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.
handlers: Sage100BranchMappingController.list
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
APIResponseDataObject<{ branches: Sage100BranchMappingView[] }>APIError/api/v1/businesses/:businessId/accounting/sage100/branch-mappings/resync-blocked
auth: jwt (administrator); requireBusinessAccess enforces :businessId = caller's business (administrator bypasses)Re-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`).
handlers: Sage100BranchMappingController.resyncBlocked
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
APIResponseDataObject<BackgroundRunAcceptedDTO>APIErrorAPIErrorAPIError/api/v1/businesses/:businessId/accounting/sage100/branch-mappings/request-manifest
auth: jwt (administrator); requireBusinessAccess enforces :businessId = caller's business (administrator bypasses)Ask 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.
handlers: Sage100BranchMappingController.requestManifest
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
emptyAPIErrorAPIError/api/v1/businesses/:businessId/accounting/sage100/branch-mappings/backfill
auth: jwt (administrator); requireBusinessAccess enforces :businessId = caller's business (administrator bypasses)Seed 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.
handlers: Sage100BranchMappingController.backfill
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
APIResponseDataObject<object>APIErrorAPIError/api/v1/businesses/:businessId/accounting/sage100/branch-mappings/:branchId
auth: jwt (administrator); requireBusinessAccess enforces :businessId = caller's business (administrator bypasses)Assign 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.
handlers: Sage100BranchMappingController.setMapping
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
branchId pathstring | yes | — | Sage 100 F_DEPOT.DE_No — the source system's own identifier (1-100 chars, not a uuid). |
locationId bodyuuid | yes | — | Business Location whose certificate signs this depot's invoices. |
branchName bodystring | no | — | Depot display name at assignment time (max 255 chars), cached so the row stays labelled if the depot later disappears from the source. |
emptyAPIErrorAPIErrorAPIError/api/v1/businesses/:businessId/accounting/sage100/branch-mappings/:branchId/revoke
auth: jwt (administrator); requireBusinessAccess enforces :businessId = caller's business (administrator bypasses)Stop 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.
handlers: Sage100BranchMappingController.revokeMapping
| name | required | default | description |
|---|---|---|---|
businessId pathuuid | yes | — | Target business UUID. |
branchId pathstring | yes | — | Sage 100 F_DEPOT.DE_No — the source system's own identifier (1-100 chars, not a uuid). |
emptyAPIErrorAPIErrorAPIError