Grant credits
Adds credits to a prepaid customer’s balance outside checkout: a contract prepayment, a goodwill credit or a promotion. Paid grants carry a cost_basis per credit, which values consumption for revenue and margin; promotional grants have none. Credits are drawn in a published burn-down order: lowest priority first, then soonest expiry, then promotional before paid, then oldest. A grant made here has the expires_at you send, or none. The one-year default is for top-up credits, which come from checkout and auto top-up.
Authentication
A secret key (rl_sk_test_..., rl_sk_live_...) or a restricted key with limited scopes (rl_rk_test_..., rl_rk_live_...). A restricted key can carry agent: true and an expires_at, and is what a coding agent should hold. Keys end in a checksum so secret scanners can recognize them. People create, roll and revoke keys in the dashboard; GET /v1/api_keys lists them, masked.
Request
The credit type (ID or key). Must match the customer’s prepaid plan.
paid credits carry a cost basis and count as deferred revenue until used. promotional credits are free.
paid only: what the customer paid per credit. Required for paid grants.
The pool (key) the credits join. Default default, or the first pool on the customer’s plan for a grant from checkout.
When unused credits expire. Leave out for no expiry. Only a grant you create here can have none, because top-up credits expire after one year by default.
Response
paid credits carry a cost basis and count as deferred revenue until used. promotional credits are free.
An amount of money that can hold fractions of a minor unit, such as a per-token cost.
When unused credits expire. A top-up or auto top-up grant always has one: one year after payment completes by default, or as the plan’s top_up.credits_expire_in or the checkout session’s credits_expire_in sets. Left out only on a grant created with POST /v1/credit_grants and no expires_at.
The allowance key behind a grant with source: allowance, or its rollover.