Join a suggested organization

POST /fapi/v1/me/organization-suggestions/{domain_id}:join · called from the environment's sign-in host

Accepts a suggestion from List my organization suggestions: the authenticated user becomes a member of the suggested organization with the environment's default member role. The membership's source is domain_capture and the user is recorded as the actor; an organization_membership.created event is sent. Of two simultaneous joins, only one succeeds. Joining does not require a recently verified session: it grants only the default member role, and only for a domain whose address the user has verified. Requires the authenticated user's __Host-idp_session cookie; if the cookie is missing, expired, or revoked, returns 401 unauthenticated. A first-party app on another origin can instead send its front API access token (Authorization: DPoP <token> with a DPoP proof; see Front API access token).

With @keenauth/js: await keenauth.organizations.joinSuggestion(id).

Request

Headers:

Header Required Description
Idp-Client yes SDK identifier.
Origin yes Must be exactly https://<sign-in host>.

domain_id: the suggestion's id (odm_…).

No body (an empty JSON object is accepted).

Response

200 OK with {"membership_id": "mem_…", "organization_id": "org_…"}.

Errors

Status Code When
401 unauthenticated No valid session cookie or front API access token.
403 origin_not_allowed Origin is missing or wrong.
403 role_not_assignable The default member role cannot be granted by domain capture.
403 user_not_active The user is not active.
404 not_found The domain is not a suggestion for this user (unknown, malformed, not in suggest mode, no verified address in it, or dismissed three times).
409 membership_already_exists The user already has a membership in the organization.
409 organization_disabled The organization is disabled or being deleted.
409 membership_limit_reached The user has reached their membership limit.
409 organization_membership_limit_reached The organization has reached its membership limit.
503 temporarily_unavailable The membership directory did not answer; retry later.

Example

curl -X POST https://example.keenauth.app/fapi/v1/me/organization-suggestions/odm_01j9a5c4000000000000000001:join \
  -H "Idp-Client: my-app/1.0.0 (node/22.0.0)" \
  -H "Origin: https://example.keenauth.app" \
  -b cookies.txt
{
  "membership_id": "mem_01j9yyyyyyyyyyyyyyyyyyyyyy",
  "organization_id": "org_01j9xxxxxxxxxxxxxxxxxxxxxx"
}

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.