Skip to main content
POST
JavaScript

Authorizations

X-API-KEY
string
header
required

Server API Key

Headers

X-ACCOUNT-ID
string

Account ID — optional when authenticating with a user JWT (Bearer token); falls back to the user's first membership. Ignored for API-key auth.

X-ENVIRONMENT-ID
string

Environment ID — required when authenticating with a user JWT (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is intrinsic to the key).

Body

application/json

Request body for creating a credit grant. Grants cannot be edited after creation — void and re-grant if the amount, priority, or expiration needs to change.

displayName
string
required

The display name for the credit grant

Maximum string length: 255
amount
number
required

The credit amount to grant

grantType
enum<string>
required

The type of credit grant (PAID, PROMOTIONAL)

Available options:
PAID,
PROMOTIONAL
customerId
string
required

The customer ID to grant credits to (required)

Required string length: 1 - 255
Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_|.@-]*$
currencyId
string
required

The credit currency ID (required)

Required string length: 1 - 255
Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$
priority
integer

Determines which grant is drawn down first when the customer has multiple active grants in the same currency (0-100). Lower numbers are consumed first. Defaults to 50 — the same default used for recurring credits granted by a plan or price — so without setting this explicitly, draw order against plan-included credits falls back to expiration date and grant type. To have this grant consumed before or after plan-included credits, set a lower or higher priority than the plan/price credit configuration.

Required range: 0 <= x <= 100
effectiveAt
string<date-time>

The date when the credit grant becomes effective

expireAt
string<date-time>

The date when the credit grant expires

metadata
object

Additional metadata for the credit grant

cost
Money · object

The monetary cost of the credit grant

comment
string

An optional comment on the credit grant

Maximum string length: 255
resourceId
string

The resource ID to scope the grant to

Required string length: 1 - 255
Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_|.-]*$
paymentCollectionMethod
enum<string>

The payment collection method (CHARGE, INVOICE, NONE). Optional if the grant has no cost, since there is nothing to collect payment for. With NONE or CHARGE, the grant is active and its credits are usable right away (or as soon as the charge succeeds). With INVOICE, the grant stays pending — its credits are not usable — until the generated invoice is paid.

Available options:
CHARGE,
INVOICE,
NONE
awaitPaymentConfirmation
boolean

Whether to wait for payment confirmation before returning (default: true). When false, the request returns immediately while payment (if any) is collected asynchronously; check the returned status to see whether the credits are already usable.

billingInformation
CreditGrantBillingInfo · object

Billing information for the credit grant, used when the grant has a payment collection method that requires collecting payment (e.g. invoice due date, billing address).

Response

The newly created credit grant object.

Response object

data
CreditGrant · object
required

Credit grant object representing allocated credits for a customer. Credit grants cannot be edited after creation via this API — void the grant to stop further consumption from it, then create a new grant with the corrected amount, priority, or expiration.