Skip to main content

Folders

Create, rename and delete folders to organize your site's file tree. Folders are created automatically when you upload a file into a nested path — these endpoints are for when you want to manage the structure explicitly.

All endpoints require a valid X-API-Key header.

POST /api/v1/files/create-folder

Create an empty folder.

Body parameters

FieldTypeDescription
pathstring (required)Folder path. Parent folders are created as needed.
cURL — single folder
curl -X POST https://www.flexweg.com/api/v1/files/create-folder \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"path": "images"}'
cURL — nested folders
curl -X POST https://www.flexweg.com/api/v1/files/create-folder \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"path": "blog/2026"}'
When is this useful?

Most of the time you don't need it — uploading a file to assets/css/main.css creates assets/ and assets/css/ automatically. Use this endpoint when you want to create a folder structure up-front (scaffolding), or an empty folder that doesn't yet have files.

POST /api/v1/files/rename-folder

Rename or move a folder and all its contents to a new path.

Body parameters

FieldTypeDescription
old_pathstring (required)Current folder path.
new_pathstring (required)Target folder path.
cURL — rename
curl -X POST https://www.flexweg.com/api/v1/files/rename-folder \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"old_path": "images", "new_path": "photos"}'
cURL — move into a subfolder
curl -X POST https://www.flexweg.com/api/v1/files/rename-folder \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"old_path": "blog/2023", "new_path": "blog/2024"}'
URLs change for every file inside

Every file under the folder gets a new public URL. External links, bookmarks and references inside your HTML (if they use absolute paths to the old location) will break until you update them.

DELETE /api/v1/files/delete-folder

Delete a folder and every file it contains permanently.

Query parameters

FieldTypeDescription
pathstring (required)Folder path to delete.
cURL
curl -X DELETE "https://www.flexweg.com/api/v1/files/delete-folder?path=old-images" \
-H "X-API-Key: YOUR_API_KEY"
Irreversible and recursive

This endpoint walks the folder tree and deletes everything below the target path. There is no trash bin; once gone, it's gone.