ConnectedAccounts
Methods
update()
Update a connected account's alias and/or credentials.
def update(nanoid: str, alias: str | None = ..., connection: connected_account_patch_params.Connection | None = ...) -> connected_account_patch_response.ConnectedAccountPatchRes...Parameters
| Name | Type |
|---|---|
nanoid | str |
alias? | str | None |
connection? | connected_account_patch_params.Connection | None |
Returns
connected_account_patch_response.ConnectedAccountPatchRes... — Response with id, status, and success.
Example
# Set an alias
composio.connected_accounts.update('ca_abc123', alias='work-gmail')
# Clear an alias
composio.connected_accounts.update('ca_abc123', alias='')initiate()
Compound function to create a new connected account. This function creates a new connected account and returns a connection request. Users can then wait for the connection to be established using the wait_for_connection method. .. deprecated:: For Composio-managed (default) auth configs on redirectable OAuth schemes (OAuth1, OAuth2, DCR_OAUTH), the legacy endpoint this method wraps is being retired: 2026-05-08 for new organizations and 2026-07-03 for all remaining organizations. After your org's cutover, this method will raise :class:composio.exceptions.ComposioLegacyConnectedAccountsEndpointRetiredError for that specific combination. Use :meth:ConnectedAccounts.link for Composio-managed OAuth — it works for every redirectable scheme regardless of whether the auth config is Composio-managed or custom, and the return shape is the same. Custom auth configs (your own OAuth app) and non-OAuth schemes (API key, bearer token, basic auth) are unaffected and continue to work on initiate(). See https://docs.composio.dev/docs/changelog/2026/04/24
def initiate(user_id: str, auth_config_id: str, callback_url: str | None = ..., allow_multiple: bool = ..., config: connected_account_create_params.ConnectionState | None = ..., alias: str | None = ...) -> ConnectionRequestParameters
| Name | Type |
|---|---|
user_id | str |
auth_config_id | str |
callback_url? | str | None |
allow_multiple? | bool |
config? | connected_account_create_params.ConnectionState | None |
alias? | str | None |
Returns
ConnectionRequest — The connection request.
link()
Create a Composio Connect Link for a user to connect their account to a given auth config. This method will return an external link which you can use for the user to connect their account.
def link(user_id: str, auth_config_id: str, callback_url: str | None = ..., alias: str | None = ..., allow_multiple: bool = ..., experimental: link_create_params.Experimental | None = ...) -> ConnectionRequestParameters
| Name | Type |
|---|---|
user_id | str |
auth_config_id | str |
callback_url? | str | None |
alias? | str | None |
allow_multiple? | bool |
experimental? | link_create_params.Experimental | None |
Returns
ConnectionRequest — Connection request object.
Example
# Create a connection request and redirect the user to the redirect url
connection_request = composio.connected_accounts.link('user_123', 'auth_config_123')
redirect_url = connection_request.redirect_url
print(f"Visit: {redirect_url} to authenticate your account")
# Wait for the connection to be established
connected_account = connection_request.wait_for_connection()
# Create a connection request with callback URL
connection_request = composio.connected_accounts.link(
'user_123',
'auth_config_123',
callback_url='https://your-app.com/callback'
)
redirect_url = connection_request.redirect_url
print(f"Visit: {redirect_url} to authenticate your account")
# Wait for the connection to be established
connected_account = composio.connected_accounts.wait_for_connection(connection_request.id)
connection_request = composio.connected_accounts.link(
'user_creator',
'auth_config_123',
experimental={
'account_type': 'SHARED',
'acl_config_for_shared': {
'allow_all_users': True,
'not_allowed_user_ids': ['user_bob'],
},
},
)wait_for_connection()
Wait for connected account with given ID to be active
def wait_for_connection(id: str, timeout: float | None = ...) -> connected_account_retrieve_response.ConnectedAccountRetri...Parameters
| Name | Type |
|---|---|
id | str |
timeout? | float | None |
Returns
connected_account_retrieve_response.ConnectedAccountRetri...