Skip to content
AI · Secret guide

Leaked Hugging Face Organization API Token: what to do in the first hour

High severityChecked liveLast verified · 5 min read

A Hugging Face organization API token is an older kind of credential that acts for a whole organization on the Hugging Face Hub rather than for one person. Depending on its role, whoever holds it can read the organization’s private models, datasets and Spaces, and, if it allowed writing, replace files in them. Altering a published model or dataset is the worst case, because other people download and run what you publish. Invalidate the token first, then check what was changed.

Check your GitHub account for leaked secrets — free

Provider
HuggingFace
Severity
High
Impact
SaaS account access and billing
Checked live by LeakWatch
Yes

What a Hugging Face organization API token looks like

An organization token starts with api_org_ followed by 34 letters, upper or lower case. It has no digits and no separator:

api_org_…XXXX   organization token (masked, 34 letters after the prefix)

Do not confuse it with the personal user access token, which starts with hf_ and is the current format for tokens people create themselves. The organization format with api_org_ comes from older versions of the Hub; the vendor’s current guidance is built around user tokens with fine-grained permissions, and a person has not confirmed in this guide whether organization tokens can still be created. A token found in old code may therefore be long dead, which is useful to know, but only a live test tells. The usual variable names are HF_TOKEN, HUGGINGFACE_TOKEN and HUGGING_FACE_HUB_TOKEN, and it is sent as an Authorization: Bearer header to huggingface.co.

How Hugging Face organization tokens get leaked

  • Training and inference scripts. A token typed into a notebook or script to download a private model, then committed with it.
  • Notebook outputs. A Jupyter or Colab notebook saved with the token printed in a cell or its output.
  • Spaces and demos. An app whose code or configuration contains the token instead of using the Space’s secret setting.
  • CI and Docker files. A build that downloads private weights and passes the token in a command line or an environment line written in clear text.
  • Old repositories. Because the format is old, forgotten projects and archived forks are a frequent source.
  • Logs and issues. A stack trace or debug output that echoes the Authorization header, pasted into a public issue.

What to do in the first hour

  1. Open your Hugging Face token settings (see the link below) and the organization’s settings, and look for the page that lists tokens. Find the exposed one and invalidate or delete it. If the token no longer appears anywhere, it may already be inactive, but continue with the checks.
  2. Create a replacement with the smallest permission that works: read-only if the job only downloads models, and limited to specific repositories if the options allow it.
  3. Deploy the new token to the application or secret store, then test one download or call.
  4. Check the organization’s activity. Review the commit history of every private model, dataset and Space of the organization for commits you did not make, and look at the organization’s audit or activity view if your plan offers one.
  5. Check what could have been added. Look for new repositories, changed visibility, new members or tokens, new webhooks and changed Space secrets.
  6. Restore anything altered. If a model file, a dataset or a Space was modified, revert to a commit you trust, and warn the people who downloaded it if it was public.
  7. Rotate what the repositories hold. Spaces and datasets often contain other keys. Rotate them and clean the code. See I accidentally pushed an API key to GitHub.

Not sure what else leaked from the same repository? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at Hugging Face

Hugging Face tokens are managed in the access tokens area of your Hugging Face account settings, after you sign in as a user who is allowed to manage the organization. Select the exposed token and delete or invalidate it. For an organization-level credential, also look at the settings of the organization itself for a list of tokens and members. A person has not confirmed the exact menu wording for this guide, and the interface changes, so look for the section where tokens are listed, and follow the Hugging Face documentation on security tokens on security tokens.

How LeakWatch detects it

The rule is called HuggingFace Organization API Token. It looks for api_org_ at a word boundary, followed by exactly 34 letters in either case, and then a delimiter: a backtick, a quote, a space or line break, a semicolon, a literal \n or \r, or the end of the text. A body that is shorter, longer, or contains digits is not reported. The severity is high.

LeakWatch can check whether a detected key is still active with a read-only request to HuggingFace. It never reads your data or spends your credits.

This type is checked live. LeakWatch sends one read-only request to the Hugging Face account-information endpoint (whoami-v2) with the token as a bearer credential. A successful answer means the token is live, and LeakWatch keeps the account name, email and organization names that the answer returns, never the token echoed back. A 401 answer means the token is invalid. A 429 answer means the check was rate-limited and is not conclusive, and any other answer is recorded as an error rather than a result.

FAQ

Is an api_org_ token the same as an hf_ token?

No. The hf_ prefix is for user access tokens, the current format. The api_org_ format is older and tied to an organization. Both are checked the same way by LeakWatch, but you manage them in different places.

The live check says my token is invalid. Can I stop?

Not entirely. An invalid token cannot be used, but you should still check the organization’s recent commits and settings, since it may have been used before it was deactivated.

Could someone have changed a public model with this token?

If the token had write access, yes. Check the commit history of each repository, and revert and announce any change you did not make.

Get alerted next time a secret leaks — create a free account

LeakWatch is not affiliated with HuggingFace.