通用能力接口参考API Key 管理创建 API Key

创建 API Key

创建新的 API Key。完整的 API Key 只在响应中返回一次,请立即保存到服务器端。此接口只接受控制台登录凭证。

认证

控制台登录凭证:Authorization: Bearer <登录凭证>。此接口不接受 API Key。

示例中的凭证为占位值,请替换后在服务器端运行。

代码示例

curl -X POST 'https://shixux.com/api/keys' \  -H 'Authorization: Bearer login_credential_placeholder' \  -H 'Content-Type: application/json' \  -d '{"name":"default"}'
{  "id": "example",  "name": "example",  "public_prefix": "example",  "is_active": true,  "last_used_at": "2026-10-06T10:00:00Z",  "created_at": "2026-10-06T10:00:00Z",  "key": "example"}

请求体

application/json
  1. body
name?Name
长度length <= 120
默认"default"

响应体

请求成功

application/json
  1. response
created_at*Created At
格式date-time
id*Id
is_active*Is Active
key*Key
last_used_at*|null
name*Name
public_prefix*Public Prefix

本页目录