Aller au contenu

API console: 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.

Organisations, members, roles, invitations. Handlers: internal/console/org.

Organisations the user belongs to

operationId orgList · auth: session

Status Meaning Body
200 OK application/json MembershipList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — MembershipList

  • data (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)

Create a team organisation

operationId orgCreate · auth: session · requires a verified email

Request body (required) application/json — CreateOrgRequest

  • name (string, required, minLength: 1, maxLength: 80)
Status Meaning Body
201 OK application/json Org
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 201 application/json — Org

  • 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)

Make an organisation the session’s active one

operationId orgSwitch · auth: session

Every org-scoped endpoint acts on the active organisation of the session.

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

Response 200 application/json — SessionInfo

  • 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)
  • 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)
  • permissions (array of string, required) — Permissions the role grants in the active organisation: view_usage, manage_own_keys, manage_all_keys, view_billing, manage_billing, manage_members, manage_org, owner.
  • is_admin (boolean, required)
  • totp_verified (boolean, required) — This session passed the second factor. The admin API needs is_admin and totp_verified.
  • csrf_token (string, required) — Echo in the X-CSRF-Token header of every state-changing request (also set as the gw_csrf cookie).
  • expires_at (string, required)

Accept an invitation

operationId orgAcceptInvitation · auth: session

The user’s verified email must match the invited address.

Request body (required) application/json — TokenRequest

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

Response 200 application/json — Membership

  • 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)

The active organisation

operationId orgGet · auth: orgSession

Status Meaning Body
200 OK application/json Membership
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — Membership

  • 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)

Rename the active organisation

operationId orgUpdate · auth: orgSession

Request body (required) application/json — UpdateOrgRequest

  • name (string, required, minLength: 1, maxLength: 80)
Status Meaning Body
200 OK application/json Org
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — Org

  • 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)

Close the active organisation

operationId orgClose · auth: orgSession

Owner only, team organisations only. The session falls back to the personal organisation. Every API key of the organisation is revoked; remaining credits stay in the ledger. Refused with 422 personal_org, 422 org_frozen, 422 org_has_debt (settle the debt first) and 409 org_has_subscription (cancel the subscription first).

Status Meaning Body
204 Done. —
default Error envelope. The HTTP status follows the error kind. application/json Error

Effective rate limits and trust tier

operationId orgLimits · auth: orgSession

Status Meaning Body
200 OK application/json OrgLimits
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — OrgLimits

  • trust_tier (integer, required)
  • trust_tier_name (string, required)
  • limits (RateLimits, required) — Rate limits; 0 means unlimited for that dimension.
    • rpm (integer, required) — Requests per minute.
    • tpm (integer, required) — Tokens per minute.
    • concurrency (integer, required) — Simultaneous in-flight requests.
  • max_spend_per_day_nano (string, required, pattern: ”^-?[0-9]+$”, nullable) — Nano-USD as a decimal integer string; null when not set.
  • max_topup_cents (integer, required, nullable) — Largest single top-up; null = platform limit only.
  • max_topup_cents_per_day (integer, required, nullable)
  • auto_recharge_allowed (boolean, required)

List members

operationId orgListMembers · auth: orgSession

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)

Change a member’s role

operationId orgSetMemberRole · auth: orgSession

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

Request body (required) application/json — SetMemberRoleRequest

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

Response 200 application/json — Member

  • user_id (string, required)
  • email (string, required)
  • display_name (string, required)
  • role (OrgRole, required)
  • joined_at (string, required)

Remove a member, or leave

operationId orgRemoveMember · auth: orgSession

Removing yourself leaves the organisation. The member’s API keys are revoked.

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

Transfer ownership to another member

operationId orgTransferOwnership · auth: orgSession

Request body (required) application/json — TransferOwnershipRequest

  • user_id (string, required)
Status Meaning Body
204 Done. —
default Error envelope. The HTTP status follows the error kind. application/json Error

List pending invitations

operationId orgListInvitations · auth: orgSession

Status Meaning Body
200 OK application/json InvitationList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — InvitationList

  • data (array of Invitation, required)
    • id (string, required)
    • email (string, required)
    • role (OrgRole, required)
    • invited_by (string, required)
    • expires_at (string, required)
    • created_at (string, required)

Invite someone by email

operationId orgCreateInvitation · auth: orgSession · requires a verified email

Request body (required) application/json — CreateInvitationRequest

  • email (string, required)
  • role (OrgRole, required)
Status Meaning Body
201 OK application/json Invitation
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 201 application/json — Invitation

  • id (string, required)
  • email (string, required)
  • role (OrgRole, required)
  • invited_by (string, required)
  • expires_at (string, required)
  • created_at (string, required)

Revoke a pending invitation

operationId orgRevokeInvitation · auth: orgSession

Parameter In Type Required Description
invitation_id path string<uuid> yes
Status Meaning Body
204 Done. —
default Error envelope. The HTTP status follows the error kind. application/json Error