Skip to content

Report Usage

Last updated: Phase 8.5

Record a usage event for a metered entitlement.

Endpoint

POST /api/v1/integration/usage/record

Headers

HeaderRequiredValue
X-API-KeyYesYour API key
Content-TypeYesapplication/json

Request Body

json
{
  "license_key": "VX-ACME-abc123def456",
  "metric": "api.calls",
  "quantity": 150,
  "metadata": {
    "endpoint": "/v1/search",
    "period": "hourly"
  }
}
FieldRequiredTypeDescription
license_keyYesstringThe license key
metricYesstringEntitlement code / metric name
quantityYesintegerUsage amount (min: 1)
metadataNoobjectAdditional context

Response (202 Accepted)

json
{
  "data": {
    "recorded": true,
    "usage_event": {
      "id": 1,
      "entitlement_code": "api.calls",
      "quantity": 150,
      "recorded_at": "2026-03-30T10:30:00.000000Z"
    }
  },
  "meta": {
    "request_id": "uuid",
    "api_version": "1"
  }
}

Note: HTTP 202 indicates the event was accepted. The recorded: true field confirms persistence.

Error Responses

CodeHTTPDescription
LICENSE.NOT_FOUND404License key not found
AUTH.INVALID_API_KEY401Invalid API key
RATE_LIMIT.EXCEEDED429Rate limit exceeded

Notes

  • Usage events are stored in the tenant's isolated database
  • Metadata includes license_key_id and source: "integration_api" automatically
  • Usage events are immutable — they cannot be edited or deleted
  • Use the Tenant Dashboard to view usage snapshots and reports

Built by Veltara Works