Not publicly available
Note that this API is only available on a case-by-case basis. Please contact admin@pypi.org if you would like to integrate with this API.
Third parties integrate with PyPI to find, identify and revoke API tokens that are accidentally made public. The following partners currently report publicly exposed API tokens to PyPI:
All PyPI users that use API tokens are opted into this by default, and no action is necessary to benefit from this.
This API is for third parties who may find PyPI API tokens and wish to report them to PyPI.
A PyPI API token is a string consisting of a prefix (pypi), a separator (-) and a string representing a Macaroon base64 serialized with PyMacaroon:
pypi-[A-Za-z0-9-_]{85,}The base64 string will not be shorter than 85 characters. A token can be arbitrarily long because we may add arbitrary caveats to the serialized Macaroon.
PyPI has adopted the GitHub secret scanning reporting pattern.
PyPI expects every request to this API to include two headers:
The names of these headers can be arbitrary and should be provided to PyPI at integration time. They will be verified for every request.
PyPI assumes that the signature is an ECDSA signature, and that the digest is SHA-256.
PyPI expects to be able to verify the public key used to sign the request at a URL provided at integration time. This URL structure is arbitrary but should exist at a trusted domain.
Integrating parties should be prepared to provide P-256/384/521 keys, and use SHA-256 only (not SHA-384 or SHA-512, despite those being common with P-384 and P-521 respectively).
The response from a GET request to this URL should return a JSON document with the following example structure:
Note that more providing more than one key is not necessary. PyPI will not accept responses for keys that are not marked as current at the time of disclosure.
Route: POST /_/secrets/disclose-token
Accepts a report of one or more arbitrary API tokens, with details on where it was located. The message body is a JSON array that contains one or more objects, with each object representing a single secret match.
The keys for each secret match are:
Currently the only valid value for type is "pypi_api_token"
Additional fields may be provided but will be ignored.
Example request:
Status codes: