跳转到内容

控制台 API: search

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

Global search of the user console (PRD V3 U2). Handlers: internal/console/search.

Search the active organisation

operationId consoleSearch · auth: orgSession

Finds API keys, top-up orders, requests, members and models of the session’s active organisation. The query’s shape picks what is searched: a UUID is looked up exactly (key, order, request, member, model), sk- matches API key prefixes (only the first 10 characters are used, so a pasted secret is never stored), a query with @ matches member emails by prefix, anything else matches names by prefix (key names, member display names, model slugs, display names and aliases). At most 5 hits per group. Each group follows the permission of its list operation: keys need manage_own_keys (members without manage_all_keys find only the keys they created), orders view_billing, requests view_usage.

Parameter In Type Required Description
q query string yes The search text; leading and trailing spaces are ignored. (minLength: 1, maxLength: 200)
Status Meaning Body
200 OK application/json SearchResults
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — SearchResults

  • query (string, required) — The query as it was searched (trimmed; an sk- query cut to 10 characters).
  • kind (“uuid” | “key_prefix” | “email” | “name”, required) — How the query was read.
  • groups (array of SearchGroup, required) — Only groups with at least one hit, in a fixed order per scope.
    • type (SearchHitType, required)
    • items (array of SearchHit, required, maxItems: 5)
      • id (string, required) — The object’s id (a UUID), or the setting key for setting hits.
      • title (string, required) — Main label, e.g. the key name, email, organisation name or model slug.
      • subtitle (string, required) — Secondary label (key prefix, model display name, amount, setting description); may be empty.
      • status (string, required) — The object’s status as its own API reports it (active, paid, …); empty when it has none.
      • org_id (string, required, nullable) — Organisation the object belongs to (admin search), null otherwise.