Billing API
Suite subscription state: plans, invoices, usage meters, limits, and entitlements for your organization.
| Endpoint | POST https://billing.api.gist.link/graphql |
| Token audience | audience=billing |
| Permission prefix | billing: |
Mint an access token for this API with your IAM key and audience=billing
— see Authentication.
Queries
Section titled “Queries”| Operation | Required permission | Description |
|---|---|---|
appSubscriptions |
billing:query:appSubscriptions |
The caller organization’s active third-party app-store subscriptions (mirrored from developers). |
billingStatus |
billing:query:billingStatus |
Whether the caller’s organization is billed at all. Only the suite operator org (GistLink’s own account, auth’s SUITE_OPERATOR) is never billed — clients use this to replace billing actions with a “not billed” notice. Any org member. |
checkLimit |
billing:query:checkLimit |
THE cross-service limit contract: product apps call this before a billable action and must refuse it when allowed=false (gated orgs are always disallowed; BLOCK meters stop at their cap; OVERAGE meters allow and bill). ROLE_SERVICE (org-bound token) or any org member. |
creditBalance |
billing:query:creditBalance |
THE cross-service prepaid-credit hard-stop check: product apps running billable AI work (e.g. agentworkforce) call this with an org-bound token before a model call and must STOP when has_credits is false. Callable by ROLE_SERVICE tokens or an org member for their own org. |
creditWallet |
billing:query:creditWallet |
The caller organization’s prepaid AI-credit wallet (balance + auto-recharge + recent ledger). Any org member. |
currentPeriodEstimate |
billing:query:currentPeriodEstimate |
The AWS-style live estimate for the current billing period: month-to-date base + seat + per-service usage charges, plus a linear month-end forecast. Any org member. |
entitlements |
billing:query:entitlements |
Resolves the entitlement keys granted to an organization right now. THE cross-service entitlements contract: other GistLink services call this (via a ROLE_SERVICE token) to gate product features. Orgs with no subscription fall back to the free plan’s keys; orgs GATED for non-payment resolve to status “suspended” with NO keys (full lockout). Callable by ROLE_SERVICE tokens or an org member for their own org. |
invoice |
billing:query:invoice |
One invoice by uuid (must belong to the caller’s organization). Any org member. |
invoices |
billing:query:invoices |
Cursor-paginated invoices for the current organization. Any org member. |
plans |
billing:query:plans |
Every plan customers of GistLink may subscribe to. Any authenticated user. |
rateLimits |
billing:query:rateLimits |
THE cross-service API rate-limit contract: auth/api calls this (via a self-issued ROLE_SERVICE token) when minting org-bound access tokens and stamps the resolved budgets into the token’s rate_limits claim, which the shared auth bundle enforces in every product API. Resolution: Subscription overrides win, then the plan (free-plan fallback for orgs with no subscription). Callable by ROLE_SERVICE tokens or an org member for their own org. |
subscription |
billing:query:subscription |
The current organization’s subscription (null if never subscribed). Any org member. |
usageMeters |
billing:query:usageMeters |
The billable usage meter catalog. Any authenticated caller. |
Mutations
Section titled “Mutations”| Operation | Required permission | Description |
|---|---|---|
cancelSubscription |
billing:mutation:cancelSubscription |
Cancel the caller’s organization’s subscription. Any org member. |
completePaymentMethodSetup |
billing:mutation:completePaymentMethodSetup |
Finish saving the card after the browser confirms the embedded form: verifies the setup succeeded, vaults the method in pay, stores its display snapshot (brand/last4/expiry) and detaches any previously saved card. Any org member. |
purchaseCredits |
billing:mutation:purchaseCredits |
Buy prepaid AI credits now. Raises its OWN credit-category invoice, charges it immediately against the saved card through the pay rail, and credits the wallet on success — the top-up appears on the billing page as a distinct invoice, separate from the monthly subscription invoice. Requires a saved payment method. Any org member. |
removePaymentMethod |
billing:mutation:removePaymentMethod |
Remove the saved payment method (collection will start dunning at the next period close). Any org member. |
resumeSubscription |
billing:mutation:resumeSubscription |
Resume a subscription previously set to cancel at period end. Any org member. |
retryInvoicePayment |
billing:mutation:retryInvoicePayment |
Retry collection of an open invoice right now. Any org member. |
selectPlan |
billing:mutation:selectPlan |
Switch the caller’s organization onto a plan immediately (monthly billing; no checkout redirect — billing invoices internally at period end). Any org member. An organization’s FIRST subscription starts a 30-day free trial on any plan (status trialing, trial_ends_at set); the trial period closes into a zero-total invoice. Plan switches keep the trial clock; a second trial is never granted. Selecting a paid plan without a saved payment method is allowed; add one via startPaymentMethodSetup before the trial ends to avoid dunning. Custom (enterprise) plans cannot be selected here — contact sales (a super admin assigns them via assignPlan). |
setAutoRecharge |
billing:mutation:setAutoRecharge |
Configure (or disable) automatic credit top-ups when the balance runs low. Any org member. |
startPaymentMethodSetup |
billing:mutation:startPaymentMethodSetup |
Start saving a card through the suite’s own pay charge rail: returns the PSP client secret + publishable key so the billing frontend renders an EMBEDDED card form (payment element) — never a PSP-hosted page. Any org member. |
Internal operations
Section titled “Internal operations”The following operations exist in the schema but are reserved for internal
suite automation (service tokens or suite operators) and are not available
to IAM credentials: createPlan, syncAppSubscription, cancelAppSubscription, updatePlan, archivePlan, createUsageMeter, updateUsageMeter, setPlanMeterConfig, removePlanMeterConfig, assignPlan, setOrganizationRateLimits, recordUsage, consumeCredits, refundCredits.