How it works without Apex
Use Apex's stdlib-only apex_transactional clients for Python 3.10+ and Ruby 3.0+ (zero requests, httpx, faraday, or httparty dependencies) to send inline emails or dashboard-edited commId templates. Every call attaches and reuses an Idempotency-Key across backoff retries on network, 429, 5xx, and 409 idempotency_in_flight errors, plus includes sandbox mode and sandbox_recipient helpers for bounce tests.
How Apex does it for you
Apex replays cached responses for 24 hours per Idempotency-Key, rejects mismatched payload reuse with 409 idempotency_key_mismatch, applies workspace brand settings to commId templates without deploys, and lets CI simulate bounces in sandbox mode.
How to set this up in 5 steps
Mint a workspace transactional API key (apex_tx_)
Create an apex_tx_ secret in Apex Settings and load it as APEX_TX_KEY in your Django, FastAPI, or Rails environment.
Install the stdlib-only Python wheel or Ruby gem
Run pip install https://app.apex.inc/downloads/sdk/apex_transactional-0.3.1-py3-none-any.whl (Python) or curl -fsSLO https://app.apex.inc/downloads/sdk/apex_transactional-0.3.1.gem && gem install ./apex_transactional-0.3.1.gem (Ruby) with zero third-party HTTP dependencies.
Pick inline body or dashboard-managed commId template
Send inline subject/html/text for simple internal alerts, or reference a saved transactional commId with a variables map so operators can edit copy without redeploying (never mix both shapes in one call).
Pass a business idempotency_key from your worker job
Supply a stable key like receipt-1812 or invite-{token}. If omitted, the SDK generates a UUID and reuses it across retries; passing your own business key also protects across Celery or Sidekiq job re-runs.
Test success and bounce paths in sandbox mode
Instantiate the client with sandbox=True and call sandbox_recipient('success') or sandbox_recipient('bounce') in CI to verify your exception handlers without delivering real email.
Stdlib-only Python and Ruby clients
Receipts, login codes, and team invitations usually originate in Celery, RQ, Sidekiq, or ActiveJob workers. When a queue worker retries a job after a transient timeout, a naive HTTP call emails your customer twice; meanwhile, bloated vendor SDKs often clash with pinned versions of requests, httpx, pydantic, faraday, or httparty.
Apex ships stdlib-only transactional clients for Python 3.10+ and Ruby 3.0+ with zero external HTTP dependencies. Install the Python wheel directly with pip install https://app.apex.inc/downloads/sdk/apex_transactional-0.3.1-py3-none-any.whl, or download and install the Ruby gem with curl -fsSLO https://app.apex.inc/downloads/sdk/apex_transactional-0.3.1.gem && gem install ./apex_transactional-0.3.1.gem. Both docs pages publish the exact SHA-256 checksums for pinned builds.

Inline vs. template send shapes
Both SDKs support two mutually exclusive payload shapes (mixing commId with subject/html/text returns 400 validation_error):
- Template shape (`commId` + `variables`, recommended): References a saved workspace transactional communication. Operators can tweak wording in the composer without a code deploy, workspace branding applies automatically, and transactional templates suppress unsubscribe links.
- Inline shape (`subject` + `html`/`text`): Useful when content belongs right next to the call site (internal ops alerts or quick scripts).
import os
from apex_transactional import ApexTransactionalClient
apex = ApexTransactionalClient(
base_url="https://app.apex.inc",
api_key=os.environ["APEX_TX_KEY"], # starts with apex_tx_
)
apex.send(
{
"to": "alex@example.com",
"commId": "invite",
"variables": {
"inviterName": "Jordan",
"orgName": "Northwind",
"role": "member",
"acceptUrl": "https://app.example.com/invite/accept?token=tok_123",
},
},
idempotency_key="invite-tok_123",
)require "apex_transactional"
apex = ApexTransactional::Client.new(
base_url: "https://app.apex.inc",
api_key: ENV.fetch("APEX_TX_KEY"),
)
apex.send(
{ to: "alex@example.com", subject: "Receipt #1812", text: "Thanks for your order." },
idempotency_key: "receipt-1812",
)
Retry policy and sandbox testing
Every send() attaches an Idempotency-Key (using your business key when provided, or generating and reusing one UUID per call across internal retries). Both clients apply exponential backoff with jitter (default 3 attempts, 250 ms base delay capped at 5,000 ms) using this exact policy:
| Outcome | Retried automatically? | SDK behavior |
|---|---|---|
| Network / TCP / DNS, `429`, `5xx`, `409 idempotency_in_flight` | Yes | Backoff with jitter using the same Idempotency-Key |
| Timeout | No | Single attempt within the configured timeout (default 30s) |
| `400`, `401`, `409 idempotency_key_mismatch`, `422` | No | Raises a typed exception (ApexValidationError, ApexAuthError, ApexIdempotencyMismatchError) |
In CI and staging tests, pass sandbox=True (Python) or sandbox: true (Ruby) and address sandbox_recipient("success") or sandbox_recipient("bounce") to verify error handling deterministically without sending a single real email. You can also inject a custom transport callable for unit tests.
What this costs on Apex
Live Apex pricing · Pay-as-you-go
Estimated Apex cost for Django or Rails SaaS sending 40,000 transactional receipts, invites, and password resets per month
$18 / month
Estimated from live usage meters.
| Apex meter / schedule | Scenario volume | Free allowance / basis | Rate | Apex cost |
|---|---|---|---|---|
Messages Transactional receipts, password resets, and team invitations (40,000 monthly transactional sends with 24-hour idempotency replay) | 40,000 / mo | 10K / month | $60.00 per 100K messages | $18 |
Sandbox mode calls and replayed idempotent retries incur zero duplicate communication charges. History: 13 months no card, 3 years with card, 7 years once you've paid an invoice. Live pricing.
Sandbox simulations and 24-hour idempotent response replays never bill as extra sends, so you pay only for real delivered emails.
