---
id: "pypi_token"
kind: "datatype"
status: "draft"
is_pii: false
categories: ["secrets"]
langs: ["common"]
quality: 70
url: "http://registry.apicrafter.io/datatype/pypi_token"
---

# PyPI API token (`pypi_token`)

> **Draft.** Draft records have not been reviewed yet and may be incomplete or wrong; do not treat them as authoritative for legal or compliance decisions.

API token of the Python Package Index, used to upload packages. It is a serialized macaroon with the prefix pypi-; PyPI documents that the part after the prefix is at least 85 characters long. Tokens of pypi.org begin with pypi-AgEIcHlwaS5vcmc. Examples are left out because GitHub push protection rejects token-shaped values, even constructed ones.

- Parent datatype: `access_token`
- Personal data (PII): no
- Categories: Secrets and credentials (passwords, keys, tokens) (secrets)
- Countries: global
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^pypi-[A-Za-z0-9_-]{85,}$
```

## Examples

- `pypi-AgEIcHlwaS5vcmcExampleTokenNotReal` (invalid example) — Too short

## Supported by tools

- `detectsecrets`
- `gitleaks`
- `trufflehog`

## Sources

- doc: <https://docs.pypi.org/api/secrets/>
- other: <https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml>

## Quality

Score 70/100. Missing: examples, mapping (Wikidata, Schema.org, ...), translation.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/pypi_token.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/secrets/pypi_token.yaml>
