MCP-native for Cursor, Claude Code, and Windsurf
SDK

Python
SDK

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 posthawkposthawk
Simple API

Send emails with
five lines of code

Initialize the client, call send, and check the result. Every method returns a PosthawkResponse with .data and .error.

Python
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)
Error Handling
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}")
Result Pattern

No try/except
needed

SDK methods never raise exceptions for API errors. Check result.error first, then access result.data safely.

Scheduling

Schedule, cancel,
and send now

Send later by adding scheduled_for. Full management API to list, cancel, reschedule, or send immediately with send_now.

Python
# 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")# Send a scheduled email immediatelyclient.scheduled.send_now("id")
Python
# Create a newsletterresult = client.newsletters.create(    slug="weekly-digest",    name="Weekly Digest",    double_opt_in=True,)nl_id = result.data.id# Add a subscriberclient.newsletters.add_subscriber(    nl_id,    email="user@example.com",    name="Alex",)# Create and send an issueissue = client.newsletters.create_issue(    nl_id,    subject="Issue #1: Getting Started",    html="<h1>Welcome!</h1><p>Your first issue.</p>",)client.newsletters.send_issue(nl_id, issue.data.id)
Newsletters

Publish issues,
manage subscribers

Full newsletter management API: create newsletters, add subscribers, draft issues, and send to all active subscribers in one call.

Scale & deliverability

Batch sends &
a clean list

Queue up to 100 emails in one call with emails.batch, and manage the suppression list with suppressions so bounced and complained addresses never get hit again.

Python
# Send up to 100 emails in a single callresult = client.emails.batch([    {"from_email": "hi@you.com", "to": "a@example.com", "subject": "Hi", "html": "<p>One</p>"},    {"from_email": "hi@you.com", "to": "b@example.com", "subject": "Hi", "template_id": "t_welcome"},])print(result.data.queued, result.data.failed)# Keep your sender reputation cleanclient.suppressions.create(email="bounced@example.com")result = client.suppressions.list()
Complete coverage

One client,
the whole API

Every Posthawk endpoint is a typed method on the client — no raw HTTP, no guessing at shapes.

client.emails

send · get · batch

client.scheduled

list · get · cancel · reschedule · send_now

client.broadcasts

create · list · send · cancel

client.newsletters

issues · subscribers · CRUD

client.contacts

list · create · update · import_contacts

client.domains

verify · receiving · update_limits · webhook

client.webhooks

create · update · test · delete

client.suppressions

list · create · delete

client.templates

render

Getting started

Up and running
in minutes

01

Install the package

One command to add Posthawk to your project. Only requires httpx as a dependency.

02

Create a client

Initialize with your API key. The SDK handles auth headers, serialization, and error wrapping.

03

Send your first email

Call client.emails.send() with your content. Get back a typed dataclass with delivery status.

Dataclass Responses

Every response is a typed dataclass with .data and .error attributes. Full IDE autocomplete out of the box.

httpx Powered

Built on httpx with connection pooling and a 30s timeout. Context manager support for clean resource cleanup.

Schedule Emails

Schedule, list, cancel, and reschedule emails. Accepts datetime objects or ISO 8601 strings.

Never Raises

Every method returns PosthawkResponse with .data and .error — no try/except needed. Only the constructor raises for missing keys.

Start sending emails

Install the SDK and send your first email in under a minute.

Cookie Preferences

I use analytics cookies to understand how you use the site and improve your experience. Privacy Policy