跳转到内容

控制台 API: mgmtkey

本页由 server/api/openapi.yaml 生成,内容为英文,请勿手工修改。

Management API keys of the active organisation (V3 R5). Handlers: internal/console/mgmtkey.

List the organisation’s management API keys

operationId mgmtKeyList · auth: orgSession

Revoked keys are not listed. Requires owner or admin.

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

Response 200 application/json — MgmtKeyList

  • data (array of MgmtKey, required)
    • id (string, required)
    • name (string, required)
    • key_prefix (string, required) — First 10 characters, e.g. mk-AbCd123.
    • key_last4 (string, required)
    • scope (MgmtScope, required) — read: balance, usage, list inference keys. manage_keys: also create and revoke inference keys.
    • ip_allowlist (array of string, required, nullable) — CIDR prefixes; null = any address.
    • expires_at (string, required, nullable)
    • last_used_at (string, required, nullable)
    • created_by (string, required, nullable)
    • created_at (string, required)

Create a management API key

operationId mgmtKeyCreate · auth: orgSession · requires a verified email

Requires owner or admin. The plaintext secret (mk-…) is in this response only. At most 25 keys per organisation.

Request body (required) application/json — MgmtKeyInput

  • name (string, required, minLength: 1, maxLength: 100)
  • scope (MgmtScope, required) — read: balance, usage, list inference keys. manage_keys: also create and revoke inference keys.
  • ip_allowlist (array of string, nullable)
  • expires_at (string, nullable)
Status Meaning Body
201 OK application/json MgmtKeyCreated
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 201 application/json — MgmtKeyCreated

  • key (MgmtKey, required) — A management API key without its secret.
    • id (string, required)
    • name (string, required)
    • key_prefix (string, required) — First 10 characters, e.g. mk-AbCd123.
    • key_last4 (string, required)
    • scope (MgmtScope, required) — read: balance, usage, list inference keys. manage_keys: also create and revoke inference keys.
    • ip_allowlist (array of string, required, nullable) — CIDR prefixes; null = any address.
    • expires_at (string, required, nullable)
    • last_used_at (string, required, nullable)
    • created_by (string, required, nullable)
    • created_at (string, required)
  • secret (string, required) — The plaintext key (mk- + 48 characters). Returned once, never again.

DELETE /api/v1/org/mgmt-keys/{mgmt_key_id}

Section titled “DELETE /api/v1/org/mgmt-keys/{mgmt_key_id}”

Revoke a management API key

operationId mgmtKeyRevoke · auth: orgSession

Permanent. Requires owner or admin.

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