Overview
The Manage Workflows endpoint provides operations for saving and loading workflow configurations. Each user can have one active workflow stored in the database.Endpoint
Authentication
Requires a valid Supabase JWT token:Operations
Save Workflow
Saves or updates the user’s workflow. Creates a new workflow if none exists, otherwise updates the existing one.Request Body
Must be
"save" for save operationsThe complete workflow structure including elements and connections
Optional workflow name (currently defaults to “My Workflow”)
Example Request
Success Response (200)
Success message
The saved workflow record including database metadata
Example Response
Load Workflow
Retrieves the user’s saved workflow from the database.Request Body
Must be
"load" for load operationsExample Request
Success Response (200)
Always
true for successful requestsThe user’s workflow record, or
null if no workflow existsExample Response
Error Responses
400 Bad Request
401 Unauthorized
500 Internal Server Error
Database Schema
Workflows are stored in theuser_workflows table:
Each user can have only one workflow (enforced by
UNIQUE(user_id) constraint). Saving a new workflow updates the existing one.Usage Pattern
Typical workflow management flow:- On App Load: Call with
action: "load"to retrieve saved workflow - Auto-Save: Periodically call with
action: "save"during editing - Manual Save: Call with
action: "save"when user clicks save button
Row Level Security
Theuser_workflows table uses RLS to ensure:
- Users can only read their own workflows
- Users can only update/delete their own workflows
- Workflows are automatically filtered by
user_id
See Also
- Workflows Database Schema - Detailed database structure
- Run Workflow - Execute saved workflows
- Generate Workflow - AI-powered workflow creation