Skip to content
Hermesmail
Docs pages

Send an email

POST /emails

Accepts a single transactional email for immediate dispatch or future scheduling (scheduled_at) and returns its assigned identifier. Provide html, text, or both from a verified team domain (or the sandbox sender when eligible), and pass an optional Idempotency-Key header so retries replay the original identifier without duplicate delivery.

Authentication

Send an API key as a bearer token in the Authorization header. A sending access key is enough, and a full access key works too.

Parameters

Headers

Name Type Required Details
Idempotency-Key string No Send a unique value to make a retry safe: for a day, a repeat of this request answers with the original outcome.

Request body

A JSON object.

Field Type Required Details
template any No
topic_id any No
from string Yes
to string or array of string Yes
subject string Yes
bcc string or array of string No
cc string or array of string No
reply_to string or array of string No
html string No
text string No
headers object No
scheduled_at string No
attachments array of object No
attachments[].content string or array of integer No 0 to 255.
attachments[].path string No
attachments[].filename string No
attachments[].content_type string No
attachments[].content_id string No
tags array of object No
tags[].name string Yes
tags[].value string Yes

Response

Status 200, a JSON object.

Field Type Details
id string Format uuid. Matches ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$.

Headers: x-request-id, ratelimit-limit, ratelimit-remaining, ratelimit-reset, x-hermesmail-monthly-quota, x-hermesmail-daily-quota, idempotent-replayed.

Errors

Each error answers with the status below and a JSON body naming the error. Every error has its own entry.

Status Names
400 validation_error, invalid_idempotency_key
401 missing_api_key, validation_error, restricted_api_key
403 validation_error, restricted_api_key, suspended_api_key, terms_acceptance_required
409 invalid_idempotent_request, concurrent_idempotent_requests
413 validation_error
415 validation_error
422 validation_error, missing_required_field, invalid_attachment
429 rate_limit_exceeded, daily_quota_exceeded, monthly_quota_exceeded
500 application_error
503 service_unavailable

Error headers: x-request-id, ratelimit-limit, ratelimit-remaining, ratelimit-reset, retry-after.

Samples

cURL

curl -X POST 'https://api.hermesmail.app/emails' \
  -H "Authorization: Bearer $HERMESMAIL_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "from": "Sample sender <[email protected]>",
  "to": [
    "[email protected]"
  ],
  "subject": "A sample subject",
  "html": "<p>The message body, in HTML.</p>",
  "text": "The message body, in plain text."
}'

Node

import { Resend } from 'resend';

const resend = new Resend(process.env.HERMESMAIL_API_KEY, { baseUrl: 'https://api.hermesmail.app' });

const { data, error } = await resend.emails.send({
  "from": "Sample sender <[email protected]>",
  "to": [
    "[email protected]"
  ],
  "subject": "A sample subject",
  "html": "<p>The message body, in HTML.</p>",
  "text": "The message body, in plain text."
});

Python

import os
import resend

resend.api_key = os.environ["HERMESMAIL_API_KEY"]
resend.api_url = "https://api.hermesmail.app"

result = resend.Emails.send({
  "from": "Sample sender <[email protected]>",
  "to": [
    "[email protected]"
  ],
  "subject": "A sample subject",
  "html": "<p>The message body, in HTML.</p>",
  "text": "The message body, in plain text."
})

PHP

<?php
// Set RESEND_BASE_URL="https://api.hermesmail.app" in the environment.
$resend = Resend::client(getenv("HERMESMAIL_API_KEY"));

$result = $resend->emails->send([
  "from" => "Sample sender <[email protected]>",
  "to" => [
    "[email protected]"
  ],
  "subject" => "A sample subject",
  "html" => "<p>The message body, in HTML.</p>",
  "text" => "The message body, in plain text."
]);

Go

package main

import (
	"net/url"
	"os"

	"github.com/resend/resend-go/v4"
)

func main() {
	client := resend.NewClient(os.Getenv("HERMESMAIL_API_KEY"))
	baseURL, _ := url.Parse("https://api.hermesmail.app/")
	client.BaseURL = baseURL

	_, err := client.Emails.Send(&resend.SendEmailRequest{
		From: "Sample sender <[email protected]>",
		To: []string{"[email protected]"},
		Subject: "A sample subject",
		Html: "<p>The message body, in HTML.</p>",
		Text: "The message body, in plain text.",
	})
	_ = err
}

Ruby

# Set RESEND_BASE_URL="https://api.hermesmail.app/" before require "resend".
require "resend"

Resend.api_key = ENV.fetch("HERMESMAIL_API_KEY")

result = Resend::Emails.send({
  "from" => "Sample sender <[email protected]>",
  "to" => [
    "[email protected]"
  ],
  "subject" => "A sample subject",
  "html" => "<p>The message body, in HTML.</p>",
  "text" => "The message body, in plain text."
})