stytch
Stytch python client
What it is and what it does
Stytch is a Python client for Stytch's authentication-as-a-service platform. It wraps Stytch's REST API, letting you add passwordless authentication (email magic links, SMS/WhatsApp passcodes, WebAuthn, TOTPs), OAuth integrations, and session management to Python applications. The library supports both B2C (consumer) and B2B (organization-based) authentication flows.
Responses are fully typed using pydantic, so you get IDE autocomplete and runtime validation. Both sync and async methods are available for every endpoint—append `_async` to any method name to use it with asyncio. The library handles structured error responses through StytchError exceptions, letting you catch and respond to specific error types. It requires Python 3.10 or later and depends on aiohttp, requests, pydantic, and pyjwt for HTTP and JWT handling.
Use it for:
- Add email magic link authentication to a web app without building your own email verification system.
- Implement B2B multi-tenant organization management with member invitations and SSO.
- Integrate OAuth logins (Google, GitHub, etc.) alongside passwordless methods in a single client.
- Build async authentication flows in FastAPI or other async frameworks using the `_async` methods.
- Handle session validation and token refresh for both consumer and enterprise applications.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A Python client library for integrating Stytch's authentication and user infrastructure API into applications, supporting email magic links, OAuth, SMS/WhatsApp passcodes, WebAuthn, sessions, and B2B organization management.
Yes. The library is actively maintained, has no known vulnerabilities, installs cleanly with low friction, and uses a permissive MIT license. Install it if you are building on Stytch's platform and need a typed, well-documented Python client for B2C or B2B authentication flows.
Install
stytch on PyPI
pip
pip install stytchuv
uv add stytchpoetry
poetry add stytchInstalling stytch
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained with a recent release (51 days old) and ongoing repository activity. Depends on four stable, widely-used libraries: aiohttp, requests, pydantic, and pyjwt.
License in practice
MIT license is permissive; you can use, modify, and distribute this library with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install stytch
import stytch
client = stytch.Client(
project_id="project-live-...",
secret="secret-live-...",
)
resp = client.magic_links.email.login_or_create(
email="user@example.com",
login_magic_link_url="https://example.com/auth",
signup_magic_link_url="https://example.com/auth",
)
print(resp)
Requires Python 3.10 or later; you must obtain a Stytch project ID and secret from the Stytch Dashboard.
Verify before relying
- Whether the async methods work correctly with all endpoint types or if there are known limitations.
- Performance characteristics when handling high volumes of authentication requests.
- Whether custom base URL support works reliably across all B2C and B2B endpoints.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — aiohttp, requests, pydantic, pyjwt |
| Maintenance | actively maintained — 51 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 822,595/month — #4,971 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: stytch-15.3.0-py3-none-any.whl
Keywords: stytch, user, authentication
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
descopeDescope SDK provides Python backend access to…
permissive · top 5,000 on PyPI
supabase-authA Python client library for Supabase Auth that…
permissive · top 1,000 on PyPI
django-authlibProvides passwordless authentication for Django…
permissive · top 15,000 on PyPI
django-magiclinkAdds passwordless email-based authentication to…
permissive · top 15,000 on PyPI
propelauth-pyValidates access tokens and manages user…
permissive · top 15,000 on PyPI
Flask-SecurityFlask-Security adds authentication,…
permissive · top 15,000 on PyPI
authyPython client for the Twilio Authy two-factor…
permissive · top 15,000 on PyPI
Flask-Security-TooAdds user authentication, authorization, and…
permissive · top 15,000 on PyPI
PyOTPPyOTP generates and verifies one-time passwords…
permissive · top 1,000 on PyPI
boxsdkProvides a Python client library for…
permissive · top 5,000 on PyPI