Skip to main content
POST /api/v1/me/switch-organization Requires BearerAuth. Switches the active organization for the session. Because the access token is organization-scoped, switching requires re-issuing both tokens. The provided refresh token is rotated — the old one is invalidated and a new session is returned scoped to the target organization.
The caller must already be a member of the target organization. Use the organizations array from login or GET /api/v1/me to find valid organization IDs.

Request body

organization_id
string
required
UUID of the organization to switch to.
refresh_token
string
required
The current refresh token. It is rotated as part of this operation.

Response

Returns a full SessionResponse scoped to the new organization, identical in structure to login.
token
string
required
New JWT access token scoped to the target organization. Expires after 1 hour.
refresh_token
string
required
New JWT refresh token. Expires after 30 days. The previous token is now invalid.
user
object
required
The authenticated user.
current_organization
object
required
The newly active organization.
organizations
OrganizationSummary[]
required
All organizations the caller is a member of.

Errors

StatusWhen
400Request body is missing or malformed
401The access token or refresh token is missing or invalid
403The caller is not a member of the target organization

Example

curl -X POST http://localhost:8080/api/v1/me/switch-organization \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_id": "org-uuid-here",
    "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
  }'
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": { "..." : "..." },
  "current_organization": {
    "id": "org-uuid-here",
    "slug": "other-org",
    "name": "Other Org",
    "role": "developer"
  },
  "organizations": []
}

Build docs developers (and LLMs) love