vsmsconnect — API — operator

← all endpoints

GET/api/v1/operator/businesses auth: jwt (operator)

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

handlers: requireOperator → OperatorController.listBusinesses

Inputs

No parameters.

Outputs

200
APIResponse<OperatorBusinessesResponse>
`{ businesses: OperatorBusinessDTO[], stats: OperatorStatsDTO }`.
403
APIError
`USER_FORBIDDEN` — caller does not hold the strict Operator role (no Administrator bypass).
GET/api/v1/operator/businesses/:businessId/users auth: jwt (operator)

List all users belonging to the given business (cross-tenant read for operators).

handlers: requireOperator → validate(OperatorBusinessIdParamsSchema, params) → OperatorController.listBusinessUsers

Inputs

namerequireddefaultdescription
businessId path
uuid
yes—Target business UUID. Operators have no businessId of their own; there is no `requireBusinessAccess` check, so any tenant can be addressed.

Outputs

200
APIResponseDataList<UserAdminDTO>
Users of the business.
403
APIError
`USER_FORBIDDEN` — caller does not hold the strict Operator role (no Administrator bypass).
422
APIError
`VALIDATION_ERROR` — `businessId` is not a UUID.
GET/api/v1/operator/licence-keys auth: jwt (operator)

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

handlers: requireOperator → OperatorController.listLicenceKeys

Inputs

No parameters.

Outputs

200
APIResponseDataList<OperatorLicenceKeyDTO>
All licence keys.
403
APIError
`USER_FORBIDDEN` — caller does not hold the strict Operator role (no Administrator bypass).
POST/api/v1/operator/licence-keys auth: jwt (operator)

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

handlers: requireOperator → validate(CreateLicenceKeyBodySchema, body) → OperatorController.createLicenceKey

Inputs

namerequireddefaultdescription
connectors body
ConnectorType[] | null
yes—Connectors the licensed business may use. A non-empty array, or an explicit `null` for no restriction; an empty array or omitting the field is rejected.
connectorLimits body
Record<ConnectorType, { maxApiKeys?: number | null; maxConnections?: number | null }> | null
no—Optional per-connector resource limits. Each value is a positive integer, or null/omitted for unlimited. Omitted/null means every connector is unlimited. Not cross-validated against `connectors`.

Outputs

201
APIResponseDataObject<{ id: string; licenceKey: string }>
Key id and the plaintext licence key (shown once).
403
APIError
`USER_FORBIDDEN` — caller does not hold the strict Operator role (no Administrator bypass).
422
APIError
`VALIDATION_ERROR` — invalid `connectors` or `connectorLimits`.
DELETE/api/v1/operator/licence-keys/:id auth: jwt (operator)

Revoke a licence key that has not been used. Fires `LICENCE_KEY_REVOKED` audit (resource type `CONFIG`).

handlers: requireOperator → validate(OperatorLicenceKeyIdParamsSchema, params) → OperatorController.revokeLicenceKey

Inputs

namerequireddefaultdescription
id path
uuid
yes—Licence key UUID.

Outputs

204
void
Key revoked; empty body.
403
APIError
`USER_FORBIDDEN` — caller does not hold the strict Operator role (no Administrator bypass).
404
APIError
`LICENCE_KEY_NOT_FOUND` — key does not exist or has already been used.
422
APIError
`VALIDATION_ERROR` — `id` is not a UUID.
PATCH/api/v1/operator/businesses/:businessId/licensed-connectors auth: jwt (operator)

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

handlers: requireOperator → validate(OperatorBusinessIdParamsSchema, params) → validate(UpdateLicensedConnectorsBodySchema, body) → OperatorController.updateLicensedConnectors

Inputs

namerequireddefaultdescription
businessId path
uuid
yes—Target business UUID. Operators have no businessId of their own; there is no `requireBusinessAccess` check, so any tenant can be addressed.
connectors body
ConnectorType[] | null
yes—New allow-list: a non-empty array of `ConnectorType`, or `null` for unrestricted. Empty array is rejected.

Outputs

200
APIResponseDataObject<{ businessId: string; licensedConnectors: string[] | null }>
The business id and the new allow-list.
403
APIError
`USER_FORBIDDEN` — caller does not hold the strict Operator role (no Administrator bypass).
404
APIError
`BUSINESS_NOT_FOUND` — no business with that id.
422
APIError
`VALIDATION_ERROR` — invalid `businessId` or `connectors`.
PATCH/api/v1/operator/businesses/:businessId/connector-limits auth: jwt (operator)

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

