创建上下文数据库成员
接口说明
创建成员;当 GenerateInitialKey=true 时同时签发首把 API Key,并在响应中返回明文 ApiKey(敏感字段,仅此一次返回,请妥善保存)。创建成功后可通过 List / Get 查询成员及其名下 API Key 的元数据。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求语法
GET / HTTP/1.1
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| WorkspaceId |
string |
是 |
业务空间 ID |
ws-as1llqmkol**** |
| MemberName |
string |
是 |
成员名称 |
Alice |
| Role |
string |
是 |
成员角色,取值:owner / admin / member |
member |
| GenerateInitialKey |
boolean |
否 |
是否在创建成员的同时签发首把 API Key,默认 false |
true |
| InitialKeyName |
string |
否 |
首把 API Key 名称,仅当 GenerateInitialKey=true 时生效 |
my-key |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
创建成功 |
||
| RequestId |
string |
请求 ID |
FE9C65D7-930F-57A5-A207-8C396329**** |
| Member |
object |
成员信息 |
|
| MemberId |
string |
成员 ID |
mb-cz51tnnp8**** |
| MemberName |
string |
成员名称 |
Alice |
| Role |
string |
成员角色 |
admin |
| Status |
string |
成员状态 |
active |
| CreatedAt |
string |
创建时间 |
2026-05-28T17:59:55Z |
| Keys |
array<object> |
API KEY 列表 |
|
|
object |
API KEY 列表 |
||
| KeyId |
integer |
密钥 ID,由服务端生成,吊销 API Key 时以该 ID 定位 |
1 |
| Name |
string |
Api Key 名称 |
my-key |
| Description |
string |
Api Key 描述,该字段不使用 |
111 |
| KeyPrefix |
string |
API Key 的前缀 |
ctxdb- |
| KeyDisplaySuffix |
string |
API Key 的后缀 |
33631c |
| Status |
string |
Api Key 状态 |
active |
| CreatedAt |
string |
创建时间 |
2026-05-28T17:59:55Z |
| LastUsedAt |
string |
该字段为空 |
(null) |
| ExpiresAt |
string |
该字段为空 |
(null) |
| RevokedAt |
string |
该字段为空 |
(null) |
| ApiKey |
string |
明文 API Key。仅当 GenerateInitialKey=true 时返回,仅此一次返回明文,请妥善保存。 |
ctxdb-***** |
示例
正常返回示例
JSON格式
{
"RequestId": "FE9C65D7-930F-57A5-A207-8C396329****",
"Member": {
"MemberId": "mb-cz51tnnp8****",
"MemberName": "Alice",
"Role": "admin",
"Status": "active",
"CreatedAt": "2026-05-28T17:59:55Z",
"Keys": [
{
"KeyId": 1,
"Name": "my-key",
"Description": "111",
"KeyPrefix": "ctxdb-",
"KeyDisplaySuffix": "33631c",
"Status": "active",
"CreatedAt": "2026-05-28T17:59:55Z",
"LastUsedAt": "(null)",
"ExpiresAt": "(null)",
"RevokedAt": "(null)"
}
]
},
"ApiKey": "ctxdb-*****"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidParameter | Request parameter is invalid. | |
| 401 | Unauthorized | Unauthorized. | |
| 500 | InternalError | Internal server error. | |
| 403 | NoPermission | Permission denied. | |
| 502 | UpstreamError | Upstream service returned an error. | |
| 404 | ResourceNotFound | Resource not found. | |
| 409 | ResourceAlreadyExists | Resource state conflict. |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。