vsmsconnect — API — eposnow

← all endpoints

POST/api/v1/businesses/:businessId/accounting/eposnow/connect auth: jwt (administrator)

Connect 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.

handlers: EposNowConnectionController.connect

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—Business id; must match the caller's own business (requireBusinessAccess).
eposKey body
string
yes—EposNow Epos Key. Trimmed, 1-200 chars.
eposSecret body
string
yes—EposNow Epos Secret. Trimmed, 1-200 chars.
locationId body
string (uuid)
yes—VSMS Location whose certificate signs this connection's sales.

Outputs

201
APIResponseDataObject<ConnectEposNowResult>
{ connectionId, outgoingApiKey, outgoingApiSecret, apiUrl }. The outgoing key/secret are shown once and not stored in plaintext; apiUrl is the relative webhook path EposNow calls.
409
APIError
EPOSNOW_CREDENTIALS_ALREADY_CONNECTED - these Epos Key/Secret are already connected to another active location.
422
APIError
EPOSNOW_CREDENTIALS_INVALID - EposNow rejected the supplied Epos Key/Secret.
GET/api/v1/businesses/:businessId/accounting/eposnow/status auth: jwt (administrator)

List 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.

handlers: EposNowConnectionController.status

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—Business id; must match the caller's own business (requireBusinessAccess).

Outputs

200
APIResponseDataObject<EposNowStatusResponse>
{ connections[], deletedConnections[] }. Each row: connectionId, locationId, isActive, lastSyncedAt, createdAt, syncFromDate, discoveredLocationId, discoveredLocationName, credentialsInvalid, deletedAt.
GET/api/v1/businesses/:businessId/accounting/eposnow/connections/:connectionId/devices auth: jwt (administrator)

Return 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.

handlers: EposNowConnectionController.devices

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—Business id; must match the caller's own business (requireBusinessAccess).
connectionId path
string (uuid)
yes—EposNow connection id (EposNowConnectionId).

Outputs

200
APIResponseDataObject<EposNowDevicesResponse>
{ devices: Device[] }.
404
APIError
EPOSNOW_CONNECTION_NOT_FOUND - unknown, foreign or inactive connection.
PATCH/api/v1/businesses/:businessId/accounting/eposnow/connections/:connectionId/location auth: jwt (administrator)

Re-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.

handlers: EposNowConnectionController.setLocation

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—Business id; must match the caller's own business (requireBusinessAccess).
connectionId path
string (uuid)
yes—EposNow connection id (EposNowConnectionId).
locationId body
string (uuid)
yes—VSMS Location id; must belong to the caller's business.

Outputs

204
empty
No content.
404
APIError
EPOSNOW_CONNECTION_NOT_FOUND | LOCATION_NOT_FOUND (location not found for this business).
POST/api/v1/businesses/:businessId/accounting/eposnow/discover auth: jwt (administrator)

Business-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.

handlers: EposNowConnectionController.discoverAll

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—Business id; must match the caller's own business (requireBusinessAccess).

Outputs

200
APIResponseDataObject<EposNowDiscoverAllResponse>
{ locationsDiscovered, locationsCreated, locationsExisting, devicesDiscovered, devicesCreated, devicesExisting }.
404
APIError
EPOSNOW_CONNECTION_NOT_FOUND - no active connection for the business.
409
APIError
EPOSNOW_CONNECTION_NOT_FOUND - discovery is not available in this environment (till repository not wired).
502
APIError
EPOSNOW_API_ERROR - no active connection could reach EposNow.
DELETE/api/v1/businesses/:businessId/accounting/eposnow/connections/history/:connectionId auth: jwt (administrator)

Soft-delete an already-disconnected connection from the working list into the 'deleted' history. Nothing is removed from the database. Fires `EPOSNOW_CONNECTION_DELETED` audit.

handlers: EposNowConnectionController.deleteConnection

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—Business id; must match the caller's own business (requireBusinessAccess).
connectionId path
string (uuid)
yes—EposNow connection id (EposNowConnectionId).

Outputs

