Skip to content

SaaS & Transactional Email

B2B SaaS

Move SendGrid receipts to Apex without double sends

Your job queue retries a slow send and the customer gets two receipts for one charge. One key per email and Apex replays the first answer instead of sending again.

Free monthly allowances included. No credit card to start.

5 min read~1 hour active setupUpdated
Small business owner at a desk frowning at an email on her phone
One charge, one receipt.

Interactive preview · Transactional API

A retry should never mean a second receipt.

Devon's receipt request times out on your side, so your job queue retries it. Slide the retries, then take the Idempotency-Key off and count the receipts in Devon's inbox.

Illustrative fixture · Tallyhouse
2 retries

Your queue retries because it never heard back. Apex had already sent the first one.

ApexPOST /api/v1/transactional/send · inv_20418
  1. Attempt 1Timed out after 10s

    Sent the receipt

  2. Attempt 2200 · same send id

    Replayed the first response

  3. Attempt 3200 · same send id

    Replayed the first response

Receipts Devon gets

1

Exactly one

Requests your app made

3

First try plus retries

Duplicate emails a month

0

From about 51 timeouts in 8,500 sends

Every retry carries the same key, so Apex replays the first answer and sends nothing new. Devon gets one receipt.

The customer behind the receipt

Active · Price Builds

Devon Price

devon@pricebuilds.example.com

$79

Team plan · inv_20418

  1. Your Tallyhouse receipt for inv_20418Nov 20, 2026, 3:02 PM

    Email · delivered

Every receipt Apex sent to Devon shows here. With the key on, there is one.

The key should name the email, not the person. One key per receipt means a retry is recognized for 24 hours. With one key per customer, a second real receipt that same day has a different body, so Apex refuses it as a reused key.
Why the key is the receipt's id, not the customer's

The complete playbook

Step-by-step setup, worked math, and real limits.

Follow the steps below, check how this interacts with tools you already run, and inspect live Apex pricing before turning anything on.

How it works without Apex

Receipts and password resets usually go out from a background job, and the job retries when the email service is slow to answer. The first email already went out, so customers get two receipts for one charge. Moving off SendGrid is a good moment to give every email a key.

How Apex does it for you

Apex sends receipts and resets through its transactional API, signed with your domain. For 24 hours, a request with the same Idempotency-Key and body replays the first answer and sends nothing new.

How to set this up in 5 steps

  1. Verify your sending domain

    Add the DNS records Apex gives you, once per organization.

  2. Make a transactional key

    Under Settings, Workspace, Transactional API, mint a key for your server.

  3. Swap the send call

    Replace SendGrid's mail send with Apex's transactional send.

  4. Pass one key per email

    Use the receipt id or reset attempt as the Idempotency-Key so a retry replays instead of sending again.

  5. Test in sandbox

    Send with the sandbox header first, then switch it off.

Two receipts for one charge

Most apps send receipts and password resets from a background job. When the email service is slow to answer, the job gives up and tries again. The first email already went out, so the customer gets two.

Two password resets are a nuisance. Two receipts look like a double charge, and some of those customers write to support or dispute the payment.

Moving off SendGrid's mail send is a good moment to fix it, because the change touches every send call anyway.

Move the send call and give every email a key

  1. Verify your sending domain. Add the DNS records Apex gives you. It's once per organization, and Apex signs every send with your domain. See Migrating from SendGrid.

  2. Make a transactional key. Under Settings → Workspace → Transactional API, mint an apex_tx_ key for your server.

  3. Point the send call at Apex. Swap SendGrid's mail send for POST /api/v1/transactional/send. The body is smaller: one to, a subject and html or text, or a template id with variables. See the Transactional Email API.

  4. Pass the receipt's own id as the Idempotency-Key. For 24 hours, the same key with the same body replays the first answer instead of sending again. Use one key per email: the receipt id, or the reset attempt.

  5. Test in sandbox first. Send with X-Apex-Mode: sandbox. Apex simulates the outcome and logs it without reaching an inbox.

The TypeScript client makes up a key for each call and reuses it across its own retries. When your job queue runs the job again, that is a new call with a new key. Pass your own key and it wins.

The SDK's own key isn't enough for job retries

Worked example: one bookkeeping app's month (illustrative)

Tallyhouse sends about 6,200 receipts and 2,300 password resets a month. Every number is an illustrative assumption.

EmailIdempotency-Key
Receiptreceipt-inv_20418
Password resetreset-user_5521-attempt_3

In plain terms:

  • About 51 sends a month time out on Tallyhouse's side. With 2 retries each and no key, that is 102 extra emails.
  • With the receipt id as the key, each retry gets the first answer back and nothing new is sent. Devon Price gets one receipt.
  • Each reset attempt gets its own key, so a customer who asks twice still gets the second email.

What this costs to run

The table reads live from Apex's published rate card. Each receipt or reset Apex delivers counts as a send.

Live Apex pricing · Pay-as-you-go

Estimated Apex cost for 8,500 receipts and password resets a month

$0 / month

Fully inside Apex's free monthly allowances (resets every calendar month).

Apex meter / scheduleScenario volumeFree allowance / basisRateApex cost
Messages
6,200 receipts + 2,300 password resets
8,500 / mo10K / month$60.00 per 100K messages$0

A replayed retry sends nothing, so it is not a new send. Sandbox sends never reach a real inbox. Individual event history stays queryable for 13 months without a card, 3 years with a card on file, and 7 years once you've paid an invoice. See the live pricing page.

Third-party and campaign costs (not paid to Apex)

ExpenseTypical rangeNotes
SendGridYour current plan, until you switch offPaid to Twilio. Keep it during the move if you like, then cancel once every send goes through Apex.

Limits worth knowing before you start

  • The key lasts 24 hours. A retry after that is treated as a new email.

  • Same key, different body is refused. Apex answers with a conflict rather than guess which email you meant. Use one key per email, never one per customer.

  • A retry while the first is still sending waits. Apex says the send is in flight. Retry shortly.

  • Your SendGrid reputation doesn't move. Apex sends from its own shared pool, signed with your domain. Templates, your suppression list and past sends aren't imported.

  • This page is about receipts and resets. These emails have no unsubscribe link. Marketing email from SendGrid is a separate move.

For your editor or AI assistant

Swap the send call from your AI editor.

Connect Apex MCP, then paste the prompt. Your assistant checks your sending domain, mints a transactional key, and changes each send call to carry a key per email.

1Add Apex to your editor

Install in Grok Build

Opens Grok Build and adds Apex. Nothing to configure.

2Tell your agent

Paste this prompt into your AI editor (scroll to read full prompt)

Check my Apex workspace before changing anything. Confirm my sending domain is verified and list my transactional API keys. Then find every SendGrid mail send call in this repo, show me how each one maps to Apex's transactional send, and pass the receipt or reset attempt id as the Idempotency-Key. Test in sandbox before anything goes live.

The first time your agent calls Apex, it gives you a link to approve in the browser. There is no key to paste. In Grok Build you can also run /setup-apex.

See how editor setup works step by step

tallyhouse-app · Grok BuildWaiting for approval
Agent
You

Move our receipts and password resets off SendGrid, and stop the double receipts.

Set up Apex · 0 of 3
  • Sending domain verified
  • Transactional key made
  • Send calls carry a key per email

Your move

One charge, one receipt.

Move your receipts and resets to Apex and let a key per email stop the retries from doubling up.