---
title: "更新空间 API Key 用户身份配置"
method: PUT
path: "/tenants/{id}/api-principal-config"
tags: ["空间管理"]
---

# 更新空间 API Key 用户身份配置

`PUT /tenants/{id}/api-principal-config`

配置 X-API-Key 请求如何映射为终端 Principal（Owner）

## Path parameters

- `id` integer, required

## Request body

- InternalHandlerApiPrincipalConfigRequest
  - `direct_header_name` string
  - `hmac_secret` string
  - `mode` 'tenant' | 'direct_header' | 'signed_token'
  - `require_direct_header` boolean
  - `signed_token_header_name` string

## Response `200`

更新后的配置

- object

## Other responses

- `400` — 请求参数错误
- `403` — 权限不足

## Changes

- **2026-07-14** `1c6aac86ddd1` — 2 info
  - api tag `空间管理` added
  - api tag `租户管理` removed
- **2026-06-30** `6e57a624b011` — 1 info
  - endpoint added
- **2025-12-16** `edf61e68559d` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/tencentblueking/apis/weknora-api/changes/tenants/:id/api-principal-config/put.md)

---

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