更新时间:2026-04-29 GMT+08:00
分享

查询AIAPIKey列表 - ListAiApiKeys

功能介绍

查询AIAPIKey列表。

接口约束

AIAPIKey功能,需要开启白名单后才可以使用。

调用方法

请参见如何调用API

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。

  • 如果使用角色与策略授权,具体权限要求请参见权限和授权项
  • 如果使用身份策略授权,需具备如下身份策略权限。

    授权项

    访问级别

    资源类型(*为必须)

    条件键

    别名

    依赖的授权项

    apig:app:listAiApiKeys

    List

    instance *

    • g:ResourceTag/<tag-key>

    • g:EnterpriseProjectId

    -

    -

URI

GET /v2/{project_id}/apigw/instances/{instance_id}/apps/{app_id}/ai-api-keys

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID,获取方式请参见获取项目ID

instance_id

String

实例ID,在API网关控制台的“实例信息”中获取。

app_id

String

凭据编号

表2 Query参数

参数

是否必选

参数类型

描述

offset

Long

偏移量,表示从此偏移量开始查询,偏移量小于0时,自动转换为0

缺省值:0

limit

Integer

每页显示的条目数量,条目数量小于等于0时,自动转换为20,条目数量大于500时,自动转换为500

最小值:1

最大值:500

缺省值:20

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

size

Integer

本次返回的列表长度

total

Long

满足条件的记录数

ai_api_keys

Array of AiApiKeyBaseInfo objects

AIAPIKey列表,展示匿名化的已经创建的AIAPIKey。

AIAPIKey的创建数量上限可以通过配额调整。

表5 AiApiKeyBaseInfo

参数

参数类型

描述

ai_api_key

String

AIAPIKey值,不指定具体值时,由后台自动生成随机字符串。

支持大小写英文字母、数字,以及+-_/=特殊字符,长度为8~128个字符。

最小长度:8

最大长度:128

alias

String

AIAPIKey的别名。支持大小写字母,数字,下划线,中划线,长度为1~100个字符。

最小长度:1

最大长度:100

app_id

String

凭据编号。

最小长度:32

最大长度:36

create_time

String

创建时间。

id

String

AIAPIKey编号。

最小长度:32

最大长度:36

状态码:400

表6 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

状态码:401

表7 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

状态码:403

表8 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

状态码:404

表9 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

状态码:500

表10 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误描述

请求示例

响应示例

状态码:200

OK

{
  "total" : 2,
  "size" : 2,
  "ai_api_keys" : [ {
    "ai_api_key" : "GjOD3g80AABu*******8LcCcPZN",
    "alias" : "test1",
    "app_id" : "9ed8b7fe84224de681e7d7a5587e76dc",
    "create_time" : "2020-07-24T02:37:24Z",
    "id" : "32dc8ca22d1b4b9cb94022186880576b"
  }, {
    "ai_api_key" : "fdc8d90a301*******13b6f572a",
    "alias" : "test2",
    "app_id" : "9ed8b7fe84224de681e7d7a5587e76dc",
    "create_time" : "2020-07-24T02:31:45Z",
    "id" : "b3d34f746d0847fb95138670e10207ed"
  } ]
}

状态码:400

Bad Request

{
  "error_code" : "APIG.2012",
  "error_msg" : "Invalid parameter value,parameterName:app_id. Please refer to the support documentation"
}

状态码:401

Unauthorized

{
  "error_code" : "APIG.1002",
  "error_msg" : "Incorrect token or token resolution failed"
}

状态码:403

Forbidden

{
  "error_code" : "APIG.1005",
  "error_msg" : "No permissions to request this method"
}

状态码:404

Not Found

{
  "error_code" : "APIG.3004",
  "error_msg" : "App 9ed8b7fe84224de681e7d7a5587e76dc does not exist"
}

状态码:500

Internal Server Error

{
  "error_code" : "APIG.9999",
  "error_msg" : "System error"
}

状态码

状态码

描述

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

错误码

请参见错误码

相关文档