Documentation

POST /api/ai/edit

Edit the storefront in natural language.

RequestPOST /api/ai/edit
AuthenticationSession cookie required
Handlerbackend/editor10x.py

What it does

Hands a message to the editor and reports exactly what changed. The interesting responses are the failures: `no_change` means nothing was modified; `partial_edit` means changes remain in the draft and must be reviewed or undone before retrying, rather than being silently rolled forward; `editor_unavailable` carries the editor's own stderr, truncated, instead of a generic apology. `changed` is the list of fields actually modified, so a client never has to diff to find out.

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.
messagebodystringRequiredThe edit, in the founder's words. Refused as `no_message` when empty and `message_too_long` when oversized.
product_idbodystringOptionalThe product to edit. Defaults to the session's resolved product.

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

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

Recorded example

curl -s -b cookies.txt -c cookies.txt \
  -X POST -H 'Content-Type: application/json' \
  -d '{"message":"Make the hero headline shorter.","product_id":"…"}' \
  "$FLOWFINDS_ORIGIN/api/ai/edit"

Responses

200The edit was made.

FieldTypeDescription
statusstringThe outcome.
product_idstringThe product.
changedstring[]Fields actually modified.
summarystringWhat the editor did.

200Nothing changed.

FieldTypeDescription
statusstring`no_change`.
changedstring[]Empty.
explanationstring'Nothing in your store was modified.'

200The edit half-completed.

FieldTypeDescription
statusstring`failed`.
reasonstring`partial_edit`.
changedstring[]What did change and is sitting in the draft.
explanationstringReview or undo before retrying.

200The editor could not run.

FieldTypeDescription
statusstring`failed`.
reasonstring`editor_unavailable` or `no_change`.
explanationstringThe editor's own message or stderr, truncated to 300 characters.

Errors

StatusReasonWhen
400no_messageThe message is empty.
401The session has no account.
409build_in_progressA build is running for the product.
429The editor usage meter refused.
500The editor raised.
503cli_unavailableThe editor process is not installed on this machine.

Related

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