sendflit package. It has no runtime dependencies. It uses the standard library for HTTP, so it works anywhere Python 3.9 or later runs.
Looking for another language? See the SDK overview.
Install
Create a client
The client is synchronous. Each call blocks until the API responds.
Send an email
send takes keyword arguments. Use from_ for the sender, because from is a reserved word in Python.
send returns the stored email as a dictionary. Its id is what you use to look up or cancel the email later.
Arguments you can pass:
Send with a template
Attachments
Each attachment is a dictionary with afilename, a content, and an optional content_type. Pass content as str or bytes. The SDK base64-encodes it for you.
- Up to 10 attachments per message.
- Up to 10 MB per attachment. Larger files are rejected with
422.
Safe retries with idempotency keys
If a request times out, you can’t tell whether the server sent the email. Pass anidempotency_key so a retry can’t send it twice.
409. That means your code has a bug, so generate a new key for a new email. For the full rules, see Idempotency.
Send a batch
batch sends up to 100 emails in one request. It takes a list of dictionaries, each with the same keys as send, except that the sender key is from.
results list, in the same order as your input, and a count. An empty list raises TypeError, and more than 100 emails raises ValueError, before any request is made. See Batch sending.
Manage emails
cancel_email removes an email that hasn’t been sent yet. If the email was already sent, the API returns an error, which the SDK raises as SendFlitError.
Domains
Suppressions
Suppressed addresses never receive email from your account. Add an address when a recipient unsubscribes or complains.reason is optional and defaults to "unsubscribe". See Emails.
Usage and health
health in a readiness probe or a startup check.
Verify webhooks
SendFlit signs each webhook. TheX-Sendflit-Signature header carries sha256=<hex>, an HMAC-SHA256 of the raw request body. Use the module-level function to check it.
request.get_data() before anything parses it. A parsed or re-serialized body won’t match the signature. See Webhooks for the event list.
Errors and retries
Every failed request raisesSendFlitError:
429 or 5xx are retried up to max_retries times. The SDK honors the Retry-After header when present, and otherwise backs off exponentially. Other 4xx responses are not retried. See Errors, retries and limits.
Method reference
Next steps
- Quickstart: send your first email from the command line.
- Idempotency: the full retry rules.
- Batch sending: limits and per-item results.
- Webhooks: events and payloads.