Skip to content
Sign up
MenuClose

Docs

API and webhooks

Connect a Mailkomet newsletter to your website, your shop or any tool that can call an API or receive webhooks. The API reads and changes contacts and signs people up; webhooks tell your app when something happens.

Start

  • Base address: https://mailkomet.com/api/v1. Requests and answers are JSON (send Content-Type: application/json with a body, at most 32 KB).
  • Make a key in the app: open a newsletter, then API and webhooks. Only the account's owner or an admin can make keys. A key works for that one newsletter. It is shown once; if you lose it, revoke it and make a new one.
  • A key is read only or read and write. Read-only keys can only use the GET endpoints.
  • Send it in every request: Authorization: Bearer mk_.... Keep it on your server: anyone with the key can use it, so never put it in a web page or an app people download.
curl https://mailkomet.com/api/v1/me \
  -H "Authorization: Bearer $MAILKOMET_KEY"

Limits

ItemFreePaid plans
Requests per key60 a minute, 10,000 a day300 a minute, 100,000 a day
API keys per newsletter1010
Webhooks per newsletter210
Webhook deliveries per newsletter10,000 a day100,000 a day

Every answer has X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (seconds until the minute starts again). Over a limit the answer is 429 with a Retry-After header in seconds. The day restarts at midnight UTC.

The API sends no issues. Sign-ups through /subscribe send one confirmation email each, which counts toward your plan's emails like a sign-up on your sign-up page.

Errors

An error answer has an HTTP status and a JSON body with a code that stays the same, and a message for people:

{ "error": { "code": "consent_missing", "message": "This contact is new, so say why you may email them: ..." } }
CodeStatusMeaning
unauthorized401Missing or unknown API key. Send it in the Authorization header: Bearer <your key>.
forbidden403This key can only read. Make a key with read and write access in the app to change things.
rate_limited429Too many requests for this key. Wait until the time in the Retry-After header, then try again.
invalid_request400Some of the request is not valid.
consent_missing422This contact is new, so say why you may email them: consent "signed_up" (they asked for it) or "customer" (they bought from you). To have them confirm by email instead, use POST /api/v1/subscribe.
email_invalid422That email address is not valid.
field_not_found422One of the fields does not exist in this newsletter. GET /api/v1/fields lists their keys.
email_unsubscribed409This address unsubscribed from this newsletter. It can only come back by signing up again: POST /api/v1/subscribe.
contact_not_found404There is no contact with that id or email in this newsletter.
add_daily_limit429The account has added as many contacts today as it can (50 a day on Free, 2,000 on paid plans, counted with the app). Try again tomorrow, or use POST /api/v1/subscribe.
signup_closed409This newsletter is not taking sign-ups right now: they are switched off, paused, or the sender details are not filled in yet.
subscriber_limit_reached403The account has as many subscribers as its plan allows. Upgrade the plan or remove contacts first.

Pages

Lists return up to limit rows (1 to 100), newest first, with has_more and next_cursor. To get the next page, send cursor with the value of next_cursor.

Endpoints

GET /me

The newsletter the key is for, the key's name and access, and your plan's limits. Use it to check a key works. Key: read only or read and write.

curl https://mailkomet.com/api/v1/me \
  -H "Authorization: Bearer $MAILKOMET_KEY"

GET /contacts

Contacts, newest first. Optional query parameters: status (subscribed, unsubscribed, bounced, complained or blocked), tag (a tag name), email, limit (1 to 100, 50 if left out) and cursor. Key: read only or read and write.

curl https://mailkomet.com/api/v1/contacts?status=subscribed&limit=100 \
  -H "Authorization: Bearer $MAILKOMET_KEY"
{ "data": [ { "id": "...", "email": "jane@example.com", ... } ], "has_more": true, "next_cursor": "WyIyMDI2..." }

GET /contacts/{id or email}

One contact, by its id or its email address. Key: read only or read and write.

