Aller au contenu

API console: admin-org

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

Users, organisations, manual credit, usage inspection. Handlers: internal/admin/org.

Search users

operationId adminListUsers · auth: adminSession

Parameter In Type Required Description
q query string no Email or id prefix.
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 UserPage
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — UserPage

  • data (array of User, required)
    • id (string, required)
    • email (string, required)
    • email_verified (boolean, required)
    • display_name (string, required)
    • locale (Locale, required) — User interface and email language. Supported: en (English, the default and fallback), es (Spanish), fr (French), zh (Chinese). On sign-up an omitted locale is taken from the Accept-Language header (best supported match by q-value), else en.
    • status (UserStatus, required)
    • is_admin (boolean, required) — Platform operator.
    • totp_enabled (boolean, required)
    • has_password (boolean, required) — False for OAuth-only accounts.
    • oauth_providers (array of OAuthProvider, required)
    • default_org_id (string, required, nullable)
    • last_login_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)

Get a user with memberships

operationId adminGetUser · auth: adminSession

Parameter In Type Required Description
user_id path string<uuid> yes
Status Meaning Body
200 OK application/json AdminUserDetail
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminUserDetail

  • user (User, required) — A user account.
    • id (string, required)
    • email (string, required)
    • email_verified (boolean, required)
    • display_name (string, required)
    • locale (Locale, required) — User interface and email language. Supported: en (English, the default and fallback), es (Spanish), fr (French), zh (Chinese). On sign-up an omitted locale is taken from the Accept-Language header (best supported match by q-value), else en.
    • status (UserStatus, required)
    • is_admin (boolean, required) — Platform operator.
    • totp_enabled (boolean, required)
    • has_password (boolean, required) — False for OAuth-only accounts.
    • oauth_providers (array of OAuthProvider, required)
    • default_org_id (string, required, nullable)
    • last_login_at (string, required, nullable)
    • created_at (string, required)
  • memberships (array of Membership, required)
    • org (Org, required) — An organisation: the billing subject. A personal account is an org of kind personal.
      • id (string, required)
      • name (string, required)
      • kind (OrgKind, required)
      • status (OrgStatus, required)
      • frozen_reason (FreezeReason, required) — Empty when the organisation is not frozen.
      • owner_user_id (string, required)
      • trust_tier (integer, required)
      • discount_ppm (integer, required) — Fraction taken off list prices, in ppm (0 = no discount).
      • created_at (string, required)
    • role (OrgRole, required)

Suspend or reactivate a user

operationId adminSetUserStatus · auth: adminSession

Parameter In Type Required Description
user_id path string<uuid> yes

Request body (required) application/json — SetUserStatusRequest

  • status (“active” | “suspended”, required)
Status Meaning Body
200 OK application/json User
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — User

  • id (string, required)
  • email (string, required)
  • email_verified (boolean, required)
  • display_name (string, required)
  • locale (Locale, required) — User interface and email language. Supported: en (English, the default and fallback), es (Spanish), fr (French), zh (Chinese). On sign-up an omitted locale is taken from the Accept-Language header (best supported match by q-value), else en.
  • status (UserStatus, required)
  • is_admin (boolean, required) — Platform operator.
  • totp_enabled (boolean, required)
  • has_password (boolean, required) — False for OAuth-only accounts.
  • oauth_providers (array of OAuthProvider, required)
  • default_org_id (string, required, nullable)
  • last_login_at (string, required, nullable)
  • created_at (string, required)

Grant or remove operator rights

operationId adminSetUserAdmin · auth: adminSession

Granting needs TOTP enabled on the target account (422 totp_required_for_admin).

Parameter In Type Required Description
user_id path string<uuid> yes

Request body (required) application/json — SetUserAdminRequest

  • is_admin (boolean, required)
Status Meaning Body
200 OK application/json User
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — User

  • id (string, required)
  • email (string, required)
  • email_verified (boolean, required)
  • display_name (string, required)
  • locale (Locale, required) — User interface and email language. Supported: en (English, the default and fallback), es (Spanish), fr (French), zh (Chinese). On sign-up an omitted locale is taken from the Accept-Language header (best supported match by q-value), else en.
  • status (UserStatus, required)
  • is_admin (boolean, required) — Platform operator.
  • totp_enabled (boolean, required)
  • has_password (boolean, required) — False for OAuth-only accounts.
  • oauth_providers (array of OAuthProvider, required)
  • default_org_id (string, required, nullable)
  • last_login_at (string, required, nullable)
  • created_at (string, required)

