Skip to content
Hermesmail
Docs pages

cURL

Every Hermesmail operation is a plain HTTPS JSON endpoint rooted at https://api.hermesmail.app. No client library is required: pass a Bearer API key and a JSON body with curl or any HTTP client.

Authentication and base URL

Create an API key after signing in and export it as HERMESMAIL_API_KEY. Pass the key in a double-quoted Authorization header (-H "Authorization: Bearer $HERMESMAIL_API_KEY") so the shell expands the variable, and send Content-Type: application/json with -d (or pass --json on modern curl releases).

Every endpoint, field and response envelope is listed in the API reference.

Send an email

Submit a single transactional message to POST /emails from a verified domain:

curl -sS -X POST https://api.hermesmail.app/emails \
  -H "Authorization: Bearer $HERMESMAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Orders <[email protected]>",
    "to": ["[email protected]"],
    "subject": "Order confirmed",
    "text": "Your order has been received."
  }'

A successful response returns HTTP 200 and {"id": "..."} with no statusCode field.

Send a batch

Submit an array of up to 100 messages in one request to POST /emails/batch. Batch items do not accept attachments; review Limits for batch and quota rules.

curl -sS -X POST https://api.hermesmail.app/emails/batch \
  -H "Authorization: Bearer $HERMESMAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[
    {
      "from": "Alerts <[email protected]>",
      "to": ["[email protected]"],
      "subject": "First batch message",
      "text": "First recipient in the batch."
    },
    {
      "from": "Alerts <[email protected]>",
      "to": ["[email protected]"],
      "subject": "Second batch message",
      "text": "Second recipient in the batch."
    }
  ]'

A successful batch response returns HTTP 200 with {"data": [{"id": "..."}, ...]} in request order.

Send with an attachment

Attach files on POST /emails by supplying standard padded base64 in each attachment's content field (or an HTTPS path URL). Total encoded message size is bounded by 40 MB and blocked executable extensions are refused at acceptance; see Limits.

curl -sS -X POST https://api.hermesmail.app/emails \
  -H "Authorization: Bearer $HERMESMAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Billing <[email protected]>",
    "to": ["[email protected]"],
    "subject": "Your receipt",
    "text": "Find your plain-text receipt attached.",
    "attachments": [
      {
        "filename": "receipt.txt",
        "content": "UmVjZWlwdCAjMTAwMQo=",
        "content_type": "text/plain"
      }
    ]
  }'

Handle errors

Failed requests return an HTTP 4xx or 5xx status together with a JSON body containing statusCode, name and message. Branch automated retry or recovery logic on name rather than matching the human-readable message; every error name is documented in Errors.

The example below omits recipients ("to": []) and receives HTTP 422 with name: "validation_error":

curl -sS -X POST https://api.hermesmail.app/emails \
  -H "Authorization: Bearer $HERMESMAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Orders <[email protected]>",
    "to": [],
    "subject": "Missing recipient example",
    "text": "Returns a 422 validation_error envelope."
  }'