The official Posthawk SDK for Python. Built on httpx with typed dataclass responses and a simple result pattern. Send your first email in under a minute.
$ pip install posthawkposthawkInitialize the client, call send, and check the result. Every method returns a PosthawkResponse with .data and .error.
from posthawk import Posthawkclient = Posthawk("ck_live_...")result = client.emails.send( from_email="hello@yourdomain.com", to="user@example.com", subject="Welcome!", html="<h1>Hello!</h1>",)if result.error: print(result.error.message)else: print("Sent!", result.data.job_id)from posthawk import Posthawkclient = Posthawk("ck_live_...")# Every method returns PosthawkResponseresult = client.emails.send( from_email="hello@yourdomain.com", to="user@example.com", subject="Test", html="<p>Hello</p>",)if result.error: print(f"Error {result.error.status_code}: {result.error.message}")else: print(f"Job ID: {result.data.job_id}") print(f"Status URL: {result.data.status_url}")SDK methods never raise exceptions for API errors. Check result.error first, then access result.data safely.
Send later by adding scheduled_for. Full management API to list, cancel, or change the send time. Accepts datetime objects or ISO strings.
# Schedule for laterfrom datetime import datetime, timedelta, timezoneresult = client.emails.send( from_email="hello@yourdomain.com", to="user@example.com", subject="Reminder", text="Don't forget your meeting!", scheduled_for=datetime.now(timezone.utc) + timedelta(hours=24),)# Manage scheduled emailsresult = client.scheduled.list(status="scheduled")client.scheduled.cancel("id")client.scheduled.reschedule( "id", scheduled_for="2026-04-01T10:00:00Z")One command to add Posthawk to your project. Only requires httpx as a dependency.
Initialize with your API key. The SDK handles auth headers, serialization, and error wrapping.
Call client.emails.send() with your content. Get back a typed dataclass with delivery status.
Every response is a typed dataclass with .data and .error attributes. Full IDE autocomplete out of the box.
Built on httpx with connection pooling and a 30s timeout. Context manager support for clean resource cleanup.
Schedule, list, cancel, and reschedule emails. Accepts datetime objects or ISO 8601 strings.
Every method returns PosthawkResponse with .data and .error — no try/except needed. Only the constructor raises for missing keys.
Install the SDK and send your first email in under a minute.
We use analytics cookies to understand how you use our site and improve your experience. Privacy Policy