humanless
Humanless is a verification inbox API for E2E tests and AI agents: it gives each test a disposable email inbox (and TOTP secret) and returns the parsed OTP code or magic link the moment it arrives.
Use Humanless only for apps you own or are authorized to test. Never use it to bypass verification on third-party services or to create accounts in bulk.
The official Python SDK. Python 3.9+, one dependency (httpx). Sync and async clients, plus pytest fixtures.
pip install humanless # or: pip install "humanless[pytest]"
Get an API key at https://api.usehumanless.com/app (credits from $20, no subscription; see pricing) and set HUMANLESS_API_KEY.
Quickstart
from humanless import Humanless, now_ms
hl = Humanless() # reads HUMANLESS_API_KEY
with hl.with_identity(channels=["email"]) as idn:
since = now_ms() # just before your app sends the code
# ...make your app send a code to idn["email"]...
msg = hl.wait_for_code(idn["identity_id"], since=since)
print(msg["code"])
# the identity is deleted here, pass or fail
Playwright example (your app on localhost)
from playwright.sync_api import Page, expect
from humanless import Humanless, now_ms
hl = Humanless()
def test_sign_up_with_an_email_code(page: Page):
with hl.with_identity(channels=["email"]) as idn:
page.goto("http://localhost:3000/signup")
page.get_by_label("Email").fill(idn["email"])
since = now_ms() # just before the app sends the code
page.get_by_role("button", name="Send code").click()
code = hl.wait_for_code(idn["identity_id"], since=since)["code"]
page.get_by_label("Code").fill(code)
expect(page.get_by_text("Welcome")).to_be_visible()
pytest fixtures
Installing humanless registers pytest fixtures (pip install "humanless[pytest]" pulls in pytest). humanless_identity is a fresh identity for each test, deleted after it, pass or fail:
from humanless import now_ms
def test_sign_up(page, humanless_identity):
page.goto("http://localhost:3000/signup")
page.get_by_label("Email").fill(humanless_identity["email"])
since = now_ms()
page.get_by_role("button", name="Send code").click()
page.get_by_label("Code").fill(humanless_identity.wait_for_code(since=since)["code"])
| Fixture | What it gives you |
|---|---|
humanless |
A configured Humanless client. |
humanless_identity |
A fresh identity with wait_for_code(), wait_for_link(), wait_for_message(), totp() and delete() bound to it. |
new_humanless_identity |
A factory for extra identities (for example inviter and invitee); every one is deleted after the test. |
humanless_identity_options |
Override in a conftest.py to change what humanless_identity creates. Default {"channels": ["email"]}. |
totp() waits for the next code when 3 s or less remain in the 30 s window, so the code is still valid when your app checks it.
Async
from humanless import AsyncHumanless, now_ms
async with AsyncHumanless() as hl:
async with hl.with_identity(channels=["email", "totp"]) as idn:
since = now_ms()
# ...
msg = await hl.wait_for_link(idn["identity_id"], since=since)
totp = await hl.get_totp(idn["identity_id"])
API
| Method | What it does |
|---|---|
Humanless(api_key=None, *, base_url=None, http_client=None) |
Client. api_key defaults to HUMANLESS_API_KEY; base_url defaults to HUMANLESS_BASE_URL or https://api.usehumanless.com. AsyncHumanless takes the same arguments. |
create_identity(channels=None, *, domain=None, ttl_seconds=None) |
POST /v1/identities. channels defaults to ["email"]; add "totp" for 2FA. Lifetime defaults to 1 hour. |
wait_for_code(identity_id, *, since=None, timeout=60, channel="any") |
Next message with an OTP code. Long-polls (push-based); re-polls on 408 until timeout seconds. |
wait_for_link(...) |
Next message with a magic-link url. |
wait_for_message(...) |
Next message of any type (otp, magic_link, raw). Read raw_snippet when nothing was parsed. |
get_totp(identity_id) |
{"code", "seconds_remaining"} for the identity's TOTP secret (30 s period). |
get_identity(identity_id) / delete_identity(identity_id) |
Read / delete (idempotent). |
with_identity(channels=None, ...) |
Context manager: create, yield, always delete. Also humanless.with_identity(hl, ...). |
Responses are plain dicts, typed with TypedDict (Identity, Message, TotpCode).
Errors raise HumanlessError with status, code (for example unauthorized, credits_exhausted, rate_limited, identity_ended), message, retry_after_seconds and details. is_credits_exhausted and is_sms_quota_exceeded check the two 402 cases. A wait that runs out of time raises HumanlessTimeoutError (status 408).
Pass since (Unix ms from now_ms(), or a datetime, taken just before you trigger the send) so the wait is race-free and repeatable.
MCP (for agents driving a browser)
Remote MCP server: https://api.usehumanless.com/mcp (streamable HTTP, Authorization: Bearer $HUMANLESS_API_KEY). Tools: create_verification_identity, wait_for_verification_code, get_totp_code, delete_verification_identity.
claude mcp add --transport http humanless https://api.usehumanless.com/mcp --header "Authorization: Bearer $HUMANLESS_API_KEY"
npx humanless init (from the npm package) writes the equivalent config for Cursor, VS Code, Codex and Windsurf.
SMS (dedicated US numbers) is coming soon; email and TOTP work today.
Docs: https://usehumanless.com/docs · LLM-readable docs: https://usehumanless.com/llms.txt · License: MIT
Metadata
Release files for humanless 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| humanless-0.1.0.tar.gz | 16.7 kB | Without provenance | Details for humanless-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| humanless-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for humanless-0.1.0-py3-none-any.whl |
Total release size: 30.3 kB
Release files / humanless-0.1.0.tar.gz
| Download URL | humanless-0.1.0.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f6fc380cca4282e9afa35be914009cad3ffcee541e8d8f888bad7b5b0b46168
|
|
BLAKE2b-256 checksum How to use checksums |
0ee0c3743311afaf7d79129a419ee94748f56dfb26afdd13016bf01e5f66e43d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Release files / humanless-0.1.0-py3-none-any.whl
| Download URL | humanless-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08cee7654e68b23f01c767a3a02ee18fde99a2d1d8fa6032c2875c31d4cc6e69
|
|
BLAKE2b-256 checksum How to use checksums |
75031728691982c621cc3fef460b55371b165937d6d73d3c4224c202816ad332
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Security for humanless 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.