API7 Docs

Get a Credential

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

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

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

Path Parameters

username*string

Consumer username.

Match^[a-zA-Z0-9_\-]+$
Length1 <= length <= 256
id*string

Unique identifier of the resource. Can be a string (alphanumeric, -, _, .) or a positive integer.

Response Body

application/json

application/json

curl -X GET "http://127.0.0.1:9180/apisix/admin/consumers/jack/credentials/my-resource-1"

Successful response.

{
  "total": 1,
  "list": [
    {
      "key": "/apisix/consumers/john/credentials/cred-john-basic-auth",
      "value": {
        "update_time": 1725991529,
        "id": "cred-john-basic-auth",
        "plugins": {
          "basic-auth": {
            "password": "john-pass",
            "username": "john-key"
          }
        },
        "create_time": 1725991529
      },
      "createdIndex": 42,
      "modifiedIndex": 42
    }
  ]
}
Complete operation details and schema variants

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

Get a Credential

Retrieve a specific credential for a consumer.

Parameters

  • username (path, string, required): Consumer username.
  • id (path, string, required): Unique identifier of the resource. Can be a string (alphanumeric, -, _, .) or a positive integer.

Responses

  • 200: Successful response.
  • total (integer, required):
  • list (array, required):
  • list[].key (string, required):
  • list[].value (object, required): Credential configuration. Stores exactly one authentication plugin for a consumer.
  • list[].value.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.name (string, optional): Human-readable name.
  • list[].value.desc (string, optional): Description of this credential.
  • 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.plugins (object, optional): Exactly one authentication plugin configuration (e.g., key-auth, basic-auth, jwt-auth).
  • 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/{username}/credentials/{id}'