# API Token

API Token provides a way to access the Openresty XRay console API.

Need to set the HTTP request header: API-Token: {token}, such as API-Token: efa45ec2de7dfc34271aabbbbdd7266b.

Here is an example (Replace console-host with actual host name or IP address)

curl  -H "API-Token: efa45ec2de7dfc34271aabbbbdd7266b" "https://{console-host}/api/agents?detail=1"

# Generate API Token

Click on the Personal access tokens button in the top right corner.

After filling in the token name and expiration time, click the Generate button.

Click on the Copy button to copy the token to the clipboard. For security purposes the token will only be displayed once, so please take care to save this token.