Base URL
When running locally:The server auto-increments the port if 8000 is occupied. Check the CLI output for the actual URL.
Editor Interface
GET /
Serves the main editor web application HTML page. Response: HTML document with the editor interface Example:GET /favicon.ico
Redirects to the SVG favicon at/static/favicon.svg.
Response: 302 redirect
Mode Information
GET /api/mode
Returns the current server mode (“file” or “folder”). Response:Either “file” (single file editing) or “folder” (directory workspace)
File Tree
GET /api/file-tree
Returns the markdown file tree structure for folder mode. Response:Nested structure representing the directory tree with folders and markdown files
Content Management
GET /api/content
Retrieve markdown content and metadata for a file. Query Parameters:Relative file path (required in folder mode, ignored in file mode)
Raw markdown content of the file
400: Missingfileparameter in folder mode or invalid file path404: File not found500: File read error
POST /api/save
Save markdown content to disk with atomic file replacement. Request Body:Markdown content to save
Relative file path (required in folder mode, ignored in file mode)
Always “saved” on success
400: Missingfileparameter in folder mode or invalid file path404: File not found (folder mode)500: File write error
Saving triggers a file watcher event, but the server ignores events from its own writes for 500ms to prevent infinite loops.
Image Management
POST /api/images
Upload an image to the workspace images directory. Request:multipart/form-data with file upload
Image file to upload
.png.jpg,.jpeg.gif.webp.svg.bmp.ico
- Maximum file size: 10 MB
- File must not be empty
- Extension must be in the allowed list
Relative path to use in markdown (e.g.,
images/screenshot-20260228-103000-123456.png)Generated unique filename with timestamp
400: Unsupported format, empty file, or file too large
Filenames are sanitized and timestamped to prevent collisions. The original filename is preserved in the stem (e.g.,
screenshot.png becomes screenshot-20260228-103000-123456.png).GET /images/{filename}
Serve an uploaded image from the workspace images directory. Path Parameters:Image filename (can include subdirectories)
400: Invalid path (contains..or starts with/)404: Image not found
Static Assets
GET /static/{path}
Serves static frontend assets (JavaScript, CSS, fonts, icons). Example:Static files are served from the
markdown_os/static/ directory in the package.