Skip to content

PATCH /api/v1/admin/orgs/:slug/teams/:id

This page is auto-generated from src/admin/routes.ts. Do not edit by hand — see docs/dev/docs-auto-sync.md.

:warning: Heuristic extraction — not a contract. Response shapes below are mined from c.json(...) literals in the handler via an AST walker. Computed fields, ternaries, and non-literal returns are shown as placeholders. Refer to the linked source file for the authoritative behaviour.

Requires the following capability(ies):

  • projects:w

Other middleware observed on this route (heuristic):

  • requireCapability
  • adminBodyLimit

PATCH /api/v1/admin/orgs/:slug/teams/:id — rename a team’s display name and/or slug. The team’s id is IMMUTABLE — every audit_log row, projects.team_id foreign key, and team_members composite-PK row references it. Renaming the name is a pure display change; renaming the slug takes the same tenant- scoped uniqueness gate as POST (the teams_tenant_slug_idx UNIQUE constraint in mig 0036).

Audit: writes a team_renamed row of decision OK with structured decisionReason: {event, team_id, before:{name,slug}, after:{name,slug}, by_user_id} so the bridge in #569 Phase B can attribute the change to a specific actor. #591 — uses the same projects:w cap as the rest of the team admin surface (the issue body proposes teams:w but the capability vocabulary doesn’t have a separate teams entry today — teams + projects share projects:w).

{
"error": "Invalid JSON body"
}
{
"error": "Body must be a JSON object"
}
{
"error": "Body must include at least one of `name` or `slug`"
}
{
"error": "name must be a non-empty string ≤128 chars"
}
{
"error": "slug must be lowercase, alphanumeric + hyphens, ≤128 chars"
}
{
"error": "Org not found"
}
{
"error": "Team not found for this org"
}
{
"id": <member-expr>,
"name": <member-expr>,
"slug": <member-expr>,
"changed": false
}
{
"error": "Team with that slug already exists in this org"
}

Shape not a JSON literal — passed through from a variable or expression. See source.

  • File: src/admin/routes.ts
  • Line: 4941