Search organisations

operationId adminListOrgs · auth: adminSession

Parameter In Type Required Description
q query string no Name, owner email or id prefix.
status query OrgStatus no
kind query OrgKind no
in_debt query boolean 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 AdminOrgPage
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminOrgPage

  • data (array of AdminOrg, required)
    • id (string, required)
    • name (string, required)
    • kind (OrgKind, required)
    • status (OrgStatus, required)
    • frozen_reason (FreezeReason, required) — Empty when the organisation is not frozen.
    • owner_user_id (string, required)
    • trust_tier (integer, required)
    • discount_ppm (integer, required) — Fraction taken off list prices, in ppm (0 = no discount).
    • created_at (string, required)
    • owner_email (string, required)
    • frozen_at (string, required, nullable)
    • credits_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.
    • 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.
    • balance_version (integer, required)
    • ledger_frozen (boolean, required) — Set by the invariant checker: blocks conversions and adjustments into the org.
    • settled_topup_cents (integer, required)
    • rpm_limit (integer, required, nullable) — Per-org override; null = tier default.
    • tpm_limit (integer, required, nullable)
    • concurrency_limit (integer, required, nullable)
    • low_balance_threshold_nano (string, required, pattern: ”^-?[0-9]+$”, nullable) — Nano-USD as a decimal integer string; null when not set.
    • auto_recharge_enabled (boolean, required)
    • stripe_customer_id (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 an organisation

operationId adminGetOrg · auth: adminSession

Parameter In Type Required Description
org_id path string<uuid> yes
Status Meaning Body
200 OK application/json AdminOrg
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminOrg

  • id (string, required)
  • name (string, required)
  • kind (OrgKind, required)
  • status (OrgStatus, required)
  • frozen_reason (FreezeReason, required) — Empty when the organisation is not frozen.
  • owner_user_id (string, required)
  • trust_tier (integer, required)
  • discount_ppm (integer, required) — Fraction taken off list prices, in ppm (0 = no discount).
  • created_at (string, required)
  • owner_email (string, required)
  • frozen_at (string, required, nullable)
  • credits_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.
  • 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.
  • balance_version (integer, required)
  • ledger_frozen (boolean, required) — Set by the invariant checker: blocks conversions and adjustments into the org.
  • settled_topup_cents (integer, required)
  • rpm_limit (integer, required, nullable) — Per-org override; null = tier default.
  • tpm_limit (integer, required, nullable)
  • concurrency_limit (integer, required, nullable)
  • low_balance_threshold_nano (string, required, pattern: ”^-?[0-9]+$”, nullable) — Nano-USD as a decimal integer string; null when not set.
  • auto_recharge_enabled (boolean, required)
  • stripe_customer_id (string, required)
  • updated_at (string, required)

Change discount and rate limit overrides

operationId adminUpdateOrg · auth: adminSession

Parameter In Type Required Description
org_id path string<uuid> yes

Request body (required) application/json — AdminOrgUpdate

  • discount_ppm (integer, minimum: 0, maximum: 1000000)
  • rpm_limit (integer, minimum: 0) — 0 removes the override.
  • tpm_limit (integer, minimum: 0) — 0 removes the override.
  • concurrency_limit (integer, minimum: 0) — 0 removes the override.
Status Meaning Body
200 OK application/json AdminOrg
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminOrg

  • id (string, required)
  • name (string, required)
  • kind (OrgKind, required)
  • status (OrgStatus, required)
  • frozen_reason (FreezeReason, required) — Empty when the organisation is not frozen.
  • owner_user_id (string, required)
  • trust_tier (integer, required)
  • discount_ppm (integer, required) — Fraction taken off list prices, in ppm (0 = no discount).
  • created_at (string, required)
  • owner_email (string, required)
  • frozen_at (string, required, nullable)
  • credits_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.
  • 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.
  • balance_version (integer, required)
  • ledger_frozen (boolean, required) — Set by the invariant checker: blocks conversions and adjustments into the org.
  • settled_topup_cents (integer, required)
  • rpm_limit (integer, required, nullable) — Per-org override; null = tier default.
  • tpm_limit (integer, required, nullable)
  • concurrency_limit (integer, required, nullable)
  • low_balance_threshold_nano (string, required, pattern: ”^-?[0-9]+$”, nullable) — Nano-USD as a decimal integer string; null when not set.
  • auto_recharge_enabled (boolean, required)
  • stripe_customer_id (string, required)
  • updated_at (string, required)

List an organisation’s members

operationId adminListOrgMembers · auth: adminSession

Parameter In Type Required Description
org_id path string<uuid> yes
Status Meaning Body
200 OK application/json MemberList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — MemberList

  • data (array of Member, required)
    • user_id (string, required)
    • email (string, required)
    • display_name (string, required)
    • role (OrgRole, required)
    • joined_at (string, required)

List an organisation’s credit grants

operationId adminListOrgGrants · auth: adminSession

Parameter In Type Required Description
org_id path string<uuid> yes
active_only query boolean 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 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)

