In this guide, you’ll learn how to authenticate API requests to HashiCorp Consul by supplying your ACL token in the HTTP header. Consul supports two equivalent header options:Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
- X-Consul-Token
- Authorization: Bearer
Always keep your ACL tokens secure. Never commit them to version control or expose them in public logs.
Header Options Comparison
| Header Option | Syntax |
|---|---|
| X-Consul-Token | X-Consul-Token: <your-acl-token> |
| Authorization: Bearer | Authorization: Bearer <your-acl-token> |
Example 1: Using X-Consul-Token
Example 2: Using Authorization: Bearer
PUT request to the /v1/acl/token endpoint, including:
- The JSON payload from
payload.json - Your ACL token in the request header