Skip to main content
For plans with usage-based pricing, you must report usage to Credibill so we know how much to charge.

Recording Usage Events

Report usage events for a subscription to track consumption. Each event is recorded with a quantity and metric type for billing purposes.
  • Endpoint: https://giant-goldfish-922.convex.site/api/v1/usage
  • Method: POST
  • Authentication: Authorization: Bearer <CREDIBILL_API_KEY>

Request Body Schema

Examples

Usage in a Component

Response

When you record a usage event, the API responds with the event ID and duplicate status.
Response Status Codes:
  • 201 Created: New usage event recorded successfully
  • 200 OK: Event already recorded (duplicate, no charge applied)

Aggregation Types

When configuring a metered component in a Plan, you choose how usage is aggregated over the billing period:
  • Sum: Adds up all reported usage (e.g., API calls).
  • Max: Uses the maximum value recorded (e.g., Peak Storage).
  • Last: Uses the most recent value recorded (e.g., Number of Active Users).

Idempotency

To prevent double-billing due to network retries, you should provide an eventId when reporting usage. This ensures a specific event is counted only once, even if the request is retried multiple times. The system will return a duplicate: true flag if you send the same eventId again.