Kommander.ai combines account authentication, organization membership, organization permissions, owner checks, widget identity verification, and internal admin flags. API routes should fail closed with 401 when there is no session and 403 when the session is authenticated but not allowed.

RBAC Flow

Organization Roles

RoleDefault permissions
adminRead and manage organization, members, invitations, billing, integrations, analytics, conversations, and knowledge base. Includes admin_access.
managerManage members, invitations, integrations, analytics, conversations, and read knowledge base.
userRead organization, read/write conversations, and read knowledge base.
viewerRead organization, conversations, and knowledge base.
guestRead organization only.
operatorRead organization, access analytics, read/write conversations, and read knowledge base.

Custom member permission arrays may narrow or expand a member’s effective access. Endpoint checks should use the permission string, owner rule, or admin flag documented below instead of role names when the code supports granular permissions.

Endpoint Matrix

Endpoint familyMethodsRequired accessNotes
/api/admin/*AllPlatform admin session with isAdmin: trueInternal admin surface. Organization roles do not grant access.
/api/admin/authPOSTValid admin credentials and isAdmin: true user recordIssues admin session material for the admin console.
/api/admin/client-assistants, /api/admin/client-assistants/[id], /api/admin/client-assistants/[id]/claim-linkGET, POST, PATCH, DELETEPlatform admin bearer token with isAdmin: trueCreates assistants for clients, sets their prices and trial, and makes or revokes claim links. Every write is audited.
/api/organizationsGETAuthenticated userLists organizations visible to the signed-in user.
/api/organizationsPOSTAuthenticated userCreates an organization owned by the signed-in user.
/api/organizations/[id]PATCHmanage_organization or owner-equivalent service checkUpdates organization metadata.
/api/organizations/[id]DELETEOwner or service-approved organization managerSoft-deletes the organization and reconciles billing links.
/api/organizations/[id]/membersGET, POST, PATCHmanage_membersReads, adds, or updates organization members.
/api/organizations/[id]/membersDELETEremove_usersRemoves a member from the organization.
/api/organizations/[id]/invitationsPOSTinvite_usersCreates organization invitations.
/api/invitations/*GET, POSTValid invitation token or authenticated inviter, depending on routeToken routes validate invitation status and expiry.
/api/organizations/[id]/integrations/engammo/*Allmanage_integrationsIncludes configuration, FAQ sync, events, and secret rotation.
/api/integrations/customer-dataGETAuthenticated user; organization member or owner when organizationId is suppliedWithout organizationId, returns connections created by the user.
/api/integrations/customer-dataPOSTAuthenticated user with organization member or owner accessCreates a customer data connector.
/api/integrations/customer-data/[id]GET, PATCH, DELETEAuthenticated user with access to the connector’s organizationConnector credentials are never returned in plaintext.
/api/integrations/customer-data/[id]/openapiPOSTAuthenticated user with access to the connector’s organizationUploads and validates OpenAPI specs for OpenAPI customer data connectors.
/api/integrations/customer-data/[id]/testPOSTAuthenticated user with access to the connector’s organizationRuns bounded connector test calls.
/api/settings/identity-verificationGET, POSTOrganization owner or active organization memberReads or creates widget identity verification settings for the target owner.
/api/widget-clients/[id]/rotate-identity-secretPOSTOrganization owner or active organization memberRotates identity verification secrets for the target widget client.
/api/organizations/[id]/subscribePOST, PUTOrganization owner onlyCreates or updates paid channel subscriptions. Refused (409) for client assistants, which are billed through their claim link.
/api/organizations/[id]/subscribe/previewGETOrganization owner onlyPreviews billing changes.
/api/claim/[token]POSTAuthenticated user holding a live claim token; never the admin who prepared the assistantSubscribes the user at the token’s terms and makes them owner. Token stored hashed, single use, 30 days; rate limited per user.
/api/stripe/*POSTStripe webhook signature, checkout session, or authenticated billing context depending on routeWebhooks rely on provider signature verification, not user session.
/api/subscription, /api/payment-methods, /api/billing-profile/*GET, POSTAuthenticated account ownerUser-level billing views and payment-method management.
/api/conversations/*GET, POST, PATCHAuthenticated user scoped to accessible conversationsOrganization-scoped reads must preserve conversation ownership and organization filters.
/api/conversations/[id]/agent-messagePATCHwrite_conversations on the conversation owner, and the caller is the message author (sentBy.userId)Edits the text of an operator message already sent. Messages without a recorded author cannot be edited; internal-secret calls are refused.
/api/widget-conversations/*GET, POSTWidget client plus conversation identifierPublic widget traffic must remain scoped to the widget client and conversation.
/api/kommander-rag-query, /api/kommander-rag-stream, /api/kommander-rag-callbackPOSTWidget/API request context; customer data tools require verified identityPublic chat can run without identity; customer-specific tools cannot.
/api/kommander-rag-trigger-whatsapp, /api/meta/[userId], /api/twilio/[userId]POSTChannel-specific webhook verification and user or organization lookupWebhook payloads must be scoped to the configured channel owner.
/api/analytics/*, /api/dashboard/*, /api/operator/*GET, POSTAuthenticated user with analytics, dashboard, or operator access as implemented by the routeUse organization scope when a route accepts organizationId.
/api/process-file, /api/mark-faq-editedPOSTAuthenticated user scoped to the target assistant or organizationUploaded training data should remain organization-scoped.

Review Rules

  • Prefer permission checks such as manage_integrations and manage_members over ad hoc role-name checks.
  • Keep platform admin access separate from organization admin.
  • Billing subscription changes require the organization owner unless a route is explicitly an internal admin route.
  • Public widget and webhook routes must authenticate the widget client or provider signature before trusting identifiers in the payload.
  • Customer data tools require verified end-user identity with a non-empty userHash.
  • Seat changes must update organization membership, role, status, and permission data; they should not be treated as billing entitlement changes unless an enterprise contract says otherwise.

Known Authorization Gaps To Review

Some routes use organization membership or owner checks where a stricter permission may be more appropriate. When modifying an endpoint, compare it against this matrix and tighten broad membership checks if the route changes sensitive configuration, credentials, billing, or customer data access.