ConnectedAccounts class provides methods to create, manage, and maintain these connections.
Accessing Connected Accounts
Methods
initiate
Create a new connected account and return a connection request.str
required
The user ID to create the connected account for.
str
required
The auth config ID to use for authentication.
str
Callback URL for OAuth redirects.
bool
default:"False"
Allow multiple connected accounts for the same user and auth config.
ConnectionState
Connection configuration (for API key, basic auth, etc.).
link
Create a Composio Connect Link for user authentication.get
Retrieve a specific connected account.list
List connected accounts with filtering.enable
Enable a connected account.disable
Disable a connected account.refresh
Refresh account credentials.delete
Delete a connected account.wait_for_connection
Wait for a connection to become active.Connection Request
TheConnectionRequest object is returned by initiate() and link().
Properties
str
The connected account ID.
str
Connection status (e.g., “INITIATED”, “ACTIVE”).
str | None
OAuth redirect URL for user authorization.
Methods
(timeout: float) -> ConnectedAccount
Wait for the connection to become active.
Auth Schemes
Use theauth_scheme helper to create connections with different authentication methods.
Connection Statuses
ACTIVE: Connection is established and workingINACTIVE: Connection is temporarily disabledPENDING: Connection is being processedINITIATED: Connection request has startedEXPIRED: Connection credentials have expiredFAILED: Connection attempt failed
Examples
OAuth Flow
API Key Authentication
List User Connections
Refresh Expired Connection
Next Steps
Auth Configs
Configure authentication
Tools
Execute tools with connections
Toolkits
Authorize toolkits