Update user preferences (partial)
Updates user's localization and display preferences.
## Authorization
- Users can update their own preferences
- Admins can update anyone's preferences
- Managers (broker, photographer) can update their team's preferences
## Behavior
- PATCH semantics: only provided fields are updated
- Validates field values (e.g., date_time_format must be friendly/us/uk)
- Returns updated preferences with defaults applied
## Valid Values
- date_time_format: "friendly" | "us" | "uk"
- timezone: Any valid IANA timezone (e.g., "America/New_York")
- language: BCP 47 language tag (e.g., "en-US")
- measurement_unit: "imperial" | "metric"
- theme: "light" | "dark" | "system"
## Examples
```json
PATCH /api/v1/users/{user_id}/preferences
{
"date_time_format": "us",
"timezone": "America/New_York"
}
Response: {
"date_time_format": "us",
"timezone": "America/New_York",
"language": "en-US",
"measurement_unit": "imperial",
"theme": "system"
}
```
| Method | Path |
|---|---|
PATCH | /api/v1/users/{user_id}/preferences |
Primary host: https://valara.cloud (legacy alias: https://dash.jacoballenmedia.com).
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
user_id | path | yes | string |
Request body
(no request body)
Response
null
Responses
| Status | Description |
|---|---|
200 | Preferences updated successfully |
400 | Invalid preference value (see error codes) |
401 | Authentication required (see error codes) |
403 | Not authorized to update this user's preferences (see error codes) |
404 | User not found (see error codes) |
422 | Validation Error (see error codes) |
Examples
curl
curl -X PATCH "https://valara.cloud/api/v1/users/{user_id}/preferences" \
-H "Authorization: Bearer $VALARA_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Idempotency-Key: $(uuidgen)"
Python
import os
import uuid
import httpx
res = httpx.request(
"PATCH",
"https://valara.cloud/api/v1/users/{user_id}/preferences",
headers={
"Authorization": f"Bearer {os.environ['VALARA_API_KEY']}",
"Content-Type": "application/json",
"X-Idempotency-Key": str(uuid.uuid4()),
},
)
res.raise_for_status()
print(res.json())