Content API
Newsletter signup
Add readers to your site's newsletter from your own signup form.
If your site runs its own frontend, use this endpoint for its newsletter signup form. Hosted blogs already show a form when the newsletter is on. You write and send the emails from the dashboard.
It is the only Content API endpoint that writes: it adds one reader per call and nothing else.
Show the form
The site object says whether to show a form, and what it should say:
curl https://api.quillhive.com/api/public/v1/sites/YOUR_SITE_ID{
"site": {
"newsletter": {
"enabled": true,
"title": "Get the newsletter",
"description": null
}
}
}Show the form only when enabled is true. title and description are the copy set in Newsletter → Settings, or null when you should use your own.
Subscribe
/sites/{siteId}/newsletter/subscribe| Field | Type | Description |
|---|---|---|
email |
string | Required |
name |
string | Optional, up to 200 characters |
website |
string | Optional spam trap. Add it to your form as a hidden field people can't see. When it is filled, the request answers like a success and nothing happens |
curl -X POST https://api.quillhive.com/api/public/v1/sites/YOUR_SITE_ID/newsletter/subscribe \
-H "Content-Type: application/json" \
-d '{"email":"reader@example.com"}'{ "status": "confirmation_sent" }status |
What to tell the reader |
|---|---|
confirmation_sent |
Check your inbox to confirm. The site asks new readers to confirm by email (the default) |
subscribed |
You're subscribed. The site doesn't ask for confirmation |
The answer is the same whether or not the address was already on the list, so the form can't be used to find out who subscribes. A reader who asks twice gets at most one confirmation email every 10 minutes.
You can call it from the browser or from your server. From a server, pass the reader's IP address in X-Forwarded-For, so the rate limit counts each reader instead of your server. An API key isn't needed; if you send one, it must belong to the site.
Errors
| Status | Meaning |
|---|---|
400 |
The email address isn't valid |
403 |
The newsletter is off, or the site reached its plan's subscriber limit |
429 |
More than 10 signups from one address in 10 minutes. Ask the reader to try again later |
Errors carry a message you can show the reader:
{ "error": "Enter a valid email address." }What happens next
Readers confirm and unsubscribe through links in the emails, on pages Quillhive hosts, so your frontend doesn't need any other route. Manage subscribers and send emails from the dashboard: see Newsletter in the help center.