---
title: "Update a system setting value"
method: PUT
path: "/system/admin/settings/{key}"
tags: ["System Admin"]
---

# Update a system setting value

`PUT /system/admin/settings/{key}`

Persist a new value for :key. Service validates the
rawValue against the registry's declared value_type and
rejects mismatches with 400. SystemAdmin only. Emits an
audit row (action=system.setting_changed) on success.

## Path parameters

- `key` string, required

## Request body

- InternalHandlerUpdateSystemSettingRequest
  - `value` unknown

## Response `200`

the updated row

- GithubComTencentWeKnoraInternalTypesSystemSetting
  - `category` string — Category groups settings in the management UI ("limits", "agent", "auth", ...). Free-form string so adding a new category is a data-only change.
  - `created_at` string
  - `description` string
  - `enum` string[] — Enum is populated by the service layer (NOT persisted) from the in-code registry. Empty/nil means "free-form input"; non-empty means the UI should render a select with these options. Tagged `gorm:"-"` so GORM never tries to read/write the column.
  - `id` integer
  - `is_secret` boolean — IsSecret reserves UI affordances for P3 (mask + reveal-with-confirm). In P1 every row is is_secret=false; service Update accepts the column but does not yet enforce special handling.
  - `key` string
  - `last_modified_by` string
  - `last_modified_by_name` string — LastModifiedByName is a display label resolved from LastModifiedBy (the user's UUID) at handler time — username when available, otherwise email. Empty for virtual rows that were never persisted (LastModifiedBy=""). Not stored: derived per request so renaming a user reflects on the next reload without a backfill job.
  - `requires_restart` boolean — RequiresRestart reserves UI affordances for P3 (banner "this change won't take effect until the next restart"). In P1 the only seeded key is per-request, so always false.
  - `updated_at` string
  - `value` integer[]
  - `value_type` string — ValueType is one of "int", "string", "bool". Service layer rejects updates whose payload type does not match; UI uses it to pick InputNumber vs Input vs Switch.

## Other responses

- `400` — Bad request / unknown key / type mismatch
- `403` — Forbidden: not a system admin

---

[API](https://skmtc.net/tencentblueking/apis/weknora-api.md) · [All operations](https://skmtc.net/tencentblueking/apis/weknora-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tencentblueking/weknora-api/versions/d6921ae22ce0/schema)
