Skip to main content
The experimental_setWorkspaceSetting() function updates a single workspace setting value programmatically.
// In client code (React components, actions, etc.)
import { experimental_setWorkspaceSetting } from "attio/client";

// In server functions
import { experimental_setWorkspaceSetting } from "attio/server";
The Workspace Settings API is experimental and may change in the future. Please don’t use it in production versions of your app.

Parameters

key
string
required
The key of the setting to update. Must match a key defined in your workspace settings schema.The key is fully typed, so TypeScript will only allow valid setting keys.
value
string | boolean | number
required
The new value for the setting. The type must match the setting type defined in your schema.TypeScript will enforce that the value type matches the setting type.

Returns

A promise that resolves when the setting has been updated.

Example

toggle-auto-sync.server.ts
import { experimental_setWorkspaceSetting } from "attio/server";

export default async function toggleAutoSync() {
  // Set a boolean setting
  await experimental_setWorkspaceSetting("auto_sync_enabled", true);
  
  // Set a number setting
  await experimental_setWorkspaceSetting("sync_interval_minutes", 30);
  
  // Set a string setting
  await experimental_setWorkspaceSetting("team_name", "Engineering Team");
  
  return { success: true };
}

In Client Code

record-action.tsx
import { experimental_setWorkspaceSetting } from "attio/client";
import type { App } from "attio";

export const enableSyncAction: App.Record.Action = {
  id: "enable-sync",
  label: "Enable Sync",
  icon: "Check",
  onTrigger: async ({ recordId }) => {
    // Update settings from a record action
    await experimental_setWorkspaceSetting("auto_sync_enabled", true);
    await experimental_setWorkspaceSetting("sync_interval_minutes", 30);
  },
};

Type Safety

The function enforces type safety for both keys and values:
app.settings.ts
import { Settings, type SettingsSchema } from "attio";

const appSettingsSchema = {
  workspace: {
    team_name: Settings.string(),
    auto_sync_enabled: Settings.boolean(),
    sync_interval_minutes: Settings.number(),
  },
} satisfies SettingsSchema;

export default appSettingsSchema;
// TypeScript enforces valid keys and matching value types
await experimental_setWorkspaceSetting("team_name", "Team A"); // ✓ Valid
await experimental_setWorkspaceSetting("auto_sync_enabled", true); // ✓ Valid
await experimental_setWorkspaceSetting("sync_interval_minutes", 60); // ✓ Valid

await experimental_setWorkspaceSetting("nonexistent", "value"); // ✗ TypeScript error!
await experimental_setWorkspaceSetting("auto_sync_enabled", "yes"); // ✗ TypeScript error! (wrong type)
await experimental_setWorkspaceSetting("sync_interval_minutes", "30"); // ✗ TypeScript error! (wrong type)