> ## 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.

# getWorkspaceSettings()

> Get all workspace settings values

The `getWorkspaceSettings()` function retrieves all workspace settings values.

```tsx theme={"system"}
// In client code (React components, actions, etc.)
import {getWorkspaceSettings} from "attio/client"

// In server functions
import {getWorkspaceSettings} from "attio/server"
```

For React components, consider using [`useWorkspaceSettings()`](./use-workspace-settings) instead, which provides real-time updates when settings change.

## Parameters

This function takes no parameters. The return type is automatically inferred from your [workspace settings schema](./app-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

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

export default async function syncRecords() {
  // Get all workspace settings
  const settings = await 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

```tsx record-action.tsx theme={"system"}
import {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 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:

```typescript app.settings.ts theme={"system"}
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
```

```tsx theme={"system"}
// TypeScript knows the exact shape of settings
const settings = await getWorkspaceSettings()

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