> ## Documentation Index
> Fetch the complete documentation index at: https://docs.attio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Settings.getSettings()

> Get workspace settings values from client or server code

`Settings.getSettings()` reads the setting values for a schema. Without a key, it resolves with all values; with a key, it resolves with that value only. Every value is `null` until it has been set.

It is available from both `attio/client` and `attio/server`:

```tsx theme={"system"}
// In client code (extensions, dialogs, etc.)
import {Settings} from "attio/client"
```

```tsx theme={"system"}
// In server functions, webhook handlers, and event handlers
import {Settings} from "attio/server"
```

Unlike [`Settings.useSettings`](./use-settings) this is not a hook, so it can be called outside React rendering, for example in an `onTrigger` handler or a server function. For React components, prefer `Settings.useSettings`, which provides real-time updates when settings change.

## Parameters

<ParamField path="schema" type="WorkspaceSettingsSchema" required>
  The schema built with [`Settings.defineWorkspaceSchema`](./define-workspace-schema), imported
  from your schema file.
</ParamField>

<ParamField path="key" type="string">
  Optionally, the key of a single setting to retrieve. Must match a key defined in your schema;
  the key is fully typed, so TypeScript will only allow valid setting keys.

  When omitted, all setting values are returned.
</ParamField>

## Returns

A promise resolving to all setting values (no key), or to the single requested value (with a key). Types are inferred from your schema; every value is `null` until set.

## Example

### In a server function

```ts src/sync-records.server.ts theme={"system"}
import {Settings} from "attio/server"

import schema from "./app/settings/schema"

async function performSync(interval: number) {}

export default async function syncRecords() {
  // Get all workspace settings
  const settings = await Settings.getSettings(schema)

  if (!settings.auto_sync_enabled || settings.sync_interval_minutes === null) {
    return {success: false, message: "Auto-sync is disabled or not configured"}
  }

  await performSync(settings.sync_interval_minutes)

  return {success: true}
}
```

### In client code

```tsx src/app/extensions/sync-record/extension.tsx theme={"system"}
import {Extensions, Settings} from "attio/client"

import schema from "../../settings/schema"

async function performSync(recordId: string, interval: number | null) {}

export default Extensions.defineExtension({
  type: "record-action",
  id: "sync-record",
  label: "Sync Record",
  icon: "ArrowsRefresh",
  onTrigger: async ({recordId}) => {
    // Get a single setting value
    const syncEnabled = await Settings.getSettings(schema, "auto_sync_enabled")

    if (!syncEnabled) {
      return
    }

    const interval = await Settings.getSettings(schema, "sync_interval_minutes")
    await performSync(recordId, interval)
  },
})
```

## Related

* [`Settings.setSettings()`](./set-settings) - Write a setting value
* [`Settings.useSettings()`](./use-settings) - Read settings reactively in React components
