List my organizations

GET /fapi/v1/me/organizations · called from the environment's sign-in host

Lists the organizations the authenticated user can switch to in one application: organizations where the user has an active membership, that are active, and that the application is enabled for, in slug order, at most 100. This is the list an organization switcher shows, and the same list the hosted organization picker offers at sign-in, so it never shows an organization the application cannot use. No item is marked as current: the organization your application's token is bound to is the token's org_id claim. Reading changes nothing and does not require a recently verified session. Requires the authenticated user's __Host-idp_session cookie; if the cookie is missing, expired, or revoked, returns 401 unauthenticated.

With @keenauth/js: await keenauth.organizations.listMine().

Request

Headers:

Header Required Description
Idp-Client yes SDK identifier.

Query parameters:

Parameter Required Description
client_id yes The client_id of the first-party application the switcher runs in.

No body.

Response

200 OK with {"data": [...], "truncated": false}.

Each item: id (org_…, the same form as the token's org_id claim and the organization parameter), slug, name (display name with control and bidirectional characters removed; the slug when the organization has no name; render it as plain text). truncated is true when the user has more such organizations than are listed.

Errors

Status Code When
401 unauthenticated No valid session cookie.
403 headless_not_allowed The application is a third-party application.
422 validation_failed client_id is missing, empty, longer than 255 characters, given more than once, or unknown (/client_id).
503 temporarily_unavailable The membership directory did not answer; retry later.

Example

curl "https://example.keenauth.app/fapi/v1/me/organizations?client_id=app_01j9zzzzzzzzzzzzzzzzzzzz" \
  -H "Idp-Client: my-app/1.0.0 (node/22.0.0)" \
  -b cookies.txt
{
  "data": [
    {
      "id": "org_01j9xxxxxxxxxxxxxxxxxxxxxx",
      "slug": "acme",
      "name": "Acme"
    }
  ],
  "truncated": false
}

Personal data

This endpoint carries personal data: organization memberships and invitations. Personal data in the KeenAuth APIs describes what is stored, how long it is kept and how it is deleted. Do not send special categories of personal data (health, biometric data, religion, political opinions, sexual orientation) in any field.