Skip to content

Credit Grant

A Credit Grant is a prepaid or promotional balance a Customer spends on a Startup’s metered Offers, checked before each call.

Properties

PropertyTypeRequiredDescription
amountmoneyrequiredThe balance granted. Never randomized.
categorystringrequiredpaid (bought through an Order, deferred revenue until spent) or promotional (given; never cash). Never randomized.
priorityintegerOrder of use when several grants apply: a lower number spends first, then the earliest expiry.
expiresAtdatetimeWhen any remaining balance lapses. Absent means it never lapses.
appliesToOfferThe metered Offer the balance pays for. Absent means every metered Offer of the Startup.
remainingmoneyThe unspent balance, debited once after each metered call and checked as a Limit before the next.

Object

JSON
{
  "$id": "https://api.sb/tutorloop.com/credit-grants/credit_grant_1",
  "$type": "CreditGrant",
  "amount": {
    "amount": 60,
    "currency": "USD"
  },
  "category": "paid",
  "priority": 1,
  "expiresAt": "2026-10-22T12:00:00Z",
  "appliesTo": "offer_1",
  "remaining": {
    "amount": 60,
    "currency": "USD"
  }
}

Relationships

  • A Credit Grant credits one Customer: the Customer whose metered calls spend the balance; credits never move to another Customer. credits, inverse creditGrants.
  • A Credit Grant offsets many Invoices: the Invoices the grant paid toward when they finalized. offsets, inverse creditGrants.

Verbs

  1. createCreates a Credit Grant.
    POST /{namespace}/credit-grantsdoCreditGrant.created
  2. getReturns one Credit Grant by id.
    GET /{namespace}/credit-grants/{id}readNo Event
  3. listReturns Credit Grants, newest first, one page at a time.
    GET /{namespace}/credit-grantsreadNo Event
  4. applyApply spends Credit Grants against a finalizing Invoice, promotional first, then by priority and earliest expiry, and settles them through Stripe credit grants.
    POST /{namespace}/credit-grants/applydoCreditGrant.applied
  5. issueIssue gives a Customer a paid or promotional Credit Grant that its metered calls draw down before anything is invoiced.
    POST /{namespace}/credit-grants/issuedoCreditGrant.issued
  6. voidVoid ends a promotional Credit Grant early and forfeits its remaining balance, keeping the record.
    POST /{namespace}/credit-grants/{creditGrant}/voiddoCreditGrant.voided

A Credit Grant is never deleted: it ends by CreditGrant.void, and its records stay.

Permissions

Which Access level may call each Verb. One-way Verbs wait their delay window.

Operationowneradminmemberviewer
CreditGrant.createYesYesYesNo
CreditGrant.getYesYesYesYes
CreditGrant.listYesYesYesYes
CreditGrant.applyYesYesYesNo
CreditGrant.issueYesYesYesNo
CreditGrant.voidYesNoNoNo

Call it

Text
Apply the latest credit grant with an invoice.

Example

A transcription API sells a $100 paid Credit Grant and adds a $20 promotional grant with priority 1. Each metered call spends the promotional balance first, then the paid one, and a call stops when both reach zero.