Suspend an organisation

operationId adminFreezeOrg · auth: adminSession

Relay requests and top-ups are refused; the console stays readable.

Parameter In Type Required Description
org_id path string<uuid> yes

Request body (required) application/json — FreezeOrgRequest

  • reason (“admin” | “risk” | “debt” | “chargeback”, required)
  • note (string)
Status Meaning Body
200 OK application/json AdminOrg
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminOrg

  • id (string, required)
  • name (string, required)
  • kind (OrgKind, required)
  • status (OrgStatus, required)
  • frozen_reason (FreezeReason, required) — Empty when the organisation is not frozen.
  • owner_user_id (string, required)
  • trust_tier (integer, required)
  • discount_ppm (integer, required) — Fraction taken off list prices, in ppm (0 = no discount).
  • created_at (string, required)
  • owner_email (string, required)
  • frozen_at (string, required, nullable)
  • credits_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.
  • 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.
  • balance_version (integer, required)
  • ledger_frozen (boolean, required) — Set by the invariant checker: blocks conversions and adjustments into the org.
  • settled_topup_cents (integer, required)
  • rpm_limit (integer, required, nullable) — Per-org override; null = tier default.
  • tpm_limit (integer, required, nullable)
  • concurrency_limit (integer, required, nullable)
  • low_balance_threshold_nano (string, required, pattern: ”^-?[0-9]+$”, nullable) — Nano-USD as a decimal integer string; null when not set.
  • auto_recharge_enabled (boolean, required)
  • stripe_customer_id (string, required)
  • updated_at (string, required)

Lift a suspension

operationId adminUnfreezeOrg · auth: adminSession

Parameter In Type Required Description
org_id path string<uuid> yes
Status Meaning Body
200 OK application/json AdminOrg
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminOrg

  • id (string, required)
  • name (string, required)
  • kind (OrgKind, required)
  • status (OrgStatus, required)
  • frozen_reason (FreezeReason, required) — Empty when the organisation is not frozen.
  • owner_user_id (string, required)
  • trust_tier (integer, required)
  • discount_ppm (integer, required) — Fraction taken off list prices, in ppm (0 = no discount).
  • created_at (string, required)
  • owner_email (string, required)
  • frozen_at (string, required, nullable)
  • credits_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.
  • 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.
  • balance_version (integer, required)
  • ledger_frozen (boolean, required) — Set by the invariant checker: blocks conversions and adjustments into the org.
  • settled_topup_cents (integer, required)
  • rpm_limit (integer, required, nullable) — Per-org override; null = tier default.
  • tpm_limit (integer, required, nullable)
  • concurrency_limit (integer, required, nullable)
  • low_balance_threshold_nano (string, required, pattern: ”^-?[0-9]+$”, nullable) — Nano-USD as a decimal integer string; null when not set.
  • auto_recharge_enabled (boolean, required)
  • stripe_customer_id (string, required)
  • updated_at (string, required)

Set the trust tier

operationId adminSetOrgTrustTier · auth: adminSession

