Aller au contenu

Sessions

Ce contenu n’est pas encore disponible dans votre langue.

/api/v1/sessions is the general session surface. Unlike the factory routes, which serve pages-mode assistants only, this one serves both session modes: a flow session is an ordinary resource here.

Every route on this page requires Authorization: Bearer <key> — see Overview and authentication.

GET, POST, and PATCH on a single session return:

{
"id": "sess-1756100000000-3f2a91bc",
"name": "Order intake flow",
"mode": "flow",
"created_at": 1756100000000,
"updated_at": 1756100000000,
"deploy_state": "draft"
}
FieldTypeNotes
idstringAssigned by the Designer.
namestringStored verbatim.
mode"flow" | "pages"Which editor the session belongs to.
created_atintegerUnix epoch in milliseconds.
updated_atintegerUnix epoch in milliseconds.
deploy_state"draft" | "live"live once a deploy has completed successfully.
instructionsstringpages rows only. Omitted entirely for a flow row.
modelstringpages rows only, and only when a model was named. Omitted otherwise.

The flow graph, message history, and composer document are deliberately not exposed. This surface commits to metadata plus the same {instructions, model} projection the factory routes already publish, so the two cannot drift into describing the same row differently.

GET /api/v1/sessions

Terminal window
curl -sS "$GREENTIC_DESIGNER/api/v1/sessions" \
-H "Authorization: Bearer $GREENTIC_KEY"
{
"sessions": [
{
"id": "sess-1756100000000-3f2a91bc",
"name": "Order intake flow",
"mode": "flow",
"created_at": 1756100000000,
"updated_at": 1756100000000,
"deploy_state": "draft"
}
]
}

Both modes are listed. List rows carry metadata only — no instructions or model, even for a pages row.

Rows come back most-recently-touched first, and the list is not paginated: it returns every session this key owns.

StatusBody
200{ "sessions": [...] }
500 session_list_failedThe query failed.

POST /api/v1/sessions

Terminal window
curl -sS -X POST "$GREENTIC_DESIGNER/api/v1/sessions" \
-H "Authorization: Bearer $GREENTIC_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Order intake flow", "mode": "flow" }'

Body

FieldRequiredNotes
nameyesRejected when empty after trimming.
modeyesMust be "flow". See below.

Responses

StatusBody
201The session object.
400 name_requiredname missing or blank.
400 pages_mode_requires_factorymode: "pages" was requested.
500 session_create_failedThe row could not be written.

The new session is scoped by the key alone. There is no field in this body that could place it in another tenant or another team.

GET /api/v1/sessions/{id}

Terminal window
curl -sS "$GREENTIC_DESIGNER/api/v1/sessions/sess-1756100000000-3f2a91bc" \
-H "Authorization: Bearer $GREENTIC_KEY"
StatusBody
200The session object.
404 session_not_foundAbsent, another tenant’s, another team’s, another integration’s, or unowned.
500 session_read_failedThe read failed.

A flow row is reachable here — that is the whole point of this surface. On the factory routes the same id would be a 404.

PATCH /api/v1/sessions/{id}

Terminal window
curl -sS -X PATCH "$GREENTIC_DESIGNER/api/v1/sessions/sess-1756100000000-3f2a91bc" \
-H "Authorization: Bearer $GREENTIC_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Order intake flow v2" }'

name is the only field this surface exposes, and it is optional — a {} body leaves the row’s content alone and just refreshes updated_at.

StatusBody
200The updated session object.
400 name_requiredname was present but blank.
404 session_not_foundNot yours, or gone.
500 session_update_failedThe write failed.

To edit a pages row’s instructions or model, use PATCH /api/v1/factory/assistants/{id}. This route has no field that could write them.

DELETE /api/v1/sessions/{id}

Terminal window
curl -sS -X DELETE "$GREENTIC_DESIGNER/api/v1/sessions/sess-1756100000000-3f2a91bc" \
-H "Authorization: Bearer $GREENTIC_KEY" \
-i
StatusBody
204Empty.
404 session_not_foundNot yours, or already gone.
500 session_delete_failedThe delete failed.