@devries-cameron20 / composio Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 03:37 UTC

next
mdx 199 lines 5.69 KB
Raw
1 ---
2 title: "True PATCH Semantics for Auth Config Updates"
3 description: "Auth config PATCH endpoint now preserves omitted fields instead of clearing them"
4 date: "2026-01-14"
5 ---
6
7 ## Version Information
8
9 ### TypeScript/JavaScript
10 - Package: `@composio/core` and provider packages
11 - Version: `0.5.1`+
12
13 ### Python
14 - Package: `composio-core` and provider packages
15 - Version: `0.10.7`+
16
17 ---
18
19 The `PATCH /api/v3/auth_configs/{id}` endpoint now implements proper partial update semantics. Previously, omitting fields would clear them (behaving like PUT). Now, omitted fields are preserved—only explicitly provided fields are modified.
20
21 <Callout type="warn">
22 **Breaking Change**: If you relied on omitting fields to clear them, you must now explicitly send `null` or `[]`. See [Migration Guide](#migration-guide) below.
23 </Callout>
24
25 ## What Changed
26
27 | Field | Before (Buggy) | After (Correct) |
28 | ----------------------------- | ------------------------ | --------------------------------- |
29 | `credentials` | Required on every update | Optional—merged with existing |
30 | `tool_access_config` | Reset to `{}` if omitted | Preserved if omitted |
31 | `scopes` (type: default) | Cleared if omitted | Preserved if omitted |
32 | `restrict_to_following_tools` | Reset to `[]` if omitted | Preserved if omitted |
33
34 <Callout type="info">
35 **Merge Behavior**: The `credentials` object is merged—send only the fields you want to change, and existing fields are preserved.
36 </Callout>
37
38 ## New Capabilities
39
40 ### Rotate a Single Credential Field
41
42 Update just `client_secret` without resending `client_id` or other fields:
43
44 <Tabs groupId="language" items={['Python', 'TypeScript']}>
45 <Tab value="Python">
46 ```python
47 from composio import Composio
48
49 composio = Composio()
50
51 # Only send the field you want to update - other credentials are preserved
52
53 composio.auth_configs.update(
54 "ac_yourAuthConfigId",
55 options={
56 "type": "custom",
57 "credentials": {
58 "client_secret": "new_rotated_secret",
59 },
60 },
61 )
62 ```
63 </Tab>
64 <Tab value="TypeScript">
65 ```typescript
66 // @noErrors
67 import { Composio } from "@composio/core";
68
69 const composio = new Composio();
70
71 // Only send the field you want to update - other credentials are preserved
72 await composio.authConfigs.update("ac_yourAuthConfigId", {
73 type: "custom",
74 credentials: {
75 client_secret: "new_rotated_secret",
76 },
77 });
78 ```
79 </Tab>
80 </Tabs>
81
82 ### Update Tool Restrictions Without Touching Credentials
83
84 Previously, this would fail because `credentials` was required. Now it works:
85
86 <Tabs groupId="language" items={['Python', 'TypeScript']}>
87 <Tab value="Python">
88 ```python
89 from composio import Composio
90
91 composio = Composio()
92
93 # Update tool restrictions - credentials are automatically preserved
94
95 composio.auth_configs.update(
96 "ac_yourAuthConfigId",
97 options={
98 "type": "custom",
99 "tool_access_config": {
100 "tools_available_for_execution": ["GMAIL_SEND_EMAIL", "GMAIL_READ_EMAIL"],
101 },
102 },
103 )
104 ```
105 </Tab>
106 <Tab value="TypeScript">
107 ```typescript
108 // @noErrors
109 import { Composio } from "@composio/core";
110
111 const composio = new Composio();
112
113 // Note: TypeScript SDK currently requires credentials for custom type updates
114 await composio.authConfigs.update("ac_yourAuthConfigId", {
115 type: "custom",
116 credentials: {
117 // Include existing credentials when using TS SDK
118 },
119 toolAccessConfig: {
120 toolsAvailableForExecution: ["GMAIL_SEND_EMAIL", "GMAIL_READ_EMAIL"],
121 },
122 });
123 ```
124 </Tab>
125 </Tabs>
126
127 ## Migration Guide
128
129 ### Am I Affected?
130
131 **Yes**, if your code relied on omitting fields to clear them.
132
133 **No**, if you always send complete payloads or only use PATCH to update specific fields.
134
135 ### How to Clear Fields Explicitly
136
137 | To Clear | Python SDK | TypeScript SDK |
138 | -------------------- | ------------------------------------------------------------- | ------------------------------------------------------ |
139 | `tool_access_config` | `"tool_access_config": {"tools_available_for_execution": []}` | `toolAccessConfig: { toolsAvailableForExecution: [] }` |
140 | `scopes` (default) | `"scopes": ""` | `scopes: ""` (via HTTP API) |
141
142 <Tabs groupId="language" items={['Python', 'TypeScript']}>
143 <Tab value="Python">
144 ```python
145 from composio import Composio
146
147 composio = Composio()
148
149 # Explicitly clear tool restrictions with empty array
150
151 composio.auth_configs.update(
152 "ac_yourAuthConfigId",
153 options={
154 "type": "custom",
155 "tool_access_config": {
156 "tools_available_for_execution": [],
157 },
158 },
159 )
160 ```
161 </Tab>
162 <Tab value="TypeScript">
163 ```typescript
164 // @noErrors
165 import { Composio } from "@composio/core";
166
167 const composio = new Composio();
168
169 // Explicitly clear tool restrictions with empty array
170 await composio.authConfigs.update("ac_yourAuthConfigId", {
171 type: "custom",
172 credentials: {
173 // Include existing credentials when using TS SDK
174 },
175 toolAccessConfig: {
176 toolsAvailableForExecution: [],
177 },
178 });
179 ```
180 </Tab>
181 </Tabs>
182
183 ### Raw HTTP API
184
185 For users calling the API directly:
186
187 ```bash
188 # Rotate single credential
189 curl -X PATCH "https://backend.composio.dev/api/v3/auth_configs/{id}" \
190 -H "x-api-key: YOUR_API_KEY" \
191 -H "Content-Type: application/json" \
192 -d '{"type": "custom", "credentials": {"client_secret": "new_secret"}}'
193
194 # Clear tool restrictions
195 curl -X PATCH "https://backend.composio.dev/api/v3/auth_configs/{id}" \
196 -H "x-api-key: YOUR_API_KEY" \
197 -H "Content-Type: application/json" \
198 -d '{"type": "custom", "tool_access_config": {"tools_available_for_execution": []}}'
199 ```