Skip to main content
POST
/
v1
/
customer
/
reportUsage
report usage
curl --request POST \
  --url https://api.unprice.dev/v1/customer/reportUsage \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "customerId": "cus_1H7KQFLr7RepUyQBKdnvY",
  "featureSlug": "tokens",
  "usage": 30,
  "idempotenceKey": "123e4567-e89b-12d3-a456-426614174000",
  "metadata": {
    "action": "create",
    "country": "US"
  }
}
'
{
  "allowed": true,
  "message": "<string>",
  "limit": 123,
  "usage": 123,
  "notifiedOverLimit": true,
  "remaining": 123,
  "deniedReason": "INVALID_USAGE"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

The usage to report

customerId
string
required

The customer ID

Example:

"cus_1H7KQFLr7RepUyQBKdnvY"

featureSlug
string
required

The feature slug

Example:

"tokens"

usage
number
required

The usage

Example:

30

idempotenceKey
string<uuid>
required

The idempotence key

Example:

"123e4567-e89b-12d3-a456-426614174000"

metadata
object

The metadata

Example:
{ "action": "create", "country": "US" }

Response

The result of the report usage

allowed
boolean
required
message
string
limit
number
usage
number
notifiedOverLimit
boolean
remaining
number
deniedReason
enum<string>
Available options:
INVALID_USAGE,
ERROR_SYNCING_ENTITLEMENTS_LAST_USAGE,
FLAT_FEATURE_NOT_ALLOWED_REPORT_USAGE,
ENTITLEMENT_OUTSIDE_OF_CURRENT_BILLING_WINDOW,
ERROR_RESETTING_DO,
RATE_LIMITED,
ENTITLEMENT_NOT_FOUND,
LIMIT_EXCEEDED,
ENTITLEMENT_EXPIRED,
ENTITLEMENT_NOT_ACTIVE,
DO_NOT_INITIALIZED,
INCORRECT_USAGE_REPORTING,
ERROR_INSERTING_USAGE_DO,
ERROR_INSERTING_VERIFICATION_DO,
PROJECT_DISABLED,
CUSTOMER_DISABLED,
SUBSCRIPTION_DISABLED,
FETCH_ERROR,
SUBSCRIPTION_ERROR,
ENTITLEMENT_ERROR,
SUBSCRIPTION_EXPIRED,
NO_DEFAULT_PLAN_FOUND,
SUBSCRIPTION_NOT_ACTIVE,
PHASE_NOT_CREATED,
FEATURE_NOT_FOUND_IN_SUBSCRIPTION,
CUSTOMER_NOT_FOUND,
CUSTOMER_ENTITLEMENTS_NOT_FOUND,
FEATURE_TYPE_NOT_SUPPORTED,
PROJECT_DISABLED,
CUSTOMER_DISABLED,
PLAN_VERSION_NOT_PUBLISHED,
PLAN_VERSION_NOT_ACTIVE,
PAYMENT_PROVIDER_CONFIG_NOT_FOUND,
ENTITLEMENT_EXPIRED,
ENTITLEMENT_NOT_ACTIVE,
CUSTOMER_SESSION_NOT_CREATED,
CUSTOMER_SESSION_NOT_FOUND,
PLAN_VERSION_NOT_FOUND,
PAYMENT_PROVIDER_ERROR,
SUBSCRIPTION_NOT_CREATED,
CUSTOMER_NOT_CREATED,
SUBSCRIPTION_NOT_CANCELED,
CUSTOMER_PHASE_NOT_FOUND,
CURRENCY_MISMATCH,
BILLING_INTERVAL_MISMATCH,
ENTITLEMENT_NOT_FOUND,
SUBSCRIPTION_NOT_FOUND,
INVALID_ENTITLEMENT_TYPE,
NO_ACTIVE_PHASE_FOUND