POST
/
api
/
auth
/
api-keys
创建新的 API Key
curl --request POST \
  --url https://wfapi.yuhe.space/api/auth/api-keys \
  --header 'Content-Type: application/json' \
  --cookie workflow_auth_session= \
  --data '
{
  "name": "<string>",
  "expiresAt": "2023-11-07T05:31:56Z",
  "source": "<string>",
  "scopes": [
    "<string>"
  ]
}
'
{
  "errCode": 123,
  "errMessage": "<string>",
  "data": {
    "apiKey": {
      "id": "<string>",
      "userId": "<string>",
      "name": "<string>",
      "prefix": "<string>",
      "source": "<string>",
      "scopes": [
        "<string>"
      ],
      "createdAt": "2023-11-07T05:31:56Z",
      "createdByUserId": "<string>",
      "expiresAt": "2023-11-07T05:31:56Z",
      "revokedAt": "2023-11-07T05:31:56Z",
      "lastUsedAt": "2023-11-07T05:31:56Z",
      "lastUsedIp": "<string>",
      "userAgent": "<string>"
    },
    "token": "<string>"
  }
}

Authorizations

workflow_auth_session
string
cookie
required

通过密码登录或管理员密钥登录建立的 httpOnly 浏览器会话。

Body

application/json
name
string
required
expiresAt
string<date-time>
source
string
scopes
string[]

Response

返回新的 API Key 记录和只显示一次的明文 token。

errCode
integer
required
errMessage
string
required
Allowed value: ""
data
object
required