Parameter In Type Required Description
org_id path string<uuid> yes

Request body (required) application/json — SetTrustTierRequest

  • tier (integer, required, minimum: 0)
  • note (string)
Status Meaning Body
200 OK application/json AdminOrg
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminOrg

  • id (string, required)
  • name (string, required)
  • kind (OrgKind, required)
  • status (OrgStatus, required)
  • frozen_reason (FreezeReason, required) — Empty when the organisation is not frozen.
  • owner_user_id (string, required)
  • trust_tier (integer, required)
  • discount_ppm (integer, required) — Fraction taken off list prices, in ppm (0 = no discount).
  • created_at (string, required)
  • owner_email (string, required)
  • frozen_at (string, required, nullable)
  • credits_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.
  • 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.
  • balance_version (integer, required)
  • ledger_frozen (boolean, required) — Set by the invariant checker: blocks conversions and adjustments into the org.
  • settled_topup_cents (integer, required)
  • rpm_limit (integer, required, nullable) — Per-org override; null = tier default.
  • tpm_limit (integer, required, nullable)
  • concurrency_limit (integer, required, nullable)
  • low_balance_threshold_nano (string, required, pattern: ”^-?[0-9]+$”, nullable) — Nano-USD as a decimal integer string; null when not set.
  • auto_recharge_enabled (boolean, required)
  • stripe_customer_id (string, required)
  • updated_at (string, required)

POST /api/v1/admin/orgs/{org_id}/credit-adjustments

Section intitulée « POST /api/v1/admin/orgs/{org_id}/credit-adjustments »

Grant or deduct credits manually

operationId adminAdjustOrgCredit · auth: adminSession

Posts to the ledger against the adjustment account. Refused while the org’s ledger is frozen.

Parameter In Type Required Description
org_id path string<uuid> yes

Request body (required) application/json — CreditAdjustmentRequest

  • amount_nano (string, required, pattern: ”^-?[0-9]+$”) — Signed and non-zero: positive grants credits, negative deducts them. (Nano-USD, integer string.)
  • reason (string, required, minLength: 3, maxLength: 500) — Recorded in the ledger memo and the audit log.
  • idempotency_key (string, required, minLength: 8, maxLength: 64) — Repeating the call with the same key has no further effect.
  • grant_kind (“promo” | “topup”) — Positive amounts only: burn-order class of the grant. Default promo.
  • expires_at (string, nullable) — Positive amounts only.
Status Meaning Body
201 OK application/json LedgerPosting
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 201 application/json — LedgerPosting

  • txn_id (string, required)
  • grant_id (string, required, nullable)
  • 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.

Write off debt as bad debt

operationId adminWriteOffOrgDebt · auth: adminSession

Parameter In Type Required Description
org_id path string<uuid> yes

Request body (required) application/json — DebtWriteoffRequest

  • amount_nano (string, required, pattern: ”^-?[0-9]+$”) — Positive; at most the organisation’s debt. (Nano-USD, integer string.)
  • reason (string, required, minLength: 3, maxLength: 500)
  • idempotency_key (string, required, minLength: 8, maxLength: 64)
Status Meaning Body
201 OK application/json LedgerPosting
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 201 application/json — LedgerPosting

  • txn_id (string, required)
  • grant_id (string, required, nullable)
  • 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.

List usage records of an organisation

operationId adminListUsage · auth: adminSession

