We've implemented idempotency keys in our API! This means that you can now safely retry requests (intentionally or accidentally) without worrying about side effects, which is a thing that you probably care about a good deal if you're programmatically managing your newsletter subscribers/emails. To quote a somewhat recent Hacker News thread on the topic:
Having recently adopted Resend and skimmed a bunch of different email APIs, I'm still waiting to find a single provider whose API supports Stripe-style idempotency [1] so that I can guarantee I don't send the same email through their API multiple times. I'd like to confidently avoid accidentally spamming a user if i.e. a background job retries multiple times due to an unrelated error, or merely from failing to receive the API response that an email was sent/created successfully.
And that's exactly what we've built! Check out the docs on idempotency keys for more details, but the interface is exactly what you'd expect:
import requests
requests.post(
"https://api.buttondown.com/v1/emails",
json={"body": "It's great to see you again!", "subject": "Hello, world!"},
headers={"Idempotency-Key": "AaPYI03TpJgW7pgtPB09s"},
)
(And shout out to Brandur for his seminal tutorial on the subject.)