Send your first email (HTTP API)

Send a transactional email over the HTTP API on Connect in three steps.

📘

Before you start

Complete Email API - Setting up your account: a verified domain, an authorized sender (From address), and a Connect application with the Transactional Email role.

1. Get an access token

Exchange your Application Id and Application Secret for a Bearer token using HTTP Basic auth. Request the transactional_email scope.

curl -s -X POST 'https://auth.routee.net/oauth/token' \
  -u 'YOUR_APPLICATION_ID:YOUR_APPLICATION_SECRET' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=client_credentials&scope=transactional_email'

The response contains an access_token valid for 1 hour:

{ "access_token": "eyJhbGciOi...", "token_type": "Bearer", "expires_in": 3600 }
👍

Full auth guide

See Get authenticated using your application credentials for language examples and token handling.

2. Send the email

POST to https://connect.routee.net/transactional-email with your Bearer token. The from.address must be a verified authorized sender.

curl -X POST 'https://connect.routee.net/transactional-email' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "from": { "name": "Acme Support", "address": "[email protected]" },
    "to": [{ "name": "Jane Customer", "address": "[email protected]" }],
    "subject": "Your order is confirmed",
    "content": {
      "html": "<p>Thank you for your order, Jane.</p>",
      "text": "Thank you for your order, Jane."
    }
  }'
import requests

token = "YOUR_ACCESS_TOKEN"
resp = requests.post(
    "https://connect.routee.net/transactional-email",
    headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
    json={
        "from": {"name": "Acme Support", "address": "[email protected]"},
        "to": [{"name": "Jane Customer", "address": "[email protected]"}],
        "subject": "Your order is confirmed",
        "content": {
            "html": "<p>Thank you for your order, Jane.</p>",
            "text": "Thank you for your order, Jane.",
        },
    },
)
print(resp.status_code, resp.json())
const res = await fetch("https://connect.routee.net/transactional-email", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${token}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    from: { name: "Acme Support", address: "[email protected]" },
    to: [{ name: "Jane Customer", address: "[email protected]" }],
    subject: "Your order is confirmed",
    content: {
      html: "<p>Thank you for your order, Jane.</p>",
      text: "Thank you for your order, Jane.",
    },
  }),
});
console.log(res.status, await res.json());

3. Read the response

HTTP 200 means the message was accepted for processing (not yet delivered). The response returns a trackingId:

{ "trackingId": "51b1738c-5fc5-4aa2-85a4-3b063c486cd7" }

Keep the trackingId — you use it to look up delivery status.

⚠️

Common 400 errors

000000 invalid/unverified domain · 000001 invalid sender · 000002 unverified sender · 000004 no active subscription. See Email Error Codes.

Next steps