Entity Auth

Organizations

Create orgs, add members, and switch context

Organizations

Organizations provide multi‑tenant scoping. The SDKs expose thin wrappers over the API routes.

Org context

Most API calls operate within the active organization (session tid). Ensure the user has switched to the intended org before making org‑scoped calls.

Create

await ea.createOrg({ tenantId: "t1", name: "Acme", slug: "acme", ownerId: userId });
try await EntityAuth.shared.createOrg(tenantId: "t1", name: "Acme", slug: "acme", ownerId: userId)

Add member

await ea.addMember({ orgId, userId, role: "member" });
try await EntityAuth.shared.addMember(orgId: orgId, userId: userId, role: "member")

Switch active org

await ea.switchOrg({ orgId });
try await EntityAuth.shared.switchOrg(orgId: orgId)

These endpoints require an authenticated session; the current org is reflected in the session document (tid).