The SDK methods on this page require
@the-meridian/sdk 1.19.0 or later. The HTTP endpoint works from any version.Recommended integration
The simplest, safest path for merchant-facing mail:sendEmail with shop context (for optional merchant metering), and logs actionable errors without breaking your app.
Shop context vs app context
Shop-token sends never fire
usage_event.tracked automations, so a transactional email cannot accidentally re-enter your automation graph.
variables fills the template’s {{tokens}}. Meridian adds one value itself: app_url, which links to your app in that store’s admin on a shop-token send. An API-key send has no store, so app_url is empty there. An app_url you pass in variables always wins.
How this differs from automations
Automations and SDK sends share the same SendGrid pipeline, quota enforcement, and deliverability tracking. They do not double-charge or conflict.
Setup
- Create and activate an email template in the Meridian dashboard.
- Copy the template UUID.
- Call
sendEmailfrom your app backend (never from the browser, because the shop token and API key are secrets).
Examples
Shop context (merchant billing)
App context (platform quota only)
Reliability
- Idempotency: Pass
idempotencyKeyon sends you may retry (webhook handlers, job queues). Retries with the same key, template, and recipient return the original send row instead of dispatching again. Reusing a key for a different template returnsIDEMPOTENCY_KEY_CONFLICT. - All-or-nothing per request: If any recipient in a batch fails at SendGrid, the API returns an error. Quota for failed units is released automatically.
- Rate limit: 60 requests/minute per app.
Limits and errors
- Up to 20 recipients per request.
- Inactive templates are rejected (
422). - Over-quota sends return
USAGE_LIMIT_EXCEEDED(409). - Platform capacity guard returns
SENDGRID_CAPACITY_EXHAUSTED(503).