Keys / PyPI

PYPI_API_TOKEN

A PyPI API token that CI uploads Python packages with. PyPI recommends Trusted Publishing instead where your CI supports it.

Starts with
pypi-
Expires
no expiry setting
API
none; account settings only

Get it

Create one on pypi.org/manage/account/token. The steps aren't recorded yet.

Set it

PYPI_API_TOKEN=pypi-...

No tool reads it by name; pass it to pypa/gh-action-pypi-publish as password, or to Twine as TWINE_PASSWORD. Both use the username __token__. Or keep it out of .env with keypin: keypin run -- npm run dev

Replace it

  1. Add a new API token with the same scope: the whole account or one project.
  2. Deploy it everywhere that reads PYPI_API_TOKEN.
  3. Check that nothing still uses the old token, then remove it in your account settings.

Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.

Sources, checked 2026-11-16