Skip to content

Newsletter

The Newsletter module’s operations are newsletter.*, under /api/v1/newsletter/. Reading needs newsletter:read, changing newsletter:write; connecting a service needs settings:write. The old crm.newsletters.* and crm.subscribers.* names still answer, deprecated.

Digize hosts no newsletter site of its own: a website shows posts with the two operations under Published posts, signs people up with newsletter.subscribe, shows a subscriber their referrals with newsletter.referrals.mine, and signs paid readers in with POST /api/v1/newsletter/readers/sign-in, POST /api/v1/newsletter/readers/verify and POST /api/v1/newsletter/readers/me.

Those can be called from a web page with the workspace’s publishable key (dgz_pk_…, in Newsletter › Settings › General), in x-api-key or Authorization: Bearer. It can call nothing else: any other operation answers 403. Their routes answer a browser’s CORS preflight from any origin, and their answers carry Access-Control-Allow-Origin: *; no other route does, since a secret API key belongs on a server. The key is made with the first signup form, or there, and POST /api/v1/newsletter/keys/rotate replaces it: the old one stops at once (401). GET /api/v1/newsletter/keys reads it.

A page never needs a secret key for these. A site’s server can call them with an API key that has newsletter:read or newsletter:write, as any other operation.

To Operations
List posts and get one GET /api/v1/newsletter/posts GET /api/v1/newsletter/posts/{id}
Who a post went to GET /api/v1/newsletter/posts/{id}/recipients
Make, change and delete a draft POST /api/v1/newsletter/posts PATCH /api/v1/newsletter/posts/{id} DELETE /api/v1/newsletter/posts/{id}
Send, test, cancel, pause and resume POST /api/v1/newsletter/posts/{id}/send POST /api/v1/newsletter/posts/{id}/test POST /api/v1/newsletter/posts/{id}/cancel POST /api/v1/newsletter/posts/{id}/pause POST /api/v1/newsletter/posts/{id}/resume
The Overview’s numbers GET /api/v1/newsletter/overview
Settings GET /api/v1/newsletter/settings PATCH /api/v1/newsletter/settings
To Operations
List subscribers, or get one’s subscription GET /api/v1/newsletter/subscribers GET /api/v1/newsletter/subscribers/{contactId}
A subscriber’s page: contact, subscription, consent history, posts, segments, who referred them, their referrals and poll answers GET /api/v1/newsletter/subscribers/{contactId}/profile
Subscribe and unsubscribe (with a reason) POST /api/v1/newsletter/subscribers POST /api/v1/newsletter/subscribers/unsubscribe
Tag and untag, take off the list POST /api/v1/newsletter/subscribers/tags POST /api/v1/newsletter/subscribers/delete
Export as CSV: the ones named, or a tab, search and filters POST /api/v1/newsletter/subscribers/export

A subscription’s engagement is 0 to 5 stars from the posts that reached them in the last 90 days: up to 3 for the share a person opened and up to 2 for the share they clicked, where clicking half or more gives both, rounded; null when none reached them. recentSent, recentOpened and recentClicked are the counts behind it. country and region come from Cloudflare on their signup or a person’s open or click; formId, utm and referrerUrl from their signup.

The export’s filters are the Subscribers page’s: engagement (0–5, none), location (country codes), source, form, signedUp (from:<ms>, to:<ms>), tag and segment (segment ids), each a list of values; show is the tab (subscribed, pending, unsubscribed or all).

To Operations
List and get segments, with their subscribers GET /api/v1/newsletter/segments GET /api/v1/newsletter/segments/{id}
Make, change and delete one POST /api/v1/newsletter/segments PATCH /api/v1/newsletter/segments/{id} DELETE /api/v1/newsletter/segments/{id}
Add people to and take them out of a static one POST /api/v1/newsletter/segments/{id}/subscribers POST /api/v1/newsletter/segments/{id}/subscribers/remove

A segment is a CRM contact list. A smart one’s filter has the contact list filters and newsletter conditions, each with a kind:

