---
title: "Upsert Alert Preferences"
method: PUT
path: "/api/alert-preferences"
tags: ["Alerts"]
---

# Upsert Alert Preferences

`PUT /api/alert-preferences`

## Request

- Base URL: `https://api.kolens.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.kolens.ai/api/alert-preferences`
- Auth: HTTP bearer

## Headers

- `x-kolens-user-id` string, nullable

## Request body

- AlertPreferenceIn: Patch shape for PUT — every field optional. We diff vs the row we already have so partial updates from the settings form don't accidentally clear a sibling field.
  - `email_enabled` boolean, nullable
  - `email_to` string, nullable
  - `webhook_enabled` boolean, nullable
  - `webhook_url` string, nullable
  - `webhook_secret` string, nullable
  - `muted_types` string[], nullable
  - `rate_per_hour` integer, nullable
  - `preferred_locale` string, nullable: BCP-47 tag from the supported set: en | zh-CN | ja
  - `rising_score_threshold` number, nullable
  - `rising_follower_pct` number, nullable
  - `rising_follower_delta` integer, nullable
  - `rising_view_growth_pct` number, nullable
  - `rising_lookback_days` integer, nullable

## Response `200`

Successful Response

- AlertPreferenceOut
  - `email_enabled` boolean, required
  - `email_to` string, nullable
  - `webhook_enabled` boolean, required
  - `webhook_url` string, nullable
  - `webhook_secret` string, nullable
  - `muted_types` string[]
  - `rate_per_hour` integer, required
  - `preferred_locale` string, nullable
  - `supported_locales` string[]
  - `rising_score_threshold` number, nullable
  - `rising_follower_pct` number, nullable
  - `rising_follower_delta` integer, nullable
  - `rising_view_growth_pct` number, nullable
  - `rising_lookback_days` integer, nullable
  - `threshold_defaults` AlertThresholdDefaults: The global config defaults for the configurable rising_kol thresholds (#661). Echoed alongside the per-user overrides so the settings UI can show "default: 5%" placeholders and reset-to-default affordances without hardcoding the numbers in the frontend.
    - `rising_follower_pct` number, required
    - `rising_follower_delta` integer, required
    - `rising_view_growth_pct` number, required
    - `rising_lookback_days` integer, required
    - `rising_score_threshold` number, nullable
  - `last_delivered_at` string, nullable
  - `last_email_error` string, nullable
  - `last_webhook_error` string, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/kolens/apis/kolens-api.md) · [All operations](https://skmtc.dev/kolens/apis/kolens-api/llms.txt) · [OpenAPI document](https://skmtc.dev/kolens/apis/kolens-api/revisions/5d6865ab0a24?raw)
