Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
docs: remove multitenancy/organization content
Sushmithamallesh5c1d35f3661a
diff --git a/docs/content/docs/user-management.mdx b/docs/content/docs/user-management.mdxindex 6b9f9dcc3..3dde2c249 100644--- a/docs/content/docs/user-management.mdx+++ b/docs/content/docs/user-management.mdx@@ -8,33 +8,15 @@ keywords: [user id, multi-user]User IDs determine whose connected accounts and data you're accessing in Composio. Every tool execution, connection authorization, and account operation requires a `userId` parameter that identifies which context to use.-User IDs act as containers that group connected accounts together across toolkits. Depending on your application, you can use User IDs to represent an individual user, a team, or an entire organization.+User IDs act as containers that group connected accounts together across toolkits. Each user connects and manages their own accounts.-## Quick Decision Guide+## Choosing User IDs-**How do users access connected accounts in your app?**+**Recommended:** Database UUID or primary key (`user.id`)-- **Each user connects their own personal accounts?**- Use User IDs- *Use your database UUID or primary key (e.g., `user.id`)*- *Example: Users connect their personal Gmail, GitHub*+**Acceptable:** Unique username (`user.username`)-- **Teams share the same connected accounts?**- Use Organization IDs- *Use your organization UUID or primary key (e.g., `organization.id`)*- *Example: Company Slack workspace*--## Patterns--### User IDs (Individual Accounts)--In production applications with multiple users, where each user connects and manages their own accounts.--**Choosing User IDs:**--- Recommended: Database UUID or primary key (`user.id`)-- Acceptable: Unique username (`user.username`)-- Avoid: Email addresses (emails can change)+**Avoid:** Email addresses (emails can change)<Tabs groupId="language" items={['Python', 'TypeScript']} persist><Tab value="Python">@@ -82,64 +64,6 @@ const result = await composio.tools.execute('GITHUB_GET_REPO', {Never use 'default' as a User ID in production with users. This could expose other users' data.</Callout>-### Organization IDs (Team Accounts)--For applications where teams share connections - one admin connects accounts, all team members use them.--**When to use:**-- Team tools: Slack, Microsoft Teams, Jira-- Shared accounts: [email protected], company GitHub org-- Enterprise apps: IT manages connections for all employees--<Tabs groupId="language" items={['Python', 'TypeScript']} persist>- <Tab value="Python">-```python-# Use the organization ID as userId-user_id = organization.id # e.g., "org_550e8400"--# All users in the organization share the same connected accounts-tools = composio.tools.get(- user_id=user_id,- toolkits=["SLACK"],-)--# Execute tools in the organization context-result = composio.tools.execute(- "SLACK_SEND_MESSAGE",- user_id=user_id,- arguments={- "channel": '#general',- "text": 'Hello from the team!'- }-)-```- </Tab>- <Tab value="TypeScript">-```typescript-import { Composio } from '@composio/core';-const composio = new Composio({ apiKey: 'your_api_key' });-declare const organization: { id: string };-// ---cut----// Use the organization ID as userId-const userId = organization.id; // e.g., "org_550e8400"--// All users in the organization share the same connected accounts-const tools = await composio.tools.get(userId, {- toolkits: ['slack'],-});--// Execute tools in the organization context-const result = await composio.tools.execute('SLACK_SEND_MESSAGE', {- userId: userId,- arguments: {- channel: '#general',- text: 'Hello from the team!',- },-});-```- </Tab>-</Tabs>-## Multiple Connected AccountsA single User ID can have multiple connected accounts for the same toolkit. For example, a user might connect both their personal and work Gmail accounts.@@ -153,79 +77,9 @@ A single User ID can have multiple connected accounts for the same toolkit. For- **Explicit:** Specify the Connected Account ID to target a specific account- **Default:** If no Connected Account ID is provided, the most recently connected account is used-## Examples--### Organization-Based Application+## Example: Multi-User Application-In B2B applications, typically an admin connects accounts once and all team members share access. Here's a complete implementation:--**Key concepts:**-- Admin performs the OAuth connection using organization ID-- All team members execute tools using the same organization ID-- Permission checks ensure users can only access their organization's connections--```typescript-import { ConnectionRequest } from '@composio/core';-declare function storeConnectionRequest(orgId: string, adminId: string, req: ConnectionRequest): Promise<void>;-declare function userCanSendMessages(userId: string, orgId: string): Promise<boolean>;-declare const app: { post: (path: string, handler: (req: any, res: any) => Promise<any>) => void };-// ---cut----import { Composio } from '@composio/core';-const composio = new Composio({- apiKey: process.env.COMPOSIO_API_KEY,-});--// 1. Admin connects Slack for the entire organization-async function connectOrganizationToSlack(organizationId: string, adminUserId: string) {- // Use organization ID as userId in Composio- const connectionRequest = await composio.toolkits.authorize(organizationId, 'slack');-- // Store the connection request for the admin to complete- await storeConnectionRequest(organizationId, adminUserId, connectionRequest);-- return connectionRequest.redirectUrl;-}--// 2. Any user in the organization can use the connected tools-async function sendSlackMessage(organizationId: string, channel: string, message: string) {- return await composio.tools.execute('SLACK_SEND_MESSAGE', {- userId: organizationId, // organization ID, not individual user ID- arguments: {- channel: channel,- text: message,- },- });-}--// 3. Check if organization has required connections-async function getOrganizationTools(organizationId: string) {- return await composio.tools.get(organizationId, {- toolkits: ['slack', 'github', 'jira'],- });-}--// Usage in your API endpoint-app.post('/api/slack/message', async (req, res) => {- const { channel, message } = req.body;- const organizationId = req.user.organizationId; // Get from your auth system-- // Verify user has permission to send messages for this organization- if (!(await userCanSendMessages(req.user.id, organizationId))) {- return res.status(403).json({ error: 'Insufficient permissions' });- }-- try {- const result = await sendSlackMessage(organizationId, channel, message);- res.json(result.data);- } catch (error) {- res.status(500).json({ error: 'Failed to send message' });- }-});-```--### Multi-User Application--In B2C applications, each user connects and manages their own accounts. Every user goes through their own OAuth flow and their data remains completely isolated.+In applications with multiple users, each user connects and manages their own accounts. Every user goes through their own OAuth flow and their data remains completely isolated.**Key concepts:**- Each user authorizes their own accounts using their unique user ID@@ -278,65 +132,9 @@ app.get('/api/github/repos', async (req, res) => {**Data isolation**: Composio ensures each userId's connections and data are completely separate. User A can never access User B's repositories.-### Hybrid Pattern--Many applications need both personal and team resources. Users might connect their personal Gmail while sharing the company Slack workspace.--**Common scenarios:**-- Personal calendars + shared project management-- Individual GitHub accounts + organization repositories--<Tabs groupId="language" items={['Python', 'TypeScript']} persist>- <Tab value="Python">-```python-# Wrong: Using individual user ID for org-connected tool-user_tools = composio.tools.get(- user_id="user_123", # Individual user ID- toolkits=["slack"] # Fails - Slack is connected at org level-)--# Correct: Match the ID type to how the tool was connected-user_personal_tools = composio.tools.get(- user_id="user_123", # Individual user ID- toolkits=["gmail"] # User's personal Gmail-)--org_shared_tools = composio.tools.get(- user_id="org_123", # Organization ID- toolkits=["slack", "jira"] # Organization's shared tools-)-```- </Tab>- <Tab value="TypeScript">-```typescript-import { Composio } from '@composio/core';-const composio = new Composio({ apiKey: 'your_api_key' });-declare const req: { user: { id: string; organizationId: string } };-// ---cut----// Wrong: Using individual user ID for org-connected tool-const userTools = await composio.tools.get(req.user.id, {- toolkits: ['slack'], // Fails - Slack is connected at org level-});--// Correct: Match the ID type to how the tool was connected-const userPersonalTools = await composio.tools.get(req.user.id, {- toolkits: ['gmail'], // User's personal Gmail-});--const orgSharedTools = await composio.tools.get(req.user.organizationId, {- toolkits: ['slack', 'jira'], // Organization's shared tools-});-```- </Tab>-</Tabs>--Remember: The userId must match how the account was connected. If admin connected Slack with org ID, all members must use org ID to access it.-## Best Practices-**Your responsibilities:**- Pass the correct User ID for each user-- Verify user permissions before executing organization tools- Never use 'default' in production with multiple users- Keep User IDs consistent across your application and Composio- Use stable identifiers that won't change over timediff --git a/docs/content/docs/users-and-sessions.mdx b/docs/content/docs/users-and-sessions.mdxindex 23699e6ed..3851d001f 100644--- a/docs/content/docs/users-and-sessions.mdx+++ b/docs/content/docs/users-and-sessions.mdx@@ -4,7 +4,7 @@ description: Understand how Tool Router scopes tools and connections per userkeywords: [session, user id, enable toolkits, disable toolkits]----A **user ID** is an identifier from your system (database ID, UUID, or any unique string) that scopes connected accounts and tool access to a specific user. User IDs can represent individuals, teams, or organizations. See [User Management](/docs/user-management) for patterns.+A **user ID** is an identifier from your system (database ID, UUID, or any unique string) that scopes connected accounts and tool access to a specific user. See [User Management](/docs/user-management) for best practices.A **session** is an ephemeral configuration that combines:- Which user's connected accounts to use