kind Fields Takes
status in: subscribed, pending, unsubscribed, none Contacts whose subscription is in one of these states (none: never on the list)
engagement min, max (0–5) Subscribers with that many stars
opened, clicked last, unit (posts or days) A person opened (clicked in) any of the last last posts that went out (50 at most), or in the last last days
not_opened last, unit Got one of the last last posts and opened none; by days, subscribed longer than that and no opens in it
source in: signup sources
form in: form ids
utm key (source, medium, campaign, term, content), in Ignoring case
country in: ISO 3166-1 alpha-2 codes
signed_up withinDays, beforeDays Subscribed in the last, or more than, so many days ago
referrals min, max Subscribers with that many referrals that count

A post’s audience.lists takes segments. The same newsletter conditions work on crm.contacts.list and CRM’s lists.

To Operations
Import a CSV of subscribers POST /api/v1/newsletter/imports
Follow imports GET /api/v1/newsletter/imports/{id} GET /api/v1/newsletter/imports
Stop one POST /api/v1/newsletter/imports/{id}/cancel
Find subscribers with no opens in 30–365 days GET /api/v1/newsletter/subscribers/lapsed
Tag or unsubscribe them, a thousand a call POST /api/v1/newsletter/subscribers/clean

Importing subscribers says what an import does with each row and which columns it reads for each service.

To Operations
List forms and get one, with its subscribe link GET /api/v1/newsletter/forms GET /api/v1/newsletter/forms/{id}
Make, change, copy and delete one POST /api/v1/newsletter/forms PATCH /api/v1/newsletter/forms/{id} POST /api/v1/newsletter/forms/{id}/duplicate DELETE /api/v1/newsletter/forms/{id}
The welcome and confirmation emails GET /api/v1/newsletter/emails PATCH /api/v1/newsletter/emails POST /api/v1/newsletter/emails/preview

A form has a mode (inline, popup, slide_in, full_page), status (active or paused), content (heading, body, button, success and confirm messages, redirectUrl, footnote), fields (name: off, optional or required; custom: CRM field keys, each required or not), look (colours, radius, position, imageUrl), trigger (delay seconds, scroll percent, exitIntent, frequencyDays, hideForSubscribers), doubleOptIn (default, on, off), tags and siteIds. A signup keeps its id as the subscription’s formId. Signup forms says how each shows.

POST /api/v1/newsletter/subscribe signs up a visitor of your site: email, name, CRM fields by key, the formId of a signup form (its tags, double opt-in and words), the ref code from ?ref= on the page they arrived at, utm tags and the pageUrl. It answers status (pending while they still have to confirm by email, else subscribed), the form’s message and its redirectUrl, the same whether or not they were subscribed already, so it says nothing of who’s on your list.

From a page, with the publishable key:

  • Send Turnstile’s token as turnstileToken where a Turnstile widget covers the page’s address: your yourfreesite.com sites, and your own domains once Reviews › Widgets has made your workspace a widget for them. Without it the signup is refused (403).
  • Each visitor gets a few signups a minute (429 past them).
  • honeypot is a hidden field people never fill: anything in it answers as a signup and keeps nothing.

From your server, with an API key, pass the visitor’s address as visitorIp for the same limit and the referral checks; a turnstileToken is checked when you send one.

await fetch("https://digize.com/api/v1/newsletter/subscribe", {
method: "POST",
headers: { "x-api-key": "dgz_pk_…", "content-type": "application/json" },
body: JSON.stringify({
email: form.email.value,
name: form.name.value,
formId: "nlf_…",
ref: new URLSearchParams(location.search).get("ref") ?? undefined,
pageUrl: location.href,
turnstileToken: turnstile.getResponse(),
}),
});

A signup with a ref always confirms by email, and counts for the referrer once they do (Referral program).

To Operations
The program’s settings GET /api/v1/newsletter/referrals/settings PATCH /api/v1/newsletter/referrals/settings
Its numbers, rewards, the rewards to send and the leaderboard GET /api/v1/newsletter/referrals
Every referral, by state (pending, counted, refused, void) GET /api/v1/newsletter/referrals/list
Void one, or count one that was refused POST /api/v1/newsletter/referrals/{contactId}/void POST /api/v1/newsletter/referrals/{contactId}/count
Rewards at milestones POST /api/v1/newsletter/referrals/milestones PATCH /api/v1/newsletter/referrals/milestones/{id} DELETE /api/v1/newsletter/referrals/milestones/{id}
Rewards earned, and marking one sent GET /api/v1/newsletter/referrals/rewards POST /api/v1/newsletter/referrals/rewards/{id}/sent

