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.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 lettr 1.5.1
File Size Uploaded
lettr-1.5.1.tar.gz 48.3 kB Details

Built distribution (wheel)

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

Total release size: 82.1 kB

Release files / lettr-1.5.1.tar.gz

Download URL lettr-1.5.1.tar.gz
Size 48.3 kB
Tags Source
SHA-256 checksum
How to use checksums
eb134ef6d76c83ec2d338fe013626e17dabce52b7bf5084a52bff25efbafd40b
BLAKE2b-256 checksum
How to use checksums
d277f64d0ae0768e7f655cd093e35b1c0114ddeba24cfa4fde4dced263d19261
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 15, 2026.

Transparency log

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

Download URL lettr-1.5.1-py3-none-any.whl
Size 33.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b7d0846c966c373054c46d00d34b2800421479b0348818cf31e2e5d7a2b61ac9
BLAKE2b-256 checksum
How to use checksums
09a7eda24c768ad01078ad9ed3f1e3a4e9dfa360431d8cba0ad2e28b2a9a6ca5
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 15, 2026.

Transparency log

Release history Release notifications | RSS feed

1.7.0

2 release files

1.6.0

2 release files

This release

1.5.1 This release

2 release files

1.5.0

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