Parameter In Type Required Description
org_id query string<uuid> yes
from query string<date-time> no Inclusive lower bound.
to query string<date-time> no Exclusive upper bound.
api_key_id query string<uuid> no
model query string no Exact model slug.
status query UsageStatus 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 AdminUsageRecordPage
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — AdminUsageRecordPage

  • data (array of AdminUsageRecord, required)
    • request_id (string, required) — Also the generation id returned to API clients.
    • created_at (string, required)
    • api_key_id (string, required, nullable)
    • api_key_name (string, required) — Empty when the key no longer exists.
    • model (string, required)
    • provider (string, required) — Provider tag of the channel that served the request; may be empty.
    • operation (Operation, required)
    • stream (boolean, required)
    • status (UsageStatus, required)
    • finish_reason (string, required)
    • usage (UsageCounters, required) — Disjoint usage counters of one request; absent counters are zero.
      • input_tokens (integer)
      • output_tokens (integer)
      • reasoning_tokens (integer)
      • cache_read_tokens (integer)
      • cache_write_5m_tokens (integer)
      • cache_write_1h_tokens (integer)
      • image_input_tokens (integer)
      • image_output_tokens (integer)
      • audio_input_tokens (integer)
      • audio_output_tokens (integer)
      • input_chars (integer)
      • audio_input_ms (integer)
      • images (integer)
      • web_search_calls (integer)
      • requests (integer)
      • video_ms (integer) — Milliseconds of generated video (asynchronous video tasks).
    • estimated (boolean, required) — Usage was estimated locally because the upstream did not report it.
    • cost_nano (string, required, pattern: ”^-?[0-9]+$”) — Amount charged. (Nano-USD, integer string.)
    • list_nano (string, required, pattern: ”^-?[0-9]+$”) — Amount at list price, before the organisation discount. (Nano-USD, integer string.)
    • discount_ppm (integer, required)
    • attempts (integer, required) — Upstream attempts; retries = attempts - 1.
    • ttft_ms (integer, required, nullable) — Time to first token; null when nothing was delivered.
    • duration_ms (integer, required)
    • org_id (string, required)
    • channel_id (string, required, nullable)
    • offering_id (string, required, nullable)
    • upstream_model (string, required)
    • http_status (integer, required)
    • error_code (string, required)
    • upstream_cost_nano (string, required, pattern: ”^-?[0-9]+$”, nullable) — Nano-USD as a decimal integer string; null when not set.
    • settled_by (“gateway” | “reclaimer”, required)
    • breakdown (array of CostLineItem, required)
      • kind (CostItemKind, required) — Kind of a cost line. byok_service_fee is the only line of a request served with the organisation’s own provider key (BYOK); its amount is the platform’s service fee.
      • quantity (integer, required) — The counter: tokens for per_million, items for each, MILLISECONDS for per_second (divide by 1000 before multiplying by unit_price).
      • unit_price (string, required) — List price in nano-USD in the given unit, before discount (integer string).
      • unit (“per_million” | “each” | “per_second”, required)
      • amount_nano (string, required, pattern: ”^-?[0-9]+$”) — This line’s share of the charged total. (Nano-USD, integer string.)
    • price_version_id (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)

Upstream attempts of a request

operationId adminListUsageAttempts · auth: adminSession

Parameter In Type Required Description
request_id path string<uuid> yes
Status Meaning Body
200 OK application/json UpstreamAttemptList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — UpstreamAttemptList

  • data (array of UpstreamAttempt, required)
    • attempt_no (integer, required)
    • offering_id (string, required)
    • channel_id (string, required)
    • channel_key_id (string, required, nullable)
    • upstream_model (string, required)
    • upstream_protocol (string, required)
    • passthrough (boolean, required)
    • outcome (string, required)
    • delivered (boolean, required) — The attempt whose output reached the client.
    • http_status (integer, required)
    • error_code (string, required)
    • error_message (string, required)
    • upstream_request_id (string, required)
    • usage (UsageCounters) — Disjoint usage counters of one request; absent counters are zero.
      • input_tokens (integer)
      • output_tokens (integer)
      • reasoning_tokens (integer)
      • cache_read_tokens (integer)
      • cache_write_5m_tokens (integer)
      • cache_write_1h_tokens (integer)
      • image_input_tokens (integer)
      • image_output_tokens (integer)
      • audio_input_tokens (integer)
      • audio_output_tokens (integer)
      • input_chars (integer)
      • audio_input_ms (integer)
      • images (integer)
      • web_search_calls (integer)
      • requests (integer)
      • video_ms (integer) — Milliseconds of generated video (asynchronous video tasks).
    • upstream_cost_nano (string, required, pattern: ”^-?[0-9]+$”, nullable) — Nano-USD as a decimal integer string; null when not set.
    • ttfb_ms (integer, required, nullable)
    • duration_ms (integer, required)
    • started_at (string, required)

Export a user’s personal data

operationId adminExportUserData · auth: adminSession

The same document as GET /api/v1/account/export, for answering a data subject request.

