The Brevo Python SDK (brevo-python) is a fully typed client library for the Brevo API. It provides:
Brevo client with namespaced service clientsAsyncBrevohttpx client support for proxies and mTLSVersion 5.0 introduces breaking changes versus v4.x. v4.x remains supported and continues to receive wire-compatibility fixes — see the changelog for the list of changes and the README for migration steps.
httpx >= 0.21.2pydantic >= 1.9.2typing_extensions >= 4.0.0Initialize the client and send your first email:
Pass keyword arguments to the constructor to configure the client:
Use AsyncBrevo for non-blocking calls. Pass httpx.AsyncClient instead of httpx.Client when providing a custom HTTP client:
The SDK raises ApiError (or a typed subclass) for non-2xx HTTP responses:
All ApiError instances expose:
status_code — HTTP status codebody — Parsed response bodyheaders — Response headersAutomatic retries with exponential backoff are enabled by default (2 retries). Configure at the client or request level:
408, 429, 5xxmax_retries: 0 in request_optionsDefault timeout is 60 seconds. Configure at the client or request level:
All service methods accept a request_options dict as the final keyword argument:
Access response headers and status code via .with_raw_response:
The SDK has a built-in, opt-in logger you can plug your own implementation into. Pass a LogConfig dict (or a pre-built Logger) via the logging constructor option.
By default the SDK is silent: nothing is logged unless you set silent=False. This keeps integration changes from accidentally producing log volume in production.
LogConfig fieldsImplement the ILogger protocol (a typing.Protocol with debug, info, warn, error methods) to forward to any logging library — Python’s stdlib logging, structlog, loguru, or your own sink.
Build a Logger once and reuse it across Brevo and AsyncBrevo instances:
The default ConsoleLogger uses Python’s stdlib logging module under the logger name "fern". If you only need to filter or reformat output, configuring that logger via logging.getLogger("fern") may be enough — you don’t always need a custom ILogger.
Override the default httpx client for proxies, custom transports, or mTLS:
The Brevo and AsyncBrevo clients expose the following service namespaces: