@composio/core 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CustomTool-9Vlb4XaS.mjs → CustomTool-B4dQn2M5.mjs} +1 -1
- package/dist/{CustomTool-Ds5aLDth.d.mts → CustomTool-CBx9kzea.d.mts} +1 -1
- package/dist/{FileModifierErrors-WrqokuIF.mjs → FileModifierErrors-D-AKc3ds.mjs} +1 -1
- package/dist/{SsrfErrors-BSVMW915.mjs → SsrfErrors-BekZPeWY.mjs} +59 -12
- package/dist/{Telemetry-a7SOQXcg.mjs → Telemetry-BWKZmDxM.mjs} +2 -2
- package/dist/composio-CPf6NHnB.d.mts +20334 -0
- package/dist/{customTool.types-DHxXBU6E.d.mts → customTool.types-BSbIG1OG.d.mts} +291 -68
- package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +20 -12
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +28 -10
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +44 -32
- package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +8 -6
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +4 -3
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +4 -2
- package/dist/docs/reference/sdk-reference/typescript/keyring.mdx +6 -3
- package/dist/docs/reference/sdk-reference/typescript/logs.mdx +5 -3
- package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +53 -42
- package/dist/docs/reference/sdk-reference/typescript/meta.json +1 -0
- package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +5 -14
- package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +5 -3
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +7 -5
- package/dist/docs/reference/sdk-reference/typescript/session-webhooks.mdx +64 -0
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +16 -16
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +36 -8
- package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +14 -11
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +16 -18
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +42 -30
- package/dist/docs/reference/sdk-reference/typescript/usage.mdx +6 -4
- package/dist/docs/reference/sdk-reference/typescript/webhook-endpoints.mdx +9 -7
- package/dist/docs/reference/sdk-reference/typescript/webhook-subscriptions.mdx +13 -9
- package/dist/docs/reference/sdk-reference/typescript/webhooks.mdx +3 -1
- package/dist/{errors-xC13uvaA.mjs → errors-CtIKA9BH.mjs} +2 -2
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-CAwIbWYH.mjs → fileUtils.node-BJUYMEph.mjs} +7 -7
- package/dist/index.d.mts +6 -11
- package/dist/index.mjs +526 -233
- package/dist/{jsonSchema-Cc4EtHRw.mjs → jsonSchema-BZoXGUCr.mjs} +2 -2
- package/dist/models/Files.node.mjs +3 -3
- package/dist/{sensitiveFileUploadPaths-CSyJ3Ku8.mjs → sensitiveFileUploadPaths-CcbMAYCC.mjs} +21 -15
- package/dist/{ssrfGuard.node-CdIkwqVu.mjs → ssrfGuard.node-B749ae5Q.mjs} +1 -1
- package/dist/{types-DcdZy5Nc.d.mts → types-ns3Q_WrP.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +5 -5
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/dist/utils/ssrfGuard.node.mjs +1 -1
- package/dist/utils/ssrfGuard.workerd.mjs +1 -1
- package/package.json +2 -2
- package/src/composio.ts +26 -7
- package/src/errors/ComposioError.ts +3 -2
- package/src/index.ts +19 -0
- package/src/lib/toolRouterParams.ts +38 -14
- package/src/models/AuthConfigs.ts +10 -3
- package/src/models/ConnectedAccounts.ts +30 -17
- package/src/models/CustomTool.ts +0 -10
- package/src/models/Keyring.ts +2 -1
- package/src/models/MCP.ts +43 -35
- package/src/models/SessionWebhooks.ts +136 -0
- package/src/models/ToolRouter.ts +39 -4
- package/src/models/ToolRouterSession.ts +2 -2
- package/src/models/ToolRouterSessionFileMount.ts +3 -1
- package/src/models/Toolkits.ts +1 -0
- package/src/models/Tools.ts +4 -8
- package/src/models/Triggers.ts +48 -213
- package/src/models/Webhooks.ts +2 -0
- package/src/provider/ComposioProvider.ts +0 -1
- package/src/telemetry/BatchProcessor.ts +1 -1
- package/src/telemetry/Telemetry.ts +1 -1
- package/src/types/connectedAccountAuthStates.types.ts +0 -1
- package/src/types/provider.types.ts +0 -1
- package/src/types/sessionWebhooks.types.ts +292 -0
- package/src/types/toolRouter.types.ts +33 -4
- package/src/types/triggers.types.ts +4 -0
- package/src/utils/crypto.ts +6 -5
- package/src/utils/env.ts +2 -5
- package/src/utils/fileUtils.node.ts +4 -3
- package/src/utils/logger.ts +19 -9
- package/src/utils/pusher.ts +5 -2
- package/src/utils/readResponseBody.ts +30 -17
- package/src/utils/transformers/authConfigs.ts +0 -1
- package/src/utils/userCallback.ts +3 -1
- package/src/utils/webhookVerification.ts +211 -0
- package/dist/composio-Ba89XGHL.d.mts +0 -9736
|
@@ -8,8 +8,10 @@ description: "AuthConfigs class This class is used to manage authentication con
|
|
|
8
8
|
Access this class through the `composio.authConfigs` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const authConfigs = composio.authConfigs;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Methods
|
|
@@ -18,7 +20,7 @@ const result = await composio.authConfigs.list();
|
|
|
18
20
|
|
|
19
21
|
Create a new auth config
|
|
20
22
|
|
|
21
|
-
```typescript
|
|
23
|
+
```typescript signature
|
|
22
24
|
async create(toolkit: string, options?: CreateAuthConfigParams, requestOptions?: ComposioRequestOptions): Promise<CreateAuthConfigResponse>
|
|
23
25
|
```
|
|
24
26
|
|
|
@@ -37,16 +39,20 @@ async create(toolkit: string, options?: CreateAuthConfigParams, requestOptions?:
|
|
|
37
39
|
**Example**
|
|
38
40
|
|
|
39
41
|
```typescript
|
|
42
|
+
import { AuthConfigTypes } from '@composio/core';
|
|
43
|
+
|
|
40
44
|
// Use a specific Composio-managed app; omit managedAppId for the toolkit's default
|
|
41
45
|
const { composioManagedAuth } = await composio.toolkits.get('slack');
|
|
42
|
-
const slackAuthConfig = await authConfigs.create('slack', {
|
|
46
|
+
const slackAuthConfig = await composio.authConfigs.create('slack', {
|
|
43
47
|
type: AuthConfigTypes.COMPOSIO_MANAGED,
|
|
44
48
|
managedAppId: composioManagedAuth?.find(app => !app.isDefault)?.managedAppId,
|
|
45
49
|
});
|
|
46
50
|
```
|
|
47
51
|
|
|
48
52
|
```typescript
|
|
49
|
-
|
|
53
|
+
import { AuthConfigTypes, AuthSchemeTypes } from '@composio/core';
|
|
54
|
+
|
|
55
|
+
const authConfig = await composio.authConfigs.create('my-toolkit', {
|
|
50
56
|
type: AuthConfigTypes.CUSTOM,
|
|
51
57
|
name: 'My Custom Auth Config',
|
|
52
58
|
authScheme: AuthSchemeTypes.API_KEY,
|
|
@@ -66,7 +72,7 @@ This method permanently removes an auth config from the Composio platform.
|
|
|
66
72
|
This action cannot be undone and will prevent any connected accounts that use
|
|
67
73
|
this auth config from functioning.
|
|
68
74
|
|
|
69
|
-
```typescript
|
|
75
|
+
```typescript signature
|
|
70
76
|
async delete(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<AuthConfigDeleteResponse>
|
|
71
77
|
```
|
|
72
78
|
|
|
@@ -98,7 +104,7 @@ This is a convenience method that calls updateStatus with 'DISABLED'.
|
|
|
98
104
|
When disabled, the auth config cannot be used to create new connected accounts
|
|
99
105
|
or authenticate with third-party services, but existing connections may continue to work.
|
|
100
106
|
|
|
101
|
-
```typescript
|
|
107
|
+
```typescript signature
|
|
102
108
|
async disable(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<AuthConfigUpdateStatusResponse>
|
|
103
109
|
```
|
|
104
110
|
|
|
@@ -130,7 +136,7 @@ This is a convenience method that calls updateStatus with 'ENABLED'.
|
|
|
130
136
|
When enabled, the auth config can be used to create new connected accounts
|
|
131
137
|
and authenticate with third-party services.
|
|
132
138
|
|
|
133
|
-
```typescript
|
|
139
|
+
```typescript signature
|
|
134
140
|
async enable(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<AuthConfigUpdateStatusResponse>
|
|
135
141
|
```
|
|
136
142
|
|
|
@@ -161,7 +167,7 @@ Retrieves a specific authentication configuration by its ID.
|
|
|
161
167
|
This method fetches detailed information about a single auth config
|
|
162
168
|
and transforms the response to the SDK's standardized format.
|
|
163
169
|
|
|
164
|
-
```typescript
|
|
170
|
+
```typescript signature
|
|
165
171
|
async get(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<AuthConfigRetrieveResponse>
|
|
166
172
|
```
|
|
167
173
|
|
|
@@ -194,7 +200,7 @@ Lists authentication configurations based on provided filter criteria.
|
|
|
194
200
|
This method retrieves auth configs from the Composio API, transforms them to the SDK format,
|
|
195
201
|
and supports filtering by various parameters.
|
|
196
202
|
|
|
197
|
-
```typescript
|
|
203
|
+
```typescript signature
|
|
198
204
|
async list(query?: AuthConfigListParams, requestOptions?: ComposioRequestOptions): Promise<AuthConfigListResponse>
|
|
199
205
|
```
|
|
200
206
|
|
|
@@ -242,7 +248,7 @@ This method allows you to modify properties of an auth config such as credential
|
|
|
242
248
|
scopes, or tool restrictions. The update type (custom or default) determines which
|
|
243
249
|
fields can be updated.
|
|
244
250
|
|
|
245
|
-
```typescript
|
|
251
|
+
```typescript signature
|
|
246
252
|
async update(nanoid: string, data: AuthConfigUpdateParams, requestOptions?: ComposioRequestOptions): Promise<AuthConfigUpdateResponse>
|
|
247
253
|
```
|
|
248
254
|
|
|
@@ -268,11 +274,13 @@ const updatedConfig = await composio.authConfigs.update('auth_abc123', {
|
|
|
268
274
|
apiKey: 'new-api-key-value'
|
|
269
275
|
}
|
|
270
276
|
});
|
|
277
|
+
```
|
|
271
278
|
|
|
279
|
+
```typescript
|
|
272
280
|
// Update a default auth config with new scopes
|
|
273
281
|
const updatedConfig = await composio.authConfigs.update('auth_abc123', {
|
|
274
282
|
type: 'default',
|
|
275
|
-
scopes:
|
|
283
|
+
scopes: 'read:user,repo'
|
|
276
284
|
});
|
|
277
285
|
```
|
|
278
286
|
|
|
@@ -286,7 +294,7 @@ This method allows you to enable or disable an auth config. When disabled,
|
|
|
286
294
|
the auth config cannot be used to create new connected accounts or authenticate
|
|
287
295
|
with third-party services.
|
|
288
296
|
|
|
289
|
-
```typescript
|
|
297
|
+
```typescript signature
|
|
290
298
|
async updateStatus(status: 'ENABLED' | 'DISABLED', nanoid: string, requestOptions?: ComposioRequestOptions): Promise<AuthConfigUpdateStatusResponse>
|
|
291
299
|
```
|
|
292
300
|
|
|
@@ -12,7 +12,7 @@ Creates a new instance of the Composio SDK.
|
|
|
12
12
|
The constructor initializes the SDK with the provided configuration options,
|
|
13
13
|
sets up the API client, and initializes all core models (tools, toolkits, etc.).
|
|
14
14
|
|
|
15
|
-
```typescript
|
|
15
|
+
```typescript signature
|
|
16
16
|
constructor(config?: ComposioConfig): Composio
|
|
17
17
|
```
|
|
18
18
|
|
|
@@ -29,19 +29,29 @@ constructor(config?: ComposioConfig): Composio
|
|
|
29
29
|
**Example**
|
|
30
30
|
|
|
31
31
|
```typescript
|
|
32
|
+
import { Composio } from '@composio/core';
|
|
33
|
+
|
|
32
34
|
// Initialize with default configuration
|
|
33
35
|
const composio = new Composio();
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { Composio } from '@composio/core';
|
|
34
40
|
|
|
35
41
|
// Initialize with custom API key and base URL
|
|
36
42
|
const composio = new Composio({
|
|
37
43
|
apiKey: 'your-api-key',
|
|
38
44
|
baseURL: 'https://api.composio.dev'
|
|
39
45
|
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { Composio, OpenAIProvider } from '@composio/core';
|
|
40
50
|
|
|
41
|
-
// Initialize with
|
|
51
|
+
// Initialize with an explicit provider
|
|
42
52
|
const composio = new Composio({
|
|
43
53
|
apiKey: 'your-api-key',
|
|
44
|
-
provider: new
|
|
54
|
+
provider: new OpenAIProvider()
|
|
45
55
|
});
|
|
46
56
|
```
|
|
47
57
|
|
|
@@ -89,7 +99,7 @@ This method is particularly useful when you need to:
|
|
|
89
99
|
The new instance inherits all configuration from the parent instance (apiKey, baseURL, provider, etc.)
|
|
90
100
|
but allows you to specify custom request options that will be used for all API calls made through this session.
|
|
91
101
|
|
|
92
|
-
```typescript
|
|
102
|
+
```typescript signature
|
|
93
103
|
createSession(options?: { headers?: ComposioRequestHeaders }): Composio
|
|
94
104
|
```
|
|
95
105
|
|
|
@@ -106,6 +116,8 @@ createSession(options?: { headers?: ComposioRequestHeaders }): Composio
|
|
|
106
116
|
**Example**
|
|
107
117
|
|
|
108
118
|
```typescript
|
|
119
|
+
import { Composio } from '@composio/core';
|
|
120
|
+
|
|
109
121
|
// Create a base Composio instance
|
|
110
122
|
const composio = new Composio({
|
|
111
123
|
apiKey: 'your-api-key'
|
|
@@ -121,7 +133,7 @@ const composioWithCustomHeaders = composio.createSession({
|
|
|
121
133
|
});
|
|
122
134
|
|
|
123
135
|
// Use the session for making API calls with the custom headers
|
|
124
|
-
await composioWithCustomHeaders.tools.
|
|
136
|
+
await composioWithCustomHeaders.tools.getRawComposioTools({ toolkits: ['github'] });
|
|
125
137
|
```
|
|
126
138
|
|
|
127
139
|
---
|
|
@@ -134,7 +146,7 @@ In Node.js-compatible environments, telemetry is automatically flushed on proces
|
|
|
134
146
|
However, in environments like Cloudflare Workers that don't support process exit events,
|
|
135
147
|
you should call this method manually to ensure all telemetry is sent.
|
|
136
148
|
|
|
137
|
-
```typescript
|
|
149
|
+
```typescript signature
|
|
138
150
|
async flush(): Promise<void>
|
|
139
151
|
```
|
|
140
152
|
|
|
@@ -144,14 +156,20 @@ async flush(): Promise<void>
|
|
|
144
156
|
|
|
145
157
|
**Example**
|
|
146
158
|
|
|
147
|
-
```typescript
|
|
159
|
+
```typescript nocheck="Cloudflare Worker handler; the checker has no Workers Env or ExecutionContext types"
|
|
160
|
+
import { Composio } from '@composio/core';
|
|
161
|
+
|
|
148
162
|
// In a Cloudflare Worker, use ctx.waitUntil to ensure telemetry is flushed
|
|
149
163
|
export default {
|
|
150
164
|
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
|
|
151
165
|
const composio = new Composio({ apiKey: env.COMPOSIO_API_KEY });
|
|
152
166
|
|
|
153
167
|
// Do your work...
|
|
154
|
-
const result = await composio.tools.execute(
|
|
168
|
+
const result = await composio.tools.execute('GITHUB_GET_REPOS', {
|
|
169
|
+
userId: 'user_123',
|
|
170
|
+
version: '20250909_00',
|
|
171
|
+
arguments: { owner: 'composio' },
|
|
172
|
+
});
|
|
155
173
|
|
|
156
174
|
// Ensure telemetry flushes before worker terminates
|
|
157
175
|
ctx.waitUntil(composio.flush());
|
|
@@ -167,7 +185,7 @@ export default {
|
|
|
167
185
|
|
|
168
186
|
Get the Composio SDK client.
|
|
169
187
|
|
|
170
|
-
```typescript
|
|
188
|
+
```typescript signature
|
|
171
189
|
getClient(): ComposioClient
|
|
172
190
|
```
|
|
173
191
|
|
|
@@ -188,7 +206,7 @@ mutating the live config object would silently no-op. Freezing makes
|
|
|
188
206
|
that contract visible at the call site instead of letting the mutation
|
|
189
207
|
appear successful.
|
|
190
208
|
|
|
191
|
-
```typescript
|
|
209
|
+
```typescript signature
|
|
192
210
|
getConfig(): Readonly<ComposioConfig>
|
|
193
211
|
```
|
|
194
212
|
|
|
@@ -8,8 +8,10 @@ description: "ConnectedAccounts class This class is used to manage connected ac
|
|
|
8
8
|
Access this class through the `composio.connectedAccounts` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const connectedAccounts = composio.connectedAccounts;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Methods
|
|
@@ -29,7 +31,7 @@ exchange, and the connection becomes `ACTIVE`.
|
|
|
29
31
|
The session URI is single-use: redeeming it twice, or after it expires,
|
|
30
32
|
fails with a 404 from the API.
|
|
31
33
|
|
|
32
|
-
```typescript
|
|
34
|
+
```typescript signature
|
|
33
35
|
async completeAuth(params: ConnectedAccountCompleteAuthParams, requestOptions?: ComposioRequestOptions): Promise<ConnectedAccountCompleteAuthResponse>
|
|
34
36
|
```
|
|
35
37
|
|
|
@@ -47,11 +49,16 @@ async completeAuth(params: ConnectedAccountCompleteAuthParams, requestOptions?:
|
|
|
47
49
|
**Example**
|
|
48
50
|
|
|
49
51
|
```typescript
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
sessionUri
|
|
54
|
-
}
|
|
52
|
+
// Your verifier route, after authenticating the user
|
|
53
|
+
export async function GET(request: Request) {
|
|
54
|
+
// The session URI arrives as the `session_uri` query parameter of the verifier redirect
|
|
55
|
+
const sessionUri = new URL(request.url).searchParams.get('session_uri') ?? '';
|
|
56
|
+
const { connectedAccountId, toolkitSlug } = await composio.connectedAccounts.completeAuth({
|
|
57
|
+
userId: 'user_123',
|
|
58
|
+
sessionUri,
|
|
59
|
+
});
|
|
60
|
+
return new Response(`Connected ${toolkitSlug}: ${connectedAccountId}`);
|
|
61
|
+
}
|
|
55
62
|
```
|
|
56
63
|
|
|
57
64
|
---
|
|
@@ -63,7 +70,7 @@ Deletes a connected account.
|
|
|
63
70
|
This method permanently removes a connected account from the Composio platform.
|
|
64
71
|
This action cannot be undone and will revoke any access tokens associated with the account.
|
|
65
72
|
|
|
66
|
-
```typescript
|
|
73
|
+
```typescript signature
|
|
67
74
|
async delete(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<ConnectedAccountDeleteResponse>
|
|
68
75
|
```
|
|
69
76
|
|
|
@@ -91,7 +98,7 @@ await composio.connectedAccounts.delete('conn_abc123');
|
|
|
91
98
|
|
|
92
99
|
Disable a connected account
|
|
93
100
|
|
|
94
|
-
```typescript
|
|
101
|
+
```typescript signature
|
|
95
102
|
async disable(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<ConnectedAccountUpdateStatusResponse>
|
|
96
103
|
```
|
|
97
104
|
|
|
@@ -111,13 +118,7 @@ async disable(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<
|
|
|
111
118
|
```typescript
|
|
112
119
|
// Disable a connected account
|
|
113
120
|
const disabledAccount = await composio.connectedAccounts.disable('conn_abc123');
|
|
114
|
-
console.log(disabledAccount.
|
|
115
|
-
|
|
116
|
-
// You can also use updateStatus with a reason
|
|
117
|
-
// const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
118
|
-
// enabled: false,
|
|
119
|
-
// reason: 'No longer needed'
|
|
120
|
-
// });
|
|
121
|
+
console.log(disabledAccount.success); // true
|
|
121
122
|
```
|
|
122
123
|
|
|
123
124
|
---
|
|
@@ -126,7 +127,7 @@ console.log(disabledAccount.isDisabled); // true
|
|
|
126
127
|
|
|
127
128
|
Enable a connected account
|
|
128
129
|
|
|
129
|
-
```typescript
|
|
130
|
+
```typescript signature
|
|
130
131
|
async enable(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<ConnectedAccountUpdateStatusResponse>
|
|
131
132
|
```
|
|
132
133
|
|
|
@@ -146,7 +147,7 @@ async enable(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<C
|
|
|
146
147
|
```typescript
|
|
147
148
|
// Enable a previously disabled connected account
|
|
148
149
|
const enabledAccount = await composio.connectedAccounts.enable('conn_abc123');
|
|
149
|
-
console.log(enabledAccount.
|
|
150
|
+
console.log(enabledAccount.success); // true
|
|
150
151
|
```
|
|
151
152
|
|
|
152
153
|
---
|
|
@@ -158,7 +159,7 @@ Retrieves a specific connected account by its ID.
|
|
|
158
159
|
This method fetches detailed information about a single connected account
|
|
159
160
|
and transforms the response to the SDK's standardized format.
|
|
160
161
|
|
|
161
|
-
```typescript
|
|
162
|
+
```typescript signature
|
|
162
163
|
async get(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<ConnectedAccountRetrieveResponse>
|
|
163
164
|
```
|
|
164
165
|
|
|
@@ -206,7 +207,7 @@ Custom auth configs (your own OAuth app) and non-OAuth schemes (API key,
|
|
|
206
207
|
bearer token, basic auth) are unaffected and continue to work on
|
|
207
208
|
`initiate()`. See https://docs.composio.dev/docs/changelog/2026/04/24
|
|
208
209
|
|
|
209
|
-
```typescript
|
|
210
|
+
```typescript signature
|
|
210
211
|
async initiate(userId: string, authConfigId: string, options?: CreateConnectedAccountOptions, requestOptions?: ComposioRequestOptions): Promise<ConnectionRequest>
|
|
211
212
|
```
|
|
212
213
|
|
|
@@ -226,6 +227,8 @@ async initiate(userId: string, authConfigId: string, options?: CreateConnectedAc
|
|
|
226
227
|
**Example**
|
|
227
228
|
|
|
228
229
|
```typescript
|
|
230
|
+
import { AuthScheme } from '@composio/core';
|
|
231
|
+
|
|
229
232
|
// For OAuth2 authentication
|
|
230
233
|
const connectionRequest = await composio.connectedAccounts.initiate(
|
|
231
234
|
'user_123',
|
|
@@ -238,17 +241,25 @@ const connectionRequest = await composio.connectedAccounts.initiate(
|
|
|
238
241
|
})
|
|
239
242
|
}
|
|
240
243
|
);
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
import { AuthScheme } from '@composio/core';
|
|
241
248
|
|
|
242
249
|
// For API Key authentication
|
|
243
250
|
const connectionRequest = await composio.connectedAccounts.initiate(
|
|
244
251
|
'user_123',
|
|
245
252
|
'auth_config_123',
|
|
246
253
|
{
|
|
247
|
-
config: AuthScheme.
|
|
254
|
+
config: AuthScheme.APIKey({
|
|
248
255
|
api_key: 'your_api_key'
|
|
249
256
|
})
|
|
250
257
|
}
|
|
251
258
|
);
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
import { AuthScheme } from '@composio/core';
|
|
252
263
|
|
|
253
264
|
// For Basic authentication
|
|
254
265
|
const connectionRequest = await composio.connectedAccounts.initiate(
|
|
@@ -267,7 +278,7 @@ const connectionRequest = await composio.connectedAccounts.initiate(
|
|
|
267
278
|
|
|
268
279
|
### link()
|
|
269
280
|
|
|
270
|
-
```typescript
|
|
281
|
+
```typescript signature
|
|
271
282
|
async link(userId: string, authConfigId: string, options?: CreateConnectedAccountLinkOptions, requestOptions?: ComposioRequestOptions): Promise<ConnectionRequest>
|
|
272
283
|
```
|
|
273
284
|
|
|
@@ -316,7 +327,7 @@ Lists all connected accounts based on provided filter criteria.
|
|
|
316
327
|
|
|
317
328
|
This method retrieves connected accounts from the Composio API with optional filtering.
|
|
318
329
|
|
|
319
|
-
```typescript
|
|
330
|
+
```typescript signature
|
|
320
331
|
async list(query?: ConnectedAccountListParams, requestOptions?: ComposioRequestOptions): Promise<ConnectedAccountListResponse>
|
|
321
332
|
```
|
|
322
333
|
|
|
@@ -364,7 +375,7 @@ Refreshes a connected account's authentication credentials.
|
|
|
364
375
|
This method attempts to refresh OAuth tokens or other credentials associated with
|
|
365
376
|
the connected account. This is useful when a token has expired or is about to expire.
|
|
366
377
|
|
|
367
|
-
```typescript
|
|
378
|
+
```typescript signature
|
|
368
379
|
async refresh(nanoid: string, options?: ConnectedAccountRefreshOptions, requestOptions?: ComposioRequestOptions): Promise<ConnectedAccountRefreshResponse>
|
|
369
380
|
```
|
|
370
381
|
|
|
@@ -398,7 +409,7 @@ success the connection status becomes `REVOKED`. Revoking an already
|
|
|
398
409
|
revoked connection returns an empty `revokedTokens` list without an
|
|
399
410
|
upstream call.
|
|
400
411
|
|
|
401
|
-
```typescript
|
|
412
|
+
```typescript signature
|
|
402
413
|
async revoke(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<ConnectedAccountRevokeResponse>
|
|
403
414
|
```
|
|
404
415
|
|
|
@@ -429,7 +440,7 @@ Enable or disable a connected account. Accepts `{ enabled: boolean }`.
|
|
|
429
440
|
|
|
430
441
|
Use `updateAcl()` for ACL writes on SHARED connections.
|
|
431
442
|
|
|
432
|
-
```typescript
|
|
443
|
+
```typescript signature
|
|
433
444
|
async update(nanoid: string, params: UpdateConnectedAccountParams, requestOptions?: ComposioRequestOptions): Promise<ConnectedAccountUpdateStatusResponse>
|
|
434
445
|
```
|
|
435
446
|
|
|
@@ -467,7 +478,7 @@ PATCH semantics: omit a field to leave it unchanged; pass an empty
|
|
|
467
478
|
array to clear an allow/deny list. At least one field must be
|
|
468
479
|
provided.
|
|
469
480
|
|
|
470
|
-
```typescript
|
|
481
|
+
```typescript signature
|
|
471
482
|
async updateAcl(nanoid: string, params: UpdateConnectedAccountAclParams): Promise<ConnectedAccountPatchResponse>
|
|
472
483
|
```
|
|
473
484
|
|
|
@@ -503,7 +514,7 @@ await composio.connectedAccounts.updateAcl('ca_abc123', { allowedUserIds: [] });
|
|
|
503
514
|
|
|
504
515
|
Update the status of a connected account
|
|
505
516
|
|
|
506
|
-
```typescript
|
|
517
|
+
```typescript signature
|
|
507
518
|
async updateStatus(nanoid: string, params: ConnectedAccountUpdateStatusParams, requestOptions?: ComposioRequestOptions): Promise<ConnectedAccountUpdateStatusResponse>
|
|
508
519
|
```
|
|
509
520
|
|
|
@@ -527,10 +538,9 @@ const updatedAccount = await composio.connectedAccounts.updateStatus('conn_abc12
|
|
|
527
538
|
enabled: true
|
|
528
539
|
});
|
|
529
540
|
|
|
530
|
-
// Disable a connected account
|
|
541
|
+
// Disable a connected account
|
|
531
542
|
const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
532
|
-
enabled: false
|
|
533
|
-
reason: 'Token expired'
|
|
543
|
+
enabled: false
|
|
534
544
|
});
|
|
535
545
|
```
|
|
536
546
|
|
|
@@ -543,7 +553,7 @@ Waits for a connection request to complete and become active.
|
|
|
543
553
|
This method polls the Composio API, backing off from 1 second to 5 seconds between polls,
|
|
544
554
|
to check the status of a connection until it either becomes active, enters a terminal error state, or times out.
|
|
545
555
|
|
|
546
|
-
```typescript
|
|
556
|
+
```typescript signature
|
|
547
557
|
async waitForConnection(connectedAccountId: string, timeout?: number): Promise<ConnectedAccountRetrieveResponse>
|
|
548
558
|
```
|
|
549
559
|
|
|
@@ -563,7 +573,9 @@ async waitForConnection(connectedAccountId: string, timeout?: number): Promise<C
|
|
|
563
573
|
```typescript
|
|
564
574
|
// Wait for a connection to complete with default timeout
|
|
565
575
|
const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_123abc');
|
|
576
|
+
```
|
|
566
577
|
|
|
578
|
+
```typescript
|
|
567
579
|
// Wait with a custom timeout of 2 minutes
|
|
568
580
|
const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_123abc', 120000);
|
|
569
581
|
```
|
|
@@ -8,8 +8,10 @@ description: "`composio.customToolkits` — toolkits your project registers from
|
|
|
8
8
|
Access this class through the `composio.customToolkits` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const customToolkits = composio.customToolkits;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Methods
|
|
@@ -24,7 +26,7 @@ project, or to a user ID to make it private to that user. `mcpUrl`,
|
|
|
24
26
|
toolkit instead. For a private toolkit, `connectLink` is where to send
|
|
25
27
|
that user to connect.
|
|
26
28
|
|
|
27
|
-
```typescript
|
|
29
|
+
```typescript signature
|
|
28
30
|
async create(params: CustomToolkitCreateParams, requestOptions?: ComposioRequestOptions): Promise<CustomToolkitCreateResponse>
|
|
29
31
|
```
|
|
30
32
|
|
|
@@ -62,7 +64,7 @@ accounts are revoked in background jobs (`revokeJobIds`).
|
|
|
62
64
|
|
|
63
65
|
Composio-managed toolkits cannot be deleted; the API answers 403.
|
|
64
66
|
|
|
65
|
-
```typescript
|
|
67
|
+
```typescript signature
|
|
66
68
|
async delete(slug: string, requestOptions?: ComposioRequestOptions): Promise<CustomToolkitDeleteResponse>
|
|
67
69
|
```
|
|
68
70
|
|
|
@@ -91,7 +93,7 @@ console.log(result.connectedAccountsDeleted);
|
|
|
91
93
|
Re-fetches the tool definitions of a custom toolkit from its remote MCP
|
|
92
94
|
server. Call it when automatic sync fails or the remote tools change.
|
|
93
95
|
|
|
94
|
-
```typescript
|
|
96
|
+
```typescript signature
|
|
95
97
|
async sync(slug: string, params?: CustomToolkitSyncParams, requestOptions?: ComposioRequestOptions): Promise<CustomToolkitSyncResponse>
|
|
96
98
|
```
|
|
97
99
|
|
|
@@ -126,7 +128,7 @@ fields keep their current value.
|
|
|
126
128
|
On a project with 2FA enabled, updating a private toolkit requires the
|
|
127
129
|
`userId` it is private to.
|
|
128
130
|
|
|
129
|
-
```typescript
|
|
131
|
+
```typescript signature
|
|
130
132
|
async update(slug: string, params: CustomToolkitUpdateParams, requestOptions?: ComposioRequestOptions): Promise<CustomToolkitUpdateResponse>
|
|
131
133
|
```
|
|
132
134
|
|
|
@@ -168,7 +170,7 @@ field copy) when the project already owns a toolkit with this slug.
|
|
|
168
170
|
re-sending them unchanged is a no-op, and changing them fails with a 409.
|
|
169
171
|
Delete and re-register the toolkit instead, which revokes its connections.
|
|
170
172
|
|
|
171
|
-
```typescript
|
|
173
|
+
```typescript signature
|
|
172
174
|
async upsert(params: CustomToolkitUpsertParams, requestOptions?: ComposioRequestOptions): Promise<CustomToolkitUpsertResponse>
|
|
173
175
|
```
|
|
174
176
|
|
|
@@ -8,8 +8,10 @@ description: "Experimental class reference"
|
|
|
8
8
|
Access this class through the `composio.experimental` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const experimental = composio.experimental;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Properties
|
|
@@ -45,7 +47,7 @@ Resolution rule (deny wins):
|
|
|
45
47
|
3. requesting `userId` in `allowedUserIds` → ALLOW
|
|
46
48
|
4. otherwise → DENY
|
|
47
49
|
|
|
48
|
-
```typescript
|
|
50
|
+
```typescript signature
|
|
49
51
|
async updateAcl(nanoid: string, params: UpdateConnectedAccountAclParams): Promise<ConnectedAccountPatchResponse>
|
|
50
52
|
```
|
|
51
53
|
|
|
@@ -96,6 +98,5 @@ list **replaces** the list, it does not extend it:
|
|
|
96
98
|
- `notAllowedUserIds: []` → **clears the deny list**, which silently
|
|
97
99
|
re-grants access to users you previously blocked. Always pair an
|
|
98
100
|
empty deny list with a deliberate audit of the allow side.
|
|
99
|
-
```
|
|
100
101
|
|
|
101
102
|
---
|
|
@@ -18,6 +18,7 @@ description: "Complete API reference for the Composio TypeScript SDK (@composio/
|
|
|
18
18
|
| [`Keyring`](/reference/sdk-reference/typescript/keyring) | `composio.keyring` — the organization's customer-managed keyring. |
|
|
19
19
|
| [`Logs`](/reference/sdk-reference/typescript/logs) | `composio.logs` — tool-execution logs. |
|
|
20
20
|
| [`SessionConfigs`](/reference/sdk-reference/typescript/session-configs) | `composio.sessionConfigs` — saved, reusable Session configs. |
|
|
21
|
+
| [`SessionWebhooks`](/reference/sdk-reference/typescript/session-webhooks) | `composio.sessions.webhooks` — for the endpoint at a project's session |
|
|
21
22
|
| [`Experimental`](/reference/sdk-reference/typescript/experimental) | Experimental API |
|
|
22
23
|
| [`MCP`](/reference/sdk-reference/typescript/mcp) | MCP (Model Control Protocol) class |
|
|
23
24
|
| [`RemoteFile`](/reference/sdk-reference/typescript/remote-file) | Represents a file stored in a tool router session's file mount. |
|
|
@@ -47,8 +48,9 @@ const tools = await composio.tools.get('user-123', {
|
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
// Execute a tool
|
|
50
|
-
const result = await composio.tools.execute('
|
|
51
|
+
const result = await composio.tools.execute('GITHUB_LIST_STARGAZERS', {
|
|
51
52
|
userId: 'user-123',
|
|
52
|
-
arguments: { owner: 'composio' }
|
|
53
|
+
arguments: { owner: 'ComposioHQ', repo: 'composio' },
|
|
54
|
+
version: '20250909_00'
|
|
53
55
|
});
|
|
54
56
|
```
|
|
@@ -8,8 +8,10 @@ description: "`composio.keyring` — the organization's customer-managed keyring
|
|
|
8
8
|
Access this class through the `composio.keyring` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const keyring = composio.keyring;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Methods
|
|
@@ -27,7 +29,7 @@ them remain openable.
|
|
|
27
29
|
The organization behind the API key must have an ACTIVE customer keyring
|
|
28
30
|
instance; otherwise the API answers 404.
|
|
29
31
|
|
|
30
|
-
```typescript
|
|
32
|
+
```typescript signature
|
|
31
33
|
async listTransferKeys(requestOptions?: ComposioRequestOptions): Promise<KeyringTransferKeysResponse>
|
|
32
34
|
```
|
|
33
35
|
|
|
@@ -43,9 +45,10 @@ async listTransferKeys(requestOptions?: ComposioRequestOptions): Promise<Keyring
|
|
|
43
45
|
|
|
44
46
|
**Example**
|
|
45
47
|
|
|
46
|
-
```typescript
|
|
48
|
+
```typescript nocheck="Seals with the jose library, whose types the checker does not load"
|
|
47
49
|
import { CompactEncrypt, importJWK } from 'jose';
|
|
48
50
|
|
|
51
|
+
const secret = 'my-client-secret';
|
|
49
52
|
const { activeKid, keys } = await composio.keyring.listTransferKeys();
|
|
50
53
|
const jwk = keys.find(key => key.kid === activeKid)!;
|
|
51
54
|
const sealed = await new CompactEncrypt(new TextEncoder().encode(secret))
|
|
@@ -8,8 +8,10 @@ description: "`composio.logs` — tool-execution logs."
|
|
|
8
8
|
Access this class through the `composio.logs` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const logs = composio.logs;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Methods
|
|
@@ -19,7 +21,7 @@ const result = await composio.logs.list();
|
|
|
19
21
|
Retrieve one tool-execution log with its full detail (timings, context,
|
|
20
22
|
source and raw `data`).
|
|
21
23
|
|
|
22
|
-
```typescript
|
|
24
|
+
```typescript signature
|
|
23
25
|
async get(id: string, requestOptions?: ComposioRequestOptions): Promise<ToolExecutionLogDetail>
|
|
24
26
|
```
|
|
25
27
|
|
|
@@ -48,7 +50,7 @@ console.log(log.status, log.timings?.endTime);
|
|
|
48
50
|
Search tool-execution logs with filters, a time range and cursor
|
|
49
51
|
pagination.
|
|
50
52
|
|
|
51
|
-
```typescript
|
|
53
|
+
```typescript signature
|
|
52
54
|
async search(params?: LogSearchParams, requestOptions?: ComposioRequestOptions): Promise<LogSearchResponse>
|
|
53
55
|
```
|
|
54
56
|
|