actor_org_switched
This page is auto-generated from
src/auth/stytch-invite.ts. Do not edit by hand — seedocs/dev/docs-auto-sync.md.
Event string
Section titled “Event string”actor_org_switched
Emitting helpers
Section titled “Emitting helpers”| Function | Source |
|---|---|
encodeActorOrgSwitchedAuditReason | src/auth/stytch-invite.ts:733 |
Context fields
Section titled “Context fields”| Field | Type | Required | Notes |
|---|---|---|---|
from_stytch_org_id | string | yes | — |
to_stytch_org_id | string | yes | — |
by_user_id | string | yes | — |
Documentation
Section titled “Documentation”#574 — In-dashboard org switcher (Stytch Discovery without re-login).
The switch endpoint exchanges the caller’s current Stytch session for one bound to a different org they’re a member of. The audit envelope MUST be forensically linkable both ways: written to the FROM tenant so an audit reviewer sees “user left this org” and to the TO tenant so the joining-org admin sees “this principal arrived via switcher”. Two rows, same event vocabulary, distinct tenant_id columns. The encoder shape is shared.
This envelope is stored in audit_log.decision_reason (varchar(256)) as a JSON object with the shape { event, ...ctx }. The audit_log row carries tenant_id, actor_user_id, and timestamp as columns alongside — those are not duplicated in the envelope.