Introducing OpenTelemetry for Chargebee SDKs — trace every API call in any telemetry tool.
Chargebeechargebee API

Grant blocks

A grant block represents a bucket of issued credit grants associated with a given subscription, unit_id, and unit_type, allocated either through an item price or via the allocate operation.

Each grant block follows its own lifecycle, governed by a defined policy that manages how the credit grants within the block are consumed, held, expired or rolled over.

Example

An annual subscription plan grants 100 AI credits every month, resulting in a new grant block of 100 credit grants being allocated to the subscription at the start of each grant cycle.

During its lifecycle, the block tracks usage through the balance fields grouped under provisioned_block_balance and overdraft_block_balance (for example, used_amount, hold_amount, and usable_balance).

Since the grant frequency is monthly, each block has a validity of one month from its effective_from time, after which it expires. If a rollover policy is configured, any unused credit grants at expires_at may be carried forward into a new grant block; otherwise, they expire.

This process repeats each month as long as the subscription remains active, creating a sequence of time-bound grant blocks that independently track and manage their respective credit grants.

Grant Blocks Lifecycle

Grant Blocks LifeCycle

Lifecycle Of Credit Grants In A Block

LifeCycle Of Credit Grants In A Block

Sample Grant blockJSON

Grant blocks attributes

id
required, string, max chars=50

A unique identifier for this grant block.

Behavior

  • Automatically assigned by the ledger at creation time.
  • Immutable and cannot be modified once written.
subscription_id
required, string, max chars=50

Identifier of the subscription this grant block belongs to.

unit_id
required, string, max chars=50

Identifier of the credit unit this block belongs to. For example, a credit unit id such as ai_credits.

unit_type
required, enumerated string

Type of unit used for this balance. For example, credit_unit for credit grants.

Enum Values
credit_unit

The unit represents a credit unit, the type used by credit grants.

account_type
required, enumerated string

The account this block belongs to: provisioned (credit grants issued per the plan, consumed first) or overdraft (consumption beyond the configured credit grants, after the provisioned account is exhausted).

Enum Values
provisioned

Stores the credit grants given as per the plan configuration. Consumption of credit grants is first done through this account.

overdraft

Allows consumption beyond the configured credit grants. Used once the credit grants in the provisioned account are exhausted.

effective_from
required, timestamp(UTC) in seconds

Unix timestamp (in seconds) indicating when this grant block becomes active and its credits become available for use.

Behavior

  • Allocations scheduled for the future are valid but remain non-spendable until this time.
  • Prior to this timestamp, the block is in a scheduled state.

Activation

At effective_from, the block becomes active and its credits are included in the usable balance of the account.

expires_at
required, timestamp(UTC) in seconds

Unix timestamp (in seconds) indicating when this grant block stops being directly consumable.

Behavior

  • At expires_at, the block transitions from available to in_grace_period.
  • During the grace period, eligible late-arriving operations may still consume credits based on their operation_timestamp.

Finalization After the grace period ends, any remaining balance is finalized as expired or rolled over, depending on the configured rollover policy.

origin_grant_block_id
optional, string, max chars=50

Identifier of the source (originating) grant block from which this block was derived.

Behavior

  • Populated only when this block is created through a rollover.
  • References the block whose remaining balance was carried forward into this block.

Usage

Enables traceability between original and rollover blocks for audit and reporting purposes.

status
required, enumerated string, default=available

Enumerated string representing the current lifecycle state of the grant block.

Example

A block moves from scheduled → available → in_grace_period → exhausted over its lifecycle.

Enum Values
available

The block is effective and credit grants are consumable subject to remaining balance and holds.

exhausted

No usable credit grants remain; the block was fully consumed, expired, voided, or rolled over.

scheduled

The block exists but effective_from is still in the future, so credit grants are not yet spendable.

in_grace_period

Past expires_at but within the configured grace period; limited consumption is still allowed for eligible operations (those whose operation_timestamp falls within the original validity window).

grant_source
required, enumerated string

Enumerated string indicating the event or action that resulted in these credit grants being issued.

Enum Values
subscription_created

Issued when the subscription was created (initial allocation as per the plan configuration).

subscription_changed

Issued in response to a subscription change that triggers a new allocation (for example, a plan or addon update that adjusts the credit grants).

top_up

Issued from a top-up purchase or similar add-on credit-grant purchase made on top of the configured plan.

promotional_grants

Issued from the allocate operation (for example, marketing offers or goodwill credits).

rollover

Issued by carrying forward unused credit grants from another block at end-of-period processing.

grant_renewal

Issued when a grant is renewed for the next cycle by the grant renewal process (recurring re-grant of the configured credits).

subscription_renewed

Issued when the subscription renews for a new term, triggering a fresh allocation of the configured credit grants.

created_at
required, timestamp(UTC) in seconds

Unix timestamp (in seconds) indicating when this grant block was recorded in the ledger.

Behavior

  • Automatically set by the ledger at creation time.
  • Immutable and cannot be modified after being written.

Usage

Provides a reliable reference for auditability and chronological ordering of grant blocks.

modified_at
required, timestamp(UTC) in seconds

Unix timestamp (seconds) when the grant block was last updated.

resource_version
optional, long

Version number of this resource. The resource_version is updated with a new timestamp for every change made to the resource.

metadata
optional, jsonobject

Optional opaque JSON object carrying additional business context

Behavior

  • Stored as-is and returned verbatim by the ledger.
  • Not interpreted, validated, or indexed by the ledger.
provisioned_block_balance

Balance details for a grant block with provisioned account_type.

Note

Populated only for blocks with provisioned account_type; null for overdraft blocks.

overdraft_block_balance

Balance details for a grant block with overdraft account_type.

Note

Populated only for blocks with overdraft account_type; null for provisioned blocks.