API7 Docs

List All Consumers

GET /apisix/admin/consumers

GET /apisix/admin/consumers

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

Admin API key configured in config.yaml under deployment.admin.admin_key. You can also pass the key as a query parameter api_key or cookie x_api_key.

In: header

Query Parameters

label?string

Filter list to resources with the given label key.

page?integer

Page number (1-based).

Range1 <= value
Default1
page_size?integer

Items per page (10–500). When omitted, no pagination is applied and the full list is returned.

Range10 <= value <= 500

Response Body

application/json

application/json

curl -X GET "http://127.0.0.1:9180/apisix/admin/consumers?label=env&page=1&page_size=20"

Successful response.

{
  "list": [
    {
      "value": {
        "plugins": {
          "limit-count": {
            "rejected_code": 503,
            "time_window": 60,
            "key": "remote_addr",
            "key_type": "var",
            "count": 2,
            "allow_degradation": false,
            "show_limit_quota_header": true,
            "policy": "local"
          }
        },
        "username": "jack",
        "create_time": 1683164776,
        "update_time": 1684289832
      },
      "key": "/apisix/consumers/jack",
      "modifiedIndex": 119,
      "createdIndex": 17
    }
  ],
  "total": 1
}
Complete operation details and schema variants

GET /apisix/admin/consumers

List All Consumers

Retrieve all configured consumers.

Parameters

  • label (query, string, optional): Filter list to resources with the given label key.
  • page (query, integer, optional): Page number (1-based).
  • page_size (query, integer, optional): Items per page (10–500). When omitted, no pagination is applied and the full list is returned.

Responses

  • 200: Successful response.
  • total (integer, required):
  • list (array, required):
  • list[].key (string, required):
  • list[].value (object, required): Consumer configuration. Represents an API user or application with authentication credentials and plugin policies.
  • list[].value.username (string, required): Unique username for the consumer. Only alphanumeric characters, hyphens, and underscores are allowed.
  • list[].value.desc (string, optional): Description of this consumer.
  • list[].value.labels (object, optional): Key-value pairs for categorizing and filtering resources. Values must be non-empty strings (max 256 characters).
  • list[].value.create_time (integer, optional): Unix timestamp of creation. Read-only.
  • list[].value.update_time (integer, optional): Unix timestamp of last update. Read-only.
  • list[].value.group_id (object, optional): Unique identifier for the resource. Can be a string (1–64 characters, alphanumeric with -, _, .) or a positive integer.
  • anyOf variant 1: String ID
  • anyOf variant 2: Integer ID
  • list[].value.plugins (object, optional): Plugin configurations as a JSON object. Each key is a plugin name, and the value is that plugin's configuration object.

Example:

{
  "limit-count": {
    "count": 100,
    "time_window": 60
  },
  "key-auth": {}
}

See the Plugin Hub for available plugins and their schemas.

  • list[].createdIndex (integer, optional):
  • list[].modifiedIndex (integer, optional):
  • 401: Unauthorized — The API key is missing, invalid, or lacks permission.
  • error_msg (string, required): Authentication error message.
  • description (string, optional): Detailed reason for the authentication failure.

cURL

curl -X GET 'http://127.0.0.1:9180/apisix/admin/consumers'