Send Email API
Send any email from your own code, Resend-style, with Growth's routing, suppression and tracking.
Send an email whose subject and body come from your application, the way Resend's emails.send does. Use a transactional instead when the content should be edited in Growth.
Request
POST /api/v1/emails| Field | Type | Required | Description |
|---|---|---|---|
to | string or string[] | Yes | Up to 50 addresses. Each one becomes a contact and gets its own tracked send. |
subject | string | Yes | Subject line. |
html | string | One of | HTML body. Growth adds its open pixel and click tracking. |
text | string | One of | Plain-text body. Sent alone, it also gets a minimal HTML version. |
from | string | No | Name <address> or address. Must be one of the organization's sending identities. |
replyTo | string | No | Overrides the identity's reply-to. |
tags | string[] or {name,value} | No | Contact tags added to every recipient. |
stream | string | No | transactional (default) ignores marketing unsubscribes; marketing honours them. |
cc, bcc, attachments, headers and scheduledAt are refused with a 400.
Response
{
"id": "k57abc...",
"sends": [{ "to": "jane@example.com", "id": "k57abc...", "error": null }]
}id is the first accepted send. A recipient that could not be sent appears in sends with error: { code, message }; the request fails only when no recipient was sent.
Errors
| Status | code | Meaning |
|---|---|---|
| 400 | Invalid body or address | |
| 401 | Missing or invalid API key | |
| 409 | contact_bounced | The address hard-bounced and is suppressed |
| 409 | contact_complained | The recipient reported a previous email as spam |
| 409 | contact_unsubscribed | Marketing stream only: the contact unsubscribed |
| 409 | provider_not_configured | No email provider is configured |
| 409 | send_failed | The provider refused the message |
| 422 | unknown_sender | from is not a sending identity of this organization |
Read a send
GET /api/v1/emails/<id>Returns { "email": { id, to, subject, stream, provider, status, sentAt, lastEventAt, events } }, where status is queued, sent, delivered, opened, clicked, bounced, complained or failed.
SDK
import { Growth } from "@t0picyb/growth";
const growth = new Growth(process.env.GROWTH_API_KEY);
const { data, error } = await growth.emails.send({ to, subject, react: <WelcomeEmail /> });See packages/growth-sdk/README.md for installation from GitHub Packages.