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.
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.
| 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. |
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 |
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.
Each error answers with the status below and a JSON body naming the error. Every error has its own entry.
Error headers: x-request-id, ratelimit-limit, ratelimit-remaining, ratelimit-reset, retry-after.
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."
}'
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."
});
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
// 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."
]);
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
}
# 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."
})