Skip to main content

pidgeon

Email for founders, teams and agents. Give each agent its own address beside your team's, on @zurchin.email or your own domain, or give every user of your product inboxes of their own. https://zurchin.com

Version 2 is for the new Pidgeon, now Zurchin. Code written for 1.x (the old email API at /api/v1) keeps working on 1.68.0 until that API is retired.

pip install zurchin

Python 3.10 or later. Depends on cryptography and httpx.

Give an agent an inbox

Everything Email does is under pidgeon.email; each call answers the API's JSON as a dict. Create an inbox, send, and wait for the reply:

from zurchin import Pidgeon

pidgeon = Pidgeon(api_key="pgn_…")
inbox = pidgeon.email.inboxes.create("bookings")  # bookings@pidgeon.email

# Send, with a file:
pdf = pidgeon.email.attachments.upload(inbox["id"], "menu.pdf")
pidgeon.email.messages.send(inbox["id"], to=["ana@example.com"], subject="Table for two",
                            text="Friday at 8?", attachment_ids=[pdf["id"]])

# Wait for the answer (up to 50 seconds a call), then read it cleaned:
got = pidgeon.email.messages.wait(inbox["id"], timeout=50)
for message in got["data"]:
    pidgeon.email.messages.get(message["id"], body="clean")
    pidgeon.email.messages.update(message["id"], seen=True)

# A person looks first:
draft = pidgeon.email.drafts.create(inbox["id"], to=["ana@example.com"], subject="…", text="…")
pidgeon.email.drafts.request_approval(draft["id"])

# Hand a conversation to a person:
thread = pidgeon.email.threads.list(inbox_id=inbox["id"], status="open")["data"][0]
pidgeon.email.threads.update(thread["id"], owner_type="human", status="human_review")

On your own domain, pass domain="example.com" once mail is on for it (pidgeon.email.domains.enable_mail).

Also under pidgeon.email: messages.list, search(q), threads (get, remove, add_label, remove_label), labels, contacts, attachments.upload_large (up to 25 MB: describe, put and complete in one call) and attachments.get, storage(), inboxes.update(hold_suspicious=True), domains (enable_mail, disable_mail, check), app_passwords for mail apps, calendar.events, rules, suppressions, and test_inbound (with a test key, deliver mail to your inbox as if someone sent it).

Errors raise PidgeonError with status, code and message. A PATCH sends only the fields you pass; None clears one that can be cleared (contacts.update(id, notes=None)).

pidgeon.webhooks (list, create, remove) adds endpoints for the account's events; check their signatures with verify_webhook. Also pidgeon.sites and pidgeon.mandates (Sign in with Zurchin), pidgeon.events, pidgeon.pods, and pidgeon.request(method, path, body) for any /v1 call.

For platforms

Give every user of your platform inboxes of their own, white-labelled on their own domain. Each user gets a pod; a key of that pod reaches only its mail.

pod = pidgeon.pods.create("Acme Ltd")
# acme.com is the user's domain, with mail on, in their pod.
inbox = pidgeon.email.inboxes.create("support", pod_id=pod["id"], domain="acme.com")
key = pidgeon.keys.create("Acme", access="send", pod_id=pod["id"])["key"]

Sign in with Zurchin

Agents sign in to websites as themselves, with a key of their own.

Set an agent up

Set an agent up in one call: it is registered, its key is made here, and only the public half is published, in a request signed with the key itself (which is how Zurchin knows you hold it).

made = pidgeon.agents.set_up("Booking agent", "Books tables.")
made.key.private_jwk    # keep it where the agent runs; Pidgeon never sees it

Or by hand: generate_agent_key() (key.kid, key.public_jwk, key.private_jwk), then pidgeon.publish_key(agent_id, key, directory).

Sign its requests

Your agent's page on zurchin.com gives you PIDGEON_AGENT_KEY and PIDGEON_DIRECTORY. Then every request you send through the client is signed:

from zurchin import agent_from_env

with agent_from_env().client() as http:
    http.post("https://shop.example/signup", json={"email": "agent@example.com"})

Or with a key you hold yourself:

from zurchin import signed_client, sign_request

http = signed_client(private_jwk, "https://acme.agents.pidgeon.ai")

# Without httpx: the three headers to add to any request.
headers = sign_request("POST", "https://shop.example/signup", None,
                       private_jwk, "https://acme.agents.pidgeon.ai")

AgentAuth(private_jwk, directory) is the same signer as an httpx.Auth, for a client you already have, sync or async. A signature covers the host, method, path and query, carries a new nonce, and lasts a minute. Zurchin accepts a signature once, so sign again to retry; never resend old signature headers.

An agent's key id is the key's RFC 7638 JWK thumbprint.

Your site

Register it with pidgeon.sites.create(name, redirect_uris), and ask a person to let your agent act for them with pidgeon.mandates.create(…).

People sign in to your site with any OpenID Connect library: the issuer is https://zurchin.com, with the client id and secret you registered. Check an ID token with verify_id_token(id_token, client_id).

An agent signs in with no person present, and sends its ID token with every request it signs:

from zurchin import signed_client
from zurchin.auth import sign_in_as_agent

session = sign_in_as_agent("site_…", key.private_jwk, "https://acme.agents.pidgeon.ai")
shop = signed_client(key.private_jwk, "https://acme.agents.pidgeon.ai",
                     headers={"authorization": f"Bearer {session.id_token}"})

Your site accepts the request only when it is signed with the key the token names, so a copied token is useless on its own:

from zurchin.auth import verify_agent_sign_in, SignInError

claims = verify_agent_sign_in(request.method, request.url, request.headers, "site_…")
claims["sub"], claims["agent"], claims["account"], claims["reputation"]

For an MCP server whose authorization server trusts Zurchin, the agent asks for an ID-JAG and presents it there as a JWT bearer grant:

from zurchin.auth import request_id_jag

id_jag = request_id_jag("https://auth.example.com", "https://agent.example.com/oauth/client.json",
                        key.private_jwk, "https://acme.agents.pidgeon.ai",
                        resource="https://mcp.example.com/mcp")

License

Apache-2.0

Metadata

Release files for zurchin 2.16.2

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

Source distribution (sdist)

Source distribution for zurchin 2.16.2
File Size Uploaded Provenance Actions
zurchin-2.16.2.tar.gz 46.1 kB With provenance Details for zurchin-2.16.2.tar.gz

Built distribution (wheel)

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

Total release size: 83.4 kB

Release files / zurchin-2.16.2.tar.gz

Download URL zurchin-2.16.2.tar.gz
Size 46.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b1fb8310f7c488ed8fe7ee377008fe25902a7daa5b02264e78b73f40c97d6c09
BLAKE2b-256 checksum
How to use checksums
2c28c134bdfa0fd8c1abcc37b141f901d0370f2eb29c2fa3406a489d8c316b18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / zurchin-2.16.2-py3-none-any.whl

Download URL zurchin-2.16.2-py3-none-any.whl
Size 37.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e122023d5036083f05e1a215d731891e72de85e6b8246409bdba565b5e808548
BLAKE2b-256 checksum
How to use checksums
4affa3d36069014e2432544fa8f3c53ece47f6ab8f2c0e5409a1666fab145ed6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for zurchin 2.16.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for zurchin-2.16.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

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.

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