72 lines
2.5 KiB
Plaintext
72 lines
2.5 KiB
Plaintext
---
|
|
title: "Create Balance"
|
|
openapi: "openapi POST /v1/balances.create"
|
|
---
|
|
|
|
import { DynamicParamField } from "/snippets/dynamic-param-field.jsx";
|
|
import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx";
|
|
import { DynamicResponseExample } from "/snippets/dynamic-response-example.jsx";
|
|
|
|
### Body Parameters
|
|
|
|
<DynamicParamField body="customer_id" type="string" required>
|
|
The ID of the customer.
|
|
</DynamicParamField>
|
|
|
|
<DynamicParamField body="feature_id" type="string" required>
|
|
The ID of the feature.
|
|
</DynamicParamField>
|
|
|
|
<DynamicParamField body="entity_id" type="string">
|
|
The ID of the entity for entity-scoped balances (e.g., per-seat limits).
|
|
</DynamicParamField>
|
|
|
|
<DynamicParamField body="included_grant" type="number">
|
|
The initial balance amount to grant. For metered features, this is the number of units the customer can use.
|
|
</DynamicParamField>
|
|
|
|
<DynamicParamField body="unlimited" type="boolean">
|
|
If true, the balance has unlimited usage. Cannot be combined with 'included_grant'.
|
|
</DynamicParamField>
|
|
|
|
<DynamicParamField body="reset" type="object">
|
|
Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets.
|
|
<Expandable title="properties">
|
|
<DynamicParamField body="interval" type="'one_off' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'" required>
|
|
The interval at which the balance resets (e.g., 'month', 'day', 'year').
|
|
</DynamicParamField>
|
|
|
|
<DynamicParamField body="interval_count" type="number">
|
|
Number of intervals between resets. Defaults to 1 (e.g., interval_count: 2 with interval: 'month' resets every 2 months).
|
|
</DynamicParamField>
|
|
|
|
</Expandable>
|
|
</DynamicParamField>
|
|
|
|
<DynamicParamField body="rollover" type="object">
|
|
Rollover configuration for the balance.
|
|
<Expandable title="properties">
|
|
<DynamicParamField body="max" type="number | null" />
|
|
|
|
<DynamicParamField body="max_percentage" type="number | null" />
|
|
|
|
<DynamicParamField body="duration" type="'month' | 'forever'" />
|
|
|
|
<DynamicParamField body="length" type="number" required />
|
|
|
|
</Expandable>
|
|
</DynamicParamField>
|
|
|
|
<DynamicParamField body="expires_at" type="number">
|
|
Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset.
|
|
</DynamicParamField>
|
|
|
|
<DynamicParamField body="balance_id" type="string">
|
|
A unique identifier for this balance. Use this to target the balance in future update / delete calls.
|
|
</DynamicParamField>
|
|
|
|
|
|
### Response
|
|
|
|
<DynamicResponseField name="success" type="boolean" />
|