Get a Consumer
GET /apisix/admin/consumers/{username}
GET /apisix/admin/consumers/{username}Interactive request editor loads with JavaScript.
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
Path Parameters
username*string
Consumer username.
Match
^[a-zA-Z0-9_\-]+$Length
1 <= length <= 256Response Body
application/json
application/json
application/json
curl -X GET "http://127.0.0.1:9180/apisix/admin/consumers/jack"Successful response.
{
"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
}**Unauthorized** — The API key is missing, invalid, or lacks permission.
{
"error_msg": "failed to check token",
"description": "missing apikey"
}{
"error_msg": "failed to check token",
"description": "wrong apikey"
}{
"error_msg": "failed to check token",
"description": "invalid method for role viewer"
}Key not found
{
"error_msg": "Key not found"
}Complete operation details and schema variants
GET /apisix/admin/consumers/{username}
Get a Consumer
Retrieve a single consumer by username.
Parameters
username(path, string, required): Consumer username.
Responses
200: Successful response.key(string, required):value(object, required): Consumer configuration. Represents an API user or application with authentication credentials and plugin policies.value.username(string, required): Unique username for the consumer. Only alphanumeric characters, hyphens, and underscores are allowed.value.desc(string, optional): Description of this consumer.value.labels(object, optional): Key-value pairs for categorizing and filtering resources. Values must be non-empty strings (max 256 characters).value.create_time(integer, optional): Unix timestamp of creation. Read-only.value.update_time(integer, optional): Unix timestamp of last update. Read-only.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
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.
createdIndex(integer, optional):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.404: Not Found — The specified resource does not exist.error_msg(string, required): Error message indicating the resource was not found.
cURL
curl -X GET 'http://127.0.0.1:9180/apisix/admin/consumers/{username}'