API7 Docs

List all consumer credentials on a gateway group

GET /apisix/admin/consumers/{username}/credentials

GET /apisix/admin/consumers/{username}/credentials

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

In: header

Path Parameters

username*string

The unique identifier of the consumer.

Match^[a-zA-Z0-9_\-]+$
Length1 <= length <= 512

Query Parameters

plugin_name?string

the plugin name of the consumer credential.

Length1 <= length <= 100
gateway_group_id*string

Gateway group ID. Optional when using the gateway group admin key to authenticate.

Length1 <= length
page?integer

Page number of the listed resources. Used together with page_size. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.

Formatint32
Range1 <= value
page_size?integer

Number of resources listed per page. Used together with page. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.

Formatint32
Range1 <= value
direction?string

Order to list the resources by. The sorting index follows the configuration of order_by.

Default"desc"

Value in

  • "asc"
  • "desc"
order_by?string

Index to order consumers by.

Default"updated_at"

Value in

  • "created_at"
  • "updated_at"
  • "name"
search?string

Condition to search resources by.

labels?string

Label(s) to filter resources by. The format is labels[key]=value and should be URL-encoded.

Length1 <= length

Response Body

application/json

application/json

curl -X GET "$API_BASE_URL/apisix/admin/consumers/johndoe/credentials?gateway_group_id=86fb9981-d9d2-4555-9df8-91ae92129335&search=version%253Dv2"

Successfully retrieved the paginated list of consumer credentials.

{
  "total": 1,
  "list": [
    {
      "name": "us-west-rsc",
      "plugins": {
        "key-auth": {
          "key": "john-key"
        }
      },
      "desc": "Object description.",
      "labels": {
        "version": "v2",
        "env": "prod"
      },
      "id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
      "created_at": 1742288232,
      "updated_at": 1742288235
    }
  ]
}
Complete operation details and schema variants

GET /apisix/admin/consumers/{username}/credentials

List all consumer credentials on a gateway group

IAM Action: gateway:GetConsumerCredential, Resource: arn:api7:gateway:gatewaygroup/%s/consumer/%s

Parameters

  • username (path, string, required): The unique identifier of the consumer.
  • plugin_name (query, string, optional): the plugin name of the consumer credential.
  • gateway_group_id (query, string, required): Gateway group ID. Optional when using the gateway group admin key to authenticate.
  • page (query, integer, optional): Page number of the listed resources. Used together with page_size. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.
  • page_size (query, integer, optional): Number of resources listed per page. Used together with page. For example, when there are 13 resources in total, if the query parameters are page=1&page_size=10, the GET response will show the route total as 13 and display 10 resources in the first page. If the query parameters are page=2&page_size=10, the GET response will show the route total as 13 and display 3 resources in the second page.
  • direction (query, string, optional): Order to list the resources by. The sorting index follows the configuration of order_by.
  • order_by (query, string, optional): Index to order consumers by.
  • search (query, string, optional): Condition to search resources by.
  • labels (query, string, optional): Label(s) to filter resources by. The format is labels[key]=value and should be URL-encoded.

Responses

  • 200: Successfully retrieved the paginated list of consumer credentials.
  • allOf variant 1
  • list (array, optional): An array of resources.
  • total (integer, optional): Total number of objects.
  • allOf variant 2
  • list (array, optional): An array of consumer credentials.
  • allOf variant 1
  • list[].name (string, required): The object name.
  • list[].plugins (object, required): Plugin configuration.
  • oneOf variant 1: key-auth
  • list[].plugins.key-auth (object, required): key-auth plugin configurations.
  • list[].plugins.key-auth.key (string, optional): key-auth user key.
  • oneOf variant 2: basic-auth
  • list[].plugins.basic-auth (object, required): basic-auth plugin configurations.
  • list[].plugins.basic-auth.username (string, optional): basic-auth unique username.
  • list[].plugins.basic-auth.password (string, optional): basic-auth user password.
  • oneOf variant 3: hmac-auth
  • list[].plugins.hmac-auth (object, required): hmac-auth plugin configurations.
  • list[].plugins.hmac-auth.key_id (string, optional): hmac-auth key unique identifier.
  • list[].plugins.hmac-auth.secret_key (string, optional): hmac-auth secret key.
  • oneOf variant 4: jwt-auth
  • list[].plugins.jwt-auth (object, required): jwt-auth plugin configurations.
  • list[].plugins.jwt-auth.key (string, optional): jwt-auth key unique identifier.
  • list[].plugins.jwt-auth.secret (string, optional): jwt-auth secret.
  • oneOf variant 5: ldap-auth-advanced
  • list[].plugins.ldap-auth-advanced (object, required): ldap-auth-advanced plugin configurations.
  • list[].plugins.ldap-auth-advanced.user_dn (string, optional): ldap-auth-advanced unique user DN.
  • list[].desc (string, optional): The object description.
  • list[].labels (object, optional): Key-value pairs of labels.
  • allOf variant 2
  • list[].id (string, optional): The object ID.
  • list[].created_at (integer, optional): The object created timestamp.
  • list[].updated_at (integer, optional): The object updated timestamp.
  • 400: Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.
  • value (object, optional): The specific resource.
  • error_msg (string, optional): The error message.

cURL

curl -X GET '$API_BASE_URL/apisix/admin/consumers/{username}/credentials'