Prerequisites
Before you start, you need:- A Sendbaze API key
- A verified domain. A test key works without one, and so does the shared test address for emails to yourself.
- Python 3.9 or later
Guide
1
Install
The SDK has no dependencies beyond the standard library.
2
Set your API key
Store the key in an environment variable in your
.env file. The client reads SENDBAZE_API_KEY by default..env
3
Send an email
send.py
from_ stands in for the reserved word from; class_ does the same for class. Snake_case names such as reply_to and template_id are converted to the API’s camelCase.The call returns as soon as the email is queued. Delivery is reported by webhook and in the dashboard Logs.4
Try it
Run the script and open the dashboard Logs. A live key delivers within seconds; a test key shows the message with a test badge and sends nothing.
Examples
Handle errors
Every non-2xx response raisesSendbazeError with a stable code that matches the errors reference. Network failures raise SendbazeConnectionError, which is safe to retry with the same idempotency key.
Send with a template
Attach a file
Look up and list messages
Django
Call the client from a view, a signal handler or a Celery task. Keep the key in the environment, never in the repo.views.py
Verify a webhook (Flask)
Without the SDK
The API is plain JSON over HTTPS, sorequests or httpx work too:
SDK reference
Every resource the SDK covers: emails, templates, domains, suppressions, webhooks, SMS and usage.