Skip to main content

Organizations Controller

The Organizations Controller provides comprehensive organization management capabilities including creation, member management, role-based access control, and team collaboration features for the VChata platform.

Base Path

Overview

This controller enables multi-tenant organization management with:
  • 🏢 Organization Management - Create, update, and delete organizations
  • 👥 Member Management - Invite, remove, and manage team members
  • 🔐 Role-Based Access - OWNER, ADMIN, MEMBER, and VIEWER roles
  • 📧 Invitation System - Email-based user invitations
  • 🔄 Organization Switching - Multi-organization support for users
  • 🛡️ Permission Control - Granular access control for all operations

Authentication & Authorization

  • 🔐 All endpoints require valid JWT authentication token
  • 👥 Role-based access control (OWNER > ADMIN > MEMBER > VIEWER)
  • 🏢 Organization-scoped operations with membership verification
  • 🛡️ Guards ensure users can only access organizations they belong to

Organization Management

Create Organization

Description: Creates a new organization with the current user as the owner.
object

Get All Organizations

Description: Retrieves all organizations the current user belongs to with their roles.

Get Organization Details

Description: Retrieves detailed information about a specific organization.

Update Organization

Description: Updates organization details. Requires OWNER or ADMIN role.
object

Delete Organization

Description: Permanently deletes an organization. Requires OWNER role only.
Irreversible Action: Deleting an organization will permanently remove all associated data including campaigns, leads, billing information, and member access.

Member Management

Get Organization Members

Description: Retrieves all members of the organization with their roles and activity status.

Invite User to Organization

Description: Sends an invitation email to join the organization. Requires OWNER or ADMIN role.
object

Update Member Role

Description: Updates a member’s role in the organization. Requires OWNER or ADMIN role.
object

Remove Member

Description: Removes a member from the organization. Requires OWNER or ADMIN role.

Leave Organization

Description: Allows the current user to leave the organization (self-removal).

Role Hierarchy

The VChata platform uses a hierarchical role system:
1

OWNER

Full control over organization including deletion and billing
2

ADMIN

Can manage members, update organization settings, access billing
3

MEMBER

Can create and manage campaigns, leads, and content
4

VIEWER

Read-only access to organization data

Permission Matrix

Error Responses

Common Errors

Organization Switching

Users can belong to multiple organizations and switch between them:
  1. Multi-Organization Support - Users can be members of multiple organizations
  2. Context Switching - Frontend can switch organization context
  3. Scoped Operations - All operations are scoped to the current organization
  4. Role Preservation - User roles are maintained per organization

Security Features

  • 🔐 JWT Authentication - All endpoints require valid authentication
  • 🛡️ Organization Guards - Ensures users can only access their organizations
  • 👥 Role-Based Access - Granular permissions based on user roles
  • 📧 Secure Invitations - Email-based invitations with expiration
  • 🔄 Audit Trail - All member actions are logged
  • 🚫 Self-Protection - Owners cannot remove themselves without transferring ownership