# Switching Orgs

Source: https://aiand-docs-staging.pages.dev/organizations/switching/

A user can belong to multiple organizations. The org used for a given request determines the billing account, rate limits, model access, and visible files.

## With API keys

API keys are scoped to a single org at creation time. **The key chooses the org** — no extra header needed.

```bash
curl https://api.aiand.com/v1/chat/completions \
  -H "Authorization: Bearer sk-..." \
  -d '{...}'
```

To act on a different org, use that org's API key.

The [ai& CLI](/cli/) works the same way: its key belongs to the org chosen at sign-in. Keep one [profile](/cli/#organizations-and-profiles) per org and pick it with `--profile`, as in `aiand --profile work usage`.

## With JWT (browser / console)

JWTs identify the user, not an org. Pass `X-Org-ID` on every request to select the active org:

```bash
curl https://api.aiand.com/api/v1/keys \
  -H "Authorization: Bearer <jwt>" \
  -H "X-Org-ID: <org-id>"
```

Requests without `X-Org-ID` on JWT-authed endpoints return `400`.

## Listing your orgs

```bash
curl https://api.aiand.com/api/v1/me \
  -H "Authorization: Bearer <jwt>"
```

The response includes a `memberships` array with each org's `id`, `name`, and your `role` in it. From a terminal, `aiand orgs` lists the same organizations.

<Aside type="note">
  The role is resolved from the membership table per-request, not from the JWT. If you're demoted in an org, the next request reflects the new role immediately.
</Aside>
