Content pages API
Content pages: publish a table as pages on your site, list them, or stop publishing.
Endpoints
/api/v1/content/bindPublish a table as pages on a site: its PUBLISHED rows become readable by anyone, only through this site, mapped fields only (drafts and unmapped fields never leave). Writes an access rule on the table that the owner sees and can change. From the chat, an AI client or an API key this waits for the tap of the person on an approval card (nothing is changed before it); an agent or an automation is refused; in the dashboard it is made at once. Params: siteId (site_listProjects), tableId (tables_listTables), urlPattern (the address of a row, ending with :slug, such as /blog/:slug or /recipes/:category/:slug; /api, /.auth, /_static and /assets are kept by the platform), fields (field ids from tables_getFieldsByTableId: slug and title are needed; description, image, body, publishedAt, updatedAt, author and category are optional; only these fields are ever readable; a secret field cannot be mapped), statusField (field id of a text or select Status field), publishedValue (the status value that means published, such as published), optional publicBaseUrl (an https address the pages are also served from through the owner's own proxy, such as https://example.com; every address the pages name uses it: canonical, og:url, JSON-LD, the feed, the sitemap, IndexNow and a changed slug's 301; the proxy forwards the pattern's paths, /assets/*, /sitemap-c-*, /sitemap-n-*, /feed-* and /<IndexNow key>.txt to the site's own address with the same path), titleTemplate ("{title} | {siteName}"), seoFields (field ids holding a row's own seoTitle, seoDescription, ogImage, noindex, canonical) and canonicalBindingId (for a table bound to a second site: the binding whose address is the canonical one; default the first made), news (true for a news collection: rows published in the last 48 hours get a Google News sitemap and each page a NewsArticle; needs fields.publishedAt; default false) and authorKind (who each page's Article names as author: organization, the default, is the site; person is the row's fields.author, which must be mapped). Refused with the reason when the pattern is reserved or has no :slug, a mapped field is not a field of the table, a published row's slug is not lowercase letters, digits and hyphens or is used twice, news is on without fields.publishedAt, or authorKind is person without fields.author. Needs "Edit and publish sites" and "Share bases and forms publicly". The site's own page reads a row with serenities.content.get({ path }), with React use() inside <Suspense> so each published row's stored page holds it: every published row is stored as its own page at its address (in the binding's sitemap, named by the site's sitemap index), an unpublished, deleted or closed row answers a real 404, and a changed slug leaves a 301 from the old address; each page carries one JSON-LD graph (Article or NewsArticle: headline, dates from publishedAt and updatedAt, image, the site as publisher) and a link to the table's RSS feed (its latest published rows, newest first), and IndexNow (Bing, Yandex and others; not Google, which reads the sitemap) is told each time a page is published, changed or removed. Returns the new entry with sitemaps (the binding's sitemap URLs, absolute on its canonical base: publicBaseUrl when set, else the site's own address; name them in the robots.txt of a proxied host), or the approval card to tap.
Parameters
siteId | stringrequired | The site (site_listProjects) |
tableId | stringrequired | A table of this workspace (tables_listTables); it may be bound to several sites |
urlPattern | stringrequired | The address of a row on the site, ending with :slug, such as /blog/:slug or /recipes/:category/:slug |
fields | objectrequired | Which field fills which part of the page (slug, title, description, image, body, publishedAt, updatedAt, author, category); only these fields ever leave. Field ids from tables_getFieldsByTableId. |
statusField | stringrequired | Field id of the status (a text or select field, such as Status). The status, slug and category fields must be text-like (text, longtext, select, status, slug, email, url); a calculated field (formula, lookup, rollup, hash, created_time, updated_time) is refused, because its value is worked out after each save and the publish checks could not see it. While bound, tables_updateField refuses retyping them to a non-text type (unbind first) |
publishedValue | stringrequired | The status value that means published, such as published |
publicBaseUrl | string | An https address the pages are also served from (your own proxy), such as https://example.com; the canonical address of a page is this plus its path |
titleTemplate | string | The page title, with {title} and {siteName}, such as "{title} | {siteName}" |
seoFields | object | Optional per-row overrides: the field ids holding a row's own seoTitle, seoDescription, ogImage, noindex, canonical |
canonicalBindingId | string | For a table bound to a second site: the binding whose address is the canonical one (default: the first binding made) |
news | boolean | A news collection (default false): its rows of the last 48 hours get a Google News sitemap and each page a NewsArticle. Needs fields.publishedAt |
authorKind | string | Who each page's Article names as author: 'organization' (default, the site) or 'person' (the row's fields.author) Allowed values: |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/content/bind \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"siteId": "example",
"tableId": "example",
"urlPattern": "example"
}'/api/v1/content/unbindStop publishing a table on a site: removes the binding and the access rule it wrote on the table. It only closes access, so it is made at once, with no approval card. Param: bindingId (from content_list). Needs "Edit and publish sites". Returns the binding id.
Parameters
bindingId | stringrequired | From content_list |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/content/unbind \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"bindingId": "example"
}'/api/v1/content/listList the tables a site publishes as pages: each binding's id, table, address pattern, mapped fields, status field and published value. No row data. Param: siteId (site_listProjects). Returns one entry per table the site publishes that you may see (a table in a base your access limits close is left out), with its tableName.
Parameters
siteId | stringrequired | The site (site_listProjects) |
Example Request
curl -X POST https://app.serenitiesai.com/api/v1/content/list \
-H "Authorization: Bearer mk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"siteId": "example"
}'