---
title: "Set a connection's team binding"
method: PUT
path: "/me/connection"
tags: ["Account"]
---

# Set a connection's team binding

`PUT /me/connection`

## Request

- Base URL: `https://api.varg.ai/v2`
- URL: `https://api.varg.ai/v2/me/connection`
- Auth: HTTP bearer

Binds an OAuth connection to a team and optional default folder. Send `team_id: null` (or omit it)
to move the connection back to the personal account. A connected app can only change its own
binding; an app session must pass `client_id` in the body. API keys have no connection and get 400.
Returns the stored binding.

## Request body

- AccountConnectionRequest
  - `client_id` string: Required for an app session; a connected app may omit it or must send its own.
  - `team_id` string, uuid, nullable: Team to bind to, or null/omitted for the personal account.
  - `workspace_id` string, nullable: Default folder in the selected scope, or null.

## Response `200`

The stored binding

- AccountConnection: Which team and default folder an OAuth connection works in.
  - `client_id` string, required
  - `team_id` string, nullable, required: Null means the personal account.
  - `team_slug` string, nullable, required
  - `team_name` string, nullable, required
  - `team_owner` boolean, required: True when the user owns the bound team (owners manage its API keys; members only spend).
  - `workspace_id` string, nullable, required: Default folder for the connection, if any.
  - `status` 'ok' | 'no_team_access', required: `ok` means the binding is usable (`team_id: null` is the normal personal case). `no_team_access` means the user can no longer act in the bound team; clients should refuse to generate rather than fall back to the personal balance.

## Other responses

- `400`: Invalid body, API key used, or `client_id` missing (`invalid_request`)
- `401`: Missing or invalid API key / JWT
- `403`: No access to that team, or a connected app targeted another client (`forbidden`)
- `404`: Folder does not exist in the selected scope (`workspace_not_found`)
- `500`: Could not save the binding or resolve the team account
- `503`: The binding could not be read back (`binding_unavailable`)

## Changes

- **2026-10-20** `43bcf5ea398d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/varg/apis/varg-api/changes/me/connection/put.md)

---

[API](https://skmtc.dev/varg/apis/varg-api.md) · [All operations](https://skmtc.dev/varg/apis/varg-api/llms.txt) · [OpenAPI document](https://skmtc.dev/varg/apis/varg-api/revisions/09d49a6d852f?raw)
