Skip to main content
POST
/
check
TypeScript
import { Autumn } from 'autumn-js';

const autumn = new Autumn();

const { data, error } = await autumn.check({ customer_id: 'customer_id', feature_id: 'feature_id' });
{
  "allowed": true,
  "code": "feature_found",
  "customer_id": "customer_123",
  "feature_id": "api_tokens",
  "required_balance": 5,
  "interval": "month",
  "interval_count": 1,
  "unlimited": false,
  "balance": 350,
  "usage": 150,
  "included_usage": 500,
  "next_reset_at": 1731507600000,
  "overage_allowed": false
}
If the customer_id you send doesn’t already exist, Autumn will automatically create a new customer. You can optionally set the properties of this new customer through the customer_data field.

Authorizations

Authorization
string
header
required

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

Body

application/json
customer_id
string
required

ID which you provided when creating the customer

feature_id
string
required

ID of the feature to check access to. Required if product_id is not provided.

entity_id
string

If using entity balances (eg, seats), the entity ID to check access for.

customer_data
object

Properties used if customer is automatically created. Will also update if the name or email is not already set.

required_balance
number

If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, allowed will be false.

send_event
boolean

If true, a usage event will be recorded together with checking access. The required_balance field will be used as the usage value.

with_preview
boolean

If true, the response will include a preview object, which can be used to display information such as a paywall or upgrade confirmation.

Response

200 - application/json
allowed
boolean
required

Whether the customer has access to the feature

code
string
required

Code describing the result of the check

customer_id
string
required

ID of the customer

feature_id
string
required

ID of the feature

entity_id
string | null

ID of the entity

required_balance
number

Balance of the feature the customer is required to have.

interval

The billing interval (e.g., 'month', 'year') or 'multiple' if the feature has different intervals across subscriptions

Available options:
lifetime,
minute,
hour,
day,
week,
month,
quarter,
semi_annual,
year
interval_count
number | null

The number of intervals between usage resets

unlimited
boolean | null

Whether the feature has unlimited usage with no restrictions or limits

balance
number | null

The remaining available balance across all subscriptions for this feature (or all time for allocated features)

usage
number | null

The total cumulative usage consumed in the current cycle across all subscriptions (or all time for allocated features)

included_usage
number | null

The total amount of usage included in the customer's plan(s) for this feature

next_reset_at
number | null

Unix timestamp (in milliseconds) when the usage counter will reset for the next cycle

overage_allowed
boolean | null

Whether the customer can continue using the feature beyond the included usage. If false, access is blocked when limit is reached

breakdown
object[] | null

Detailed breakdown by interval for features with multiple intervals

usage_limit
number | null

If this feature has a price, the usage limit indicates the maximum amount of usage the customer can use of this feature.