Documentation

POST /api/pages

Generate a page from an intent.

RequestPOST /api/pages
AuthenticationSession cookie required
Handlerflowfinds-organ/app/api/pages/route.ts

What it does

Turns a normalised intent into a stored page and returns its permanent path. A guest user is minted if there is none, so the page has an owner from the moment it exists. Repeating an intent reuses the existing page rather than creating a second one, and `reused` says which happened. When generation cannot produce a page the response is 200 with `kind: "fallback"` and a route to send the visitor to instead — a failure to generate is not a failure to answer.

Authentication

Session cookie required. Send the ff_session cookie. Without one the engine treats the caller as a new visitor with no holds and no claims, and returns a new cookie to use from then on.

Parameters

ParameterInTypeRequiredDescription
textbodystringRequiredThe intent. Refused as `empty intent` when blank.

Request

The cookie jar carries the session between calls. Angle-bracketed values are the parameter types from the table above.

curl -s -b cookies.txt -c cookies.txt \
  -X POST -H 'Content-Type: application/json' \
  -d '{"text":"<string>"}' \
  "https://flowfinds.ai/api/pages"
const res = await fetch("https://flowfinds.ai/api/pages", {
  method: "POST",
  credentials: "include",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "text": "<string>"
  }),
});
const data = await res.json();
import requests

s = requests.Session()
r = s.post("https://flowfinds.ai/api/pages", json={
    "text": "<string>"
  })
data = r.json()

Recorded example

curl -s -b cookies.txt -c cookies.txt \
  -X POST -H 'Content-Type: application/json' \
  -d '{"text":"show me my supplier terms"}' \
  "$FLOWFINDS_ORIGIN/api/pages"

Responses

200A page exists.

FieldTypeDescription
kindstring`generated`.
hrefstring`/p/<slug>`.
reusedbooleanTrue when an existing page was returned.
headlinestringThe page's headline.
insightstringThe one-line insight.

200Generation declined.

FieldTypeDescription
kindstring`fallback`.
hrefstringWhere to send the visitor instead.
reasonstringWhy generation declined.

Errors

StatusReasonWhen
400The body is malformed, or the intent is empty.
429quota exceededThe owner's page quota is used up.

Related

Back to the API reference index, or read the cookbook for recipes that compose this endpoint with others.