Docs · Content API REST reference
Content API · v1
Content API reference
The REST endpoints your site calls to read what NexoFlow publishes for it. On JavaScript or TypeScript, the nexoflow-sdk package wraps the posts and site settings with types and retries; everything else, and any other language, is plain HTTP.
Overview
The Content API is for one website reading its own content: published posts, site settings, the structured data for a page, the site's llms.txt and its post images. Every call is authenticated with that site's key and runs from your server, never the browser.
curl "https://nexoflow.net/api/v1/content/posts?limit=5&sort=newest" \
-H "Authorization: Bearer $NEXOFLOW_API_KEY"Authentication
Send your site key as a Bearer token. Keys start with pk_live_. A missing, malformed or replaced key gets a 401.
Authorization: Bearer pk_live_••••••••••••••••••••••••••••••••Never in a URL, never in a browser
?key= are refused, because URLs end up in logs and page source. The API also doesn't answer browsers calling from other sites. Keep the key in your hosting's NEXOFLOW_API_KEY and call the API from server code only.Base URL
Every path below starts here.
https://nexoflow.net/api/v1Endpoints
Paths are relative to the base URL. All of them take the same Bearer key, except images, which carry their own token.
- GET
/content/postsList published posts
Query:
page(default 1),limit(default 20, max 100),tag,category,sort(newest, the default, oroldest). Newest first by publish date. A scheduled post stays out until its publish date. The list leaves out each post's body; fetch the post for that. - GET
/content/posts/{slug}One post with its body
Query:
format(html, the default, ormarkdownfor the post's source) andstyled=trueto wrap the HTML in a styled container with its CSS. A slug that isn't published yet, or is scheduled for later, gets a404. - GET
/content/site-settingsPermalinks and feature flags
Returns
{ permalinkStructure, features }.permalinkStructuredefaults to/%slug%;featuresholds four on/off flags (reading time, related posts, share buttons, schema markup), each on unless switched off. - GET
/content/structured-data?path=/a/pageThe JSON-LD for one page
Returns
{ jsonld, scriptTag }, wherescriptTagis ready to print in the page's head. Returns{ jsonld: null }when the page has no valid markup or schema markup is switched off.pathis required (up to 2,048 characters); without it you get a400. - GET
/content/llms-txtYour site's llms.txt
Plain text built from your business records, ready to serve at your own
/llms.txt, with anETag. A404with a plain sentence when there's nothing to serve: no live website on record yet, or schema markup switched off. - GET
/content/images/{path}?token=img_…Post and author images
You don't build these: every image URL in a post response already points here with its
token. The token only reads this site's images, so it's safe in public HTML. It is not your site key. - POST
/content/revalidateNote that content changed
JSON body:
slugs(optional; empty means everything) andtype(defaultpost). Returns{ revalidated, slugs, type, projectId, timestamp }for your own cache code; it doesn't clear your site's cache itself. - POST
/content/verifyConfirm the connection
Marks the site as connected and returns
{ ok, projectId, connectedAt }. Optional: any authenticated request does the same.
nf.posts.slugs() in the SDK isn't an endpoint of its own: it pages through /content/posts and returns the slugs.
Response shapes
Responses are JSON (llms.txt is plain text, images are the image). The exact fields and their TypeScript types ship with nexoflow-sdk; the ones you'll use most:
Post list
| Field | What it holds |
|---|---|
posts | The posts on this page: slug, title, excerpt, metaTitle, metaDescription, noIndex, noFollow, categories, tags, author, featuredImageUrl, dates, readingTimeMinutes and path. |
pagination | page, limit, total, totalPages, hasMore |
siteFeatures | The same on/off flags as site settings, so one call is enough for an index page. |
permalinkStructure | For example /%slug% or /%year%/%month%/%slug%. Each post already has a resolved path. |
One post
Everything a list item has, plus:
| Field | What it holds |
|---|---|
content | The body as HTML (or the source with format=markdown). In HTML, an FAQ section is included as a styled accordion. |
contentStyles | CSS for the body and its FAQ. Inject it on the page so the post is styled as intended. |
focusKeyword | The post's main search phrase, or null. Single post only. |
faq | The FAQ as { question, answer } items, for FAQPage JSON-LD. Empty when the post has none. |
relatedArticles | Resolved cards for the related posts chosen in the editor. Empty when related posts are switched off. |
siteFeatures | The site's on/off flags, so the post page needs no second call. |
Image URLs (featuredImageUrl, images inside content) are absolute and ready for an img tag as they are. thingsToDoPages and relatedThingsToDo come from NexoFlow's earlier version; v2 doesn't make those pages, so they're empty unless your site had them before.
Caching
Each answer says how long a cache may keep it:
| Endpoint | Cache-Control |
|---|---|
| Posts and one post | public, s-maxage=10, stale-while-revalidate=30 |
| Site settings | public, s-maxage=60, stale-while-revalidate=120 |
| Structured data, llms.txt | private, max-age=300 |
| Images | public, max-age=31536000, immutable |
On Next.js, the SDK adds its own revalidate hint (60 seconds unless you set another), so your pages refresh on that schedule.
Errors
Errors come back with an HTTP status and a JSON body with one error message, written to be read (llms.txt answers its 404 in plain text). The SDK turns them into a NexoFlowError.
HTTP/1.1 401 Unauthorized
{ "error": "Missing API key. Use header: Authorization: Bearer pk_live_…" }400: a required parameter is missing, such aspathfor structured data.401: the key is missing, doesn't start withpk_live_, isn't recognised, or was sent as?key=.402: the business's plan has ended and so has the 30 days its posts stay up afterwards.404: no published post with that slug, nothing to serve (llms.txt), or the business was deleted.500: something failed on NexoFlow's side. The SDK retries these on its own.