Documentation
POST /api/ai/edit
Edit the storefront in natural language.
| Request | POST /api/ai/edit |
|---|---|
| Authentication | Session cookie required |
| Handler | backend/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
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
ff_session | cookie | string | Optional | The 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. |
message | body | string | Required | The edit, in the founder's words. Refused as `no_message` when empty and `message_too_long` when oversized. |
product_id | body | string | Optional | The 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
200 — The edit was made.
| Field | Type | Description |
|---|---|---|
status | string | The outcome. |
product_id | string | The product. |
changed | string[] | Fields actually modified. |
summary | string | What the editor did. |
200 — Nothing changed.
| Field | Type | Description |
|---|---|---|
status | string | `no_change`. |
changed | string[] | Empty. |
explanation | string | 'Nothing in your store was modified.' |
200 — The edit half-completed.
| Field | Type | Description |
|---|---|---|
status | string | `failed`. |
reason | string | `partial_edit`. |
changed | string[] | What did change and is sitting in the draft. |
explanation | string | Review or undo before retrying. |
200 — The editor could not run.
| Field | Type | Description |
|---|---|---|
status | string | `failed`. |
reason | string | `editor_unavailable` or `no_change`. |
explanation | string | The editor's own message or stderr, truncated to 300 characters. |
Errors
| Status | Reason | When |
|---|---|---|
400 | no_message | The message is empty. |
401 | — | The session has no account. |
409 | build_in_progress | A build is running for the product. |
429 | — | The editor usage meter refused. |
500 | — | The editor raised. |
503 | cli_unavailable | The editor process is not installed on this machine. |
Related
GET /api/store— The state of the session's storefront.POST /api/store— Start generating the storefront for the session's product.POST /api/store/publish— Verify and publish the storefront, regenerating it if verification demands.POST /api/intent— Ask the engine what it would change on a surface, and why.POST /api/intent/apply— Apply a proposed intent, regenerating the store.POST /api/intent/order— Override the section the storefront leads with.POST /api/intent/revert— Undo the last applied intent.GET /api/editor/— Read editor state and store metrics.
Back to the API reference index, or read the cookbook for recipes that compose this endpoint with others.