GET /api/v1/newsletter/referrals/mine answers one subscriber’s own numbers for a referral hub page on your site: link and code, count (referrals that count), pending, the milestones with whether each is reached, next (the next one and how many more), and rewards (each with its status, promo code, downloadUrl, or the addressUrl where they give their address). It takes token, the referral token on ?rt= of the hub link their emails carry ({{referral_hub_link}}), or a signed-in reader’s token from POST /api/v1/newsletter/readers/verify; a token for another workspace, or a made-up one, is 401. It’s null for someone no longer subscribed, and enabled is false while the program is off.

newsletter.subscribed and newsletter.unsubscribed (with contactId and source), and newsletter.confirmed (with contactId) when someone follows their double opt-in link. Imports and cleaning the list start no automations. newsletter.published (with newsletterId, slug and access) when a post goes on the web. newsletter.upgraded and newsletter.downgraded (with contactId, tierId, fromTierId, subscriptionId and source: stripe, comp or gift) when a reader’s paid tier changes; your webhooks get them as newsletter.subscriber.upgraded and .downgraded. newsletter.referral_milestone (with contactId, milestoneId and referrals) when a subscriber earns a referral reward. newsletter.poll_answered (with pollId, newsletterId, contactId, option (the answer’s words), optionIndex and question) when a reader answers a poll or changes their answer. Each starts the workflows whose trigger is that event (Automations); GET /api/v1/newsletter/automations lists those workflows.

GET /api/v1/newsletter/published lists the posts on the web, the newest first, limit at a time (20 unless it says, at most 100) from offset, with the total. tag keeps to posts with that tag, in any case. GET /api/v1/newsletter/published/{slug} answers one by its slug, or null when no published post has it.

Each post has:

Field
id, slug Its id and its address on your site
url Its full address, from the post URL pattern in Newsletter › Settings; null without one
title, subtitle Its headline (the subject when it has no title) and subtitle
seo.title, seo.description For <title>, <meta name="description"> and link previews: the SEO fields, else the title and the subtitle or first words
thumbnailUrl Its picture, for the archive and og:image
tags, authors Its tags, and its authors’ id and name
access all, free or paid
publishedAt When it went on the web
html The post as web HTML: semantic tags with nl- classes (nl-image, nl-button, nl-embed, nl-html, nl-paywall) for your stylesheet. Headings start at <h2>; your page’s <h1> is the title
blocks The blocks behind the HTML, for a site that renders its own
paywalled Whether something was held back for paid readers
excerpt Its first words, for an archive or a feed

Blocks for email only aren’t in either. Merge tags have no reader on the web, so only {{workspace_name}} and {{view_online}} are filled in.

import { createApiClient } from "@digize/sdk/api";
const api = createApiClient({ apiKey: env.DIGIZE_API_KEY });
// The archive, a page at a time.
const { data: posts, total } = await api.newsletter.posts.published({
limit: 12,
offset: 0,
});
// One post's page.
const post = await api.newsletter.posts.bySlug({ slug: "the-guji-is-here" });
if (!post) return new Response("Not found", { status: 404 });
Terminal window
curl "https://digize.com/api/v1/newsletter/published?tag=recipes&limit=10" \
-H "Authorization: Bearer $DIGIZE_API_KEY"

The HTML and blocks are a free reader’s: they stop at the post’s first paywall break, which is kept (<div class="nl-paywall" data-paywall>, the last block) for your page to show its words and your call to subscribe, and paywalled is true. A post for paid readers only with no break has nothing but that call.

Pass a reader token as reader (Reader sign-in) and a paid reader’s posts come whole, with paywalled false; their tier is checked again on every call. Once you sell paid tiers, a free reader’s paywall carries the link to your upgrade page: an “Upgrade to keep reading” link to …/_n/upgrade/….

Cache what you fetch, and refresh it when Digize tells you: the newsletter.post.published, newsletter.post.updated and newsletter.post.unpublished webhooks carry the post’s slug and url (Publishing to the web).

