Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

feat(sdk-ts): typed ComposioLegacyConnectedAccountsEndpointRetiredError

Composioc9f5cb348d12
diff --git a/ts/packages/core/src/errors/ConnectedAccountsErrors.ts b/ts/packages/core/src/errors/ConnectedAccountsErrors.ts
index 2e53a473f..2bdbfac42 100644
--- a/ts/packages/core/src/errors/ConnectedAccountsErrors.ts
+++ b/ts/packages/core/src/errors/ConnectedAccountsErrors.ts
@@ -4,6 +4,7 @@ export const ConnectedAccountErrorCodes = {
CONNECTED_ACCOUNT_NOT_FOUND: 'CONNECTED_ACCOUNT_NOT_FOUND',
MULTIPLE_CONNECTED_ACCOUNTS: 'MULTIPLE_CONNECTED_ACCOUNTS',
FAILED_TO_CREATE_CONNECTED_ACCOUNT_LINK: 'FAILED_TO_CREATE_CONNECTED_ACCOUNT_LINK',
+ LEGACY_CONNECTED_ACCOUNTS_ENDPOINT_RETIRED: 'LEGACY_CONNECTED_ACCOUNTS_ENDPOINT_RETIRED',
} as const;
export class ComposioConnectedAccountNotFoundError extends ComposioError {
@@ -51,3 +52,35 @@ export class ComposioFailedToCreateConnectedAccountLink extends ComposioError {
this.name = 'ComposioFailedToCreateConnectedAccountLink';
}
}
+
+/**
+ * Thrown by `composio.connectedAccounts.initiate()` when the legacy
+ * `POST /api/v3/connected_accounts` endpoint rejects a Composio-managed
+ * OAuth (OAuth1, OAuth2, DCR_OAUTH) auth-config request.
+ *
+ * The retiring path is being phased out — new orgs from 2026-05-08 and
+ * all remaining orgs from 2026-07-03. Migrate the call to
+ * `composio.connectedAccounts.link()`, which works for every redirectable
+ * scheme regardless of whether the auth config is Composio-managed or
+ * custom.
+ *
+ * See: https://docs.composio.dev/docs/changelog/2026/04/24
+ */
+export class ComposioLegacyConnectedAccountsEndpointRetiredError extends ComposioError {
+ constructor(
+ message: string = 'POST /api/v3/connected_accounts is no longer supported for Composio-managed OAuth auth configs. Use composio.connectedAccounts.link() instead.',
+ options: Omit<ComposioErrorOptions, 'code' | 'statusCode'> = {}
+ ) {
+ super(message, {
+ ...options,
+ code: ConnectedAccountErrorCodes.LEGACY_CONNECTED_ACCOUNTS_ENDPOINT_RETIRED,
+ statusCode: 400,
+ possibleFixes: options.possibleFixes || [
+ 'Replace `composio.connectedAccounts.initiate(userId, authConfigId, options)` with `composio.connectedAccounts.link(userId, authConfigId, options)`. The return shape (id, redirectUrl, waitForConnection()) is the same.',
+ 'If you relied on the `allowMultiple` guard in initiate(), pre-check existing active connections with `composio.connectedAccounts.list({ userIds, authConfigIds, statuses: [ConnectedAccountStatuses.ACTIVE] })` before calling link().',
+ 'Migration guide: https://docs.composio.dev/docs/changelog/2026/04/24',
+ ],
+ });
+ this.name = 'ComposioLegacyConnectedAccountsEndpointRetiredError';
+ }
+}