curl https://mailkomet.com/api/v1/contacts/jane@example.com \
  -H "Authorization: Bearer $MAILKOMET_KEY"
{
  "data": {
    "id": "6f1c2a7e-4d1b-4c55-9a0e-2b8d7c1e9f30",
    "email": "jane@example.com",
    "name": "Jane",
    "status": "subscribed",
    "source": "api",
    "created_at": "2026-11-16T10:12:00+00:00",
    "status_changed_at": "2026-11-16T10:12:00+00:00",
    "tags": ["Customers"],
    "fields": { "city": "Paris" }
  }
}

POST /contacts

Adds a contact, or updates the one with this email. A new contact is added as subscribed at once, without a confirmation email, so you must say why you may email them: consent "signed_up" (they asked for your newsletter) or "customer" (they bought from you). It follows the same rules as adding a contact by hand in the app, including the daily limit (50 a day on Free, 2,000 on paid plans, counted together with the app). For an existing contact, name changes when you send it, tags are added, remove_tags are removed and fields are set (null clears a field). Status never changes here. Answers 201 for a new contact, 200 for an update. Key: read and write.

curl -X POST https://mailkomet.com/api/v1/contacts \
  -H "Authorization: Bearer $MAILKOMET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"jane@example.com","name":"Jane","consent":"customer","tags":["Customers"],"fields":{"city":"Paris"}}'
{
  "data": {
    "id": "6f1c2a7e-4d1b-4c55-9a0e-2b8d7c1e9f30",
    "email": "jane@example.com",
    "name": "Jane",
    "status": "subscribed",
    "source": "api",
    "created_at": "2026-11-16T10:12:00+00:00",
    "status_changed_at": "2026-11-16T10:12:00+00:00",
    "tags": ["Customers"],
    "fields": { "city": "Paris" }
  }
}

PATCH /contacts/{id or email}

Updates a contact: name, tags, remove_tags and fields, as above. The email can't change. Key: read and write.

curl -X PATCH https://mailkomet.com/api/v1/contacts/6f1c2a7e-4d1b-4c55-9a0e-2b8d7c1e9f30 \
  -H "Authorization: Bearer $MAILKOMET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"remove_tags":["Trial"],"fields":{"city":null}}'

POST /contacts/{id or email}/unsubscribe

Marks a contact unsubscribed, as the newsletter. It gets no more emails from this newsletter. Key: read and write.

curl -X POST https://mailkomet.com/api/v1/contacts/jane@example.com/unsubscribe \
  -H "Authorization: Bearer $MAILKOMET_KEY"

DELETE /contacts/{id or email}

Deletes a contact and its consent record. An unsubscribe is kept, so a later import can't bring the address back. Key: read and write.

curl -X DELETE https://mailkomet.com/api/v1/contacts/jane@example.com \
  -H "Authorization: Bearer $MAILKOMET_KEY"
{ "deleted": true }

POST /subscribe

Signs a person up with double opt-in, exactly like your sign-up page: Mailkomet emails them a confirmation link and they become a contact only when they press it. Use this for sign-up forms on your own website. Send the person's IP address as ip_address: without it, a key can sign up 10 people an hour. Each key takes at most 300 sign-ups an hour, and the newsletter's daily sign-up limits and your plan's emails apply. tags are added when the person confirms. The answer is the same 202 whether the email went out now or later, so it can't be used to test addresses. Key: read and write.

curl -X POST https://mailkomet.com/api/v1/subscribe \
  -H "Authorization: Bearer $MAILKOMET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"sam@example.com","name":"Sam","tags":["Website"],"ip_address":"203.0.113.7"}'
{ "data": { "status": "pending_confirmation" } }

GET /tags

Every tag of the newsletter with how many contacts have it. Key: read only or read and write.

curl https://mailkomet.com/api/v1/tags \
  -H "Authorization: Bearer $MAILKOMET_KEY"
{ "data": [ { "id": "...", "name": "Customers", "contacts": 120 } ] }

GET /fields

The custom contact fields: the key to use in fields, the label, the type (text, number, date or dropdown) and a dropdown's options. Key: read only or read and write.

