0
# Settings Management
1
2
Organization-level settings configuration for managing integrations, content filtering, and customization options across the Supermemory platform.
3
4
## Capabilities
5
6
### Get Settings
7
8
Retrieves current organization settings including integration configurations and filtering options.
9
10
```typescript { .api }
11
/**
12
* Get settings for an organization
13
* @param options - Optional request configuration
14
* @returns Promise resolving to current organization settings
15
*/
16
get(options?: RequestOptions): APIPromise<SettingGetResponse>;
17
18
interface SettingGetResponse {
19
/** Items to exclude from processing */
20
excludeItems?: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;
21
/** Items to include in processing */
22
includeItems?: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;
23
/** Custom filter prompt for LLM processing */
24
filterPrompt?: string | null;
25
/** Enable/disable LLM-based filtering */
26
shouldLLMFilter?: boolean | null;
27
28
// Google Drive Integration
29
/** Google Drive OAuth client ID */
30
googleDriveClientId?: string | null;
31
/** Google Drive OAuth client secret */
32
googleDriveClientSecret?: string | null;
33
/** Enable custom Google Drive OAuth keys */
34
googleDriveCustomKeyEnabled?: boolean | null;
35
36
// Notion Integration
37
/** Notion OAuth client ID */
38
notionClientId?: string | null;
39
/** Notion OAuth client secret */
40
notionClientSecret?: string | null;
41
/** Enable custom Notion OAuth keys */
42
notionCustomKeyEnabled?: boolean | null;
43
44
// OneDrive Integration
45
/** OneDrive OAuth client ID */
46
onedriveClientId?: string | null;
47
/** OneDrive OAuth client secret */
48
onedriveClientSecret?: string | null;
49
/** Enable custom OneDrive OAuth keys */
50
onedriveCustomKeyEnabled?: boolean | null;
51
}
52
```
53
54
**Usage Example:**
55
56
```typescript
57
import Supermemory from "supermemory";
58
59
const client = new Supermemory({ apiKey: "your-api-key" });
60
61
const settings = await client.settings.get();
62
63
console.log("LLM Filtering:", settings.shouldLLMFilter);
64
console.log("Google Drive Integration:", settings.googleDriveCustomKeyEnabled);
65
console.log("Current Filter Prompt:", settings.filterPrompt);
66
```
67
68
### Update Settings
69
70
Updates organization settings with new configurations for integrations and filtering.
71
72
```typescript { .api }
73
/**
74
* Update settings for an organization
75
* @param params - Settings to update (all fields optional)
76
* @param options - Optional request configuration
77
* @returns Promise resolving to update confirmation with applied changes
78
*/
79
update(params?: SettingUpdateParams, options?: RequestOptions): APIPromise<SettingUpdateResponse>;
80
81
interface SettingUpdateParams {
82
/** Items to exclude from processing */
83
excludeItems?: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;
84
/** Items to include in processing */
85
includeItems?: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;
86
/** Custom filter prompt for LLM processing */
87
filterPrompt?: string | null;
88
/** Enable/disable LLM-based filtering */
89
shouldLLMFilter?: boolean | null;
90
91
// Google Drive Integration
92
/** Google Drive OAuth client ID */
93
googleDriveClientId?: string | null;
94
/** Google Drive OAuth client secret */
95
googleDriveClientSecret?: string | null;
96
/** Enable custom Google Drive OAuth keys */
97
googleDriveCustomKeyEnabled?: boolean | null;
98
99
// Notion Integration
100
/** Notion OAuth client ID */
101
notionClientId?: string | null;
102
/** Notion OAuth client secret */
103
notionClientSecret?: string | null;
104
/** Enable custom Notion OAuth keys */
105
notionCustomKeyEnabled?: boolean | null;
106
107
// OneDrive Integration
108
/** OneDrive OAuth client ID */
109
onedriveClientId?: string | null;
110
/** OneDrive OAuth client secret */
111
onedriveClientSecret?: string | null;
112
/** Enable custom OneDrive OAuth keys */
113
onedriveCustomKeyEnabled?: boolean | null;
114
}
115
116
interface SettingUpdateResponse {
117
/** Organization ID */
118
orgId: string;
119
/** Organization slug/identifier */
120
orgSlug: string;
121
/** Object containing the updated settings */
122
updated: SettingUpdateDetails;
123
}
124
125
interface SettingUpdateDetails {
126
excludeItems?: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;
127
includeItems?: string | number | boolean | { [key: string]: unknown } | Array<unknown> | null;
128
filterPrompt?: string | null;
129
shouldLLMFilter?: boolean | null;
130
googleDriveClientId?: string | null;
131
googleDriveClientSecret?: string | null;
132
googleDriveCustomKeyEnabled?: boolean | null;
133
notionClientId?: string | null;
134
notionClientSecret?: string | null;
135
notionCustomKeyEnabled?: boolean | null;
136
onedriveClientId?: string | null;
137
onedriveClientSecret?: string | null;
138
onedriveCustomKeyEnabled?: boolean | null;
139
}
140
```
141
142
**Usage Examples:**
143
144
```typescript
145
// Enable LLM filtering with custom prompt
146
const llmSettings = await client.settings.update({
147
shouldLLMFilter: true,
148
filterPrompt: "Only include technical documentation and exclude marketing content",
149
});
150
151
console.log("Updated organization:", llmSettings.orgSlug);
152
console.log("LLM filtering enabled:", llmSettings.updated.shouldLLMFilter);
153
154
// Configure Google Drive integration
155
const googleDriveSettings = await client.settings.update({
156
googleDriveCustomKeyEnabled: true,
157
googleDriveClientId: "your-google-client-id",
158
googleDriveClientSecret: "your-google-client-secret",
159
});
160
161
// Configure multiple integrations
162
const multiIntegrationSettings = await client.settings.update({
163
notionCustomKeyEnabled: true,
164
notionClientId: "your-notion-client-id",
165
notionClientSecret: "your-notion-client-secret",
166
onedriveCustomKeyEnabled: true,
167
onedriveClientId: "your-onedrive-client-id",
168
onedriveClientSecret: "your-onedrive-client-secret",
169
});
170
171
// Update content filtering rules
172
const contentFiltering = await client.settings.update({
173
excludeItems: {
174
types: ["image", "video"],
175
patterns: ["*.tmp", "temp_*"]
176
},
177
includeItems: {
178
extensions: [".md", ".txt", ".pdf"],
179
categories: ["documentation", "research"]
180
},
181
});
182
```
183
184
## Configuration Patterns
185
186
### Integration Setup
187
188
```typescript
189
// Step 1: Enable custom keys for an integration
190
await client.settings.update({
191
googleDriveCustomKeyEnabled: true,
192
});
193
194
// Step 2: Configure OAuth credentials
195
await client.settings.update({
196
googleDriveClientId: process.env.GOOGLE_DRIVE_CLIENT_ID,
197
googleDriveClientSecret: process.env.GOOGLE_DRIVE_CLIENT_SECRET,
198
});
199
200
// Step 3: Create connection (see Connection Management docs)
201
const connection = await client.connections.create("google-drive", {
202
containerTags: ["main-workspace"],
203
});
204
```
205
206
### Content Filtering Configuration
207
208
```typescript
209
// Configure inclusion/exclusion rules
210
const filteringConfig = await client.settings.update({
211
// Exclude temporary and system files
212
excludeItems: {
213
patterns: ["*.tmp", "*.log", ".DS_Store"],
214
directories: ["node_modules", ".git", "temp"],
215
fileTypes: ["executable", "binary"]
216
},
217
218
// Include only relevant content
219
includeItems: {
220
extensions: [".md", ".txt", ".pdf", ".docx"],
221
categories: ["documentation", "research", "notes"],
222
minSize: 100, // bytes
223
maxSize: 10485760 // 10MB
224
},
225
226
// Enable AI-powered content filtering
227
shouldLLMFilter: true,
228
filterPrompt: `
229
Include: Technical documentation, research papers, meeting notes, project specifications
230
Exclude: Marketing materials, temporary files, personal content, duplicates
231
Focus on: Work-related content that provides value for knowledge management
232
`.trim(),
233
});
234
```
235
236
### Environment-based Configuration
237
238
```typescript
239
// Development environment
240
const devSettings = await client.settings.update({
241
shouldLLMFilter: false, // Faster processing
242
filterPrompt: null,
243
excludeItems: { patterns: ["*.test.*", "*.spec.*"] },
244
});
245
246
// Production environment
247
const prodSettings = await client.settings.update({
248
shouldLLMFilter: true,
249
filterPrompt: "Only include production-ready documentation and exclude test files",
250
includeItems: {
251
categories: ["documentation", "specifications", "guides"],
252
quality: "high"
253
},
254
});
255
```
256
257
## Settings Management Workflows
258
259
### Complete Organization Setup
260
261
```typescript
262
const setupOrganization = async () => {
263
// 1. Get current settings
264
const current = await client.settings.get();
265
console.log("Current configuration:", current);
266
267
// 2. Configure integrations
268
await client.settings.update({
269
// Enable all custom integrations
270
googleDriveCustomKeyEnabled: true,
271
notionCustomKeyEnabled: true,
272
onedriveCustomKeyEnabled: true,
273
274
// Set OAuth credentials from environment
275
googleDriveClientId: process.env.GOOGLE_DRIVE_CLIENT_ID,
276
googleDriveClientSecret: process.env.GOOGLE_DRIVE_CLIENT_SECRET,
277
notionClientId: process.env.NOTION_CLIENT_ID,
278
notionClientSecret: process.env.NOTION_CLIENT_SECRET,
279
onedriveClientId: process.env.ONEDRIVE_CLIENT_ID,
280
onedriveClientSecret: process.env.ONEDRIVE_CLIENT_SECRET,
281
});
282
283
// 3. Configure content filtering
284
await client.settings.update({
285
shouldLLMFilter: true,
286
filterPrompt: "Focus on work-related content: documentation, research, notes. Exclude personal and temporary files.",
287
288
excludeItems: {
289
patterns: ["*.tmp", "*.log", ".DS_Store", "Thumbs.db"],
290
directories: ["node_modules", ".git", "temp", "cache"],
291
types: ["executable", "archive"]
292
},
293
294
includeItems: {
295
extensions: [".md", ".txt", ".pdf", ".docx", ".pptx", ".xlsx"],
296
categories: ["documentation", "research", "notes", "specifications"],
297
languages: ["en", "es", "fr"] // if language detection is supported
298
}
299
});
300
301
console.log("Organization setup complete");
302
};
303
```
304
305
### Settings Backup and Restore
306
307
```typescript
308
// Backup current settings
309
const backupSettings = async () => {
310
const settings = await client.settings.get();
311
312
// Store settings (e.g., in file or database)
313
const backup = {
314
timestamp: new Date().toISOString(),
315
settings: settings,
316
};
317
318
return backup;
319
};
320
321
// Restore settings from backup
322
const restoreSettings = async (backup: any) => {
323
const { settings } = backup;
324
325
// Remove read-only fields and restore
326
const updateParams = { ...settings };
327
delete updateParams.orgId;
328
delete updateParams.orgSlug;
329
330
return await client.settings.update(updateParams);
331
};
332
```
333
334
## Security Considerations
335
336
### Credential Management
337
338
```typescript
339
// ✅ Good: Use environment variables
340
await client.settings.update({
341
googleDriveClientId: process.env.GOOGLE_DRIVE_CLIENT_ID,
342
googleDriveClientSecret: process.env.GOOGLE_DRIVE_CLIENT_SECRET,
343
});
344
345
// ❌ Bad: Hardcode credentials
346
await client.settings.update({
347
googleDriveClientId: "hardcoded-client-id",
348
googleDriveClientSecret: "hardcoded-secret",
349
});
350
```
351
352
### Validation and Error Handling
353
354
```typescript
355
const updateSettingsSafely = async (params: SettingUpdateParams) => {
356
try {
357
// Validate required fields
358
if (params.googleDriveCustomKeyEnabled && !params.googleDriveClientId) {
359
throw new Error("Google Drive Client ID required when custom keys enabled");
360
}
361
362
const result = await client.settings.update(params);
363
364
// Verify critical settings were applied
365
const verification = await client.settings.get();
366
if (verification.shouldLLMFilter !== params.shouldLLMFilter) {
367
console.warn("LLM filter setting may not have been applied correctly");
368
}
369
370
return result;
371
372
} catch (error) {
373
if (error instanceof BadRequestError) {
374
console.error("Invalid settings configuration:", error.message);
375
} else if (error instanceof PermissionDeniedError) {
376
console.error("Insufficient permissions to update settings:", error.message);
377
} else {
378
console.error("Settings update failed:", error.message);
379
}
380
381
throw error;
382
}
383
};
384
```