控制台 API: billing
本页由 server/api/openapi.yaml 生成,内容为英文,请勿手工修改。
Balance, top-ups, orders, subscriptions, invoices, auto-recharge, redeem codes. Handlers: internal/console/billing.
GET /api/v1/billing/balance
Section titled “GET /api/v1/billing/balance”Balance of the active organisation
operationId billingBalance · auth: orgSession
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json Balance |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — Balance
credits_nano(string, required, pattern: ”^-?[0-9]+$”) — Sum of the remaining credits of all grants. (Nano-USD, integer string.)debt_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.spendable_nano(string, required, pattern: ”^-?[0-9]+$”) — Negative when in debt. (Nano-USD, integer string.)version(integer, required) — Increases with every balance change. frozen(boolean, required)breakdown(CreditBreakdown) — credits_nano of the balance split by origin; purchased + bonus + subscription = credits_nano. purchased: paid top-ups (grant kind topup). bonus: signup bonus, redeem codes, promotional and admin credits and converted commission (kinds promo and affiliate). subscription: plan credits (kind subscription). Returned by GET /api/v1/billing/balance only.purchased(CreditBucket, required)remaining_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.next_expires_at(string, required, nullable) — Earliest expiry among the bucket’s grants that still hold credits; null when none expires. next_expiring_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
bonus(CreditBucket, required)remaining_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.next_expires_at(string, required, nullable) — Earliest expiry among the bucket’s grants that still hold credits; null when none expires. next_expiring_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
subscription(CreditBucket, required)remaining_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.next_expires_at(string, required, nullable) — Earliest expiry among the bucket’s grants that still hold credits; null when none expires. next_expiring_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
GET /api/v1/billing/grants
Section titled “GET /api/v1/billing/grants”List credit grants
operationId billingListGrants · auth: orgSession
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
active_only |
query | boolean | no | Only grants with remaining, unexpired credit. |
cursor |
query | string | no | Opaque cursor from a previous page’s next_cursor. |
limit |
query | integer<int32> | no | (minimum: 1, maximum: 200, default: 50) |
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json GrantPage |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — GrantPage
data(array of Grant, required)id(string, required) kind(GrantKind, required) — Burn order: subscription, promo, affiliate, topup; then by expiry.source_type(GrantSource, required)amount_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.remaining_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.refundable(boolean, required)order_id(string, required, nullable) expires_at(string, required, nullable) expired_at(string, required, nullable) created_at(string, required)
next_cursor(string, required, nullable) — Pass ascursorto fetch the next page; null on the last page.has_more(boolean, required)
GET /api/v1/billing/transactions
Section titled “GET /api/v1/billing/transactions”Balance history
operationId billingListTransactions · auth: orgSession
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
kind |
query | LedgerTxnKind | no | |
from |
query | string<date-time> | no | Inclusive lower bound. |
to |
query | string<date-time> | no | Exclusive upper bound. |
cursor |
query | string | no | Opaque cursor from a previous page’s next_cursor. |
limit |
query | integer<int32> | no | (minimum: 1, maximum: 200, default: 50) |
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json BillingTransactionPage |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — BillingTransactionPage
data(array of BillingTransaction, required)id(string, required) kind(LedgerTxnKind, required)amount_nano(string, required, pattern: ”^-?[0-9]+$”) — Net effect on the organisation’s spendable balance (positive = credit added). (Nano-USD, integer string.)memo(string, required)ref_type(string, required)ref_id(string, required)created_at(string, required)
next_cursor(string, required, nullable) — Pass ascursorto fetch the next page; null on the last page.has_more(boolean, required)
GET /api/v1/billing/topup-options
Section titled “GET /api/v1/billing/topup-options”Payment methods and limits for a top-up
operationId billingTopupOptions · auth: orgSession
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json TopupOptions |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — TopupOptions
currency(“USD”, required)methods(array of TopupMethodOption, required) — The payment methods available, in display order.method(TopupMethod, required) — What the customer pays with. Customers never see which processor handles a method.min_cents(integer, required) max_cents(integer, required) supports_saved_method(boolean, required) — The card can be saved for auto-recharge.bonus_ppm(integer, required) — Bonus credits on top of the amount credited, in parts per million (15000 = 1.5 %); 0 = none. The rate shown when the order is created is the one applied. Only the crypto method carries a bonus.
max_cents_per_day(integer, required, nullable) — Trust-tier daily cap; null = none. suggested_cents(array of integer, required)
POST /api/v1/billing/topups
Section titled “POST /api/v1/billing/topups”Create a top-up checkout
operationId billingCreateTopup · auth: orgSession · requires a verified email
Returns the order with checkout_url. Idempotent on idempotency_key; reusing the key with other parameters is a 409 idempotency_mismatch.
Request body (required) application/json — CreateTopupRequest
method(TopupMethod) — What the customer pays with. Customers never see which processor handles a method.provider(PaymentProvider)amount_cents(integer, required, minimum: 1) idempotency_key(string, required, minLength: 8, maxLength: 64) — Generated when the dialog opens. Repeating the call returns the same order.save_payment_method(boolean) — Card only: save the card and authorise off-session charges.
| Status | Meaning | Body |
|---|---|---|
| 201 | OK | application/json Order |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 201 application/json — Order
id(string, required) method(TopupMethod, required) — What the customer pays with. Customers never see which processor handles a method.purpose(OrderPurpose, required)status(OrderStatus, required) — rejected: an operator rejected the review; nothing is credited unless the provider later confirms more than rejected_cents.amount_cents(integer, required) — Amount requested, USD cents. confirmed_cents(integer, required) — Cumulative amount paid (confirmed). credited_cents(integer, required) — Cumulative amount paid that was turned into credits (the bonus is not included). bonus_ppm(integer, required) — Crypto bonus rate promised when the order was created, in ppm; 0 = no bonus. bonus_nano(string, required, pattern: ”^[0-9]+$”) — Bonus credits granted so far on top of credited_cents (a separate promotional credit). A refund takes back the matching share of it; the part already spent becomes debt, at most a small cap per order (bonus_debt_nano). (Nano-USD, integer string.)bonus_debt_nano(string, pattern: ”^[0-9]+$”) — Debt this order’s refunds and chargebacks booked because their share of the bonus had already been spent (at most the per-order cap, setting topup.bonus_clawback_debt_cap_nano; undone when the refund fails or the chargeback is won). The next top-up repays debt first. Only on GET /billing/orders/{order_id} for an order with a bonus and a refund or chargeback, absent elsewhere. (Nano-USD, integer string.)refunded_cents(integer, required) disputed_cents(integer, required) checkout_url(string, required, nullable) — Where to send the payer while the order is pending.receipt_url(string, required, nullable)plan_id(string, required, nullable) expires_at(string, required, nullable) paid_at(string, required, nullable) created_at(string, required) updated_at(string, required)
GET /api/v1/billing/orders
Section titled “GET /api/v1/billing/orders”List payment orders
operationId billingListOrders · auth: orgSession
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
status |
query | OrderStatus | no | |
purpose |
query | OrderPurpose | no | |
cursor |
query | string | no | Opaque cursor from a previous page’s next_cursor. |
limit |
query | integer<int32> | no | (minimum: 1, maximum: 200, default: 50) |
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json OrderPage |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — OrderPage
data(array of Order, required)id(string, required) method(TopupMethod, required) — What the customer pays with. Customers never see which processor handles a method.purpose(OrderPurpose, required)status(OrderStatus, required) — rejected: an operator rejected the review; nothing is credited unless the provider later confirms more than rejected_cents.amount_cents(integer, required) — Amount requested, USD cents. confirmed_cents(integer, required) — Cumulative amount paid (confirmed). credited_cents(integer, required) — Cumulative amount paid that was turned into credits (the bonus is not included). bonus_ppm(integer, required) — Crypto bonus rate promised when the order was created, in ppm; 0 = no bonus. bonus_nano(string, required, pattern: ”^[0-9]+$”) — Bonus credits granted so far on top of credited_cents (a separate promotional credit). A refund takes back the matching share of it; the part already spent becomes debt, at most a small cap per order (bonus_debt_nano). (Nano-USD, integer string.)bonus_debt_nano(string, pattern: ”^[0-9]+$”) — Debt this order’s refunds and chargebacks booked because their share of the bonus had already been spent (at most the per-order cap, setting topup.bonus_clawback_debt_cap_nano; undone when the refund fails or the chargeback is won). The next top-up repays debt first. Only on GET /billing/orders/{order_id} for an order with a bonus and a refund or chargeback, absent elsewhere. (Nano-USD, integer string.)refunded_cents(integer, required) disputed_cents(integer, required) checkout_url(string, required, nullable) — Where to send the payer while the order is pending.receipt_url(string, required, nullable)plan_id(string, required, nullable) expires_at(string, required, nullable) paid_at(string, required, nullable) created_at(string, required) updated_at(string, required)
next_cursor(string, required, nullable) — Pass ascursorto fetch the next page; null on the last page.has_more(boolean, required)
GET /api/v1/billing/orders/{order_id}
Section titled “GET /api/v1/billing/orders/{order_id}”Get a payment order
operationId billingGetOrder · auth: orgSession
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
order_id |
path | string<uuid> | yes |
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json Order |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — Order
id(string, required) method(TopupMethod, required) — What the customer pays with. Customers never see which processor handles a method.purpose(OrderPurpose, required)status(OrderStatus, required) — rejected: an operator rejected the review; nothing is credited unless the provider later confirms more than rejected_cents.amount_cents(integer, required) — Amount requested, USD cents. confirmed_cents(integer, required) — Cumulative amount paid (confirmed). credited_cents(integer, required) — Cumulative amount paid that was turned into credits (the bonus is not included). bonus_ppm(integer, required) — Crypto bonus rate promised when the order was created, in ppm; 0 = no bonus. bonus_nano(string, required, pattern: ”^[0-9]+$”) — Bonus credits granted so far on top of credited_cents (a separate promotional credit). A refund takes back the matching share of it; the part already spent becomes debt, at most a small cap per order (bonus_debt_nano). (Nano-USD, integer string.)bonus_debt_nano(string, pattern: ”^[0-9]+$”) — Debt this order’s refunds and chargebacks booked because their share of the bonus had already been spent (at most the per-order cap, setting topup.bonus_clawback_debt_cap_nano; undone when the refund fails or the chargeback is won). The next top-up repays debt first. Only on GET /billing/orders/{order_id} for an order with a bonus and a refund or chargeback, absent elsewhere. (Nano-USD, integer string.)refunded_cents(integer, required) disputed_cents(integer, required) checkout_url(string, required, nullable) — Where to send the payer while the order is pending.receipt_url(string, required, nullable)plan_id(string, required, nullable) expires_at(string, required, nullable) paid_at(string, required, nullable) created_at(string, required) updated_at(string, required)
POST /api/v1/billing/orders/{order_id}/sync
Section titled “POST /api/v1/billing/orders/{order_id}/sync”Re-check an order with the provider
operationId billingSyncOrder · auth: orgSession
Used by the checkout return page so the credit shows without waiting for the webhook.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
order_id |
path | string<uuid> | yes |
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json Order |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — Order
id(string, required) method(TopupMethod, required) — What the customer pays with. Customers never see which processor handles a method.purpose(OrderPurpose, required)status(OrderStatus, required) — rejected: an operator rejected the review; nothing is credited unless the provider later confirms more than rejected_cents.amount_cents(integer, required) — Amount requested, USD cents. confirmed_cents(integer, required) — Cumulative amount paid (confirmed). credited_cents(integer, required) — Cumulative amount paid that was turned into credits (the bonus is not included). bonus_ppm(integer, required) — Crypto bonus rate promised when the order was created, in ppm; 0 = no bonus. bonus_nano(string, required, pattern: ”^[0-9]+$”) — Bonus credits granted so far on top of credited_cents (a separate promotional credit). A refund takes back the matching share of it; the part already spent becomes debt, at most a small cap per order (bonus_debt_nano). (Nano-USD, integer string.)bonus_debt_nano(string, pattern: ”^[0-9]+$”) — Debt this order’s refunds and chargebacks booked because their share of the bonus had already been spent (at most the per-order cap, setting topup.bonus_clawback_debt_cap_nano; undone when the refund fails or the chargeback is won). The next top-up repays debt first. Only on GET /billing/orders/{order_id} for an order with a bonus and a refund or chargeback, absent elsewhere. (Nano-USD, integer string.)refunded_cents(integer, required) disputed_cents(integer, required) checkout_url(string, required, nullable) — Where to send the payer while the order is pending.receipt_url(string, required, nullable)plan_id(string, required, nullable) expires_at(string, required, nullable) paid_at(string, required, nullable) created_at(string, required) updated_at(string, required)
GET /api/v1/billing/plans
Section titled “GET /api/v1/billing/plans”Subscription plans on offer
operationId billingListPlans · auth: public
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json PlanList |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — PlanList
data(array of Plan, required)id(string, required) code(string, required)name(string, required)description(string, required)price_cents(integer, required) interval(PlanInterval, required)credit_nano(string, required, pattern: ”^-?[0-9]+$”) — Credits granted for every paid invoice. (Nano-USD, integer string.)credit_expires(boolean, required) — Granted credits expire at the end of the paid period.features(array of string, required)active(boolean, required)sort_order(integer, required) created_at(string, required)
GET /api/v1/billing/subscription
Section titled “GET /api/v1/billing/subscription”The organisation’s live subscription
operationId billingGetSubscription · auth: orgSession
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json SubscriptionState |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — SubscriptionState
subscription(Subscription)id(string, required) plan(Plan, required) — A subscription plan.id(string, required) code(string, required)name(string, required)description(string, required)price_cents(integer, required) interval(PlanInterval, required)credit_nano(string, required, pattern: ”^-?[0-9]+$”) — Credits granted for every paid invoice. (Nano-USD, integer string.)credit_expires(boolean, required) — Granted credits expire at the end of the paid period.features(array of string, required)active(boolean, required)sort_order(integer, required) created_at(string, required)
status(SubscriptionStatus, required)current_period_start(string, required, nullable) current_period_end(string, required, nullable) cancel_at_period_end(boolean, required)canceled_at(string, required, nullable) created_at(string, required)
POST /api/v1/billing/subscription
Section titled “POST /api/v1/billing/subscription”Start a subscription checkout
operationId billingSubscribe · auth: orgSession · requires a verified email
Request body (required) application/json — SubscribeRequest
plan_id(string, required)
| Status | Meaning | Body |
|---|---|---|
| 201 | OK | application/json Link |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 201 application/json — Link
url(string, required)
POST /api/v1/billing/subscription/cancel
Section titled “POST /api/v1/billing/subscription/cancel”Cancel at the end of the period
operationId billingCancelSubscription · auth: orgSession
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json Subscription |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — Subscription
id(string, required) plan(Plan, required) — A subscription plan.id(string, required) code(string, required)name(string, required)description(string, required)price_cents(integer, required) interval(PlanInterval, required)credit_nano(string, required, pattern: ”^-?[0-9]+$”) — Credits granted for every paid invoice. (Nano-USD, integer string.)credit_expires(boolean, required) — Granted credits expire at the end of the paid period.features(array of string, required)active(boolean, required)sort_order(integer, required) created_at(string, required)
status(SubscriptionStatus, required)current_period_start(string, required, nullable) current_period_end(string, required, nullable) cancel_at_period_end(boolean, required)canceled_at(string, required, nullable) created_at(string, required)
POST /api/v1/billing/subscription/resume
Section titled “POST /api/v1/billing/subscription/resume”Undo a scheduled cancellation
operationId billingResumeSubscription · auth: orgSession
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json Subscription |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — Subscription
id(string, required) plan(Plan, required) — A subscription plan.id(string, required) code(string, required)name(string, required)description(string, required)price_cents(integer, required) interval(PlanInterval, required)credit_nano(string, required, pattern: ”^-?[0-9]+$”) — Credits granted for every paid invoice. (Nano-USD, integer string.)credit_expires(boolean, required) — Granted credits expire at the end of the paid period.features(array of string, required)active(boolean, required)sort_order(integer, required) created_at(string, required)
status(SubscriptionStatus, required)current_period_start(string, required, nullable) current_period_end(string, required, nullable) cancel_at_period_end(boolean, required)canceled_at(string, required, nullable) created_at(string, required)
POST /api/v1/billing/portal
Section titled “POST /api/v1/billing/portal”Link to the provider’s customer portal
operationId billingPortal · auth: orgSession
Request body application/json — PortalRequest
return_path(string) — Path of the web app to return to; default /billing.
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json Link |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — Link
url(string, required)
GET /api/v1/billing/invoices
Section titled “GET /api/v1/billing/invoices”List subscription invoices
operationId billingListInvoices · auth: orgSession
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
cursor |
query | string | no | Opaque cursor from a previous page’s next_cursor. |
limit |
query | integer<int32> | no | (minimum: 1, maximum: 200, default: 50) |
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json InvoicePage |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — InvoicePage
data(array of Invoice, required)id(string, required) subscription_id(string, required) provider_invoice_id(string, required)status(“paid” | “refunded” | “disputed” | “void”, required)amount_paid_cents(integer, required) period_start(string, required) period_end(string, required) hosted_invoice_url(string, required)invoice_pdf_url(string, required)paid_at(string, required, nullable)
next_cursor(string, required, nullable) — Pass ascursorto fetch the next page; null on the last page.has_more(boolean, required)
GET /api/v1/billing/payment-methods
Section titled “GET /api/v1/billing/payment-methods”List saved payment methods
operationId billingListPaymentMethods · auth: orgSession
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json PaymentMethodList |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — PaymentMethodList
data(array of PaymentMethod, required)id(string, required) brand(string, required)last4(string, required)exp_month(integer, required) exp_year(integer, required) off_session_authorized(boolean, required)status(“active” | “detached”, required)created_at(string, required)
DELETE /api/v1/billing/payment-methods/{payment_method_id}
Section titled “DELETE /api/v1/billing/payment-methods/{payment_method_id}”Remove a saved payment method
operationId billingDetachPaymentMethod · auth: orgSession
Disables auto-recharge when it used this method.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
payment_method_id |
path | string<uuid> | yes |
| Status | Meaning | Body |
|---|---|---|
| 204 | Done. | — |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
GET /api/v1/billing/auto-recharge
Section titled “GET /api/v1/billing/auto-recharge”Auto-recharge settings
operationId billingGetAutoRecharge · auth: orgSession
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json AutoRecharge |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — AutoRecharge
enabled(boolean, required)allowed(boolean, required) — False when the trust tier does not permit auto-recharge yet.threshold_nano(string, required, pattern: ”^-?[0-9]+$”) — Recharge when the spendable balance falls below this. (Nano-USD, integer string.)amount_cents(integer, required) — Amount charged per recharge. payment_method_id(string, required, nullable) max_per_day(integer, required) max_cents_per_day(integer, required, nullable) disabled_reason("" | “payment_failed” | “requires_action” | “limit” | “risk”, required) — Why the system switched it off; empty when it did not.
PUT /api/v1/billing/auto-recharge
Section titled “PUT /api/v1/billing/auto-recharge”Replace auto-recharge settings
operationId billingSetAutoRecharge · auth: orgSession
Request body (required) application/json — AutoRechargeInput
enabled(boolean, required)threshold_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.amount_cents(integer, required, minimum: 1) payment_method_id(string, nullable) max_per_day(integer, minimum: 1, maximum: 20) max_cents_per_day(integer, nullable)
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json AutoRecharge |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — AutoRecharge
enabled(boolean, required)allowed(boolean, required) — False when the trust tier does not permit auto-recharge yet.threshold_nano(string, required, pattern: ”^-?[0-9]+$”) — Recharge when the spendable balance falls below this. (Nano-USD, integer string.)amount_cents(integer, required) — Amount charged per recharge. payment_method_id(string, required, nullable) max_per_day(integer, required) max_cents_per_day(integer, required, nullable) disabled_reason("" | “payment_failed” | “requires_action” | “limit” | “risk”, required) — Why the system switched it off; empty when it did not.
GET /api/v1/billing/low-balance-alert
Section titled “GET /api/v1/billing/low-balance-alert”Low-balance alert threshold
operationId billingGetLowBalanceAlert · auth: orgSession
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json LowBalanceAlert |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — LowBalanceAlert
threshold_nano(string, required, pattern: ”^-?[0-9]+$”, nullable) — Null turns the alert off.
PUT /api/v1/billing/low-balance-alert
Section titled “PUT /api/v1/billing/low-balance-alert”Set or clear the low-balance alert
operationId billingSetLowBalanceAlert · auth: orgSession
Request body (required) application/json — LowBalanceAlert
threshold_nano(string, required, pattern: ”^-?[0-9]+$”, nullable) — Null turns the alert off.
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json LowBalanceAlert |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — LowBalanceAlert
threshold_nano(string, required, pattern: ”^-?[0-9]+$”, nullable) — Null turns the alert off.
POST /api/v1/billing/redeem
Section titled “POST /api/v1/billing/redeem”Redeem a code for credits
operationId billingRedeem · auth: orgSession · requires a verified email
Request body (required) application/json — RedeemRequest
code(string, required)
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json Redemption |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — Redemption
id(string, required) credit_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.grant_id(string, required) balance(Balance, required) — Balance of an organisation. spendable = credits - debt.credits_nano(string, required, pattern: ”^-?[0-9]+$”) — Sum of the remaining credits of all grants. (Nano-USD, integer string.)debt_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.spendable_nano(string, required, pattern: ”^-?[0-9]+$”) — Negative when in debt. (Nano-USD, integer string.)version(integer, required) — Increases with every balance change. frozen(boolean, required)breakdown(CreditBreakdown) — credits_nano of the balance split by origin; purchased + bonus + subscription = credits_nano. purchased: paid top-ups (grant kind topup). bonus: signup bonus, redeem codes, promotional and admin credits and converted commission (kinds promo and affiliate). subscription: plan credits (kind subscription). Returned by GET /api/v1/billing/balance only.purchased(CreditBucket, required)remaining_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.next_expires_at(string, required, nullable) — Earliest expiry among the bucket’s grants that still hold credits; null when none expires. next_expiring_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
bonus(CreditBucket, required)remaining_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.next_expires_at(string, required, nullable) — Earliest expiry among the bucket’s grants that still hold credits; null when none expires. next_expiring_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
subscription(CreditBucket, required)remaining_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.next_expires_at(string, required, nullable) — Earliest expiry among the bucket’s grants that still hold credits; null when none expires. next_expiring_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
created_at(string, required)