API de consola: admin-org
Esta página se genera a partir de server/api/openapi.yaml. Su contenido está en inglés; no la edites a mano.
Users, organisations, manual credit, usage inspection. Handlers: internal/admin/org.
GET /api/v1/admin/users
Sección titulada «GET /api/v1/admin/users»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 ascursorto fetch the next page; null on the last page.has_more(boolean, required)
GET /api/v1/admin/users/{user_id}
Sección titulada «GET /api/v1/admin/users/{user_id}»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 kindpersonal.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)
POST /api/v1/admin/users/{user_id}/status
Sección titulada «POST /api/v1/admin/users/{user_id}/status»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)
POST /api/v1/admin/users/{user_id}/admin
Sección titulada «POST /api/v1/admin/users/{user_id}/admin»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)
GET /api/v1/admin/orgs
Sección titulada «GET /api/v1/admin/orgs»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 ascursorto fetch the next page; null on the last page.has_more(boolean, required)
GET /api/v1/admin/orgs/{org_id}
Sección titulada «GET /api/v1/admin/orgs/{org_id}»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)
PATCH /api/v1/admin/orgs/{org_id}
Sección titulada «PATCH /api/v1/admin/orgs/{org_id}»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)
GET /api/v1/admin/orgs/{org_id}/members
Sección titulada «GET /api/v1/admin/orgs/{org_id}/members»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)
GET /api/v1/admin/orgs/{org_id}/grants
Sección titulada «GET /api/v1/admin/orgs/{org_id}/grants»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 ascursorto fetch the next page; null on the last page.has_more(boolean, required)
POST /api/v1/admin/orgs/{org_id}/freeze
Sección titulada «POST /api/v1/admin/orgs/{org_id}/freeze»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)
POST /api/v1/admin/orgs/{org_id}/unfreeze
Sección titulada «POST /api/v1/admin/orgs/{org_id}/unfreeze»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)
POST /api/v1/admin/orgs/{org_id}/trust-tier
Sección titulada «POST /api/v1/admin/orgs/{org_id}/trust-tier»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
Sección titulada «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.
POST /api/v1/admin/orgs/{org_id}/debt-writeoffs
Sección titulada «POST /api/v1/admin/orgs/{org_id}/debt-writeoffs»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.
GET /api/v1/admin/usage
Sección titulada «GET /api/v1/admin/usage»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_feeis 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 ascursorto fetch the next page; null on the last page.has_more(boolean, required)
GET /api/v1/admin/usage/{request_id}/attempts
Sección titulada «GET /api/v1/admin/usage/{request_id}/attempts»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)
GET /api/v1/admin/users/{user_id}/export
Sección titulada «GET /api/v1/admin/users/{user_id}/export»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.
POST /api/v1/admin/users/{user_id}/erasure
Sección titulada «POST /api/v1/admin/users/{user_id}/erasure»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)
POST /api/v1/admin/orgs/{org_id}/erasure
Sección titulada «POST /api/v1/admin/orgs/{org_id}/erasure»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)
GET /api/v1/admin/erasures
Sección titulada «GET /api/v1/admin/erasures»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)
POST /api/v1/admin/erasures/{erasure_id}/cancel
Sección titulada «POST /api/v1/admin/erasures/{erasure_id}/cancel»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)