Brevo Rust SDK

Official Rust SDK for the Brevo API: send transactional email and SMS, manage contacts and campaigns, and more.
Quick facts
For people and AI coding agents who want the essentials first.
| Crate name | brevo-rust (cargo add brevo-rust) |
| Import path | use brevo_rust::prelude::*; |
| Client | BrevoClient, built with BrevoClient::new(ClientConfig { .. }) |
| Authentication | API key, sent as the api-key header (OAuth is not supported in this SDK yet) |
| Base URL | https://api.brevo.com/v3 |
| Call shape | client.<resource>.<method>(&request, None).await returning Result<T, ApiError> |
| Runtime | async, uses tokio and reqwest with rustls (no system OpenSSL) |
| Full method list | reference.md |
| API docs | https://developers.brevo.com |
Installation
or add it to your Cargo.toml:
[]
= "1.0.0"
Quick start
Send your first transactional email:
use *;
async
Authentication
The SDK authenticates with your Brevo API key, which it sends in the api-key header. Keep the key out of source control, for example in an environment variable as above.
You can override the key for a single call with RequestOptions::new().api_key("...").
Configuration
ClientConfig controls the client. Common fields:
| Field | Default | Purpose |
|---|---|---|
api_key |
None |
Your Brevo API key |
base_url |
https://api.brevo.com/v3 |
API base URL |
timeout |
60 seconds | Request timeout (std::time::Duration) |
max_retries |
3 | Retries for failed requests |
custom_headers |
SDK identification headers | Extra headers sent on every request |
user_agent |
brevo-rust/<version> |
User-Agent header |
reqwest_client |
None |
Your own reqwest::Client (proxies, TLS, and so on) |
A builder is also available:
use ApiClientBuilder;
use Duration;
let client = new
.api_key
.timeout
.max_retries
.build
.expect;
Error handling
Every method returns Result<T, ApiError>. ApiError has a variant for each error the API documents, plus transport and serialization errors, so you can match on the ones you care about:
match client.account.get_account.await
See src/error.rs for all variants.
Retries and timeouts
Failed requests are retried automatically, up to 3 times by default, and requests time out after 60 seconds. Change either per call:
let response = client
.transactional_emails
.send_transac_email
.await;
Request options
RequestOptions also lets you add headers, query parameters or body properties to a single call:
let options = new
.additional_header
.additional_query_param;
Custom HTTP client
Provide your own reqwest::Client to control proxies, TLS roots or connection settings. When set, it owns all transport-level configuration:
use ApiClientBuilder;
let http = builder.build.expect;
let client = new
.api_key
.reqwest_client
.build
.expect;
Reference
Every resource and method is listed in reference.md. Resources are fields on BrevoClient, such as client.contacts, client.email_campaigns and client.transactional_emails.
Contributing
This library is generated programmatically. Changes made directly to the generated code would be overwritten. Please open an issue first to discuss changes.
Contributions to this README are always welcome!