Files
CRUD endpoints for every file hosted on your Flexweg site — HTML, CSS, JS, images, fonts, PDF.
All endpoints require a valid X-API-Key header. See Authentication.
GET /api/v1/files/list
List all files and folders on your site with metadata (size, type, URL). Supports pagination for large sites.
Query parameters (all optional)
| Field | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number. |
per_page | integer | 100 | Items per page (max 100). |
curl -X GET "https://www.flexweg.com/api/v1/files/list?page=1&per_page=100" \
-H "X-API-Key: YOUR_API_KEY"
{
"success": true,
"storage_folder": {
"slug": "a78gj8d3",
"name": "Mon Site",
"file_count": 30,
"storage_used": 274668,
"storage_used_formatted": "268.23 KB"
},
"pagination": {
"current_page": 1,
"per_page": 100,
"total_items": 3,
"total_pages": 1,
"has_more": false,
"is_last_page": true
},
"files": [
{
"path": "coree",
"name": "coree",
"type": "folder",
"size": 0,
"size_formatted": "0 B",
"url": null,
"depth": 0,
"parent": null
},
{
"path": "coree/index.html",
"name": "index.html",
"type": "file",
"size": 9971,
"size_formatted": "9.74 KB",
"url": "https://your-site.flexweg.com/coree/index.html",
"depth": 1,
"parent": "coree"
}
]
}
- Folders appear with
type: "folder"andurl: null. .gitkeepfiles are filtered out automatically.- Results are sorted by depth, then folders-first, then alphabetically by name.
- Check
pagination.has_moreto know if you need to fetch another page.
GET /api/v1/files/get
Retrieve the raw content of a single file.
Query parameters
| Field | Type | Description |
|---|---|---|
path | string (required) | Path of the file (e.g. index.html, assets/css/main.css). |
curl -X GET "https://www.flexweg.com/api/v1/files/get?path=index.html" \
-H "X-API-Key: YOUR_API_KEY"
POST /api/v1/files/upload
Create or update a file. If a file already exists at the target path, it is overwritten.
Body parameters
| Field | Type | Description |
|---|---|---|
path | string (required) | Target path — determines where the file lives and its public URL. |
content | string (required) | File content. Plain text for text files, base64-encoded for binary files. |
encoding | string | Set to "base64" for binary uploads. Omit for text files. |
Example 1 — HTML file
curl -X POST https://www.flexweg.com/api/v1/files/upload \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"path": "index.html", "content": "<!DOCTYPE html>..."}'
Example 2 — CSS file
curl -X POST https://www.flexweg.com/api/v1/files/upload \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"path": "assets/css/main.css", "content": "body { margin: 0; }"}'
Example 3 — Binary file (image)
curl -X POST https://www.flexweg.com/api/v1/files/upload \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"path": "assets/img/logo.png",
"content": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"encoding": "base64"
}'
Supported file types
- Web: HTML, CSS, JS, JSON, XML, TXT
- Images: JPG, JPEG, PNG, GIF, SVG, WebP, ICO
- Documents: PDF
- Fonts: WOFF, WOFF2, TTF, OTF
- Videos: see Videos for dedicated endpoint
Max size: 10 MB per file.
Error responses
{
"error": "File limit exceeded",
"message": "You have reached your file limit of 20 files. Upgrade your plan to upload more files.",
"current_file_count": 20,
"file_limit": 20,
"current_plan": "free",
"upgrade_url": "https://www.flexweg.com/pricing"
}
{
"error": "Storage limit exceeded",
"message": "You have reached your storage limit of 2 MB. Available space: 256 KB. Upgrade your plan to get more storage.",
"current_storage": 1835008,
"storage_limit": 2097152,
"storage_limit_formatted": "2 MB",
"current_storage_formatted": "1.75 MB",
"available_storage": 262144,
"available_storage_formatted": "256 KB",
"current_plan": "free",
"upgrade_url": "https://www.flexweg.com/pricing"
}
{
"error": "File too large",
"message": "File size exceeds the maximum allowed size of 10 MB",
"max_size_bytes": 10485760
}
{
"error": "Invalid file type",
"message": "File type 'exe' is not allowed. Allowed types: html, css, js, jpg, jpeg, png, ..."
}
Limits by plan
| Plan | Files | Storage |
|---|---|---|
| Free | 20 | 2 MB |
| Standard | 100 | 10 MB |
| Premium | 500 | 50 MB |
| Business | 2000 | 500 GB |
| Enterprise | Unlimited | Unlimited |
Use the Storage endpoint to check your live usage before uploading.
POST /api/v1/files/rename
Rename a file or move it to a new path.
Body parameters
| Field | Type | Description |
|---|---|---|
old_path | string (required) | Current path. |
new_path | string (required) | New path. Folders are created automatically. |
curl -X POST https://www.flexweg.com/api/v1/files/rename \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"old_path": "old.html", "new_path": "new.html"}'
Renaming changes the file's public URL. Anyone who bookmarked or linked to the old path will get a 404.
DELETE /api/v1/files/delete
Permanently delete a file.
Query parameters
| Field | Type | Description |
|---|---|---|
path | string (required) | Path of the file to delete. |
curl -X DELETE "https://www.flexweg.com/api/v1/files/delete?path=index.html" \
-H "X-API-Key: YOUR_API_KEY"
Deletion is immediate and cannot be undone. Files do not go through a trash bin.