Skip to main content

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, ...).
list_identities(*, status=None, limit=None, cursor=None) GET /v1/identities: the identities this key can use, newest first.
create_key(*, agent_name=None, scope=None, identity_ids=None, permissions=None, expires_at=None) / list_keys() / revoke_key(key_id) Scoped keys for agents: limit a key to specific identities and to read + totp. Needs your full account key. The new key is shown once.
audit(*, identity_id=None, action=None, since=None, until=None, limit=None, cursor=None) GET /v1/audit: who read which code, when, over REST/MCP/dashboard. Codes and bodies are never logged.

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; is_forbidden is true when the key lacks a permission (don't retry with the same key). 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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for humanless 0.1.1
File Size Uploaded Provenance Actions
humanless-0.1.1.tar.gz 20.2 kB Without provenance Details for humanless-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for humanless 0.1.1
File Interpreter ABI Platform Actions
humanless-0.1.1-py3-none-any.whl Python 3 none any Details for humanless-0.1.1-py3-none-any.whl

Total release size: 35.7 kB

Release files / humanless-0.1.1.tar.gz

Download URL humanless-0.1.1.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e1f33606033f9e476edf0f255f9669c595a93a3bdba653114bfc551719a72560
BLAKE2b-256 checksum
How to use checksums
f1891d7a02cbba445b509f1282a9dea980d0d6c176114018c2561a30e64099f9
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.1-py3-none-any.whl

Download URL humanless-0.1.1-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9540476037b58759e7159af3abaa222eba176094d6f710cdb1c2bda75003e2d1
BLAKE2b-256 checksum
How to use checksums
c706acd10f1a8cbb698c131a20aa3d75215674d5bf3aac6bb4c0a618b296612c
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.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page