---
title: "Set Active Team Endpoint"
method: POST
path: "/users/me/active-team"
tags: ["users"]
---

# Set Active Team Endpoint

`POST /users/me/active-team`

Switch the authenticated user's active team.

Delegates the locked membership write and billing-cache invalidation
to :func:`set_active_team`, then reads the activated team back through
:func:`get_team_response_for_user`. Both a revoked membership and a
concurrent teardown surface as a single 409 so the frontend has one
retry path. Emits a ``team.activated`` audit event after the switch
commits.

Args:
    request: ``{team_id: uuid}`` — target team to activate.
    auth: Authenticated user context.

Returns:
    ``TeamResponse`` for the newly active team.

Raises:
    HTTPException: 409 if the user is not a current member of the
        target team (or the membership is revoked between the
        activation and the readback).

## Request body

- SetActiveTeamRequest — Request body for POST /users/me/active-team.
  - `team_id` string, uuid, required

## Response `200`

Successful Response

- TeamResponse — Response model for a single team.
  - `id` string, required
  - `name` string, required
  - `owner_id` string, required
  - `payment_plan` string, required
  - `router_enabled` boolean
  - `zero_data_retention` boolean
  - `created_at` string, required
  - `updated_at` string, required
  - `member_count` integer, nullable
  - `current_user_role` 'owner' | 'billing' | 'admin' | 'editor' | 'viewer' — Team member roles with hierarchical permissions. Wire DTO mirror of the ORM ``TeamRoleType`` enum. Used only for API request/response serialization; authorization decisions route through the ORM matrix (``database_tables.permissions``), never this enum.
  - `capabilities` object, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/pioneer/apis/brain-api.md) · [All operations](https://skmtc.net/pioneer/apis/brain-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pioneer/brain-api/revisions/31dfe831e079/schema)
