Skip to main content
The experimental_getWorkspaceSettings() function retrieves all workspace settings values.
// In client code (React components, actions, etc.)
import { experimental_getWorkspaceSettings } from "attio/client";

// In server functions
import { experimental_getWorkspaceSettings } from "attio/server";
For React components, consider using experimental_useWorkspaceSettings() instead, which provides real-time updates when settings change.
The Workspace Settings API is experimental and may change in the future. Please don’t use it in production versions of your app.

Parameters

This function takes no parameters. The return type is automatically inferred from your workspace settings schema defined in src/app.settings.ts.

Returns

A promise that resolves to an object containing all workspace settings values as defined in your schema. The returned object is fully typed based on your schema definition.

Example

In a Server Function

sync-records.server.ts
import { experimental_getWorkspaceSettings } from "attio/server";

export default async function syncRecords() {
  // Get all workspace settings
  const settings = await experimental_getWorkspaceSettings();
  
  // Access settings values with full type safety
  const syncInterval = settings.sync_interval_minutes;
  const autoSyncEnabled = settings.auto_sync_enabled;
  
  if (!autoSyncEnabled) {
    return { success: false, message: "Auto-sync is disabled" };
  }
  
  // Use settings in your server logic
  await performSync(syncInterval);
  
  return { success: true };
}

In Client Code

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

export const syncAction: App.Record.Action = {
  id: "sync-record",
  label: "Sync Record",
  icon: "Refresh",
  onTrigger: async ({ recordId }) => {
    // Get workspace settings
    const settings = await experimental_getWorkspaceSettings();
    
    if (!settings.auto_sync_enabled) {
      return;
    }
    
    // Use settings in your action logic
    await performSync(recordId, settings.sync_interval_minutes);
  },
};

Type Safety

The function’s return type is automatically inferred from your schema:
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 knows the exact shape of settings
const settings = await experimental_getWorkspaceSettings();

settings.team_name // string
settings.auto_sync_enabled // boolean
settings.sync_interval_minutes // number
settings.nonexistent // TypeScript error!