Back to API Overview

Site blog API

Site blog: turn a site's blog on or off, and set its addresses, posts per page and RSS.

4 endpoints

Endpoints

POST
/api/v1/blog/enable

Turn a site's blog on. The first time it makes the site's Posts table in the site's database (fields Title, Slug, Excerpt, Body (markdown), Featured image, Featured image alt, SEO title, SEO description, Keywords, Tags, Category, Author, Featured (a checkbox), Status (draft, scheduled, published), Publish at, Published at, Content updated at, Edited by); turning it on again reuses that table and its posts. It publishes the posts whose Status is published at the post address (default /blog/:slug), only through this site and only the mapped fields, and saves the settings (blog address /blog, posts per page 10, RSS on). Calling it while it is on changes nothing. From the chat, an AI client or an API key it waits for the tap of the person on an approval card (the posts become readable by anyone through the site); an agent or an automation is refused; in the dashboard it is made at once. Refused, nothing made, while the server has not switched on pages published from a table (the words say the blog is not available yet). Param: siteId (site_listProjects). Needs "Edit and publish sites" and "Share bases and forms publicly". Returns the settings, or the approval card to tap. Write posts as rows of the Posts table (tables_* tools, Status published to publish). The site's pages read them with serenities.content.list({ path: '/blog', page, perPage, category, tag, featured }) and serenities.content.get({ path }); both answer featured and readTime (minutes, computed from the body).

Parameters

siteIdstringrequired

The site (site_listProjects)

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/blog/enable \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "siteId": "example"
}'
POST
/api/v1/blog/disable

Turn a site's blog off: its posts stop being served (their addresses answer 404) and the blog list answers 404. The Posts table and every post stay; blog_enable serves them again from the same table. Param: siteId. Needs "Edit and publish sites". Returns the settings.

Parameters

siteIdstringrequired

The site (site_listProjects)

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/blog/disable \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "siteId": "example"
}'
POST
/api/v1/blog/getSettings

A site's blog settings: enabled, blogAddress, postAddress, perPage, rss, categories, listHeading, listIntro, ctaHeading, ctaText, ctaLink, twitterHandle, newsSitemap, the Posts table's tableId and tableName, bindingId. A site whose blog was never on answers enabled false with the defaults (categories [], newsSitemap false, the words null). Param: siteId.

Parameters

siteIdstringrequired

The site (site_listProjects)

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/blog/getSettings \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "siteId": "example"
}'
POST
/api/v1/blog/updateSettings

Change a site's blog settings; only what is sent changes. Params: siteId, blogAddress (the list page's address, such as /blog or /news), postAddress (a post's address, ending with :slug, such as /posts/:slug; each post's old address keeps working with a 301 to the new one), perPage (1 to 50), rss (true or false; stored, but rss false does not stop the feed yet), categories (a list of at most 100 names, each at most 60 characters; empty = any category), listHeading (at most 120 characters), listIntro (500), ctaHeading (120), ctaText (300), ctaLink (an https address or a path on this site such as /pricing), twitterHandle (such as @serenities_ai: 1 to 15 letters, digits or underscores), newsSitemap (true or false, default false; stored, the news sitemap itself comes later). null or "" clears a text. A value that can't be used is refused with words saying why, and nothing changes. Publish at is not checked yet: a post whose Status is published is served by content.list and content.get straight away, even with a future Publish at. Needs "Edit and publish sites". Returns the settings.

Parameters

siteIdstringrequired

The site (site_listProjects)

blogAddressstring

The address of the list page, such as /blog or /news

postAddressstring

The address of a post, ending with :slug, such as /blog/:slug or /posts/:slug. A changed address keeps the old one working: each post's old address answers with a 301 to the new one

perPageinteger

Posts per list page, 1 to 50

rssboolean

The blog's RSS feed on or off

categoriesarray

The blog's category names (at most 100, each at most 60 characters, no name twice); an empty list lets each post use any category

listHeadingstringnull

The blog list page's heading (at most 120 characters; null or "" clears it)

listIntrostringnull

The blog list page's introduction (at most 500 characters; null or "" clears it)

ctaHeadingstringnull

The call-to-action heading shown on the blog (at most 120 characters; null or "" clears it)

ctaTextstringnull

The call-to-action text (at most 300 characters; null or "" clears it)

ctaLinkstringnull

The call-to-action link: an https address or a path on this site, such as /pricing (null or "" clears it)

twitterHandlestringnull

The X (Twitter) handle for the posts' cards, such as @serenities_ai (1 to 15 letters, digits or underscores)

newsSitemapboolean

A Google News sitemap for the blog on or off (default off; stored now, the sitemap itself comes later)

publicBaseUrlstringnull

The blog's public address when the site is served at another domain through your own proxy, such as https://example.com (an https address; a path is allowed, such as https://example.com/articles). The blog's canonical links, social cards, feed and sitemap then name it. null or "" puts everything back on the site's own address. The blog must be on

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/blog/updateSettings \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "siteId": "example",
  "blogAddress": "example",
  "postAddress": "example"
}'