API reference · Billing
GET/api/billing/licence-count

Get tenant licence usage

Server-to-server webhook endpoint used by the billing service to query current licence usage for a tenant. The caller supplies tenant_id and an x-webhook-signature header containing HMAC-SHA256("GET:<tenant_id>", ALGA_WEBHOOK_SECRET). The response reports the configured licensed internal-user limit, active internal-user count, calculated remaining seats, and last licence update timestamp.

Query parameters

tenant_idstringRequired
Tenant identifier to query. This must match a tenants.tenant record.

Header parameters

x-webhook-signaturestringRequired
HMAC-SHA256 hex digest proving the caller knows ALGA_WEBHOOK_SECRET.

Response body

Success response 200 · schema LicenceUsageResponse

tenant_idstringRequired
Echoed tenant identifier from the request.
limitintegerRequiredNullable
Licensed internal-user count from tenants.licensed_user_count. Null means unlimited.
usedintegerRequired
Count of active internal users where users.user_type is internal and is_inactive is false.
remainingintegerRequiredNullable
Calculated remaining seats as max(0, limit - used), or null when limit is unlimited.
last_updatedstringRequiredNullable
ISO timestamp from tenants.last_license_update, or null if no license update has been recorded.

Response codes

200
Licence usage returned successfully.
400
Missing tenant_id query parameter.
401
Webhook signature missing or invalid.
404
Tenant not found.
500
Unexpected internal error.