Skip to content

Reference

Hugging Face

Connect Hugging Face to Alter Vault for secure API access

Use Hugging Face credentials to make authenticated API calls through Alter Vault without exposing API keys in code.

PropertyValue
Provider IDhuggingface
CategoryAI
Credential TypeAccess Token

Log in to Hugging Face

Log in to Hugging Face at huggingface.co.

Navigate to Access Tokens

Navigate to Settings > Access Tokens at huggingface.co/settings/tokens.

Create a token

Click Create new token and choose a role (fine-grained, read, or write).

Copy the token

Copy the token (starts with hf_) — it is only shown once.

Open the Developer Portal

Go to portal.alterauth.com and navigate to the application.

Add Hugging Face

Go to Managed Secrets > Add Provider > Hugging Face.

Enter credentials

Paste your Access Token into the credential field.

Save

Click Save. You’ll receive a grant_id to use with the SDK.

response = await alter_app.request(
HttpMethod.GET,
"https://huggingface.co/api/whoami-v2",
grant_id="YOUR_GRANT_ID",
)

Alter policy rules can target these attested operations and families for operation-level and parameter-aware controls.

Operation IDFamiliesMethodProvider path
get:/api/whoami-v2readGET/api/whoami-v2
post:/api/repos/createwritePOST/api/repos/create
post:/api/repos/movewritePOST/api/repos/move
get:/api/models/{namespace}/{repo}/commits/{rev}readGET/api/models/{namespace}/{repo}/commits/{rev}
get:/api/models/{namespace}/{repo}/refsreadGET/api/models/{namespace}/{repo}/refs
get:/api/models/{namespace}/{repo}/tree/{rev}/{path}readGET/api/models/{namespace}/{repo}/tree/{rev}/{path}
post:/api/models/{namespace}/{repo}/commit/{rev}writePOST/api/models/{namespace}/{repo}/commit/{rev}
post:/api/models/{namespace}/{repo}/branch/{rev}writePOST/api/models/{namespace}/{repo}/branch/{rev}
delete:/api/models/{namespace}/{repo}/branch/{rev}deleteDELETE/api/models/{namespace}/{repo}/branch/{rev}
post:/api/models/{namespace}/{repo}/tag/{rev}writePOST/api/models/{namespace}/{repo}/tag/{rev}
delete:/api/models/{namespace}/{repo}/tag/{rev}deleteDELETE/api/models/{namespace}/{repo}/tag/{rev}
put:/api/models/{namespace}/{repo}/settingsadminPUT/api/models/{namespace}/{repo}/settings
delete:/api/models/{namespace}/{repo}/lfs-files/{sha}deleteDELETE/api/models/{namespace}/{repo}/lfs-files/{sha}
get:/api/datasets/{namespace}/{repo}/tree/{rev}/{path}readGET/api/datasets/{namespace}/{repo}/tree/{rev}/{path}
post:/api/datasets/{namespace}/{repo}/commit/{rev}writePOST/api/datasets/{namespace}/{repo}/commit/{rev}
delete:/api/datasets/{namespace}/{repo}/branch/{rev}deleteDELETE/api/datasets/{namespace}/{repo}/branch/{rev}
put:/api/datasets/{namespace}/{repo}/settingsadminPUT/api/datasets/{namespace}/{repo}/settings
post:/api/spaces/{namespace}/{repo}/commit/{rev}writePOST/api/spaces/{namespace}/{repo}/commit/{rev}
put:/api/spaces/{namespace}/{repo}/settingsadminPUT/api/spaces/{namespace}/{repo}/settings
get:/api/spaces/{namespace}/{repo}/secretsreadGET/api/spaces/{namespace}/{repo}/secrets
post:/api/spaces/{namespace}/{repo}/secretsadminPOST/api/spaces/{namespace}/{repo}/secrets
delete:/api/spaces/{namespace}/{repo}/secretsadmin, deleteDELETE/api/spaces/{namespace}/{repo}/secrets
get:/api/spaces/{namespace}/{repo}/variablesreadGET/api/spaces/{namespace}/{repo}/variables
post:/api/spaces/{namespace}/{repo}/variableswritePOST/api/spaces/{namespace}/{repo}/variables
delete:/api/spaces/{namespace}/{repo}/variablesdeleteDELETE/api/spaces/{namespace}/{repo}/variables
get:/api/collectionsreadGET/api/collections
get:/api/collections/{namespace}/{slug}readGET/api/collections/{namespace}/{slug}
post:/api/collectionswritePOST/api/collections
patch:/api/collections/{namespace}/{slug}writePATCH/api/collections/{namespace}/{slug}
delete:/api/collections/{namespace}/{slug}deleteDELETE/api/collections/{namespace}/{slug}
post:/api/collections/{namespace}/{slug}/itemswritePOST/api/collections/{namespace}/{slug}/items

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.