Skip to content

Send Your First Email in Minutes.

Quick Start

  1. 1

    Verify Your Account Email

    Sign up and confirm your email address.

  2. 2

    Add and Verify a Domain

    Add the DNS records shown in the dashboard. We check MX, SPF, DKIM and DMARC.

  3. 3

    Create an API Key

    Make a key with the send scope. It is shown once, so store it as a secret.

  4. 4

    Call POST /v1/send

    You get a 202 and a message id back. Delivery happens in the background.

Send an Email

Authenticate with Authorization: Bearer YOUR_API_KEY. Keys use the ts_live_ prefix.

cURL

curl -s -X POST "https://api.traffsite.com/v1/send" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: order-1042-receipt" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "[email protected]",
    "subject": "Your receipt",
    "body": "Thanks for your order.",
    "domain": "yourdomain.com"
  }'

Node.js

const res = await fetch("https://api.traffsite.com/v1/send", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.TRAFFSITE_API_KEY,
    "Idempotency-Key": "order-1042-receipt",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    to: "[email protected]",
    subject: "Your receipt",
    body: "Thanks for your order.",
    domain: "yourdomain.com",
  }),
});
const data = await res.json();

Python

import os, requests

r = requests.post(
    "https://api.traffsite.com/v1/send",
    headers={
        "Authorization": "Bearer " + os.environ["TRAFFSITE_API_KEY"],
        "Idempotency-Key": "order-1042-receipt",
    },
    json={
        "to": "[email protected]",
        "subject": "Your receipt",
        "body": "Thanks for your order.",
        "domain": "yourdomain.com",
    },
)
print(r.json())

Request Fields

FieldRequiredNotes
toYesOne email address, up to 254 characters.
domainYesA domain you have added and verified.
fromNoMust belong to one of your verified domains.
subjectNoUp to 500 characters, no line breaks.
body / htmlNoPlain text up to 50,000 characters, or an HTML body.
template, variablesNoSend a saved template with up to 50 variables.
attachmentsNoUp to 5 files, 2 MB each and 5 MB in total.
Idempotency-Key (header)No1 to 128 characters. A retry with the same key does not send twice.

Webhooks

Register an endpoint and receive a POST for message events: message.accepted, message.failed, message.bounced and message.complaint. Payloads never include the message body.

HeaderValue
X-Traffsite-EventThe event name, for example message.accepted.
X-Traffsite-DeliveryThe delivery id.
X-Traffsite-Signaturet=TIMESTAMP,v1=HEX_HMAC, signed with your webhook secret.

A failed delivery is retried up to 5 more times with growing delays. An endpoint that keeps failing is disabled automatically. You can have up to 5 endpoints.

Errors Worth Handling

StatusCodeMeaning
402INSUFFICIENT_CREDITSNo email credit left. Buy a pack.
402INSUFFICIENT_BALANCEThe wallet cannot cover an attachment fee. Top up.
422RECIPIENT_SUPPRESSEDThe address is on your suppression list. Nothing is sent or charged.
429DAILY_LIMIT_REACHEDThe daily sending cap is used. It resets at 00:00 UTC.

Open the full reference in your dashboard·Pricing