API

Email API for transactional and bulk email

Send one-off and bulk email from your own SMTP, SendGrid, Mailgun, Postmark or SES account. Get a delivery log.

Problems we solve

Does any of this sound like your week?

Every email provider needs different code.

Call one /send endpoint. Use SMTP, SendGrid, Mailgun, Postmark or Amazon SES, and the log still lives in Takelan.

Marketing wants to edit emails without a deploy.

Keep templates in one place. The app calls /send with the template name and variables, and the wording changes without a deploy.

Did the customer get the email?

Search the sent-mail log or fetch one message by id. Stats and a time series show the totals.

Sending to hundreds of people needs a queue.

The bulk endpoint takes up to 1,000 recipients, each with their own variables. The result shows which addresses worked and which failed.

What it does

  • The Takelan Email API sends email for your apps. You write a template once. Then you call one endpoint with a recipient and a few variables. Takelan renders the message, sends it and records the result in a searchable log.
  • It solves a problem every product team hits: email is never "just one call". You need templates and a way to preview them. You need a sending provider. You need a log that answers "did the customer get it?" You also need a way to send a few hundred at once without writing a queue. This API gives you those parts behind one key.
  • You choose how mail leaves. Use the platform default, or register your own mail server. Supported provider types are plain SMTP, SendGrid, Mailgun, Postmark and Amazon SES. Provider secrets are stored encrypted on the server. You can also add Proxmox Mail Gateway hosts. Set a default one and test it. Then match a sent message to its line in the gateway log.
  • Mail can come in as well. Inbound mailboxes take messages from a gateway webhook, signed with HMAC-SHA256. Or they check an IMAP mailbox again and again. Messages are grouped in threads. You can turn a thread into a ticket in Takelan Customer Desk.
  • Send as a user with a normal token. Or send as an app with a service token or API key. Your account comes from the token, never from the request body. So one customer cannot send as another. Over the limit, you get a 429 with a Retry-After header. Exact numbers vary by environment, so we do not publish one here.
  • Pricing that stays affordable. Start free*. Bring your own provider, so you do not pay twice for sending. *Free test level; past the limits, non-critical calls slow or pause and nothing is charged unless you turn overage on. Connected ShadowCradle organizations can switch on Takelan SSO and these base-included services with one switch. Airgap licences work without any Takelan connection.

See how it works

One call, your choice of route

Your app sends a template name and variables. The API builds the message and sends it. It uses the platform route or your own mail provider. The result goes into a log you can search.

Mail coming in

Inbound mailboxes take messages from a signed gateway webhook. Or they check an IMAP mailbox. Messages are grouped in threads. A thread can become a Customer Desk ticket.
Example use cases6 examples

Receipts, resets and welcome mail

A SaaS team keeps "welcome", "password reset" and "invoice" templates in one place. The app calls /send with the template name and variables. Marketing can edit the wording without a deploy.

Send through the provider you already pay for

A small agency registers its Postmark server once. Every app it builds then sends through that server. The delivery log still lives in Takelan.

Monthly notices to a customer list

An MSP sends a maintenance notice to a client list with the bulk endpoint. Each recipient can carry its own variables, such as name and server. The result lists which addresses worked and which failed.

Mail gateway visibility

An IT team that runs Proxmox Mail Gateway adds it, makes it the default and tests it. For any sent message, it can match the gateway log. You see what happened after it left.

Shared support inbox to tickets

A support mailbox is polled over IMAP, or fed by a gateway webhook. Replies are grouped into threads, and one call turns a thread into a ticket.

Raw messages with your own threading

A sales tool sends a plain message with its own Message-ID, In-Reply-To and References headers. Replies then stay in one thread in the reader mail app.

Try it

Send a templated email

curl -X POST https://app.takelan.com/api/v1/email/send \
  -H "X-API-Key: $TAKELAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "template_name": "welcome",
    "to_email": "sam@example.com",
    "to_name": "Sam",
    "template_variables": { "first_name": "Sam", "plan": "Starter" }
  }'

# Response (abridged, fictional)
# {
#   "id": "8f2c...e1",
#   "to_email": "sam@example.com",
#   "template_name": "welcome",
#   "status": "sent"
# }

Add "mail_server_id" to send through one of your own registered mail servers. Without it the tenant default is used, and then the platform default.

Bulk send with per-recipient variables

curl -X POST https://app.takelan.com/api/v1/email/send/bulk \
  -H "X-API-Key: $TAKELAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "template_name": "maintenance-notice",
    "batch_name": "november-window",
    "default_variables": { "window": "Sat 02:00-04:00" },
    "recipients": [
      { "email": "ops@client-a.example", "variables": { "client": "Client A" } },
      { "email": "it@client-b.example",  "variables": { "client": "Client B" } }
    ]
  }'

# Response (abridged, fictional)
# { "batch_name": "november-window", "total_recipients": 2, "successful": 2, "failed": 0 }

One request takes up to 1,000 recipients, as set in the request schema.

