Create a domain
POST /domains
Registers a sending domain for the authenticated team, generates its DKIM key pair, and returns the DNS records to publish before verification. Optionally specify custom_return_path (defaults to send) and choose opportunistic or enforced TLS delivery.
Send a full access API key as a bearer token in the Authorization header. A sending access key is refused.
A JSON object.
| Field | Type | Required | Details |
|---|---|---|---|
name |
string | Yes | 1 to 1024 characters. |
region |
string | No | At most 64 characters. |
custom_return_path |
string | No | At most 64 characters. |
open_tracking |
boolean | No | |
click_tracking |
boolean | No | |
tracking_subdomain |
any | No | |
tls |
string | No | One of opportunistic, enforced. |
capabilities |
object | No | |
capabilities.sending |
string | No | One of enabled, disabled. |
capabilities.receiving |
string | No | One of enabled, disabled. |
Status 201, 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)$. |
name |
string | |
status |
string | One of not_started, pending, verified, failed, temporary_failure, partially_verified, partially_failed. |
created_at |
string | Matches ^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}\+00$. |
region |
string | |
open_tracking |
boolean | |
click_tracking |
boolean | |
capabilities |
object | |
capabilities.sending |
string | One of enabled, disabled. |
capabilities.receiving |
string | One of enabled, disabled. |
tracking_subdomain |
string | |
records |
array of object | |
records[].record |
string | One of DKIM, SPF, Receiving, Tracking, TrackingCAA. |
records[].name |
string | |
records[].type |
string | One of MX, TXT, CNAME, CAA. |
records[].ttl |
string | |
records[].status |
string | One of not_started, pending, verified, failed, temporary_failure. |
records[].value |
string | |
records[].priority |
integer | 0 to 65535. |
Headers: x-request-id, ratelimit-limit, ratelimit-remaining, ratelimit-reset.
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 |
| 401 | missing_api_key, validation_error, restricted_api_key |
| 403 | validation_error, restricted_api_key, suspended_api_key, terms_acceptance_required |
| 404 | not_found |
| 413 | validation_error |
| 415 | validation_error |
| 422 | validation_error, missing_required_field |
| 429 | rate_limit_exceeded |
| 503 | service_unavailable |
Error headers: x-request-id, ratelimit-limit, ratelimit-remaining, ratelimit-reset, retry-after.
curl -X POST 'https://api.hermesmail.app/domains' \
-H "Authorization: Bearer $HERMESMAIL_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "mail.example.test",
"custom_return_path": "bounces"
}'
import { Resend } from 'resend';
const resend = new Resend(process.env.HERMESMAIL_API_KEY, { baseUrl: 'https://api.hermesmail.app' });
const { data, error } = await resend.domains.create({
"name": "mail.example.test",
"customReturnPath": "bounces"
});
import os
import resend
resend.api_key = os.environ["HERMESMAIL_API_KEY"]
resend.api_url = "https://api.hermesmail.app"
result = resend.Domains.create({
"name": "mail.example.test",
"custom_return_path": "bounces"
})
<?php
// Set RESEND_BASE_URL="https://api.hermesmail.app" in the environment.
$resend = Resend::client(getenv("HERMESMAIL_API_KEY"));
$result = $resend->domains->create([
"name" => "mail.example.test",
"custom_return_path" => "bounces"
]);
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.Domains.Create(&resend.CreateDomainRequest{
Name: "mail.example.test",
CustomReturnPath: "bounces",
})
_ = err
}
# Set RESEND_BASE_URL="https://api.hermesmail.app/" before require "resend".
require "resend"
Resend.api_key = ENV.fetch("HERMESMAIL_API_KEY")
result = Resend::Domains.create({
"name" => "mail.example.test",
"custom_return_path" => "bounces"
})