hf auth token prints the current token
Introduced 2026-04-16 · score 0.99
HOW TO USE IT
When you need the current Hugging Face token for a whoami-v2 request, pipe `hf auth token` into curl with a Bearer authorization header.
hf auth token | xargs -I {} curl -H "Authorization: Bearer {}" https://huggingface.co/api/whoami-v2WHY THIS HELPS
Use the current Hugging Face token in a command that queries the whoami endpoint.
REQUIREMENTS AND LIMITATIONS
- Version: v1.11.0
- hf auth token (required): Prints the current access token to stdout; has no documented options beyond --help.
- Authorization: Bearer {} (required): Passes the token from `hf auth token` as the request's Bearer credential.
- https://huggingface.co/api/whoami-v2 (required): Request URL shown in the release-note example.
- Prerequisite: Be logged in with a stored token; otherwise `hf auth token` errors and directs you to run `hf auth login` first.
FIRST-PARTY EVIDENCE
- https://github.com/huggingface/huggingface_hub/releases/tag/v1.11.0
- https://github.com/huggingface/huggingface_hub/blob/v1.11.0/docs/source/en/package_reference/cli.md
- https://github.com/huggingface/huggingface_hub/blob/v1.11.0/src/huggingface_hub/cli/auth.py
Check the installed version and the source before using it. Entry JSON