Endpoints33 endpoints
  • POST /api/v1/email/send Send one email from a template.
  • POST /api/v1/email/send-message Send a raw message with your own Message-ID, In-Reply-To and References.
  • POST /api/v1/email/send/bulk Send a template to a list of recipients, each with its own variables.
  • GET /api/v1/email/products List the products (sending identities) you registered.
  • POST /api/v1/email/products/register Register a product that sends mail.
  • POST /api/v1/email/templates Create a template.
  • GET /api/v1/email/templates List templates.
  • PUT /api/v1/email/templates/{template_id} Edit a template.
  • POST /api/v1/email/templates/{template_id}/duplicate Copy a template, including a starter template.
  • POST /api/v1/email/templates/preview Render a template with variables without sending.
  • GET /api/v1/email/samples Browse starter templates. Fetch one by key, or preview it.
  • GET /api/v1/email/emails Search the sent-mail log.
  • GET /api/v1/email/emails/{email_id} One message and its delivery status.
  • POST /api/v1/email/emails/{email_id}/match-gateway-log Find the matching line in a mail gateway log.
  • GET /api/v1/email/stats Delivery statistics.
  • GET /api/v1/email/stats/timeseries Statistics over time.
  • GET /api/v1/email/reports Email reports.
  • GET /api/v1/email/servers/providers List provider types (SMTP, SendGrid, Mailgun, Postmark, SES) and the fields each needs.
  • POST /api/v1/email/servers Register your own mail server.
  • GET /api/v1/email/servers List your mail servers.
  • PATCH /api/v1/email/servers/{server_id} Change a mail server.
  • POST /api/v1/email/servers/{server_id}/test Test the connection.
  • POST /api/v1/email/servers/{server_id}/send-test Send a test message through it.
  • POST /api/v1/email/gateways Register a Proxmox Mail Gateway.
  • GET /api/v1/email/gateways List gateways.
  • POST /api/v1/email/gateways/{gateway_id}/set-default Make a gateway the default.
  • POST /api/v1/email/gateways/{gateway_id}/test Test a gateway.
  • POST /api/v1/email/inbound Gateway webhook for inbound mail. Signed with X-Inbound-Signature (HMAC-SHA256).
  • POST /api/v1/email/inbound/mailboxes Create an inbound mailbox (gateway webhook or IMAP polling).
  • POST /api/v1/email/inbound/mailboxes/{mailbox_id}/poll Poll an IMAP mailbox now.
  • GET /api/v1/email/inbound List inbound messages.
  • GET /api/v1/email/inbound/threads/{thread_ref} Read a whole thread.
  • POST /api/v1/email/inbound/{message_id}/convert-to-ticket Turn an inbound message into a Customer Desk ticket.

MCP

Available as tools through /mcp/utils. Reading templates, the sent log and stats works with a read-only key. Sending mail is a write, so it is off by default. It needs the writes switch for your account (Settings, MCP / AI agents) and a key that is not read-only. Routes that touch provider secrets are marked sensitive. The inbound webhook is not offered as a tool. About MCP

Common questions

how to send transactional email with an API

Create a template with POST /api/v1/email/templates. Then call POST /api/v1/email/send with the template name, the recipient and your variables. Use the X-API-Key header. The result is saved in the sent-mail log.

can I use my own SMTP server, SendGrid, Mailgun, Postmark or SES with the Takelan Email API

Yes. Add a mail server of type SMTP, SendGrid, Mailgun, Postmark or SES. Then pass its mail_server_id when you send. Without one, the tenant default server is used, then the platform default. Provider secrets are stored encrypted on the server.

how do I send bulk email from an API with different variables per person

POST /api/v1/email/send/bulk takes a template, shared default_variables and a list of recipients. Each one has its own variables. One request holds up to 1,000 recipients. The response says how many succeeded and failed, per address.

does it work with Proxmox Mail Gateway

Yes. You can add PMG hosts, set a default and test one. You can also match a sent message against the gateway log. Inbound mail from a gateway can also be delivered to a signed webhook.

how do I receive inbound email in an app

Create an inbound mailbox. Point your gateway at the signed webhook. It uses X-Inbound-Signature, an HMAC-SHA256 of the raw body. Or let Takelan check an IMAP mailbox. Messages are threaded, and a repeat delivery of the same Message-ID creates nothing new.

how do I check if an email was delivered via API

Search GET /api/v1/email/emails or fetch one message by id. For aggregate numbers, use /stats and /stats/timeseries. We do not publish delivery-rate figures, because they depend on the provider you choose.

what authentication does the email API use

Send an X-API-Key header, or a Bearer token from Takelan SSO. App-to-app callers can use a service token. The tenant comes from the credential, so one tenant cannot send as another.

is the Takelan email API free

It is negotiable on price. You can start free*, and bringing your own provider avoids paying twice for sending. *Free test level; past the limits, non-critical calls slow or pause and nothing is charged unless you turn overage on.

Analytics & Cookies

We use self-hosted Matomo analytics. By default we measure anonymously with no cookies. Enable cookies to help us improve your experience. You can change this anytime.