Admin API Key
Admin API keys authenticate requests to the APISIX Admin API. Each key grants either read and write access or read-only access to gateway resources.
Key Requirement and Permissions
Keep Admin API key authentication enabled in production and use strong, unique keys.
The following configuration keeps the default startup-generated admin key and shows how to enable an optional read-only key with an environment variable:
deployment:
admin:
admin_key_required: true
admin_key:
-
name: admin
key: ''
role: admin # read and write access
# - name: viewer
# key: "${{CUSTOM_API_VIEW_KEY}}"
# role: viewer # read-only access
When Admin API key authentication is enabled, each admin_key entry must be an object with an explicit role:
admingrants read and write access.viewergrants read-only access.
If key is present, its value must be a string or YAML null. Quote a key that consists only of digits or resembles a Boolean value so that YAML preserves it as a string.
An admin entry with key: '' tells APISIX to generate a key at startup and write it to the configuration file. A missing or null key, and an empty viewer key, remain unusable. APISIX also rejects a request carrying an empty key.
These entry checks apply to traditional and control-plane configurations, including a traditional deployment where the Admin API listener is disabled. Setting admin_key_required: false skips the checks because it disables Admin API key authentication; do not use it only to preserve an invalid key configuration.
To customize these configurations for your deployment, add the custom configurations to the config.yaml configuration file and reload APISIX for changes to take effect.
Other Admin API Security Options
In addition to setting the Admin API keys, you can also customize other configurations to further secure the Admin API, such as:
- Admin API CORS
- Admin API Access IP whitelist
- Admin API mTLS
For a complete list of configuration options, see config.yaml.example.