# Switching Orgs

Source: https://staging-docs.aiand.com/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.

## 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.

<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>