204
empty
No content.
404
APIError
EPOSNOW_CONNECTION_NOT_FOUND - unknown, foreign or already-deleted connection.
409
APIError
EPOSNOW_CONNECTION_STILL_ACTIVE - disconnect the connection before deleting it.
DELETE/api/v1/businesses/:businessId/accounting/eposnow/connections/:connectionId auth: jwt (administrator)

Deactivate 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.

handlers: EposNowConnectionController.disconnect

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—Business id; must match the caller's own business (requireBusinessAccess).
connectionId path
string (uuid)
yes—EposNow connection id (EposNowConnectionId).

Outputs

204
empty
No content.
POST/api/v1/businesses/:businessId/accounting/eposnow/connections/:connectionId/reconnect auth: jwt (administrator)

Re-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).

handlers: EposNowConnectionController.reconnect

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—Business id; must match the caller's own business (requireBusinessAccess).
connectionId path
string (uuid)
yes—EposNow connection id (EposNowConnectionId).
eposKey body
string
yes—EposNow Epos Key. Trimmed, 1-200 chars.
eposSecret body
string
yes—EposNow Epos Secret. Trimmed, 1-200 chars.
confirmLocationChange body
boolean
no—Operator acknowledgement that the reconnect deliberately repoints the connection at a different EposNow location; send only after the EPOSNOW_RECONNECT_LOCATION_MISMATCH prompt is confirmed.

Outputs

204
empty
No content.
404
APIError
EPOSNOW_CONNECTION_NOT_FOUND.
409
APIError
EPOSNOW_CREDENTIALS_ALREADY_CONNECTED - these credentials are already connected to another active location.
422
APIError
EPOSNOW_CREDENTIALS_INVALID (EposNow rejected the Key/Secret) | EPOSNOW_RECONNECT_LOCATION_MISMATCH (credentials belong to a different EposNow location; error data carries previous/new EposNow location ids and names).
POST/api/v1/businesses/:businessId/accounting/eposnow/connections/:connectionId/regenerate-credentials auth: jwt (administrator)

Rotate 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).

handlers: EposNowConnectionController.regenerateCredentials

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—Business id; must match the caller's own business (requireBusinessAccess).
connectionId path
string (uuid)
yes—EposNow connection id (EposNowConnectionId).

Outputs

200
APIResponseDataObject<RegenerateEposNowCredentialsResult>
{ connectionId, outgoingApiKey, outgoingApiSecret, apiUrl }. The secret is shown once.
404
APIError
EPOSNOW_CONNECTION_NOT_FOUND - unknown, foreign or inactive connection.
GET/api/v1/businesses/:businessId/accounting/eposnow/connections/:connectionId/sync auth: jwt (administrator | view invoices | submit invoices)

Manual 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.

handlers: EposNowSyncController.sync

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—Business id; must match the caller's own business (requireBusinessAccess).
connectionId path
string (uuid)
yes—EposNow connection id (EposNowConnectionId).
modifiedSince query
string (ISO datetime)
no—One-shot backfill lower bound.
dateTo query
string (ISO datetime)
no—One-shot backfill upper bound; defaults to now.

Outputs

202
APIResponseDataObject<BackgroundRunAcceptedDTO>
Started in the background: `{ runId }`. Poll `GET /api/v1/businesses/:businessId/background-runs/:runId`; once `status` is `done`, `result` holds the response body this endpoint used to return.
409
APIError
BACKGROUND_RUN_IN_PROGRESS — a Sync Now for this connection, or the business's EposNow Sync All is already running. `data` is `BackgroundRunInProgressDTO` (`runId`, `kind`, `params`, `startedAt`) of the running run.
POST/api/v1/businesses/:businessId/accounting/eposnow/sync-all auth: jwt (administrator | view_invoices | submit_invoices)

Sync 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.

handlers: EposNowSyncController.syncAll

Inputs

namerequireddefaultdescription
businessId path
uuid
yes—Target business UUID.
connectionIds body
uuid[] (1-50)
yes—The connections to sync, in order.
modifiedSince body
string
no—Optional lower bound, same format as the single-connection sync.
dateTo body
string
no—Optional upper bound, same format as the single-connection sync.

