Teams API
GET /api/v1/admin/teams/{id}/member-permissions
Section titled “GET /api/v1/admin/teams/{id}/member-permissions”GET /api/v1/admin/teams/{id}/member-permissions · operation getTeamMemberPermissions
Key actions the team delegates to its plain members (ADR 0133) and the actions available: keys:create, keys:rotate, keys:revoke, keys:delete. Readable by members of the team and global admins; other teams read as 404. Requires team_management and teams:read.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required |
Responses
| Status | Description | Body |
|---|---|---|
200 |
OK | — |
404 |
Feature disabled or team not visible | — |
PUT /api/v1/admin/teams/{id}/member-permissions
Section titled “PUT /api/v1/admin/teams/{id}/member-permissions”PUT /api/v1/admin/teams/{id}/member-permissions · operation putTeamMemberPermissions
Replaces the delegated key actions. A member of the team then takes those actions on the team’s keys with a team administrator’s limits (explicit models, no wildcard routes, team policy, no owner); a member of the team without the action gets 403 action_not_delegated. Only a global admin or an administrator of the team may change it; others read as 404. Empty list (the default) delegates nothing. Audited. Requires team_management and keys:manage.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required | |
X-CSRF-Token |
header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
Request body (required)
application/json: objectmember_permissions(array of string, required)
Responses
| Status | Description | Body |
|---|---|---|
200 |
OK | — |
400 |
Unknown or repeated action | — |
404 |
Feature disabled or team not administered | — |
GET /api/v1/admin/teams/{id}/detail
Section titled “GET /api/v1/admin/teams/{id}/detail”GET /api/v1/admin/teams/{id}/detail · operation teamsIdentityDetail
Requires identity_details, identity_inventory, team_management and teams:read. Reads exact identity metadata, configured access ceiling, persisted usage and bounded target audit in one read-only repeatable-read snapshot. Limits are a separate current observation. Global users:manage is required for console users. Other identities respect live session memberships; foreign or scoped-deleted IDs return 404. No tokens, hashes or credential material. Summary and recent requests require their respective usage_analytics/request_logs flags and actions. Audit requires global audit:read plus audit_explorer. RPM and direct key/team quota projections require global rates:read/quotas:read and the corresponding operational flags; other cumulative limits may still apply. Console user names/memberships never imply inference ownership. Both from and to must be provided together, or both omitted for the previous 24 hours. Unknown, duplicate and empty query parameters return 400. Range is positive and at most 90 days. Disabled, restricted and unavailable sections are explicit; empty usage does not prove no traffic. Configured policy and feature states are informational, never an authorization grant. Cache-Control no-store.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required, pattern ^[a-z][a-z0-9_-]{1,63}$ |
|
from |
query | string (date-time) | Start of the usage window shown, RFC 3339. |
to |
query | string (date-time) | End of the usage window shown, RFC 3339. |
Responses
| Status | Description | Body |
|---|---|---|
200 |
Authorized identity detail with explicit section availability and bounded metadata | application/json: IdentityDetail |
400 |
Invalid input | application/json: Error |
401 |
Missing or invalid bearer key | application/json: Error |
403 |
Model not allowed | application/json: Error |
404 |
Disabled feature or identity not found within authorized scope | — |
503 |
Identity authority or requested detail section unavailable | — |
GET /api/v1/admin/teams/page
Section titled “GET /api/v1/admin/teams/page”GET /api/v1/admin/teams/page · operation listTeamInventory
Requires identity_inventory and team_management. Teams with effective policy when enabled. Requires teams:read. Scope is applied before SQL count and pagination. Count/page use one repeatable-read snapshot; default ordering is created_at DESC, id DESC; sort=name selects alias for keys or name for teams/users. Sort and order are closed enums applied to the full authorized set; ties use ID in the same direction. Duplicate or unknown query parameters are rejected. Omitted status/all selects active teams only. Deleted is explicit and global-only. No bearer tokens or hashes. Effective policy enrichment may observe a later revision than the count/page snapshot and does not authorize mutations. Total is the matching authorized inventory, not provider usage. Cache-Control no-store.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
limit |
query | integer, default 25, min 1, max 100 |
Most teams on this page. |
offset |
query | integer, default 0, min 0, max 10000 |
Rows to skip before this page, for pagination. |
search |
query | string, max length 128 | |
team_id |
query | string, max length 64, pattern ^([a-z][a-z0-9_-]{1,63})?$ |
|
status |
query | string, one of "active", "deleted", "all" |
Only teams in this state. |
source |
query | string, one of "yaml", "console" |
Only teams declared in the YAML (yaml) or created in the console (console). |
sort |
query | string, one of "created_at", "name", "id", default "created_at" |
Order by creation time (default), name or ID. |
order |
query | string, one of "asc", "desc", default "desc" |
Sort direction: asc or desc. |
Responses
| Status | Description | Body |
|---|---|---|
200 |
Bounded page; truncated means additional matches exist, not authorization bypass | application/json: object |
400 |
Invalid input | application/json: Error |
401 |
Missing or invalid bearer key | application/json: Error |
403 |
Model not allowed | application/json: Error |
404 |
Feature disabled | application/json: Error |
503 |
Identity authority or bounded inventory query unavailable | — |
Response 200 fields:
application/json: objectitems(array of TeamInventoryItem, required, max items 100)total(integer (int64), required, min 0)limit(integer, required, min 1, max 100)offset(integer, required, min 0, max 10000)truncated(boolean, required)
GET /api/v1/admin/teams
Section titled “GET /api/v1/admin/teams”GET /api/v1/admin/teams · operation listTeams
List team metadata from PostgreSQL, including teams declared by YAML keys. Scoped roles see only active memberships. When team policy enforcement is enabled, each team includes effective policy.allowed_models, policy.scopes and policy.source (default, yaml or console); default means no access.
Authentication: adminSession
Responses
| Status | Description | Body |
|---|---|---|
200 |
Team directory, wrapped in data | — |
401 |
Missing or invalid bearer key | application/json: Error |
404 |
Feature disabled | application/json: Error |
POST /api/v1/admin/teams
Section titled “POST /api/v1/admin/teams”POST /api/v1/admin/teams · operation createTeam
Create a team. With organization_admins (T168) an organization admin may create teams, always in its own organization: organization_id is then omitted or its own, and any other organization answers 403 organization_forbidden. Renaming and deleting a team of another organization answer 404 to an organization admin.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-CSRF-Token |
header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
Request body (required)
application/json: objectname(string, required, min length 2, max length 128)
Responses
| Status | Description | Body |
|---|---|---|
201 |
Team created with a PostgreSQL-generated unique ID | — |
400 |
Invalid input | application/json: Error |
403 |
Model not allowed | application/json: Error |
409 |
Generated team ID collision; retry | — |
PUT /api/v1/admin/teams/{id}
Section titled “PUT /api/v1/admin/teams/{id}”PUT /api/v1/admin/teams/{id} · operation updateTeam
Rename a console team while preserving its database-generated ID, memberships, keys and usage references. Requires the current per-team version and team_management flag. YAML teams are operator-owned.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required | |
X-CSRF-Token |
header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
Request body (required)
application/json: objectname(string, required, min length 2, max length 128)version(integer (int64), required, min 0) — Per-team optimistic concurrency version from GET /api/v1/admin/teams
Responses
| Status | Description | Body |
|---|---|---|
200 |
Updated team with incremented version | — |
400 |
Invalid input | application/json: Error |
403 |
Model not allowed | application/json: Error |
404 |
Team not found or feature disabled | — |
409 |
Stale version or YAML-owned team | — |
DELETE /api/v1/admin/teams/{id}
Section titled “DELETE /api/v1/admin/teams/{id}”DELETE /api/v1/admin/teams/{id} · operation deleteTeam
Soft-delete a console team and atomically revoke its managed keys; preserve usage and audit history. YAML teams are operator-owned.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required | |
X-CSRF-Token |
header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
Responses
| Status | Description | Body |
|---|---|---|
204 |
Team deleted | — |
403 |
Model not allowed | application/json: Error |
404 |
Team not found or feature disabled | — |
409 |
YAML team cannot be deleted through API | — |
PUT /api/v1/admin/teams/{id}/organization
Section titled “PUT /api/v1/admin/teams/{id}/organization”PUT /api/v1/admin/teams/{id}/organization · operation moveTeamOrganization
Global admin moves a team to another organization with the current team version; the next request of every key of the team uses the new ceiling.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required | |
X-CSRF-Token |
header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
Request body (required)
application/json: objectorganization_id(string, required)version(integer (int64), required, min 0) — Current team version
Responses
| Status | Description | Body |
|---|---|---|
200 |
Team with its new organization and version | — |
400 |
Invalid input | application/json: Error |
403 |
Model not allowed | application/json: Error |
404 |
Unknown team or organization, or feature disabled | — |
409 |
Stale team version, or team_has_organization_members (T168): a member belongs to the team’s current organization; remove those memberships first | — |
PUT /api/v1/admin/teams/{id}/policy
Section titled “PUT /api/v1/admin/teams/{id}/policy”PUT /api/v1/admin/teams/{id}/policy · operation setTeamPolicy
Global admin sets a team ceiling on model aliases and explicit route or MCP discovery scopes. Overrides the YAML policy, requires team_policy_management and current team version; changes affect the next request for every team-bound key, including YAML keys and existing managed keys. Empty arrays deny all corresponding access.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required | |
X-CSRF-Token |
header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
Request body (required)
application/json: objectversion(integer (int64), required, min 0) — Current per-team version from GET /api/v1/admin/teamsallowed_models(array of string, required, max items 100) — Existing public model aliases; wildcards are forbiddenscopes(array of string, required, max items 16) — Explicit route:<capability>, route:models or mcp:read/mcp:execute; route:* is forbidden
Responses
| Status | Description | Body |
|---|---|---|
200 |
New team version and effective console policy | — |
400 |
Invalid input | application/json: Error |
403 |
Model not allowed | application/json: Error |
404 |
Team not found or feature disabled | — |
409 |
Stale team version | — |
DELETE /api/v1/admin/teams/{id}/policy
Section titled “DELETE /api/v1/admin/teams/{id}/policy”DELETE /api/v1/admin/teams/{id}/policy · operation revertTeamPolicy
Global admin removes a console policy override and restores the YAML base policy or default deny. Requires current team version and team_policy_management.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required | |
X-CSRF-Token |
header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
Request body (required)
application/json: objectversion(integer (int64), required, min 0)
Responses
| Status | Description | Body |
|---|---|---|
200 |
New team version and restored effective policy | — |
400 |
Invalid input | application/json: Error |
403 |
Model not allowed | application/json: Error |
404 |
Team or console policy override not found, or feature disabled | — |
409 |
Stale team version | — |
PUT /api/v1/admin/teams/{id}/require
Section titled “PUT /api/v1/admin/teams/{id}/require”PUT /api/v1/admin/teams/{id}/require · operation setTeamRequire
Global admin replaces a console team’s attribution requirement (T140). Requires team_management and the team’s current version, which it advances. Binds every key of the team at its next request, keys issued before it included; a key’s own require only adds to it. YAML teams take theirs from team_requirements (409 yaml_owned). Team listings show require and, when team_requirements names the team, yaml_require; keys get the union of both.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required | |
X-CSRF-Token |
header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
Request body (required)
application/json: objectrequire(AttributionRequirement, required)version(integer (int64), required, min 0) — Team version from the team listing
Responses
| Status | Description | Body |
|---|---|---|
200 |
Team with the new require and version | — |
400 |
invalid_require | — |
403 |
Model not allowed | application/json: Error |
404 |
Team not found or feature disabled | — |
409 |
Stale version, or a YAML team (yaml_owned) | — |
POST /api/v1/admin/teams/{id}/disable
Section titled “POST /api/v1/admin/teams/{id}/disable”POST /api/v1/admin/teams/{id}/disable · operation disableTeam
Disable a console team - none of its keys authenticate until it is enabled; an organization admin acts only inside its organization. Requires teams:manage, CSRF and reversible_disable and team_management. Audited.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-CSRF-Token |
header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
id |
path | string, required, max length 128 |
Responses
| Status | Description | Body |
|---|---|---|
204 |
Done | — |
400 |
Invalid input | application/json: Error |
401 |
Missing or invalid bearer key | application/json: Error |
403 |
Model not allowed | application/json: Error |
404 |
Feature disabled or not found (another organization’s object is not found) | — |
409 |
Already in that state, revoked, or YAML-owned | — |
503 |
Storage unavailable | — |
POST /api/v1/admin/teams/{id}/enable
Section titled “POST /api/v1/admin/teams/{id}/enable”POST /api/v1/admin/teams/{id}/enable · operation enableTeam
Enable a disabled console team. Requires teams:manage, CSRF and reversible_disable and team_management. Audited.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-CSRF-Token |
header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
id |
path | string, required, max length 128 |
Responses
| Status | Description | Body |
|---|---|---|
204 |
Done | — |
400 |
Invalid input | application/json: Error |
401 |
Missing or invalid bearer key | application/json: Error |
403 |
Model not allowed | application/json: Error |
404 |
Feature disabled or not found (another organization’s object is not found) | — |
409 |
Already in that state, revoked, or YAML-owned | — |
503 |
Storage unavailable | — |