Record usage of a metered feature for a customer
const url = 'https://api.seal0.app/v1/usage';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"customer_id":"example","feature_key":"example","quantity":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.seal0.app/v1/usage \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "customer_id": "example", "feature_key": "example", "quantity": 1 }'Adds quantity to the customer’s usage in the period containing the server’s current time: the subscription’s billing period, otherwise the UTC calendar month. Exact: each request is one write. Retry with the same Idempotency-Key to avoid counting twice.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Optional; replays the stored response for 24 hours.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Opaque customer ID from the integrating application.
Feature or plan key.
Units to add to the current period’s usage.
Responses
Section titled “Responses”The usage after recording.
The Customer’s usage of the feature after recording, in the current period.
object
Opaque customer ID from the integrating application.
Feature or plan key.
Example generated
{ "customer_id": "example", "feature_key": "example", "period_end": "2026-04-15T12:00:00Z", "period_start": "2026-04-15T12:00:00Z", "used": 1}Error envelope.
object
object
Stable snake_case error code.
Offending input field, when known.
Example generated
{ "error": { "code": "example", "field": "example", "message": "example", "request_id": "example" }}Error envelope.
object
object
Stable snake_case error code.
Offending input field, when known.
Example generated
{ "error": { "code": "example", "field": "example", "message": "example", "request_id": "example" }}Error envelope.
object
object
Stable snake_case error code.
Offending input field, when known.
Example generated
{ "error": { "code": "example", "field": "example", "message": "example", "request_id": "example" }}Error envelope.
object
object
Stable snake_case error code.
Offending input field, when known.
Example generated
{ "error": { "code": "example", "field": "example", "message": "example", "request_id": "example" }}Error envelope.
object
object
Stable snake_case error code.
Offending input field, when known.
Example generated
{ "error": { "code": "example", "field": "example", "message": "example", "request_id": "example" }}default
Section titled “default”Error envelope.
object
object
Stable snake_case error code.
Offending input field, when known.
Example generated
{ "error": { "code": "example", "field": "example", "message": "example", "request_id": "example" }}