API/Send Email API

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
FieldTypeRequiredDescription
tostring or string[]YesUp to 50 addresses. Each one becomes a contact and gets its own tracked send.
subjectstringYesSubject line.
htmlstringOne ofHTML body. Growth adds its open pixel and click tracking.
textstringOne ofPlain-text body. Sent alone, it also gets a minimal HTML version.
fromstringNoName <address> or address. Must be one of the organization's sending identities.
replyTostringNoOverrides the identity's reply-to.
tagsstring[] or {name,value}NoContact tags added to every recipient.
streamstringNotransactional (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

StatuscodeMeaning
400Invalid body or address
401Missing or invalid API key
409contact_bouncedThe address hard-bounced and is suppressed
409contact_complainedThe recipient reported a previous email as spam
409contact_unsubscribedMarketing stream only: the contact unsubscribed
409provider_not_configuredNo email provider is configured
409send_failedThe provider refused the message
422unknown_senderfrom 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.