Aller au contenu

API console: billing

Cette page est générée à partir de server/api/openapi.yaml. Son contenu est en anglais ; ne la modifiez pas à la main.

Balance, top-ups, orders, subscriptions, invoices, auto-recharge, redeem codes. Handlers: internal/console/billing.

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.

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 as cursor to fetch the next page; null on the last page.
  • has_more (boolean, required)

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 as cursor to fetch the next page; null on the last page.
  • has_more (boolean, required)

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)

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)

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 as cursor to fetch the next page; null on the last page.
  • has_more (boolean, required)

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)

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)

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)

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)

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)

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)

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)

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)

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 as cursor to fetch the next page; null on the last page.
  • has_more (boolean, required)

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 intitulée « 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

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.

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.

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.

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.

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)