vsmsconnect — API — on-premise-agent

← all endpoints

Routes shared by every on-premise connector — AMICUS, Atrex, Sage 100, Sage 200 Evolution and Sage 300. These connectors read the customer's own database through the sales agent, which authenticates with an API key. The agent sends a heartbeat and asks which app location it is scoped to; the app reads the combined push status. Connector-specific routes (register manifests, branch mappings, tax-mapping seeding, sync) are listed under each connector.

GET/api/v1/businesses/:businessId/accounting/sync/status auth: jwt (administrator | view_invoices | submit_invoices)

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

handlers: AccountingAgentSyncController.status

Inputs

namerequireddefaultdescription
businessId path
uuid
yes—Target business UUID.

Outputs

200
APIResponseDataObject<PushStatusResponse>
Map of source → `{ lastPushAt: string | null }` (ISO-8601 timestamp).
403
APIError
USER_FORBIDDEN — businessId on path does not match the caller's JWT.
POST/api/v1/businesses/:businessId/accounting/agent/heartbeat auth: apikey

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

handlers: AccountingAgentSyncController.recordHeartbeat

Inputs

namerequireddefaultdescription
businessId path
uuid
yes—Target business UUID. Must match the API key's `BusinessId`; a mismatch is rejected with 403.
Authorization header
string
yes—`ApiKey <key>` — validated by `requireApiKey` against the stored key hash.
lastPushAt body
number | null
no—Epoch-ms of the agent's last push.
lastPushOutcome body
'success' | 'transient' | 'persistent_outage' | null
no—Outcome of the last push.
consecutiveFailures body
number
no—Consecutive failed pushes.
persistentOutageActive body
boolean
no—Whether a persistent outage is active.
backlogEstimate body
Record<string, number>
no—Estimated backlog per source.
version body
string
no—Agent build version, recorded against the API key.

Outputs

204
void
Heartbeat accepted (no body).
401
APIError
AUTH_UNAUTHORIZED — missing or invalid (unknown or revoked) API key.
403
APIError
USER_FORBIDDEN — the API key does not belong to the business in the path.
422
APIError
VALIDATION_ERROR — body or path failed schema validation.
GET/api/v1/businesses/:businessId/accounting/agent/context auth: apikey

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

handlers: AccountingAgentSyncController.agentContext

Inputs

namerequireddefaultdescription
businessId path
uuid
yes—Target business UUID. Must match the API key's `BusinessId`; a mismatch is rejected with 403.
Authorization header
string
yes—`ApiKey <key>` — validated by `requireApiKey` against the stored key hash.

Outputs

200
APIResponseDataObject<{ businessId: string; location: { id: string; name: string } | null }>
The key's business and resolved location.
401
APIError
AUTH_UNAUTHORIZED — missing or invalid (unknown or revoked) API key.
403
APIError
USER_FORBIDDEN — the API key does not belong to the business in the path.
422
APIError
VALIDATION_ERROR — body or path failed schema validation.