Cloudflare Email API

Base URL: https://email-api.msar.me

GET /health

Check that the API is running. No authentication required.

cURL

curl https://email-api.msar.me/health

JavaScript

const response = await fetch("https://email-api.msar.me/health");
const data = await response.json();
console.log(data);

Response

{
  "success": true,
  "status": "ok"
}

POST /send

Send an email. Requires Authorization: Bearer YOUR_API_KEY.

Request body (JSON):

cURL

curl -X POST "https://email-api.msar.me/send" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"recipient@example.com","subject":"Hello","text":"Plain text fallback","html":"<h1>Hello</h1><p>Sent from my Worker.</p>","replyTo":"hello@msar.me"}'

JavaScript

const response = await fetch("https://email-api.msar.me/send", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    to: "recipient@example.com",
    subject: "Hello",
    text: "Plain text fallback",
    html: "<h1>Hello</h1><p>Sent from my Worker.</p>",
    replyTo: "hello@msar.me",
  }),
});

const data = await response.json();
console.log(data);

Response

{
  "success": true,
  "message": "Email sent successfully",
  "messageId": "..."
}

On error, success is false and error describes the problem (e.g. validation, unauthorized).