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

Update tenant licensed user count

Server-to-server webhook endpoint used by the billing service to synchronize a tenant's licensed internal-user count from a Stripe subscription quantity. The x-webhook-signature header must be the HMAC-SHA256 hex digest of the raw JSON request body using ALGA_WEBHOOK_SECRET. When event_id is provided, the handler treats tenants.stripe_event_id as an idempotency marker and skips duplicate Stripe events.

Header parameters

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

Request body

Content type: application/json · schema LicenceCountUpdateRequest

tenant_idstringRequired
Tenant identifier from tenants.tenant whose licensed user count should be updated.
license_countintegerRequired
Licensed internal-user count from the Stripe subscription quantity.
≥ 0
event_idstring
Stripe webhook event ID. When supplied, the handler uses tenants.stripe_event_id for idempotency.

Response body

Success response 200 · schema LicenceCountUpdateResponse

successbooleanRequired
Indicates the license count update was accepted.
Enum: true
tenant_idstringRequired
Echoed tenant identifier that was updated.
license_countintegerRequired
Echoed licensed user count that was written.
updated_atstring <date-time>Required
ISO timestamp generated by the handler for this response.

Response codes

200
Licence count update accepted, or duplicate event safely ignored.
400
tenant_id or license_count is missing or invalid.
401
Webhook signature missing or invalid.
404
Tenant not found.
500
Unexpected internal error.