Skip to main content
Settings store user preferences, onboarding status, and custom configuration. Each user typically has one settings object.

Get Settings

Retrieve settings for the authenticated user.
curl -X GET http://localhost:3000/api/settings \
  -H "Cookie: session=your-session-token"

Response

Returns an array of settings objects (typically one per user).
id
string (uuid)
Unique settings identifier
userId
string
ID of the user these settings belong to
lastDashboardId
string (uuid) | null
ID of the last viewed dashboard
config
object
Custom user configuration (key-value pairs)
onboardingCompleted
boolean
Whether the user has completed onboarding (default: false)
createdAt
string (ISO 8601)
Creation timestamp
updatedAt
string (ISO 8601)
Last update timestamp
[
  {
    "id": "a3bb189e-8bf9-3888-9912-ace4e6543002",
    "userId": "user123",
    "lastDashboardId": "550e8400-e29b-41d4-a716-446655440000",
    "config": {
      "theme": "dark",
      "language": "en"
    },
    "onboardingCompleted": true,
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-20T14:22:00.000Z"
  }
]

Update Settings

curl -X PUT http://localhost:3000/api/settings \
  -H "Content-Type: application/json" \
  -H "Cookie: session=your-session-token" \
  -d '{
    "id": "a3bb189e-8bf9-3888-9912-ace4e6543002",
    "lastDashboardId": "550e8400-e29b-41d4-a716-446655440000",
    "config": {
      "theme": "light",
      "notifications": true
    },
    "onboardingCompleted": true
  }'

Request Body

id
string (uuid)
required
Settings ID to update
lastDashboardId
string (uuid)
ID of the last viewed dashboard
config
object
Custom configuration object (key-value pairs)
onboardingCompleted
boolean
Mark onboarding as completed

Response

Returns the updated settings object.
{
  "id": "a3bb189e-8bf9-3888-9912-ace4e6543002",
  "userId": "user123",
  "lastDashboardId": "550e8400-e29b-41d4-a716-446655440000",
  "config": {
    "theme": "light",
    "notifications": true
  },
  "onboardingCompleted": true,
  "createdAt": "2024-01-15T10:30:00.000Z",
  "updatedAt": "2024-01-20T15:10:00.000Z"
}

Config Field

The config field is a flexible JSONB object that can store any custom user preferences:
{
  "config": {
    "theme": "dark",
    "language": "en",
    "notifications": true,
    "displayMode": "compact",
    "customOption": "value"
  }
}
You can store any valid JSON data structure in the config field.

Onboarding Flow

The onboardingCompleted field tracks whether a user has finished the initial setup:
  1. User signs up - settings created with onboardingCompleted: false
  2. User completes onboarding steps in the UI
  3. Frontend calls PUT /api/settings with onboardingCompleted: true
  4. User no longer sees onboarding prompts
// Mark onboarding as complete
await fetch('/api/settings', {
  method: 'PUT',
  credentials: 'include',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    id: settingsId,
    onboardingCompleted: true
  })
});

Build docs developers (and LLMs) love