curl https://mailkomet.com/api/v1/fields \
  -H "Authorization: Bearer $MAILKOMET_KEY"
{ "data": [ { "key": "city", "label": "City", "type": "text", "options": [] } ] }

GET /issues

Issues, newest first, with their numbers. Optional: status (draft, scheduled, sending, sent or withdrawn), limit and cursor. The API can't send issues. Key: read only or read and write.

curl https://mailkomet.com/api/v1/issues?status=sent \
  -H "Authorization: Bearer $MAILKOMET_KEY"

GET /issues/{id}

One issue with its content blocks and each link's clicks. Key: read only or read and write.

curl https://mailkomet.com/api/v1/issues/{id} \
  -H "Authorization: Bearer $MAILKOMET_KEY"

GET /stats

Contacts by status, and the last 30 days: contacts added, unsubscribes, issues sent, emails sent, delivered, opens and clicks. Key: read only or read and write.

curl https://mailkomet.com/api/v1/stats \
  -H "Authorization: Bearer $MAILKOMET_KEY"

Contact sources: form (the sign-up page or a website form), import, manual (added by hand) and api (added or signed up through the API).

Webhooks

Add a webhook in the app under API and webhooks: an https address and the events you want. Mailkomet sends each event as a POST request with a JSON body, usually within a minute.

EventWhendata has
subscribedA contact is added as subscribed: a confirmed sign-up, added by hand, an import, the API, or subscribed again.contact
confirmedA person confirmed their sign-up with the link in the confirmation email.contact, confirmed_at
unsubscribedA contact unsubscribed, or was marked unsubscribed.contact
bouncedAn email to a contact bounced for good.contact
complainedA contact marked an email as spam.contact
clickedA person clicked a link in an email (once per person and link).contact, issue (id, subject, kind), url, clicked_at
issue_sentAn issue, or a later round of it, finished sending.issue (id, subject, status, sent_at, stats)
POST https://hooks.example.com/mailkomet
Content-Type: application/json
Mailkomet-Event: subscribed
Mailkomet-Event-Id: 0b6c1f0e-8a52-4f4b-9b1e-6a3f2d9c7e11
Mailkomet-Signature: t=1763288000,v1=5f2b...

{
  "id": "0b6c1f0e-8a52-4f4b-9b1e-6a3f2d9c7e11",
  "type": "subscribed",
  "created_at": "2026-11-16T10:13:20+00:00",
  "newsletter_id": "c2a1...",
  "data": { "contact": { "id": "...", "email": "jane@example.com", "status": "subscribed", "source": "form", "tags": [], "fields": {} } }
}

Check the signature

Each webhook has its own signing secret (whsec_...), shown when you add it or make a new one. The Mailkomet-Signature header is t= the time in Unix seconds and v1= the HMAC-SHA256, in hex, of the time, a full stop and the raw body, with the secret as the key. Refuse a request whose signature does not match or whose time is more than 5 minutes off.

import { createHmac, timingSafeEqual } from "node:crypto";

// rawBody: the request body exactly as received (before JSON.parse).
function fromMailkomet(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const t = Number(parts.t);
  if (!t || Math.abs(Date.now() / 1000 - t) > 300) return false; // older than 5 minutes
  const want = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest();
  const got = Buffer.from(parts.v1 ?? "", "hex");
  return got.length === want.length && timingSafeEqual(got, want);
}

Answers and retries

  • Answer with any 2xx status within 5 seconds. Anything else, no answer, or a redirect (redirects are not followed) is a failure.
  • A failed delivery is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours, and a last time 24 hours after the event. The event id stays the same on every try, so you can ignore one you already have.
  • If that last try fails too, the webhook is switched off and the app shows a notice. Switch it on again once your app works.
  • Webhooks only go to https addresses with a host name that points to the public internet, on port 443.
  • Events past the newsletter's deliveries for the day are not sent; the app shows how many.
  • The app shows each webhook's deliveries of the last 30 days, with the answer your app gave, and has a button to send a test event.

Questions about the API: support@mailkomet.com.