Obtain a Token from the Dashboard
API7 Gateway uses Dashboard-created tokens for authenticated access. Across the docs, the same token can be used as the X-API-KEY value in API7 Gateway Admin API requests or as ADC_TOKEN when using ADC.
For routine API access, sign in with a non-root user and create a token for that user instead of using the initial Super Admin account.
Prerequisites
Before you begin, ensure you have:
- API7 Gateway is running and the Dashboard is accessible.
- You have a non-root user account with the permissions required for the resources you want to manage.
If you only have the initial administrator account, sign in as Super Admin first to create or invite a user and assign the required role. Then sign in with that user to create the token. For details, see User Management and Role-Based Access Control.
Create a Token in the Dashboard
- Sign in to the Dashboard with your non-root user account.
- In the sidebar, navigate to Organization -> Tokens.
- Click Create Token.
- Enter a name and any other required settings.
- Copy the generated token and store it securely.
Use the Token
Set the token as an environment variable for Admin API examples:
export API_KEY="a7ee-xxxxxxxxxxxxx"
Use it in API7 Gateway Admin API requests:
If you are not running locally, replace localhost with your Dashboard or Admin API host.
curl -k "https://localhost:7443/api/users" -X GET \
-H "X-API-KEY: ${API_KEY}"
You can use the same token for:
- API7 Gateway Admin API requests under
/api/*and/apisix/admin/* - ADC authentication as
ADC_TOKEN
Security Notes
- Treat the token like a password and do not commit it to source control.
- Create separate tokens for different users or automation workflows when possible.
- Revoke tokens you no longer need.