All Products
Search
Document Center

API Gateway:QueryConsumerAuthorizationRules

Last Updated:Dec 17, 2025

Queries a list of consumer authentication rules.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
apig:QueryConsumerAuthorizationRulesnone
*All Resources
*
    none
none

Request syntax

GET /v1/authorization-rules HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
apiNameLikestringNo

The API name.

api-xx
pageNumberintegerNo

The number of the page to return.

1
pageSizeintegerNo

The number of entries per page.

10
consumerIdstringNo

The consumer ID.

cs-ct21c16m1hkp64hk6qmg
resourceIdstringNo

The resource ID.

ha-cn-li942gy8p03
resourceTypestringNo

The resource type.

HttpApiRoute
environmentIdstringNo

The environment ID.

env-cpqnr6tlhtgubc***
groupByApibooleanNo

Specifies whether to group the results by API.

true
parentResourceIdstringNo

The parent resource ID.

ha-cn-li942gy8p01
consumerNameLikestringNo

The consumer name.

consumer-xxx

Response parameters

ParameterTypeDescriptionExample
object

The response schema.

requestIdstring

The request ID.

A60EE5CA-1294-532A-9775-8D2FD1C6EFBF
codestring

The status code.

Ok
messagestring

The returned message.

success
dataobject

The response parameters.

totalSizestring

The total number of entries returned.

6
pageNumberinteger

The page number of the returned page.

1
pageSizeinteger

The number of entries per page.

10
itemsarray<object>

The rules.

itemobject

The rule information.

consumerAuthorizationRuleIdstring

The rule ID.

car-csgeka5lhtggrjcprok0
consumerIdstring

The consumer ID.

cs-csheiftlhtgmp0j0hp4g
apiInfoHttpApiApiInfo

The API details.

environmentInfoEnvironmentInfo

The environment information.

gatewayInfoGatewayInfo

The instance information.

resourceIdstring

The resource IDs.

2351944
resourceTypestring

The resource type.

HttpApiRoute
expireStatusstring

The rule status.

InEffect
expireModestring

The expiry mode. Valid values: LongTerm and ShortTerm.

ShortTerm
expireTimestamplong

The time when the rule expires.

172086834548
createTimestamplong

The creation timestamp. Unit: milliseconds.

1719386834548
updateTimestamplong

The update timestamp. Unit: milliseconds.

1719386834548
deployStatusstring

The deployment status of the API in the current environment.

{}
consumerInfoConsumerInfo

The consumer information.

resourceInfoobject

The resource information.

routeHttpRoute

The route.

operationInfoHttpApiOperationInfo

The operation information.

Examples

Sample success responses

JSONformat