A feed or a sitemap is a page of GET /api/v1/newsletter/published: title, url (or your own address from slug), publishedAt, excerpt or html, authors and tags. Escape what goes into XML, and page with offset past 100.

Operation
POST /api/v1/newsletter/posts, PATCH /api/v1/newsletter/posts/{id} A draft’s subject, preview text, format (blocks, plain or html), blocks or body, access, visibility (email_web, email, web), web (title, subtitle, SEO, thumbnail, tags, authors) and slug; templateId starts one from a template
POST /api/v1/newsletter/posts/preview The email (medium: email) or web page (medium: web), as a free or paid reader
POST /api/v1/newsletter/posts/{id}/publish, POST /api/v1/newsletter/posts/{id}/unpublish Putting a web-only post on the web, or taking one off
POST /api/v1/newsletter/images A one-time address to upload a post’s image to, and where it shows from
GET /api/v1/newsletter/templates, POST /api/v1/newsletter/templates, PATCH /api/v1/newsletter/templates/{id}, DELETE /api/v1/newsletter/templates/{id} Templates (Templates)

A block’s links must be https://, http://, mailto: or tel: addresses, or a merge tag such as {{view_online}}; anything else is refused with invalid.

Operation
POST /api/v1/newsletter/posts/{id}/checks Every check before a post goes, error or warning, and how many it goes to now; with audience, abTest and at it checks those in place of the saved post’s. POST /api/v1/newsletter/posts/{id}/send refuses a post with an error
PUT /api/v1/newsletter/posts/{id}/ab-test A draft’s subject line test: variants (B to D, each subject and preview), share (0.1–0.5), metric (opens or clicks) and waitHours (1–24); null takes it off
POST /api/v1/newsletter/posts/{id}/pick-winner The test’s winner by its variantId, while it waits; the rest get it
POST /api/v1/newsletter/posts/{id}/resend The post again, with a new subject, to those it reached who didn’t open it or click: a post of its own (kind: resend, parentId), now or at at, 24 hours after it finished at the soonest
POST /api/v1/newsletter/posts/{id}/reschedule A scheduled post’s new time
GET /api/v1/newsletter/calendar Posts scheduled or sent from from to before to (62 days at most), for a calendar

An audience’s excludeLists leaves out anyone in those segments. A test’s winner has the highest rate of people who opened (a person’s open; a click counts) or clicked, of those its subject reached; with fewer than 20 reached by any subject the post’s own (A) is kept, and subjects tied on the best rate go to the earliest. abTest.reason says which: best, tie, too_few or manual. A recipient’s variant is the subject they were dealt in the test, null for those who got the winner. See Sending.

Paid tiers are products on your own connected Stripe account (Paid subscriptions). Money is in your workspace’s currency, in its minor unit (800 is $8.00).

Operation
GET /api/v1/newsletter/paid, GET /api/v1/newsletter/tiers Whether Stripe is connected, and the tiers with their monthly and yearly prices, trialDays and readers
POST /api/v1/newsletter/tiers, PATCH /api/v1/newsletter/tiers/{id} A tier’s name, description, monthly, yearly and trialDays; a new price is a new Stripe Price
POST /api/v1/newsletter/tiers/{id}/archive, POST /api/v1/newsletter/tiers/{id}/restore, POST /api/v1/newsletter/tiers/order Taking a tier off the upgrade page, putting it back, ordering them
POST /api/v1/newsletter/tiers/{id}/checkout A Stripe Checkout url for a reader (reader token or email) to subscribe to a tier, month or year
POST /api/v1/newsletter/gifts/checkout, GET /api/v1/newsletter/gifts Buying some months of a tier for someone, and the gifts bought
GET /api/v1/newsletter/paid/readers, GET /api/v1/newsletter/subscribers/{contactId}/tier Readers at a paid tier, and one subscriber’s tier, comps and Stripe subscriptions
POST /api/v1/newsletter/subscribers/{contactId}/comp, POST /api/v1/newsletter/comps/{grantId}/end Giving a tier until a date without charging, and ending it
GET /api/v1/newsletter/revenue, GET /api/v1/newsletter/posts/{id}/revenue MRR, readers by tier, upgrades and cancellations by month, posts credited with upgrades; one post’s sponsors, upgrades and gifts
GET /api/v1/newsletter/paid/settings, PATCH /api/v1/newsletter/paid/settings Where readers land, the hosts sign-in links may go back to, the free tier’s name
POST /api/v1/newsletter/readers/sign-in, POST /api/v1/newsletter/readers/verify, POST /api/v1/newsletter/readers/me Signing a reader in on your site and reading their token (Reader sign-in)

