Skip to main content

Email Sending API

Two endpoints handle email delivery through different providers.

POST /api/send-email

Primary sending endpoint using Resend.

Request

curl -X POST https://kinetic.email/api/send-email \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"to": "recipient@example.com",
"subject": "Check out this kinetic email!",
"html": "<!DOCTYPE html>...",
"senderEmail": "sender@example.com"
}'
FieldTypeRequiredDescription
tostringYesRecipient email address
subjectstringYesEmail subject line
htmlstringYesFull HTML email content
senderEmailstringNoSender's email (for attribution banner)

Response

{
"success": true,
"messageId": "re_abc123..."
}

Processing Pipeline

Before sending, the endpoint applies several transformations:

  1. Tracking pixel injection — Adds a 1x1 transparent pixel with mail merge variables:
    • {{UUID}} — Unique interaction ID
    • {{SEND_ID}} — Send session ID
    • {{TIMESTAMP}} — Send timestamp
  2. Image URL resolution — Converts relative image paths to absolute https://kinetic.email/... URLs
  3. Attribution banner — If the sender is not the recipient, an "Sent via Kinetic Email" banner is appended
  4. XSS sanitization — Sender email is HTML-escaped before insertion into the banner

POST /api/send-email-ses

Fallback sending endpoint using AWS SES.

Request

Same request format as /api/send-email.

Response

{
"success": true,
"messageId": "ses_xyz789..."
}

Token Cost

Both endpoints charge the email_send token action. The cost is defined in the token_action_costs table.

Error Handling

StatusErrorCause
401Authentication requiredMissing or invalid JWT
402Insufficient tokensNot enough tokens for email_send
400Missing required fieldsto, subject, or html not provided
500Send failedResend/SES API error