P

PyPI Upload API

REST discovered

Details
URL
https://upload.pypi.org/legacy/
Docs
https://docs.pypi.org/api/upload/
Authentication
PyPI API token api_key discovered Get key ↗
Authorization: Basic <credential>

Sign in to PyPI account settings and create an API token from Add API token. PyPI supports account-scoped and project-scoped tokens. Use the token as the password and the literal username __token__ when uploading with tools like twine.

PyPI Trusted Publisher configuration (OIDC-exchanged short-lived API token) two_step discovered Get key ↗

Configure a Trusted Publisher for your project in PyPI following Getting Started and Adding a Trusted Publisher. In CI, use the recommended `pypi-publish` GitHub Action or another supported provider flow; the CI provider supplies an OIDC token and PyPI exchanges it for a short-lived API token valid for about 15 minutes.