handlers: requireOperator → validate(OperatorBusinessIdParamsSchema, params) → validate(UpdateConnectorLimitsBodySchema, body) → OperatorController.updateConnectorLimits

Inputs

namerequireddefaultdescription
businessId path
uuid
yes—Target business UUID. Operators have no businessId of their own; there is no `requireBusinessAccess` check, so any tenant can be addressed.
connector body
ConnectorType
yes—The connector whose limits are being set.
maxApiKeys body
number | null
no—Positive integer, or null/omitted for unlimited.
maxConnections body
number | null
no—Positive integer, or null/omitted for unlimited.

Outputs

200
APIResponseDataObject<{ businessId: string; connectorLimits: Record<string, ConnectorLimitConfig> }>
The business id and its full updated connector-limits map.
403
APIError
`USER_FORBIDDEN` — caller does not hold the strict Operator role (no Administrator bypass).
404
APIError
`BUSINESS_NOT_FOUND` — no business with that id.
422
APIError
`VALIDATION_ERROR` — invalid `businessId` or body.
GET/api/v1/operator/businesses/:businessId/connectors auth: jwt (operator)

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

handlers: requireOperator → validate(OperatorBusinessIdParamsSchema, params) → OperatorController.listConnectors

Inputs

namerequireddefaultdescription
businessId path
uuid
yes—Target business UUID. Operators have no businessId of their own; there is no `requireBusinessAccess` check, so any tenant can be addressed.

Outputs

200
APIResponse<ConnectorHealthResponse>
`{ connectors: ConnectorHealthDTO[] }`.
403
APIError
`USER_FORBIDDEN` — caller does not hold the strict Operator role (no Administrator bypass).
422
APIError
`VALIDATION_ERROR` — `businessId` is not a UUID.
GET/api/v1/operator/businesses/:businessId/connectors/:connector/activity auth: jwt (operator)

Paginated, newest-first invoice activity feed for one connector of a business, with a status summary. Supports status, invoice-number search and document-type filters.

handlers: requireOperator → validate(OperatorConnectorActivityParamsSchema, params) → validate(OperatorConnectorActivityQuerySchema, query) → OperatorController.listConnectorActivity

Inputs

namerequireddefaultdescription
businessId path
uuid
yes—Target business UUID. Operators have no businessId of their own; there is no `requireBusinessAccess` check, so any tenant can be addressed.
connector path
ConnectorType
yes—Connector to list activity for; must be a `ConnectorType` value.
page query
number
no11-based page number (integer, min 1).
pageSize query
number
no25Page size (integer, 1–100).
status query
string
no—Aggregate-status filter; `all` or omitted means no filter. Unknown values yield an empty list.
search query
string
no—Invoice-number search (LIKE %term%); blank is ignored.
type query
'sale' | 'refund' | 'copy' | 'quote' | 'training' | 'normal' | 'advance'
no—Document-type filter. `all` or any unrecognised value means no filter.

Outputs

200
APIResponse<ConnectorActivityResponse>
`{ summary, items, total, page, totalPages }`.
403
APIError
`USER_FORBIDDEN` — caller does not hold the strict Operator role (no Administrator bypass).
422
APIError
`VALIDATION_ERROR` — invalid `businessId`, unknown `connector`, or out-of-range `page`/`pageSize`.
GET/api/v1/operator/businesses/:businessId/connector-invoice-buckets auth: jwt (operator)

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

handlers: requireOperator → validate(OperatorBusinessIdParamsSchema, params) → validate(OperatorConnectorBucketsQuerySchema, query) → OperatorController.listConnectorInvoiceBuckets

Inputs

namerequireddefaultdescription
businessId path
uuid
yes—Target business UUID. Operators have no businessId of their own; there is no `requireBusinessAccess` check, so any tenant can be addressed.
days query
number
no30Lookback window in days (integer, min 1). Capped per granularity: day 90, month 730, year 3650; a larger value is rejected.
granularity query
'day' | 'month' | 'year'
nodayBucket size. `week` is not supported and is rejected.
connector query
ConnectorType
no—Single-connector filter; omitted means all connectors for the business.

Outputs

200
APIResponse<ConnectorInvoiceBucketsResponse>
`{ buckets, granularity, connector, from, to }` (`from`/`to` epoch ms).
403
APIError
`USER_FORBIDDEN` — caller does not hold the strict Operator role (no Administrator bypass).
422
APIError
`VALIDATION_ERROR` — invalid `businessId`, `connector` or `granularity`, or `days` above the cap for the granularity.