API reference
A JSON API over HTTPS. All paths are relative to https://stalkmail.com/api/v1. Every request needs a newsletter API key and acts only on that newsletter.
Conventions
- Authenticate with
Authorization: Bearer $STALKMAIL_API_KEY. See Authentication. - Every request re-verifies the newsletter owner account. A deleted account returns
401 unauthorizedfor API keys and404for public pages and forms. - Requests and responses are JSON, except multipart uploads.
- Timestamps are ISO 8601 in UTC.
- Cursor lists use
limitandcursorand returnpagination.nextCursor. - Page lists use
pageandperPageand return a pagination object with totals. - Deleting resources returns
204 No Content. Errors use the shape on the errors page. - Rate limits are per key and per route. Every response includes
Cache-Control: no-store.
curl "https://stalkmail.com/api/v1/subscribers?limit=20" \
-H "Authorization: Bearer $STALKMAIL_API_KEY"Overview
The same numbers the dashboard overview shows: KPIs, audience and engagement series, delivery health, website visits and recent activity.
GET
/api/v1/overviewDashboard overview for a range.Query parameters
range enum 7d,30d,90dor12m. Defaults to30d.Response
{ "data": { "range": "30d", "since": "2026-10-08T00:00:00.000Z", "until": "2026-11-07T00:00:00.000Z", "kpis": { "subscribers": { "total": 1240, "subscribed": 1180, "newInPeriod": 94, "lostInPeriod": 12 }, "emailsSent": 4210, "opened": 1590, "clicked": 210, "openRate": 0.38, "clickRate": 0.05 }, "audience": [{ "label": "Oct 8", "key": "2026-10-08", "newSubscribers": 4, "unsubscribed": 0 }], "engagement": [{ "label": "Oct 8", "key": "2026-10-08", "sent": 0, "opened": 0 }], "website": { "total": 820, "home": 300, "issues": 520, "countries": [], "devices": [], "topIssues": [], "series": [] }, "recentCampaigns": [], "recentActivity": [] } }Rate limit: 60 requests per minute per key.
Campaigns
Create drafts, edit content and send settings, preview and send. Sending runs in the background through Inngest.
GET
/api/v1/campaignsList campaigns with cursor pagination and filters.Query parameters
status enum draft,scheduled,sending,sentorfailed.delivery enum email_web,emailorweb.visibleOnWeb boolean Filter by whether the campaign's website issue is published ("Visible on website"). truereturns only campaigns visible on the public website;falsereturns campaigns with an unpublished issue or no issue at all.search string Case-insensitive text match. from ISO 8601 date Only include records created on or after this date. to ISO 8601 date Only include records created on or before this date. limit integer Results per page, 1–100. Defaults to 50. cursor string Opaque cursor from pagination.nextCursor. Omit for the first page.Response
{ "data": [ { "id": "cmp_…", "subject": "November update", "status": "sent", "delivery": "email_web", "audienceType": "everyone", "visibleOnWeb": true, "stats": { "sent": 1180, "delivered": 1172, "opened": 441, "clicked": 63, "bounced": 8 }, "sentAt": "2026-11-01T09:00:00.000Z" } ], "pagination": { "nextCursor": null } }Rate limit: 120 requests per minute per key.
POST
/api/v1/campaignsCreate a campaign draft, optionally with content.JSON body
subject string Email subject, up to 200 chars. previewText string Inbox preview text, up to 200 chars. blocks array BlockNote blocks. Opaque to the API. coverImage string HTTPS URL for the archive card. Example
curl https://stalkmail.com/api/v1/campaigns \ -X POST \ -H "Authorization: Bearer $STALKMAIL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "subject": "November update" }'Rate limit: 30 requests per minute per key.
GET
/api/v1/campaigns/:idRetrieve one campaign with content, audience, issue and rates.visibleOnWebistruewhen the linked website issue is published;falsefor an unpublished issue or anemail-only campaign.- Toggle the field with
PATCH /api/v1/campaigns/:id/publish.
PATCH
/api/v1/campaigns/:idUpdate content, delivery, audience or schedule.- Send at least one field to update.
- Content edits on a sent campaign with a web delivery republish the linked issue in place.
JSON body
subject string Email subject. previewText string Inbox preview text. blocks array BlockNote blocks. coverImage string HTTPS image URL. delivery enum email_web,emailorweb.audience object { type, segmentIds, subscriberIds }.schedule object { mode: "now" | "later", at }.Rate limit: 90 requests per minute per key.
DELETE
/api/v1/campaigns/:idDelete a draft, scheduled or failed campaign.- Sent campaigns keep their history and stats and cannot be deleted.
- Deleting a campaign with a published issue also removes the issue.
Rate limit: 30 requests per minute per key.
POST
/api/v1/campaigns/:id/sendSend now or schedule delivery.- Sending to the entire audience requires
"confirm": true; otherwise the API returns409 confirmation_required. - A campaign must have a subject and the newsletter must have a mailing address and verified from-domain.
- Email-only audiences need at least one subscribed recipient.
JSON body
delivery enum email_web,emailorweb. Defaults toemail_web.audience.type enum everyone,segmentsorcontacts.audience.segmentIds string[] Required when type is segments. Up to 20.audience.subscriberIds string[] Required when type is contacts. Up to 5,000.schedule.mode enum noworlater. Defaults tonow.schedule.at ISO 8601 date Required when mode is later.confirm boolean Must be trueto send to the entire audience.Example
curl https://stalkmail.com/api/v1/campaigns/cmp_…/send \ -X POST \ -H "Authorization: Bearer $STALKMAIL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "delivery": "email_web", "audience": { "type": "segments", "segmentIds": ["seg_…"] }, "schedule": { "mode": "later", "at": "2026-11-12T09:00:00.000Z" } }'Response
{ "data": { "scheduled": true, "scheduledAt": "2026-11-12T09:00:00.000Z" } }Rate limit: 12 requests per minute per key.
- Sending to the entire audience requires
POST
/api/v1/campaigns/:id/testSend a test rendering to one address.JSON body
email* string Recipient address. subject string Override the subject for this test. previewText string Override the preview text. blocks array Override the blocks. Rate limit: 20 requests per minute per key.
POST
/api/v1/campaigns/:id/duplicateCopy content into a fresh draft.Response
{ "data": { "id": "cmp_…", "status": "draft", "subject": "November update" } }Rate limit: 30 requests per minute per key.
GET
/api/v1/campaigns/:id/previewRender the campaign HTML.Query parameters
channel enum emailorweb. Defaults toemail.Response
{ "data": { "channel": "email", "html": "<!doctype html>…" } }PATCH
/api/v1/campaigns/:id/publishPublish or unpublish the linked website issue (the "Visible on website" toggle).- Only campaigns with a web delivery (
weboremail_web) can be published. - Unpublishing keeps the issue and its slug; the public URL returns 404 until republished.
JSON body
published* boolean trueto publish,falseto unpublish.Rate limit: 30 requests per minute per key.
- Only campaigns with a web delivery (
Subscribers
Manage contacts, their tags and custom field values, and import CSVs. Subscriber ids are stable hashes and an email cannot be changed once created.
GET
/api/v1/subscribersList subscribers with cursor pagination, search and filters.Query parameters
status enum pending,subscribed,unsubscribedorbounced.cleanup enum active,waiting,dormantorstopped.source enum manual,csv,apiorform.tagId string Only contacts carrying this tag. email string Email prefix match, case-insensitive. from ISO 8601 date Only include records created on or after this date. to ISO 8601 date Only include records created on or before this date. limit integer Results per page, 1–100. Defaults to 50. cursor string Opaque cursor from pagination.nextCursor. Omit for the first page.Response
{ "data": [ { "id": "…", "email": "reader@example.com", "name": "Alex Reader", "status": "subscribed", "source": "api", "tags": ["tag_…"], "fields": { "company": "Acme" }, "stats": { "emailsReceived": 12, "opens": 7, "clicks": 2 }, "createdAt": "2026-01-04T10:00:00.000Z" } ], "pagination": { "nextCursor": "…" } }Rate limit: 240 requests per minute per key.
POST
/api/v1/subscribersAdd a subscriber.- Duplicates return
409 conflict; existing or unsubscribed contacts are never silently resubscribed. - Contacts who reported spam return
409 complained. - Domains marked undeliverable by list cleanup return
422 validation_error.
JSON body
email* string Valid email address. name string Display name, up to 120 chars. status enum subscribedorpending. Defaults tosubscribed.location string Free-text location, up to 120 chars. tagIds string[] Tag ids to attach. fields object Custom field values keyed by field key. Example
curl https://stalkmail.com/api/v1/subscribers \ -X POST \ -H "Authorization: Bearer $STALKMAIL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "email": "reader@example.com", "name": "Alex Reader", "tagIds": ["tag_…"] }'Rate limit: 120 requests per minute per key.
- Duplicates return
GET
/api/v1/subscribers/:idRetrieve one subscriber.PATCH
/api/v1/subscribers/:idUpdate name, status, location, tags or custom fields.- The email address cannot be changed because the document id is derived from it.
- Setting status to
subscribedon a contact who reported spam returns409 complained.
JSON body
name string Display name. Empty string clears it. status enum pending,subscribed,unsubscribedorbounced.location string Free-text location. tagIds string[] Replaces the contact's tags. fields object Replaces stored custom field values. DELETE
/api/v1/subscribers/:idPermanently delete a subscriber.GET
/api/v1/subscribers/:id/activityRecent activity timeline for one subscriber.Query parameters
limit integer Number of entries, 1–100. Defaults to 30. POST
/api/v1/subscribers/importStart a CSV import from a multipart `file` field.- Maximum file size is 5 MB and the maximum is 20,000 valid rows.
- The first row must contain headers;
emailis required,nameis optional. - Imports run in the background and can be polled with the status endpoint.
Example
curl https://stalkmail.com/api/v1/subscribers/import \ -X POST \ -H "Authorization: Bearer $STALKMAIL_API_KEY" \ -F "file=@contacts.csv"Response
{ "data": { "importId": "imp_…", "chunkCount": 1, "totalRows": 420, "validRows": 418, "invalidRows": 2, "status": "queued" } }Rate limit: 10 requests per minute per key.
GET
/api/v1/subscribers/imports/:idStatus and counters for an import job.
Custom fields
Extra contact properties stored at subscribers.fields.<key> and usable as {{key}} personalization tokens.
GET
/api/v1/fieldsList custom fields with page pagination.Query parameters
search string Case-insensitive text match. page integer 1-based page number. Defaults to 1. perPage integer Results per page, 1–100. Defaults to 50. POST
/api/v1/fieldsCreate a custom field.- Keys are immutable identifiers once created; renaming the label does not break tokens.
- Reserved keys such as
email,name,statusandunsubscribe_urlcannot be used.
JSON body
label* string Shown in the dashboard, 1–60 chars. key* string Lowercase token starting with a letter. Reserved tokens are rejected. type enum text,number,dateorurl. Defaults totext.GET
/api/v1/fields/:idRetrieve one custom field.PATCH
/api/v1/fields/:idChange a field's label, key or type.JSON body
label string New label. key string New key. type enum New type. DELETE
/api/v1/fields/:idDelete a field and every stored value for it.
Segments
Saved audience rules evaluated against the newsletter's contacts. Conditions support engagement windows, tags, status and custom fields.
GET
/api/v1/segmentsList saved segments with page pagination.Query parameters
search string Case-insensitive text match. page integer 1-based page number. Defaults to 1. perPage integer Results per page, 1–100. Defaults to 50. POST
/api/v1/segmentsCreate a saved segment.JSON body
name* string 1–60 characters. match enum allorany. Defaults toall.conditions* array 1–12 conditions. conditions[].type enum opened,clicked,subscribed,tag,statusorfield.conditions[].operator enum is,is_not,contains,is_emptyoris_not_empty.conditions[].days integer Lookback window for engagement conditions, 1–365. conditions[].value string Tag id, status value or field text. conditions[].fieldKey string Custom field key for fieldconditions.Example
curl https://stalkmail.com/api/v1/segments \ -X POST \ -H "Authorization: Bearer $STALKMAIL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Engaged 30 days", "match": "all", "conditions": [ { "type": "opened", "days": 30, "operator": "is" }, { "type": "status", "value": "subscribed", "operator": "is" } ] }'GET
/api/v1/segments/:idRetrieve one saved segment.PATCH
/api/v1/segments/:idUpdate a segment's name, match mode or conditions.DELETE
/api/v1/segments/:idDelete a segment. Contacts are unaffected.
Sender
From name and address, mailing address and the authors list used by campaign, confirmation and welcome emails.
GET
/api/v1/senderSender identity, authors and verified from-domains.Response
{ "data": { "sender": { "fromName": "The Weekly", "fromEmail": "hello@the-weekly.com", "postalAddress": "12 Example St, Lisbon", "authors": [] }, "verifiedDomains": ["the-weekly.com"] } }PATCH
/api/v1/senderUpdate the sender identity or authors.- A from-email domain must be the newsletter's
{slug}.stalkmail.comaddress,stalkmail.com, or a domain verified under Domains.
JSON body
fromName string Up to 100 characters. fromEmail string Full from address. postalAddress string Up to 200 characters. authors array Full authors array, up to 10 entries. Rate limit: 30 requests per minute per key.
- A from-email domain must be the newsletter's
Domains
Sending domains registered with Amazon SES. Adding a domain returns the DNS verification records.
GET
/api/v1/domainsList claimed domains with page pagination.Query parameters
status string Filter by provider status. search string Case-insensitive text match. page integer 1-based page number. Defaults to 1. perPage integer Results per page, 1–100. Defaults to 50. POST
/api/v1/domainsRegister a sending domain with SES and return its DNS records.JSON body
domain* string Domain name such as example.com.Response
{ "data": { "domain": "example.com", "status": "pending", "provider": "ses", "providers": { "ses": { "status": "pending", "dnsRecords": [ { "name": "s1._domainkey.example.com", "type": "CNAME", "value": "s1.dkim.amazonses.com", "purpose": "DKIM", "provider": "ses" } ] } } } }Rate limit: 10 requests per hour per key.
GET
/api/v1/domains/:domainRetrieve one claimed domain.DELETE
/api/v1/domains/:domainRemove a domain from this newsletter and from the provider.POST
/api/v1/domains/:domain/verifyAsk the provider to verify DNS records.Rate limit: 20 requests per hour per key.
POST
/api/v1/domains/:domain/refreshRefresh the stored DNS records and status.Rate limit: 30 requests per hour per key.
API keys
Create and revoke keys for the newsletter. The plaintext key is returned once and only its SHA-256 hash is stored.
GET
/api/v1/api-keysList keys with page pagination.Query parameters
includeRevoked boolean Include revoked keys. Defaults to false.page integer 1-based page number. Defaults to 1. perPage integer Results per page, 1–100. Defaults to 50. Response
{ "data": [ { "id": "key_…", "name": "CI deploy", "prefix": "sm_live_ab12", "createdAt": "2026-01-04T10:00:00.000Z", "lastUsedAt": null, "revoked": false } ], "pagination": { "page": 1, "perPage": 50, "total": 1, "pageCount": 1 } }POST
/api/v1/api-keysCreate a key. The plaintext `key` is returned once.JSON body
name* string 1–50 characters. Response
{ "data": { "id": "key_…", "name": "CI deploy", "prefix": "sm_live_ab12", "key": "sm_live_…", "revoked": false } }Rate limit: 10 requests per hour per key.
GET
/api/v1/api-keys/:idRetrieve one key's metadata.DELETE
/api/v1/api-keys/:idRevoke a key. Requests using it fail immediately afterwards.- A key can revoke itself; the request succeeds and future calls fail.
Media
Upload images for campaign content, cover images or newsletter settings. The account credentials never leave the server.
POST
/api/v1/mediaUpload an image from a multipart `file` field.- Accepts JPG, PNG and WebP up to 4 MB.
- Returns the hosted HTTPS URL, file id, name and size.
Example
curl https://stalkmail.com/api/v1/media \ -X POST \ -H "Authorization: Bearer $STALKMAIL_API_KEY" \ -F "file=@cover.png"Response
{ "data": { "url": "https://nyc.cloud.appwrite.io/v1/storage/buckets/newsletter-media/files/f_…/view?project=…", "fileId": "…", "name": "campaign-….png", "size": 84213 } }Rate limit: 30 requests per minute per key.
Settings
Every dashboard settings section. Fetch the full settings first, then PATCH only the fields you want to change. Kebab-case and camelCase section names both work.
GET
/api/v1/settingsReturn every settings section.Response
{ "data": { "schemaVersion": 5, "confirmSignups": { "enabled": true, "subject": "Please confirm your subscription" }, "welcomeEmail": { "enabled": true, "subject": "Welcome to {{newsletter_name}}" }, "website": { "published": true, "description": "…", "socials": {} }, "form": { "enabled": true, "heading": "Join the newsletter", "layout": "stacked" }, "design": { "preset": "lime", "accent": "#B9F13F", "radius": 10 }, "notifications": { "summary": "weekly", "mcpEnabled": true }, "sender": { "fromName": "The Weekly", "fromEmail": "hello@the-weekly.com" }, "listCleanup": { "enabled": true, "ignoredIssues": 6, "quietDays": 180 } }, "sections": [ "confirmSignups", "welcomeEmail", "website", "form", "design", "notifications", "sender", "listCleanup" ] }GET
/api/v1/settings/:sectionReturn one settings section.- Sections:
confirmSignups,welcomeEmail,website,form,design,notifications,sender,listCleanup. - Kebab-case aliases such as
confirm-signups,welcome-emailandlist-cleanupare accepted.
- Sections:
PATCH
/api/v1/settings/:sectionUpdate fields in one settings section.- The body is merged with the current section, so partial updates keep existing values.
- Sender changes still enforce the verified from-domain rule;
PATCH /api/v1/senderis equivalent and preferred. website.publishedmust be on before a campaign can publish a web issue.- Design tokens are shared by the website, issue pages, join page, signup form and embed.
JSON body
confirmSignups.enabled boolean Use double opt-in for form signups. confirmSignups.subject string Confirmation email subject, up to 120 chars. confirmSignups.previewText string Preview text, up to 140 chars. confirmSignups.body string Plain-text body with {{confirm_url}}, up to 5,000 chars.welcomeEmail.enabled boolean Send a welcome email after confirmation. welcomeEmail.subject string Welcome subject. welcomeEmail.body string Plain-text body with {{unsubscribe_url}}.website.published boolean Publish the public website and archive. website.description string Hero description, up to 300 chars. website.socials object { website, x, linkedin, instagram, youtube }URLs.form.enabled boolean Accept signups from the hosted page and embed. form.domains string[] Allowed embed domains, up to 10. form.heading string Form heading, up to 80 chars. form.layout enum stackedorinline.form.collectName boolean Ask for a name in addition to email. form.redirectUrl string HTTPS URL to redirect to after signup. design.preset enum lime,charcoal,sageorpaper.design.accent string Six-digit hex accent colour. design.radius integer Corner radius, 0–24. notifications.summary enum off,dailyorweekly.notifications.mcpEnabled boolean Allow agent actions through the /mcpendpoint.listCleanup.enabled boolean Enable cold-contact handling. listCleanup.ignoredIssues integer Ignored issues before a contact becomes dormant, 2–100. listCleanup.quietDays integer Quiet days before cleanup, 30–3,650. listCleanup.lastChance object { builtIn, subject, previewText, body, buttonLabel }.sender.fromName string From name, up to 100 chars. sender.fromEmail string Must use the newsletter's {slug}.stalkmail.com,stalkmail.com, or a verified domain.sender.postalAddress string Mailing address shown in email footers. Example
curl https://stalkmail.com/api/v1/settings/design \\ -X PATCH \\ -H "Authorization: Bearer $STALKMAIL_API_KEY" \\ -H "Content-Type: application/json" \\ -d '{ "accent": "#B9F13F", "radius": 14 }'Rate limit: 30 requests per minute per key.
Logs
The dashboard activity log. Every API write is recorded with actorType: "api" and the key id.
GET
/api/v1/logsList logs with cursor pagination and filters.Query parameters
level enum info,warnorerror.actorType enum user,api,publicorsystem.action string Exact action name, such as campaign.sent.status enum successorfailure.from ISO 8601 date Only include records created on or after this date. to ISO 8601 date Only include records created on or before this date. limit integer Results per page, 1–100. Defaults to 50. cursor string Opaque cursor from pagination.nextCursor. Omit for the first page.Response
{ "data": [ { "id": "…", "level": "info", "actorType": "api", "action": "campaign.sent", "status": "success", "message": "Queued campaign for immediate delivery.", "createdAt": "2026-11-01T09:00:00.000Z" } ], "pagination": { "nextCursor": null } }Rate limit: 120 requests per minute per key.
Notifications
Dashboard notifications. Keys and other resources created through the API notify the newsletter owner here.
GET
/api/v1/notificationsList notifications with cursor pagination.Query parameters
kind enum actionornews.unread boolean Only unread notifications when true.limit integer Results per page, 1–100. Defaults to 50. cursor string Opaque cursor from pagination.nextCursor. Omit for the first page.Response
{ "data": [ { "id": "ntf_…", "kind": "news", "type": "api_key.created", "title": "API key created", "body": "A new API key named "CI deploy" was created.", "href": "/dashboard/api-keys", "read": false, "createdAt": "2026-11-01T09:00:00.000Z" } ], "unreadCount": 1, "pagination": { "nextCursor": null } }PATCH
/api/v1/notificationsMark every notification read, or only the ids in the body.- Omit the body to mark everything read.
- Send
{ "ids": ["ntf_…"] }to mark specific notifications.
JSON body
ids string[] Notification ids, up to 100. DELETE
/api/v1/notificationsDelete every notification, or only the ids in the body.JSON body
ids string[] Notification ids, up to 100. GET
/api/v1/notifications/:idRetrieve one notification.PATCH
/api/v1/notifications/:idMark one notification read.DELETE
/api/v1/notifications/:idDelete one notification.
Public forms
Public signup endpoints scoped by newsletter slug, not by API key. They honour the form toggle, domain allowlist and double opt-in.
GET
/api/forms/:slugForm settings and design tokens for the hosted page and embed.POST
/api/forms/:slug/subscribeSubmit a signup. Returns `pending` when double opt-in is on.- Requires an allowed
Originheader when an allowlist is configured. - A honeypot field and per-IP rate limiting protect the endpoint.
- Requires an allowed
Settings coverage
General details live under /api/v1/newsletter, sender identity under /api/v1/sender, and every other dashboard section under /api/v1/settings/:section: confirmSignups, welcomeEmail, website, form, design, notifications and listCleanup. Settings PATCH requests merge into the current values, so you can send only what changed. The only dashboard action not exposed is creating or switching a newsletter, which is an account-level session action rather than a per-newsletter API operation.
MCP clients
MCP tools call StalkMail through the dedicated /mcp endpoint with the same API key. The newsletter owner can turn agent actions off in Settings → Notifications without revoking the key. The MCP endpoint returns 403 forbidden while the toggle is off. Plain REST API requests are unaffected.
Sending safely from an agent
- Create the campaign with
POST /api/v1/campaigns, then write the content withPATCH /api/v1/campaigns/:id. - Render
GET /api/v1/campaigns/:id/previewand send a test to yourself withPOST /api/v1/campaigns/:id/test. - Send with a specific
audience.typeofsegmentsorcontacts. The API rejectseveryoneunless the request also sets"confirm": true. - Poll
GET /api/v1/campaigns/:idand readstatusandstatsas delivery progresses.