Skip to main content

Lettr for Python SDK

The official Python SDK for the Lettr Email API. A clean, typed client for emails, templates, domains, webhooks, audience, and campaigns — methods raise typed exceptions on failure.

Installation

pip install lettr

Quick Start

import lettr

client = lettr.Lettr("lttr_your_api_key")

response = client.emails.send(
    from_email="you@example.com",
    to=["user@example.com"],
    subject="Hello from Lettr!",
    html="<h1>Welcome!</h1>",
)

print(response.request_id)

Use the client as a context manager to close the connection pool automatically:

with lettr.Lettr("lttr_your_api_key") as client:
    client.emails.send(from_email="you@example.com", to=["user@example.com"],
                       subject="Hello!", html="<p>Hello!</p>")

Error Handling

The SDK raises typed exceptions — all subclasses of lettr.LettrError:

try:
    client.emails.send(from_email="you@example.com", to=["user@example.com"],
                       subject="Hello", html="<p>Hello!</p>")
except lettr.ValidationError as e:
    print(e.message, e.errors)
except lettr.LettrError as e:
    print(e.message)

See Error Handling for the full exception hierarchy.

Documentation

Full guides for every resource, with complete request/response details, live in the docs:

📚 docs.lettr.com/quickstart/python

Topic Guide
Install, client setup, sending Quickstart
Async, Django, error handling, type hints Advanced
Manage Lettr templates & merge tags Templates
Add, verify, and manage sending domains Domains
Webhook endpoints for delivery & engagement events Webhooks
Lists, contacts, topics, properties, segments Audience
List, send, and schedule campaigns Campaigns
Flask & FastAPI integration Flask · FastAPI
Endpoint reference (params & schemas) API Reference

Requirements

  • Python 3.8+
  • httpx (installed automatically)

License

MIT

Release files for lettr 1.5.0

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

Source distribution (sdist)

Source distribution for lettr 1.5.0
File Size Uploaded
lettr-1.5.0.tar.gz 48.0 kB Details

Built distribution (wheel)

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

Total release size: 81.8 kB

Release files / lettr-1.5.0.tar.gz

Download URL lettr-1.5.0.tar.gz
Size 48.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d423ba45cd3420b8cad1dc710ac71fdd8bf04d072723d7aeab7995ccddd32f5e
BLAKE2b-256 checksum
How to use checksums
68d9d18b85a7689548663a717c0ee026bc1301e13fd541ccc904bce429da70e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 14, 2026.

Transparency log

Release files / lettr-1.5.0-py3-none-any.whl

Download URL lettr-1.5.0-py3-none-any.whl
Size 33.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e6a43996d87f81b29e9565cb43812e8237fb8977f2b425dd732b2c6819e4f7f
BLAKE2b-256 checksum
How to use checksums
4b843967aa0d4d6e9fbd7629cb7f8e7ed967b9e7d3fc6dca280ef3f6cac81975
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 14, 2026.

Transparency log

Release history Release notifications | RSS feed

1.7.0

2 release files

1.6.0

2 release files

1.5.1

2 release files

This release

1.5.0 This release

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

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