全部产品
Search
文档中心

云原生数据库 PolarDB:CreateBatchConsumer - 批量创建网关用户ApiKey

更新时间:Jul 27, 2026

批量创建apikey

接口说明

说明
  • 每个集群最多可以同时存在 3 个手动创建的备份。

  • 若出现错误提示Exceeding the daily backup times of this DB cluster,表明您的集群中已存在 3 个手动创建的备份,请删除备份后再使用该接口。

  • 调用该接口后,会在后台创建备份任务,若数据量较大,花费的时间可能较长,请耐心等待。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求语法

POST  HTTP/1.1

请求参数

名称

类型

必填

描述

示例值

GwClusterId

string

网关实例 ID。

pg-xxxxxxxx

Count

integer

用户 ApiKey 个数。

1

ConsumerGroupId

string

用户组 ID。

cg-xxxxxx

ClientToken

string

用于保证请求的幂等性,防止重复提交请求。由客户端生成该参数值,保证在不同请求间唯一,大小写敏感、不超过 64 个 ASCII 字符。

6000170000591aed949d0f5********************

CreditToken

string

兑换码;传入时走充值型激活分支,count/额度由查库补齐

"9"

Description

string

Consumer 描述前缀

myapp

RegionId

string

地域 ID。

cn-beijing

返回参数

名称

类型

描述

示例值

object

Schema of Response

RequestId

string

Id of the request

A7E6A8FD-C50B-46B2-BA85-D8B8D3******

TotalRecordCount

integer

总记录数。

2

PageRecordCount

integer

本页记录数。

1

PageNumber

integer

查询页码,默认值为 1。

1

PageSize

integer

每页记录数,取值范围如下:

  • 30

  • 50

  • 100

默认值为 30。

30

TotalPages

integer

总页数。

1

Items

array<object>

消费者对象列表

object

消费者对象

ConsumerId

string

用户 ID.

c-mqveroemc***

Name

string

名称

test

ConsumerGroupId

string

用户组 ID。

cg-xxxxxx

ConsumerTag

string

消费者标签。

test

ApiKey

string

完整 APIKey,仅本次返回

xxxxxxxx

GwClusterId

string

网关实例 ID。

pg-xxxxxxxxxx

ApiStatus

string

piKey 状态,默认 Active

Active

ApiKeyStatus

string

API Key 的状态,默认 Active

Active

Status

string

Consumer 状态,默认 Enabled

Enabled

GmtCreated

string

创建时间

2024-10-16 16:46:20

GmtModified

string

更新时间

2026-01-04T16:09:29+08:00

Description

string

应用描述/备注

myapp

ApiKeyMd5

string

API Key 的 MD5

0769a11c2d474f96fbb527f8e273d3de

BudgetPolicyId

string

预算策略 ID(每个 key 独立)

023aacc1effc4b56bb154bfbec6ba9**

BudgetLimit

integer

预算额度(= 单包点数)

3000

BudgetUsed

integer

已用额度

0

ExpireTime

string

到期时间

2025-06-25T09:37:10Z

Active

boolean

是否生效

true

Expired

boolean

是否过期

false

示例

正常返回示例

JSON格式

{
  "RequestId": "A7E6A8FD-C50B-46B2-BA85-D8B8D3******",
  "TotalRecordCount": 2,
  "PageRecordCount": 1,
  "PageNumber": 1,
  "PageSize": 30,
  "TotalPages": 1,
  "Items": [
    {
      "ConsumerId": "c-mqveroemc***",
      "Name": "test",
      "ConsumerGroupId": "cg-xxxxxx",
      "ConsumerTag": "test",
      "ApiKey": "xxxxxxxx",
      "GwClusterId": "pg-xxxxxxxxxx",
      "ApiStatus": "Active",
      "ApiKeyStatus": "Active",
      "Status": "Enabled",
      "GmtCreated": "2024-10-16 16:46:20\n",
      "GmtModified": "2026-01-04T16:09:29+08:00",
      "Description": "myapp",
      "ApiKeyMd5": "0769a11c2d474f96fbb527f8e273d3de",
      "BudgetPolicyId": "023aacc1effc4b56bb154bfbec6ba9**",
      "BudgetLimit": 3000,
      "BudgetUsed": 0,
      "ExpireTime": "2025-06-25T09:37:10Z",
      "Active": true,
      "Expired": false
    }
  ]
}

错误码

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情