{
  "requestId": "A60EE5CA-1294-532A-9775-8D2FD1C6EFBF",
  "code": "Ok",
  "message": "success",
  "data": {
    "totalSize": 6,
    "pageNumber": 1,
    "pageSize": 10,
    "items": [
      {
        "consumerAuthorizationRuleId": "car-csgeka5lhtggrjcprok0",
        "consumerId": "cs-csheiftlhtgmp0j0hp4g",
        "apiInfo": {
          "httpApiId": "api-xxx",
          "name": "test",
          "protocols": [
            "HTTP"
          ],
          "basePath": "/v1",
          "description": "for test only",
          "versionInfo": {
            "enable": true,
            "scheme": "Query",
            "headerName": "my-version",
            "queryName": "myVersion",
            "version": "v1"
          },
          "environments": [
            {
              "environmentId": "env-xxx",
              "backendScene": "SingleService",
              "backendType": "Service",
              "serviceConfigs": [
                {
                  "gatewayServiceId": "gs-xxx",
                  "name": "demo-service",
                  "protocol": "HTTP",
                  "port": 8080,
                  "weight": 100,
                  "version": "v1",
                  "match": {
                    "default": true,
                    "conditions": [
                      {
                        "type": "Query",
                        "key": "color",
                        "value": "gray",
                        "operator": "equal"
                      }
                    ]
                  },
                  "serviceId": "svc-xxx"
                }
              ],
              "customDomains": [
                {
                  "domainId": "d-xxx",
                  "name": "www.example.com",
                  "protocol": "HTTP"
                }
              ],
              "name": "test",
              "alias": "test",
              "gatewayInfo": {
                "gatewayId": "gw-xxx",
                "name": "test"
              },
              "deployStatus": "Deployed",
              "subDomains": [
                {
                  "domainId": "d-xxx",
                  "name": "www.example.com",
                  "protocol": "HTTP",
                  "networkType": "Internet"
                }
              ]
            }
          ],
          "ingressInfo": {
            "sourceId": "src-xxx",
            "ingressClass": "mse",
            "watchNamespace": "default",
            "environmentInfo": {
              "environmentId": "env-xxx"
            },
            "k8sClusterInfo": {
              "clusterId": "ca435c77cba1547cca9311957bcxxxxxx"
            },
            "overrideIngressIp": true
          },
          "type": "Rest",
          "resourceGroupId": "rg-xxx",
          "aiProtocols": [
            "OpenAI/v1"
          ],
          "deployConfigs": [
            {
              "customDomainIds": [
                "d-xxx"
              ],
              "environmentId": "env-xxx",
              "backendScene": "SingleService",
              "serviceConfigs": [
                {
                  "serviceId": "svc-xxx",
                  "weight": 100,
                  "modelNamePattern": "qwen-*",
                  "modelName": "qwen-max"
                }
              ],
              "policyConfigs": [
                {
                  "type": "AiFallback",
                  "enable": true,
                  "aiFallbackConfig": {
                    "serviceIds": [
                      "svc-xxx"
                    ]
                  }
                }
              ],
              "autoDeploy": true
            }
          ],
          "enabelAuth": true,
          "authConfig": {
            "authType": "Jwt",
            "authMode": "NoAuth"
          }
        },
        "environmentInfo": {
          "environmentId": "env-cq7l5s5lhtgi6qasrdc0",
          "name": "test",
          "alias": "test-env",
          "description": "This is a test environment.",
          "gatewayInfo": {
            "gatewayId": "gw-cq7og15lhtgi6qasrj60",
            "name": "apitest-gw",
            "vpcInfo": {
              "vpcId": "vpc-uf664nyle5kh***",
              "name": "test-vpc"
            },
            "engineVersion": "2.0.7"
          },
          "subDomainInfos": [
            {
              "domainId": "d-cpudb0llhtgl2djvq2sg",
              "name": "abc.com",
              "protocol": "HTTP",
              "networkType": "Intranet"
            }
          ],
          "default": false,
          "createTimestamp": 1721116090326,
          "updateTimestamp": 1721116090326,
          "resourceGroupId": "rg-xxxx"
        },
        "gatewayInfo": {
          "gatewayId": "gw-cq7og15lhtgi6qasrj60",
          "name": "apitest-gw",
          "vpcInfo": {
            "vpcId": "vpc-uf664nyle5kh***",
            "name": "test-vpc"
          },
          "engineVersion": "2.0.7"
        },
        "resourceId": 2351944,
        "resourceType": "HttpApiRoute",
        "expireStatus": "InEffect",
        "expireMode": "ShortTerm",
        "expireTimestamp": 172086834548,
        "createTimestamp": 1719386834548,
        "updateTimestamp": 1719386834548,
        "deployStatus": {},
        "consumerInfo": {
          "consumerId": "cs-ctd4l1um1hkph7ki1k80",
          "name": "test",
          "enable": false
        },
        "resourceInfo": {
          "route": {
            "routeId": "",
            "name": "",
            "deployStatus": "",
            "description": "",
            "match": {
              "ignoreUriCase": true,
              "path": {
                "type": "Prefix",
                "value": "/user"
              },
              "headers": [
                {
                  "type": "Exact",
                  "name": "dev",
                  "value": true
                }
              ],
              "methods": [
                "GET"
              ],
              "queryParams": [
                {
                  "type": "Exact",
                  "name": "age",
                  "value": 17
                }
              ]
            },
            "backend": {
              "scene": "Single",
              "services": [
                {
                  "serviceId": "service-cq2bmmdlhtgj***",
                  "name": "item-service",
                  "protocol": "HTTP",
                  "port": 0,
                  "weight": 49,
                  "version": "v1"
                }
              ]
            },
            "domainInfos": [
              {
                "domainId": "",
                "name": "",
                "protocol": ""
              }
            ],
            "environmentInfo": {
              "environmentId": "",
              "name": "",
              "alias": "",
              "gatewayInfo": {
                "gatewayId": "",
                "name": ""
              },
              "subDomains": [
                {
                  "domainId": "",
                  "name": "",
                  "protocol": "",
                  "networkType": "Internet"
                }
              ]
            },
            "createTimestamp": 0,
            "updateTimestamp": 0
          },
          "operationInfo": {
            "operationId": "op-xxx",
            "method": "GET",
            "name": "GetUserInfo",
            "path": "/user/123",
            "description": "A example operation.",
            "response": {
              "contentType": "application/json",
              "items": [
                {
                  "code": 200,
                  "example": {
                    "result": "ok"
                  },
                  "description": "This is a description.",
                  "jsonSchema": {
                    "type": "object",
                    "required": [
                      "result"
                    ],
                    "properties": {
                      "result": {
                        "type": "string",
                        "description": "This is a description."
                      }
                    }
                  }
                }
              ]
            },
            "request": {
              "headerParameters": [
                {
                  "name": "userId",
                  "required": true,
                  "type": "String",
                  "defaultValue": 123,
                  "exampleValue": 123,
                  "description": "The example description."
                }
              ],
              "queryParameters": [
                {
                  "name": "userId",
                  "required": true,
                  "type": "String",
                  "defaultValue": 123,
                  "exampleValue": 123,
                  "description": "The example description."
                }
              ],
              "pathParameters": [
                {
                  "name": "userId",
                  "required": true,
                  "type": "String",
                  "defaultValue": 123,
                  "exampleValue": 123,
                  "description": "The example description."
                }
              ],
              "body": {
                "description": "This is a description.",
                "example": {
                  "result": "ok"
                },
                "contentType": "application/json",
                "jsonSchema": {
                  "type": "object",
                  "required": [
                    "result"
                  ],
                  "properties": {
                    "result": {
                      "type": "string",
                      "description": "Operation result. 'ok' indicates success."
                    }
                  }
                }
              }
            },
            "mock": {
              "enable": false,
              "responseCode": 200,
              "responseContent": "Mock content."
            },
            "createTimestamp": 1719386834548,
            "enableAuth": true,
            "authConfig": {
              "authType": "Jwt",
              "authMode": "NoAuth"
            }
          }
        }
      }
    ]
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2025-07-24The request parameters of the API has changedView Change Details