Join the HubClone community
and get access to the augmented documentation experience
- Collaborate on models, datasets and Spaces
- Faster examples with accelerated inference
- Switch between documentation themes
to get started
User access tokens
What are User Access Tokens?
A user access token authenticates you to the Hub from code or the command line. Use it with the client libraries, with the API, or as the password when Git asks for one. Tokens are tied to your account: anything a token does is done as you.
How to manage User Access Tokens?
Open Settings → Access Tokens and click Create new token. Give it a name that says where it will be used.
Token types
| Type | Permissions |
|---|---|
| Fine-grained | Only the scopes and repositories you select |
| Read | Read access to everything you can read |
| Write | Read and write access to everything you can write |
Gated repositories
Gated models and datasets require approval before download. Request access on the repository page; once the owner accepts, any token with read permission can download the files.
How to use User Access Tokens?
from huggingface_hub import login
login(token="hf_xxx") # or set the HF_TOKEN environment variableNever commit a token to a repository or paste it in a public notebook. Leaked tokens found by secrets scanning are revoked automatically.