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.7.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.7.0
File Size Uploaded
lettr-1.7.0.tar.gz 60.1 kB Details

Built distribution (wheel)

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

Total release size: 100.5 kB

Release files / lettr-1.7.0.tar.gz

Download URL lettr-1.7.0.tar.gz
Size 60.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d2eb6070acb22bfc2b379c72dcc964f11ba491fe13230d9037c67e543ff6f767
BLAKE2b-256 checksum
How to use checksums
a6ff3fb77773eccb0738b7f4e1efc02069dd7d4067d78089613e9d3682bf5ad9
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 Sep 22, 2026.

Transparency log

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

Download URL lettr-1.7.0-py3-none-any.whl
Size 40.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98d2b927aa4a0ea7a42a10cab444b6ad3922c2502a3d2eef96742df674c93261
BLAKE2b-256 checksum
How to use checksums
7b7338836c3f515f6a3b49dd9c32139ad54c250f6b3e3c0ba5c98dd4cd267fd8
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 Sep 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files

1.6.0

2 release files

1.5.1

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