Documentation

POST /api/intent/apply

Apply a proposed intent, regenerating the store.

RequestPOST /api/intent/apply
AuthenticationSession cookie required
Handlerbackend/server.py

What it does

Commits a proposal by echoing it back. The engine refuses `stale_proposal` when the proposal no longer matches what it would propose now, and `no_proposal_echoed` when the caller sent none — an apply that trusted the request alone could commit a change the founder never saw. An irreversible change is refused unless `confirm_irreversible` is set. The response carries `because` and `source_row` read back from the applied record, and `reversible` so the screen can offer the revert honestly.

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
ff_sessioncookiestringOptionalThe session identifier. Omit it on the first call and store the value the response sets; every later call must send the same one or the engine treats the caller as a new visitor with no holds and no claims.
surfacebodystringRequiredThe surface being edited.
requestedbodystringRequiredThe original request.
proposedbodyobjectRequiredThe proposal returned by `POST /api/intent`, echoed verbatim.
confirm_irreversiblebodybooleanOptionalRequired when the change cannot be reverted.

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 '{"surface":"<string>","requested":"<string>","proposed":"<object>","confirm_irreversible":"<boolean>"}' \
  "https://flowfinds.ai/api/intent/apply"
const res = await fetch("https://flowfinds.ai/api/intent/apply", {
  method: "POST",
  credentials: "include",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "surface": "<string>",
    "requested": "<string>",
    "proposed": "<object>",
    "confirm_irreversible": "<boolean>"
  }),
});
const data = await res.json();
import requests

s = requests.Session()
r = s.post("https://flowfinds.ai/api/intent/apply", json={
    "surface": "<string>",
    "requested": "<string>",
    "proposed": "<object>",
    "confirm_irreversible": "<boolean>"
  })
data = r.json()

Recorded example

curl -s -b cookies.txt -c cookies.txt \
  -X POST -H 'Content-Type: application/json' \
  -d '{"surface":"…","requested":"…","proposed":{ }}' \
  "$FLOWFINDS_ORIGIN/api/intent/apply"

Responses

200The intent was applied.

FieldTypeDescription
statusstring`applied`, or `regenerate_failed` when the change committed but the store rebuild did not.
surfacestringThe surface that was edited.
appliedobjectThe intents book entry now in force for the product.
becausestringThe justification, read back from the record.
source_rowobjectThe dated row that justified the change.
reversiblebooleanWhether `POST /api/intent/revert` can undo it.
store_statusstringThe manifest status after regeneration.

Errors

StatusReasonWhen
409stale_proposalThe echoed proposal no longer matches the engine's current one.
409no_proposal_echoedNo proposal was sent back.
409irreversible_without_confirmationThe change is irreversible and `confirm_irreversible` was not set.
409build_in_progressA build is already running for this product.
500apply_build_raisedThe regeneration raised.

Related

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