GET /api/private/v1/customers
分页查询当前项目中的客户列表。
查询参数
| 参数 | 类型 | 说明 |
|---|---|---|
page | number | 页码,默认 1 |
pageSize | number | 每页条数,默认 10,最大 100 |
search | string | 按用户名或任意标识值模糊搜索 |
成功响应
{
"ok": true,
"requestId": "req_123",
"data": {
"data": [
{
"id": 1,
"username": "customer_001",
"projectId": "clx_project",
"enabled": true,
"temporary": false,
"identifiers": [
{ "id": 11, "type": "email", "value": "user@example.com" },
{ "id": 10, "type": "username", "value": "customer_001" }
],
"createdAt": "2026-03-01T00:00:00.000Z",
"updatedAt": "2026-03-01T00:00:00.000Z"
}
],
"total": 1,
"page": 1,
"pageSize": 10,
"totalPages": 1
}
}
POST /api/private/v1/customers
创建客户,并自动分配当前项目下所有免费套餐。
请求体
{
"username": "customer_001",
"enabled": true,
"password": "secret",
"identifiers": [
{ "type": "email", "value": "user@example.com" },
{ "type": "external_user_id", "value": "u_1001" }
]
}
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
username | string | 是 | 8 到 16 位 |
enabled | boolean | 否 | 默认 true |
password | string | 否 | 创建密码凭证 |
identifiers | array | 否 | 额外客户标识列表,username 系统标识会自动镜像生成 |
identifiers[].type | string | 是 | 标识类型,如 email、external_user_id,最大 16 个字符 |
identifiers[].value | string | 是 | 标识值,最大 128 个字符 |
成功响应
{
"ok": true,
"requestId": "req_124",
"data": {
"id": 2,
"username": "customer_002",
"projectId": "clx_project",
"enabled": true,
"temporary": false,
"identifiers": [
{ "id": 13, "type": "external_user_id", "value": "u_1002" },
{ "id": 12, "type": "username", "value": "customer_002" }
],
"createdAt": "2026-03-21T00:00:00.000Z",
"updatedAt": "2026-03-21T00:00:00.000Z"
}
}
HTTP 状态码为 201。创建成功后,系统会自动为该客户分配当前项目下所有免费套餐。