An audience’s tier takes all, free, paid or a tier’s id; a paid-only post goes to paid readers whatever it says. A segment’s tier condition takes the same values. A subscriber’s tierId, tierUntil and tierSource say what they read at.

Operation
GET /api/v1/newsletter/sponsors, GET /api/v1/newsletter/sponsors/{id} Sponsors with their placements and revenue, and one’s report: each post that carried them with sends, opens, clickers, clicks and price
POST /api/v1/newsletter/sponsors, PATCH /api/v1/newsletter/sponsors/{id}, POST /api/v1/newsletter/sponsors/{id}/archive, DELETE /api/v1/newsletter/sponsors/{id} Keeping sponsors
PATCH /api/v1/newsletter/sponsor-placements/{id}, GET /api/v1/newsletter/posts/{id}/sponsors A placement’s price, and a post’s sponsors

Members download a report at /api/newsletter/sponsors/<id>/report.csv and .pdf. See Sponsors.

To Operations
Every poll that went out, or one post’s (newsletterId), with each answer’s votes and share, how many answered and left a comments GET /api/v1/newsletter/polls
One poll with the latest 200 comments (recent) GET /api/v1/newsletter/polls/{id}
A poll’s results for your site GET /api/v1/newsletter/polls/{id}/results

A poll is a poll block in a post’s blocks: question, 2 to 6 options, showResults and pollId, which is empty in a draft and given when the post goes out. Votes come from readers’ emails only: each answer is the reader’s own signed link to a page that counts the vote when its button is pressed (Polls).

GET /api/v1/newsletter/polls/{id}/results can be called from a page with the publishable key: it answers the question and each option’s label, with votes and share (0 to 1) and the total votes, or null numbers when the poll hides its results. The web HTML of a poll block names it in data-poll-id.

The poll segment condition ({ kind: "poll", pollId, option? }) takes the contacts who answered a poll, or picked the answer at option (0 first).

To Operations
Growth by period (day: the last 30, week: the last 12, month: the last 12) and how the people who joined came: source, form, UTM source and campaign, referral, country, with the top referrers GET /api/v1/newsletter/reports/subscribers
Subscribers by engagement stars, the share active in 30 and 90 days, and people’s opens of the last 90 days’ posts by mail app and device GET /api/v1/newsletter/reports/engagement
The latest posts that went out (limit, up to 200) with delivered, open and click rates, unsubscribes, spam complaints and revenue GET /api/v1/newsletter/reports/posts
A post’s click map: its email with each tracked link marked with its clicks and share, and the links’ numbers GET /api/v1/newsletter/posts/{id}/click-map

Rates are shares of the people a post reached (sent, less bounced), null before it reached anyone; opens are a person’s (a click counts as one), not a mail app’s own fetch. A recipient’s openDevice (mobile, tablet, desktop, or null when it didn’t say) is from their first open or click that named one. The click map’s HTML runs nothing; show it in a sandboxed frame. See Reports.

To Operations
List feeds, with their items so far (baseline, drafted, pending, sent) and the latest GET /api/v1/newsletter/feeds
Add one POST /api/v1/newsletter/feeds
Change what it does, or pause it (active) PATCH /api/v1/newsletter/feeds/{id}
Remove one DELETE /api/v1/newsletter/feeds/{id}
Read one now POST /api/v1/newsletter/feeds/{id}/check

A feed’s mode is draft (a draft post for each new item) or digest (the new items in a post sent on digest’s schedule: frequency daily or weekly, the day for a weekly one, and the hour, on the workspace’s clock, to audience, with your subject and intro). POST /api/v1/newsletter/feeds fetches the address first and refuses one that isn’t an RSS 2.0 or Atom feed, isn’t on the public internet, or is larger than 2 MB; the items it has then are the baseline, never posted. Items are kept by GUID, so none goes twice. Feeds are read every hour. See RSS to email.