Outputs

202
APIResponseDataObject<BackgroundRunAcceptedDTO>
Started in the background: `{ runId }`. Poll `GET /api/v1/businesses/:businessId/background-runs/:runId`; once `status` is `done`, `result` holds the response body this endpoint used to return.
409
APIError
BACKGROUND_RUN_IN_PROGRESS — a EposNow Sync All for this business is already running. `data` is `BackgroundRunInProgressDTO` (`runId`, `kind`, `params`, `startedAt`) of the running run.
422
APIError
Validation failed (missing or invalid `connectionIds`, bad date).
GET/api/v1/accounting/eposnow/tax-mappings auth: jwt (administrator)

List the EposNow tax-type to V-SDC tax-label mappings for the business (active and inactive).

handlers: EposNowTaxMappingsController.list

Inputs

No parameters.

Outputs

200
APIResponseDataList<TaxRateMappingDTO>
Mappings for `Provider='eposnow'`.
409
APIError
BUSINESS_CONTEXT_REQUIRED - no active business on the JWT.
POST/api/v1/accounting/eposnow/tax-mappings/auto-map auth: jwt (administrator)

Fetch 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).

handlers: EposNowTaxMappingsController.autoMap

Inputs

No parameters.

Outputs

200
APIResponseDataList<TaxRateMappingSuggestion>
Suggested mappings per EposNow tax code.
409
APIError
BUSINESS_CONTEXT_REQUIRED - no active business on the JWT.
429
APIError
Rate limit exceeded.
PUT/api/v1/accounting/eposnow/tax-mappings auth: jwt (administrator)

Create or update one EposNow tax-type to V-SDC label mapping (MERGE on businessId, 'eposnow', providerTaxType).

handlers: EposNowTaxMappingsController.upsert

Inputs

namerequireddefaultdescription
providerTaxType body
string
yes—EposNow tax code. Trimmed, 1-100 chars.
providerTaxName body
string | null
no—Display name of the EposNow tax. Max 500 chars.
providerRate body
number | null
no—EposNow rate percent.
vsdcTaxLabel body
string
yes—Target V-SDC tax label. Trimmed, 1-10 chars.
vsdcRate body
number | null
no—V-SDC rate percent for display.

Outputs

200
APIResponseDataObject<TaxRateMappingDTO>
Upserted mapping row.
409
APIError
BUSINESS_CONTEXT_REQUIRED - no active business on the JWT.
DELETE/api/v1/accounting/eposnow/tax-mappings/:providerTaxType auth: jwt (administrator)

Soft-delete an EposNow tax mapping (sets IsActive=0). The row is retained and can be re-activated via the restore endpoint.

handlers: EposNowTaxMappingsController.remove

Inputs

namerequireddefaultdescription
providerTaxType path
string
yes—EposNow tax code to deactivate. Trimmed, 1-100 chars.

Outputs

204
empty
No content.
PATCH/api/v1/accounting/eposnow/tax-mappings/:providerTaxType/restore auth: jwt (administrator)

Re-activate a previously soft-deleted EposNow tax mapping (IsActive 0 to 1).

handlers: EposNowTaxMappingsController.restore

Inputs

namerequireddefaultdescription
providerTaxType path
string
yes—EposNow tax code to re-activate. Trimmed, 1-100 chars.

Outputs

204
empty
No content.
POST/webhooks/eposnow/:businessId/:connectionId auth: none (HTTP Basic per connection)

EposNow-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.

handlers: EposNowWebhookController.handle

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—Business id.
connectionId path
string (uuid)
yes—EposNow connection id.
Authorization header
string
yes—HTTP Basic: base64(outgoingApiKey:outgoingApiSecret).
TransactionId body
integer | string
no—EposNow transaction id; also read from transactionId, Id or id. Only the id is trusted.

Outputs

200
empty
Delivery accepted (fanned out, or dropped as unroutable).
401
empty
Credential missing/malformed/wrong, or connection unknown or inactive; all indistinguishable. Audited as EPOSNOW_WEBHOOK_AUTH_INVALID.
422
APIError
Path params are not valid UUIDs.