Parameter In Type Required Description
user_id path string<uuid> yes
Status Meaning Body
200 OK application/json PersonalDataExport
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — PersonalDataExport

Personal data export, format_version 1. Sections: format_version, generated_at, user, oauth, memberships, api_keys, personal_org (org, payment_orders, credit_grants, usage). The shape of each section follows the matching console API objects; money is nano-USD strings.

Delete a user’s account and erase their personal data

operationId adminRequestUserErasure · auth: adminSession

Same rules and error codes as POST /api/v1/account/deletion. immediate skips the grace period.

Parameter In Type Required Description
user_id path string<uuid> yes

Request body (required) application/json — AdminErasureRequest

  • forfeit_balance (boolean, default: false)
  • immediate (boolean, default: false) — Erase in the next worker pass instead of after the grace period.
Status Meaning Body
202 Accepted. application/json Erasure
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 202 application/json — Erasure

  • id (string, required)
  • subject_type (“user” | “org”, required)
  • subject_id (string, required)
  • status (ErasureStatus, required)
  • requested_via (“self” | “admin”, required)
  • requested_by (string, required, nullable)
  • forfeit_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.
  • erase_after (string, required)
  • attempts (integer, required)
  • last_error (string, required) — Code of the condition that postponed the last pass (” when none).
  • created_at (string, required)
  • done_at (string, required, nullable)

Delete a team organisation and erase its personal data

operationId adminRequestOrgErasure · auth: adminSession

Closes the team organisation (API keys revoked, invitations revoked, auto-recharge off) and erases its personal data after the grace period: name, invitations, members other than the owner, client IPs and user agents of its usage and payments, card details of its saved payment methods. Ledger entries stay. Personal organisations go with their account (422 personal_org). Same refusal codes as account deletion, except the ones about the owner’s account.

Parameter In Type Required Description
org_id path string<uuid> yes

Request body (required) application/json — AdminErasureRequest

  • forfeit_balance (boolean, default: false)
  • immediate (boolean, default: false) — Erase in the next worker pass instead of after the grace period.
Status Meaning Body
202 Accepted. application/json Erasure
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 202 application/json — Erasure

  • id (string, required)
  • subject_type (“user” | “org”, required)
  • subject_id (string, required)
  • status (ErasureStatus, required)
  • requested_via (“self” | “admin”, required)
  • requested_by (string, required, nullable)
  • forfeit_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.
  • erase_after (string, required)
  • attempts (integer, required)
  • last_error (string, required) — Code of the condition that postponed the last pass (” when none).
  • created_at (string, required)
  • done_at (string, required, nullable)

Erasure requests

operationId adminListErasures · auth: adminSession

Parameter In Type Required Description
status query ErasureStatus 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 ErasureList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — ErasureList

  • data (array of Erasure, required)
    • id (string, required)
    • subject_type (“user” | “org”, required)
    • subject_id (string, required)
    • status (ErasureStatus, required)
    • requested_via (“self” | “admin”, required)
    • requested_by (string, required, nullable)
    • forfeit_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.
    • erase_after (string, required)
    • attempts (integer, required)
    • last_error (string, required) — Code of the condition that postponed the last pass (” when none).
    • created_at (string, required)
    • done_at (string, required, nullable)
  • next_cursor (string, required, nullable)
  • has_more (boolean, required)

Cancel a pending erasure

operationId adminCancelErasure · auth: adminSession

Only while it is pending (422 erasure_not_pending afterwards: erased data cannot come back). Cancelling an account deletion reactivates the account; its API keys and sessions stay revoked. Cancelling an org deletion leaves the org closed.

Parameter In Type Required Description
erasure_id path string<uuid> yes
Status Meaning Body
200 OK application/json Erasure
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — Erasure

  • id (string, required)
  • subject_type (“user” | “org”, required)
  • subject_id (string, required)
  • status (ErasureStatus, required)
  • requested_via (“self” | “admin”, required)
  • requested_by (string, required, nullable)
  • forfeit_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.
  • erase_after (string, required)
  • attempts (integer, required)
  • last_error (string, required) — Code of the condition that postponed the last pass (” when none).
  • created_at (string, required)
  • done_at (string, required, nullable)