Create a credit grant on a subscription

View as Markdown

Grants credits to a subscription. Provide either pricing_unit_id for pricing-unit credits or currency_code for currency credits.

Authentication

AuthorizationBearer
API key obtained from the Afternoon dashboard

Path parameters

idstringRequiredformat: "cuid"

Request

This endpoint expects an object.
namestringRequired>=1 character
Display name for the credit grant
amountdouble or stringRequired

Credit amount (positive value). Accepts a number or numeric string.

pricing_unit_codestringOptional

Pricing unit code (e.g. “gpu_sec”, “token”). Required when granting pricing-unit credits.

currency_codestringOptional

Currency code (e.g. “usd”). Required when granting currency credits.

expires_atdatetime or nullOptional
ISO 8601 expiration date, or null for no expiry

Response

Credit grant created
successboolean
credit_grantobject
request_idstring

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error
500
Internal Server Error