Skip to main content

Manage user preferences

Preferences belong to the signed-in user. You can read and update only your own preferences, not another user's. Configure an authenticated client using the JavaScript setup or Python setup. Preferences are separate from user attributes and don't affect access.

Preference fields​

The first GET auto-creates a preference record with these defaults when none exists.

FieldDefaultAccepted value
date_formatYYYY-MM-DDYYYY-MM-DD, DD/MM/YYYY, MM/DD/YYYY, DD-MMM-YYYY
time_format24h24h, 12h
timezoneUTCValid IANA timezone name, such as Asia/Kolkata
themelightlight, dark
widget_config{}Application-defined settings in any JSON object

Preferences can't be managed in Console.

Read and update preferences​

An update changes only the fields you send and creates the preference record if it doesn't exist yet.

import {User} from '@taruvi/sdk';

const users = new User(taruvi);
const current = await users.getPreferences();
await users.updatePreferences({theme: "dark", timezone: "Asia/Kolkata"});
const verified = await users.getPreferences();

Verify and recover​

Re-read after an update and compare the returned values with the intended change. If the API rejects an invalid date format, time format, timezone, or theme, correct the rejected value, retry the update, then re-read the preferences. A 401 means the user's credential is missing or expired.

For other problems, see troubleshooting.