Skip to main content
POST
/
v1
/
analytics
/
usage
get usage
curl --request POST \
  --url https://api.unprice.dev/v1/analytics/usage \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "projectId": "project_1H7KQFLr7RepUyQBKdnvY",
  "range": "24h",
  "customerId": "cus_1H7KQFLr7RepUyQBKdnvY"
}
'
{
  "usage": [
    {
      "projectId": "<string>",
      "featureSlug": "<string>",
      "count": 123,
      "sum": 123,
      "max": 123,
      "last_during_period": 123,
      "customerId": "<string>",
      "entitlementId": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

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

Body

application/json

Body of the request for the get usage

projectId
string
required

The project ID (optional, if not provided, the project ID will be the one of the key)

Example:

"project_1H7KQFLr7RepUyQBKdnvY"

range
enum<string>
required

The range of the usage, last hour, day, week or month

Available options:
60m,
24h,
7d,
30d,
90d
Example:

"24h"

customerId
string

The customer ID if you want to get the usage for a specific customer

Example:

"cus_1H7KQFLr7RepUyQBKdnvY"

Response

The result of the get usage

usage
object[]
required