File System & Code Editor APIs
List, read, write, create, upload, delete, and rename files inside the isolated bot sandbox.
1. List Files (list_files)
Action: list_files
Parameters: bot_id, path (optional subdirectory)
2. Read File (read_file)
Action: read_file
Parameters: bot_id, file (e.g. index.php or includes/db.php)
3. Write / Save Code with Syntax Linting (write_file)
Action: write_file or save_code
Parameters: bot_id, file, content
cURL Write File
curl -X POST https://botlify.cloud/user_api.php -H "X-API-KEY: YOUR_KEY" -H "Content-Type: application/json" -d '{
"action": "write_file",
"bot_id": 14,
"file": "index.php",
"content": "
Syntax Validation Guard
write_file automatically lints your code using php -l. If a PHP syntax error is detected, the write is rejected to protect live bots.
4. Create File & Folder (create_file / create_folder)
Action: create_file (params: bot_id, name, path, content)
Action: create_folder (params: bot_id, name, path)
5. Rename & Delete (rename_file / delete_file)
Action: rename_file (params: bot_id, old_path, new_name)
Action: delete_file (params: bot_id, file). Critical system files (.env, database.db) are protected against accidental deletion.