Code Examples
Copy-paste-ready snippets for the Brixus365 Email API. Every snippet on this page was live-tested against production on 2026-05-04 — they work as written.
All examples assume BRIXUS_API_KEY is set in your environment:
# Either prefix works — preview keys for try-it-now, live keys for production
export BRIXUS_API_KEY=bx_live_your_key_here
Which key do these examples need? The HTTP samples below work with both bx_preview_… and bx_live_… keys. Live keys ignore the request from field on free plans and use your default verified sender — see Sending emails. SMTP and raw HTML send require a bx_live_… key — see Before you send for the 4-step setup.
Send an email
Sends a welcome email to you@example.com. Swap the slug, recipient, and variables for your case — see Starter templates for the full list.
1curl -X POST https://app.brixus365.com/api/v1/emails \
2-H "X-API-Key: $BRIXUS_API_KEY" \
3-H "Content-Type: application/json" \
4-d '{
5 "to": "you@example.com",
6 "starterTemplate": "welcome",
7 "variables": { "name": "Friend", "app_name": "Acme" }
8}'List starter templates
Returns the catalogue of available templates and the variables each one expects.
curl https://app.brixus365.com/api/v1/starter-templates \
-H "X-API-Key: $BRIXUS_API_KEY"Look up a message
Use the messageId returned by your send call to check delivery status.
curl https://app.brixus365.com/api/v1/emails/$MESSAGE_ID \
-H "X-API-Key: $BRIXUS_API_KEY"SMTP
If you already use a mail library, the SMTP relay is the fastest integration. Paid plans only — see SMTP relay for the full reference, server config, and per-language examples.
Server: smtp.brixus365.com
Port: 587 (STARTTLS)
Username: apikey
Password: bx_live_your_key_here
Language notes
A few language-specific gotchas we hit while live-testing every snippet on this page:
| Language | Note |
|---|---|
| Python (urllib) | Always set an explicit User-Agent header. The default Python-urllib/3.x agent is blocked by the WAF and returns 403 before the request reaches the API. requests and httpx set a non-blocked default agent automatically. |
| Node.js | Built-in fetch requires Node 18 or newer. On older versions install node-fetch or undici. |
| Java | Examples use java.net.http.HttpClient from JDK 11+ and text blocks from JDK 15+. For older JDKs use Apache HttpClient or OkHttp with the same headers and body. |
| .NET | The System.Net.Http.Json namespace ships in .NET 5+. On .NET Framework, serialise the body manually with System.Text.Json or Newtonsoft. |
| Rust | The example uses reqwest with rustls-tls to avoid pulling in OpenSSL. ureq is a lighter alternative if you don’t need async. |
| Elixir | Req (a higher-level wrapper over Finch) gives you JSON encoding and connection pooling for free. HTTPoison works too if it’s already in your project. |
| Swift | The async/await example requires iOS 15+ / macOS 12+. For older targets use the closure-based URLSession.dataTask with the same request setup. |
Idempotency for production code. When the network is flaky, add an Idempotency-Key header so retries don’t double-send. See Overview → Idempotency.