--- title: "Check Permissions" openapi: "openapi POST /v1/balances.check" --- import { DynamicParamField } from "/components/dynamic-param-field.jsx"; import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; Check determines if a customer has access to a feature based on their current balance. Returns `allowed: true` if they have sufficient balance, the feature is unlimited, or it's a boolean feature included in their plan. ### Common Use Cases ```typescript Check feature access const { allowed, balance } = await autumn.check({ customerId: "cus_123", featureId: "ai_messages" }); if (!allowed) { // Show upgrade prompt or paywall } console.log(`You have ${balance.remaining} messages left`); ``` ```typescript Check and track atomically const { allowed } = await autumn.check({ customerId: "cus_123", featureId: "api_calls", requiredBalance: 1, sendEvent: true // Deducts usage if allowed }); ``` ### Body Parameters The ID of the customer. The ID of the feature. The ID of the entity for entity-scoped balances (e.g., per-seat limits). Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. Additional properties to attach to the usage event if send_event is true. If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. ### Response Whether the customer is allowed to use the feature. True if they have sufficient balance or the feature is unlimited/boolean. The ID of the customer that was checked. The ID of the entity, if an entity-scoped check was performed. The required balance that was checked against. The customer's balance for this feature. Null if the customer has no balance for this feature. The feature ID this balance is for. The full feature object if expanded. The unique identifier for this feature, used in /check and /track calls. Human-readable name displayed in the dashboard and billing UI. Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools. For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage). Event names that trigger this feature's balance. Allows multiple features to respond to a single event. For credit_system features: maps metered features to their credit costs. ID of the metered feature that draws from this credit system. Credits consumed per unit of the metered feature. Display names for the feature in billing UI and customer-facing components. Singular form for UI display (e.g., 'API call', 'seat'). Plural form for UI display (e.g., 'API calls', 'seats'). Whether the feature is archived and hidden from the dashboard. Total balance granted (included + prepaid). Remaining balance available for use. Total usage consumed in the current period. Whether this feature has unlimited usage. Whether usage beyond the granted balance is allowed (with overage charges). Maximum quantity that can be purchased as a top-up, or null for unlimited. Timestamp when the balance will reset, or null for no reset. Detailed breakdown of balance sources when stacking multiple plans or grants. The unique identifier for this balance breakdown. The plan ID this balance originates from, or null for standalone balances. Amount granted from the plan's included usage. Amount granted from prepaid purchases or top-ups. Remaining balance available for use. Amount consumed in the current period. Whether this balance has unlimited usage. Reset configuration for this balance, or null if no reset. The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. Number of intervals between resets (eg. 2 for bi-monthly). Timestamp when the balance will next reset. Pricing configuration if this balance has usage-based pricing. The per-unit price amount. Tiered pricing configuration if applicable. How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). The number of units per billing increment (eg. $9 / 250 units). Whether usage is prepaid or billed pay-per-use. Maximum quantity that can be purchased, or null for unlimited. Timestamp when this balance expires, or null for no expiration. Rollover balances carried over from previous periods. Amount of balance rolled over from a previous period. Timestamp when the rollover balance expires. Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false. The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. A title suitable for displaying in a paywall or upgrade modal. A message explaining why access was denied. The ID of the feature that was checked. The display name of the feature. Products that would grant access to this feature. Use to display upgrade options. The ID of the product you set when creating the product The name of the product Product group which this product belongs to The environment of the product Whether the product is an add-on and can be purchased alongside other products Whether the product is the default product Whether this product has been archived and is no longer available The current version of the product The timestamp of when the product was created in milliseconds since epoch Array of product items that define the product's features and pricing The type of the product item The feature ID of the product item. If the item is a fixed price, should be `null` Single use features are used once and then depleted, like API calls or credits. Continuous use features are those being used on an ongoing-basis, like storage or seats. The amount of usage included for this feature. The reset or billing interval of the product item. If null, feature will have no reset date, and if there's a price, it will be billed one-off. The interval count of the product item. The price of the product item. Should be `null` if tiered pricing is set. Tiered pricing for the product item. Not applicable for fixed price items. The maximum amount of usage for this tier. The price of the product item for this tier. A flat fee charged for this tier, in addition to the per-unit amount. How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier). Defaults to graduated. Whether the feature should be prepaid upfront or billed for how much they use end of billing period. The amount per billing unit (eg. $9 / 250 units) Whether the usage should be reset when the product is enabled. The entity feature ID of the product item if applicable. The display of the product item. Used in customer context. Quantity of the feature the customer has prepaid for. Used in customer context. Quantity of the feature the customer will prepay for in the next cycle. Configuration for rollover and proration behavior of the feature. Free trial configuration for this product, if available The duration type of the free trial The length of the duration type specified Whether the free trial is limited to one per customer fingerprint Whether the free trial requires a card. If false, the customer can attach the product without going through a checkout flow or having a card on file. Used in customer context. Whether the free trial is available for the customer if they were to attach the product. ID of the base variant this product is derived from Scenario for when this product is used in attach flows True if the product has no base price or usage prices True if the product only contains a one-time price The billing interval group for recurring products (e.g., 'monthly', 'yearly') True if the product includes a free trial True if the product can be updated after creation (only applicable if there are prepaid recurring prices) ```json 200 { "allowed": true, "customer_id": "cus_123", "entity_id": null, "required_balance": 1, "balance": { "feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [ { "id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": { "interval": "month", "resets_at": 1773851121437 }, "price": null, "expires_at": null } ] } } ```