Workflow & intercepted endpoints¶
This page describes endpoints that are intercepted or implemented by the workflow middleware (routes/workflow_routes.py), rather than registered as direct routes.
Comfy Portal Endpoint (/cpe/workflow/*)¶
Per-user workflow list/get/save using the comfy-portal-endpoint response format. Paths work with and without the /api prefix. Authenticated users (JWT or API token) receive their stored workflows, not the shared user/default/workflows directory only.
| Method | Path | Description |
|---|---|---|
| GET | /api/cpe/workflow/list |
List .json files in the user's workflow dir (plus shared/global). |
| GET | /api/cpe/workflow/get?filename= |
Read one workflow as a raw JSON string. |
| POST | /api/cpe/workflow/save |
Save to the user's workflow dir. Body: { "workflow": "<string>", "name": "optional.json" }. |
| GET | /api/cpe/workflow/get-and-convert?filename= |
Read + return API-format prompt when the file is already API format. |
| GET | /api/cpe/health |
Health payload compatible with CPE. |
Requires a valid token for remote clients (REQUIRE_AUTH_FOR_REMOTE_API) and can_access_api. POST save also requires can_modify_workflows.
Userdata workflows¶
Per-user workflow list, save, load, and delete (compatible with Comfy Portal and API token/JWT):
| Method | Path / behavior | Description |
|---|---|---|
| GET | /api/userdata?dir=workflows or paths containing userdata/workflows |
List workflows (global + user-specific). Returns full file info. |
| POST | Same base path | Save workflow (body JSON). Filename from query file/name or body name. |
| GET | .../workflows/{filename} |
Load workflow content (user file first, then global). |
| DELETE | Same base path (with optional file name) | Delete workflow. User can delete own; only admin can delete global. |
/view (NSFW enforcement)¶
- GET /view — Serves output/temp images. The middleware checks the requested file against the NSFW Guard for the current user (from JWT or API token). If the user has SFW enforced and the image is tagged or detected as NSFW, the response is 403 with body "NSFW content blocked for this user." or "NSFW Blocked".
/prompt (user tagging)¶
- POST /prompt and PUT /prompt — The middleware tags the current username (from JWT or API token) so that NSFW Guard and other logic know which user is executing the prompt. The request is then passed through to ComfyUI's normal prompt handler.
Details (e.g. exact path patterns) are also generated by scripts/build_docs.py where applicable.