Skip to content

Switching Orgs

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.

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

Terminal window
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.

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

Terminal window
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.

Terminal window
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.