REST API
Newsletter API for developers
- The whole product234 actions in 38 groups, the same ones the dashboard runs, with the same checks and limits.
- Markdown or HTMLSend a campaign as Markdown, rich text or a complete HTML email, up to 500 KB.
- A signup endpoint for your siteA signups only key can add subscribers straight from the browser, and nothing else.
- OpenAPI 3.1A machine-readable spec made from the same schemas as the endpoints and the MCP tools.
What you can build with it
The API has 234 endpoints in 38 groups, one for each action the dashboard has. Among them:
- Campaigns (24): Drafts, test emails, scheduling, sending, sending in steps and reports.
- Contacts (7): Search, signups, imports with checks, status changes, deletes and exports.
- Newsletters (8): Sender, postal address, welcome and confirmation emails, list cleanup and archive.
- Segments (7): Saved audiences: rules over a newsletter's contacts, with live counts, that a campaign or an automation can use, and saved lists that keep the contacts a segment matched on one day.
- Automations (11): Emails, waits, tags, fields, webhooks, branches and random splits that start for a contact when they subscribe, get or lose a tag, join or leave a segment, upgrade, buy, click a link, go quiet, reach a date or are added by hand or by your code, and templates to start from.
- Tags and fields (12): Free-form tags on contacts, and custom fields (text, number, date, date and time, true or false, lists) for merge tags, segments, automations and the preference center.
- Paid tiers (7): Up to 3 paid tiers per newsletter with monthly, quarterly, yearly, lifetime and pay what you want prices, made as Products and Prices on your Stripe account. A paid issue reaches a tier and the tiers above it.
- Products (6): Digital products readers buy once: files kept private, pages on the newsletter's site, Stripe Checkout on your own account.
- Webhooks (9): Addresses FlockStack POSTs events to as they happen, signed, retried for about 5 days, with a log of each delivery.
- Reports (4)
You can use it for publishing an issue from your own CMS or build pipeline, syncing signups from your app, tagging readers from your product's events, and pulling campaign reports into your own dashboards.
Send an issue in three requests
Create a draft. The body is Markdown unless you set format to rich or html.
curl -X POST "https://flockstack.io/api/v1/campaigns" \
-H "Authorization: Bearer $FLOCKSTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"subject":"This week","previewText":"Three links worth your time","content":"# This week\n\nThree links worth your time."}'The answer includes the draft's id. Send a test with POST /api/v1/campaigns/{id}/test: it goes to the account owner, or to up to 10 addresses you name, and nobody on your list gets it. Then POST /api/v1/campaigns/{id}/send sends it now, or POST /api/v1/campaigns/{id}/schedule with a scheduledAt time sends it later.
Sending can't be undone, and a campaign that is already sending or sent answers conflict, so a retried request never sends twice. Before anything goes out, the API checks the plan's limits, the from address, the postal address and the email's size.
Add subscribers from your website
A signups only key can call one endpoint, POST /api/v1/contacts, and it answers browsers, so it can sit in your site's code. A new subscriber gets the welcome email, or the confirmation email when the newsletter asks readers to confirm.
curl -X POST "https://flockstack.io/api/v1/contacts" \
-H "Authorization: Bearer $FLOCKSTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"email":"jane@example.com","source":"website"}'Keep full access keys on a server: they can do everything the dashboard can.
The same rules as the dashboard
- Plan limits on emails and subscribers apply to API sends too.
- A campaign pauses when its bounce or complaint rate climbs too high, as it would from the dashboard.
- Contacts the account has never emailed go out as a small first slice, and the rest follow once that slice's bounces and complaints stay low.
- Every error has the same shape,
{ "error": { "code", "message" } }, with a code that never changes meaning. The error reference lists them.
Keys, limits and regions
- Two kinds of key: full access, for scripts, servers and AI assistants, and signups only, for signup forms. An account can have up to 20 active keys.
- Each key gets 300 requests a minute, shared between the REST API and the MCP server, and some actions have their own limits. Over a limit, the answer is
429 rate_limited. - An account lives in one region. US accounts call
https://flockstack.io/api/v1; EU accounts callhttps://eu.flockstack.io/api/v1, and their keys start withmc_eu_.
Authentication and rate limits has the details.
Events your own code can listen to
FlockStack can also call your server when something happens, such as a subscriber upgrading to a paid tier. Webhooks are signed, so your code can check that an event came from FlockStack, and each endpoint keeps a log of its deliveries.
For code generators and AI agents
The OpenAPI document at /api/v1/openapi.json describes every endpoint, and /llms.txt and /llms-full.txt give the same reference as plain text for language models. To let an assistant like Claude or ChatGPT run your newsletter without writing code, connect it to the newsletter MCP server instead: it gets one tool per endpoint.
Questions
- Does FlockStack have a newsletter API?
- Yes. FlockStack's REST API has 234 endpoints covering everything the dashboard does, from drafting and sending campaigns to subscribers, segments, automations, paid subscriptions and reports.
- Can I send a newsletter through the API?
- Yes. Create a draft, send yourself a test, then send it now or schedule it. The plan's limits, the from address, the postal address and the email's size are checked before it goes out, and sending can't be undone.
- Which formats can a campaign body use?
- Markdown (the default), rich text from the editor's format, or a complete HTML email, up to 500 KB.
- Can I call the API from the browser?
- Only to add subscribers, with a signups only key: that endpoint answers browsers. Every other endpoint needs a full access key, which belongs on a server.
- Is there an OpenAPI specification?
- Yes, OpenAPI 3.1 at /api/v1/openapi.json, generated from the same schemas as the endpoints and the MCP tools.
- Is the API included in every plan?
- Yes. The REST API and the MCP server come with every FlockStack Cloud plan, the Free plan included, and with every self-hosted server. Emails sent through them count toward the plan's emails like any other.
Make your first request
Sign in, create a full access key on the API keys page, and list your newsletters with it.
Get an API key