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

const response = await autumn.check({
customer_id: 'user_123',
feature_id: 'messages'
});
{
  "customer_id": "user_123",
  "feature_id": "messages",
  "code": "feature_found",
  "allowed": true,
  "balance": {
    "balance": 100,
    "required_balance": 12
  }
}
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

Use your Autumn Secret Key as the Bearer token.

Body

application/json
customer_id
string
required

ID which you provided when creating the customer

product_id
string

ID of the product to check access to. Required if feature_id is not provided.

feature_id
string

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

required_balance
integer
default:1

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
default:false

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

entity_id
string

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

customer_data
object

Additional customer properties. These will be used if the customer's properties are not already set.

Response

200 - application/json
allowed
boolean

Whether the customer has access to the feature or product

customer_id
string

Your unique identifier for the customer

feature_id
string

ID of the feature being checked

code
string

Status code indicating the result of the check

balance
object

Balances of the associated feature or credit system

feature_preview
object

Information about the feature, used to display information such as a paywall. Returned if check is called with a feature_id and with_preview is true.

product_preview
object

Information about the product, used to display information such as an upgrade confirmation. Returned if check is called with a product_id and with_preview is true.