Spanish Total.js
English
Documentation For AI agents
Contents

REST API overview

The endpoints your apps call, how to send the token and what comes back.

.md GitHub
On this page

Your apps talk to OpenMail over HTTP. Every address starts with your OpenMail address, for example https://mail.example.com.

Endpoints

Method and pathWhat it does
POST /Send an email with a template.
GET /profiles/List the profiles and templates.

Send the token

Every request needs an API token. Send it in one of two ways:

  • in the x-token header:
curl -H "x-token: YOUR_TOKEN" -H "content-type: application/json" \
  -d '{"id":"demo/welcome","to":"jane@example.com","data":{"name":"Jane Doe","plan":"Pro"}}' \
  https://mail.example.com/
  • or as the token query argument:
curl -H "content-type: application/json" \
  -d '{"id":"demo/welcome","to":"jane@example.com","data":{"name":"Jane Doe","plan":"Pro"}}' \
  "https://mail.example.com/?token=YOUR_TOKEN"

The header keeps the token out of server logs, so prefer it when your app can set headers.

Request formats

POST / accepts JSON (application/json) and multipart/form-data. Use multipart when you want to upload files as attachments. See Attachments.

What comes back

A successful request answers 200:

{"success":true}

Errors come back as a JSON array, for example:

[{"error":"Template not found"}]

See Errors.

Made in Europe