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.6.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.6.0
File Size Uploaded
lettr-1.6.0.tar.gz 56.1 kB Details

Built distribution (wheel)

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

Total release size: 95.0 kB

Release files / lettr-1.6.0.tar.gz

Download URL lettr-1.6.0.tar.gz
Size 56.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5ef218a6465cb05bb65b9cefe340631b6b9bd9e97dceb86b1e60cd226bb0fe63
BLAKE2b-256 checksum
How to use checksums
26f13ab6c61b50fe518d45eeab21c1048c78b64917fd9ae09fb5f1081dd7cdc1
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 11, 2026.

Transparency log

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

Download URL lettr-1.6.0-py3-none-any.whl
Size 38.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a89ef71099c4f8e108a6350cb7e1394b208e2b82b675e86e974f41b51d18177d
BLAKE2b-256 checksum
How to use checksums
420368fb9e3a359b034edcd003d1e69cd6f7f7d2c546fb7911bb85ccc0169768
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 11, 2026.

Transparency log

Release history Release notifications | RSS feed

1.7.0

2 release files

This release

1.6.0 This release

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