### Install Sylve Dependencies Source: https://github.com/alchemillahq/sylve/blob/master/README.md Installs the required packages for Sylve development and runtime on FreeBSD using the `pkg` package manager. This includes tools like `git`, `go`, `tmux`, `libvirt`, and others. ```shell pkg install git node20 npm-node20 go tmux libvirt bhyve-firmware smartmontools tmux samba419 jansson swtpm ``` -------------------------------- ### Attach Storage to VM (Bash) Source: https://context7.com/alchemillahq/sylve/llms.txt Dynamically attaches a storage device to a VM. This example demonstrates attaching a disk using virtio-blk. Requires a Bearer token for authentication. ```bash # Attach storage curl -X POST https://localhost:8181/api/vm/storage/attach \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ \ "vmid": 100, \ "diskPath": "/dev/zvol/zpool1/vms/disk2", \ "type": "virtio-blk" \ }' ``` -------------------------------- ### POST /api/vm Source: https://context7.com/alchemillahq/sylve/llms.txt Creates a new VM with specified hardware configuration, storage, and network settings. The bhyve hypervisor requires installation media to be specified at creation time as boot order changes are not supported after creation. ```APIDOC ## POST /api/vm ### Description Creates a new VM with specified hardware configuration, storage, and network settings. The bhyve hypervisor requires installation media to be specified at creation time as boot order changes are not supported after creation. ### Method POST ### Endpoint /api/vm ### Parameters #### Request Body - **name** (string) - Required - The name of the virtual machine. - **vmid** (integer) - Required - The unique identifier for the virtual machine. - **cores** (integer) - Required - The number of CPU cores to allocate. - **memory** (integer) - Required - The amount of memory (in MB) to allocate. - **cpu** (string) - Required - The CPU type or model (e.g., 'host'). - **boot** (string) - Required - The boot device (e.g., 'cd', 'disk'). - **iso** (string) - Required - The path to the ISO image for installation. - **networks** (array) - Required - Network configuration. - **type** (string) - Required - The network interface type (e.g., 'virtio'). - **bridge** (string) - Required - The network bridge to connect to. - **disks** (array) - Required - Disk configuration. - **size** (integer) - Required - The size of the disk in bytes. - **type** (string) - Required - The disk interface type (e.g., 'virtio-blk'). - **datastore** (string) - Required - The datastore path for the disk image. ### Request Example ```json { "name": "debian-vm", "vmid": 101, "cores": 2, "memory": 4096, "cpu": "host", "boot": "cd", "iso": "/mnt/datastore/isos/debian-12.iso", "networks": [ { "type": "virtio", "bridge": "vm-br0" } ], "disks": [ { "size": 32000, "type": "virtio-blk", "datastore": "zpool1/vms" } ] } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation (e.g., 'success'). - **message** (string) - A message describing the result (e.g., 'vm_created'). - **error** (string) - An error message if the operation failed. - **data** (null) - No data is returned upon successful creation. #### Response Example ```json { "status": "success", "message": "vm_created", "error": "", "data": null } ``` ``` -------------------------------- ### Create New Virtual Machine (Bash) Source: https://context7.com/alchemillahq/sylve/llms.txt Creates a new VM with specified hardware, storage, and network settings. The bhyve hypervisor requires installation media during creation. Requires a Bearer token for authentication. ```bash curl -X POST https://localhost:8181/api/vm \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ \ "name": "debian-vm", \ "vmid": 101, \ "cores": 2, \ "memory": 4096, \ "cpu": "host", \ "boot": "cd", \ "iso": "/mnt/datastore/isos/debian-12.iso", \ "networks": [ \ { \ "type": "virtio", \ "bridge": "vm-br0" \ } \ ], \ "disks": [ \ { \ "size": 32000, \ "type": "virtio-blk", \ "datastore": "zpool1/vms" \ } \ ] \ }' ``` -------------------------------- ### GET /api/vm/simple Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieves a simplified list of VMs with minimal information for quick overview or dropdown menus. ```APIDOC ## GET /api/vm/simple ### Description Retrieves a simplified list of VMs with minimal information for quick overview or dropdown menus. ### Method GET ### Endpoint /api/vm/simple ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation (e.g., 'success'). - **message** (string) - A message describing the result (e.g., 'vm_listed'). - **error** (string) - An error message if the operation failed. - **data** (array) - An array of simplified VM objects. - **id** (integer) - The ID of the virtual machine. - **name** (string) - The name of the virtual machine. - **vmid** (integer) - The VMID of the virtual machine. - **state** (string) - The current state of the VM (e.g., 'running'). #### Response Example ```json { "status": "success", "message": "vm_listed", "error": "", "data": [ { "id": 1, "name": "ubuntu-server", "vmid": 100, "state": "running" } ] } ``` ``` -------------------------------- ### GET /api/jail/simple Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieves a simplified list of jails with minimal information. ```APIDOC ## GET /api/jail/simple ### Description Retrieves a simplified list of jails with minimal information for quick overview. ### Method GET ### Endpoint /api/jail/simple ### Response #### Success Response (200) - **status** (string) - The status of the operation. - **message** (string) - A message indicating the result of the operation. - **error** (string) - Any error message if the operation failed. - **data** (array) - An array of simplified jail objects: - **id** (integer) - The unique identifier of the jail. - **ctid** (integer) - The container ID. - **name** (string) - The name of the jail. - **state** (string) - The current state of the jail. #### Response Example ```json { "status": "success", "message": "jails_listed", "error": "", "data": [ { "id": 1, "ctid": 200, "name": "webserver-jail", "state": "running" } ] } ``` ``` -------------------------------- ### File Explorer: Download file using cURL Source: https://context7.com/alchemillahq/sylve/llms.txt Downloads a file from the host system. A GET request to /api/system/file-explorer/download with the 'path' query parameter specifies the file to download. The '-o' flag specifies the output filename. ```bash curl -X GET "https://localhost:8181/api/system/file-explorer/download?path=/mnt/data/file.txt" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -o file.txt ``` -------------------------------- ### Modify VM Options (Bash) Source: https://context7.com/alchemillahq/sylve/llms.txt Configures VM boot order, clock settings, Wake-on-LAN, and serial console access. Examples include changing boot order and enabling Wake-on-LAN. Requires a Bearer token. ```bash # Modify boot order curl -X PUT https://localhost:8181/api/vm/options/boot-order/100 \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ \ "bootOrder": ["disk", "cdrom"] \ }' # Enable Wake-on-LAN curl -X PUT https://localhost:8181/api/vm/options/wol/100 \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ \ "enabled": true \ }' ``` -------------------------------- ### Get Cluster Nodes Source: https://context7.com/alchemillahq/sylve/llms.txt Lists all nodes within the cluster, providing their status and assigned role. This is achieved via a GET request to the /api/cluster/nodes endpoint. ```bash curl -X GET https://localhost:8181/api/cluster/nodes \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ``` -------------------------------- ### Initialize Disk with GPT (Bash) Source: https://context7.com/alchemillahq/sylve/llms.txt Creates a new GPT partition table on a specified disk, preparing it for further partitioning or use. This operation requires a device name and returns a status message. ```bash curl -X POST https://localhost:8181/api/disk/initialize-gpt \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ "device": "ada1" }' ``` -------------------------------- ### Get Cluster Resources Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieves aggregated resource utilization (CPU, memory, storage) across all nodes in the cluster. Access this information using a GET request to the /api/cluster/resources endpoint. ```bash curl -X GET https://localhost:8181/api/cluster/resources \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ``` -------------------------------- ### Build and Run Sylve from Source Source: https://github.com/alchemillahq/sylve/blob/master/README.md Clones the Sylve repository, builds the project using `make`, and then runs the compiled binary. It also includes instructions for copying and editing the configuration file. ```shell git clone https://github.com/AlchemillaHQ/Sylve.git cd Sylve make ``` ```shell cd bin/ cp -rf ../config.example.json config.json # Edit the config.json file to your liking ./sylve ``` -------------------------------- ### PUT /api/vm/options/boot-order/{id} Source: https://context7.com/alchemillahq/sylve/llms.txt Configures the boot order for a VM. ```APIDOC ## PUT /api/vm/options/boot-order/{id} ### Description Configure VM boot options, specifically the boot order. ### Method PUT ### Endpoint /api/vm/options/boot-order/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the virtual machine. #### Request Body - **bootOrder** (array) - Required - An array of strings specifying the boot order (e.g., `["disk", "cdrom"]`). ### Request Example ```json { "bootOrder": ["disk", "cdrom"] } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation (e.g., 'success'). - **message** (string) - A message describing the result (e.g., 'options_modified'). - **error** (string) - An error message if the operation failed. - **data** (null) - No data is returned upon successful modification. #### Response Example ```json { "status": "success", "message": "options_modified", "error": "", "data": null } ``` ``` -------------------------------- ### Host Information: Get Swap information using cURL Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieves swap space usage statistics, including total, used, and available amounts. Requires a GET request to the /api/info/swap endpoint with authentication. ```bash # Swap info curl -X GET https://localhost:8181/api/info/swap \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ``` -------------------------------- ### Utilities API - Download File Source: https://context7.com/alchemillahq/sylve/llms.txt Initiates a download of an ISO or file from a URL or magnet link. ```APIDOC ## Utilities API ### Download file from URL Initiates a download of an ISO or file from HTTP/HTTPS URL or magnet link, storing it in the downloads directory for use with VM creation. ### Method POST ### Endpoint `https://localhost:8181/api/utilities/downloads` ### Parameters #### Request Body - **url** (string) - Required - The URL or magnet link of the file to download. - **filename** (string) - Optional - The desired name for the downloaded file. If not provided, it will be derived from the URL. - **ignoreTLS** (boolean) - Optional - Whether to ignore TLS certificate verification for HTTPS URLs. Defaults to `false`. ### Request Example ```bash curl -X POST https://localhost:8181/api/utilities/downloads \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "url": "https://download.freebsd.org/releases/amd64/14.3-RELEASE/FreeBSD-14.3-RELEASE-amd64-disc1.iso", "filename": "freebsd-14.3.iso", "ignoreTLS": false }' ``` ### Response #### Success Response (200) - **status** (string) - The status of the operation. - **message** (string) - A message describing the result. - **error** (string) - An error message if the operation failed. - **data** (object) - An object containing information about the initiated download. - **id** (integer) - The unique identifier for the download. - **status** (string) - The initial status of the download (e.g., 'downloading'). #### Response Example ```json { "status": "success", "message": "download_started", "error": "", "data": { "id": 2, "status": "downloading" } } ``` ``` -------------------------------- ### Host Information: Get basic system information using cURL Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieves fundamental host information including hostname, OS version, uptime, and kernel version. Requires a GET request to the /api/info/basic endpoint with authentication. ```bash curl -X GET https://localhost:8181/api/info/basic \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ``` -------------------------------- ### Host Information: Get CPU information using cURL Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieves CPU usage statistics, core count, and processor model. This API provides both real-time and historical data. Requires a GET request to the /api/info/cpu or /api/info/cpu/historical endpoints with authentication. ```bash # Real-time CPU info curl -X GET https://localhost:8181/api/info/cpu \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." # Historical CPU info curl -X GET https://localhost:8181/api/info/cpu/historical \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ``` -------------------------------- ### Host Information: Get RAM information using cURL Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieves memory usage statistics for RAM, including total, used, and available amounts. Requires a GET request to the /api/info/ram endpoint with authentication. Historical data is available via /api/info/ram/historical. ```bash # RAM info curl -X GET https://localhost:8181/api/info/ram \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." # Historical RAM info curl -X GET https://localhost:8181/api/info/ram/historical \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ``` -------------------------------- ### Initiate File Download using Curl Source: https://context7.com/alchemillahq/sylve/llms.txt Starts a download for an ISO or file from a given URL or magnet link. The downloaded file is stored in the downloads directory. Requires Bearer token authentication and specifies download details in JSON format. ```bash curl -X POST https://localhost:8181/api/utilities/downloads \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ "url": "https://download.freebsd.org/releases/amd64/14.3-RELEASE/FreeBSD-14.3-RELEASE-amd64-disc1.iso", "filename": "freebsd-14.3.iso", "ignoreTLS": false }' ``` -------------------------------- ### GET /api/jail/state Source: https://context7.com/alchemillahq/sylve/llms.txt Returns the current state of all jails. ```APIDOC ## GET /api/jail/state ### Description Returns the current state of all jails (running, stopped, etc.). ### Method GET ### Endpoint /api/jail/state ### Response #### Success Response (200) - **status** (string) - The status of the operation. - **message** (string) - A message indicating the result of the operation. - **error** (string) - Any error message if the operation failed. - **data** (array) - An array of jail state objects: - **ctid** (integer) - The container ID of the jail. - **state** (string) - The current state of the jail. #### Response Example ```json { "status": "success", "message": "jail_states_retrieved", "error": "", "data": [ { "ctid": 200, "state": "running" } ] } ``` ``` -------------------------------- ### Fetch Default and Mandatory Settings from JSON - JavaScript Source: https://github.com/alchemillahq/sylve/blob/master/web/static/vnc/vnc.html This JavaScript code snippet asynchronously fetches default and mandatory settings from 'defaults.json' and 'mandatory.json' files. It handles potential fetch errors and logs them using a custom Log utility. The loaded settings are then passed to the UI.start function. ```javascript import UI from "./app/ui.js"; import * as Log from './core/util/logging.js'; let response; let defaults = {}; let mandatory = {}; // Default settings will be loaded from defaults.json. // Mandatory settings will be loaded from mandatory.json, which the user // cannot change. try { response = await fetch('./defaults.json'); if (!response.ok) { throw Error("" + response.status + " " + response.statusText); } defaults = await response.json(); } catch (err) { Log.Error("Couldn't fetch defaults.json: " + err); } try { response = await fetch('./mandatory.json'); if (!response.ok) { throw Error("" + response.status + " " + response.statusText); } mandatory = await response.json(); } catch (err) { Log.Error("Couldn't fetch mandatory.json: " + err); } // You can also override any defaults you need here: // // defaults['host'] = 'vnc.example.com'; // // Or force a specific setting, preventing the user from // // changing it: // // mandatory['view_only'] = true; // See docs/EMBEDDING.md for a list of possible settings. UI.start({ settings: { defaults: defaults, mandatory: mandatory } }); ``` -------------------------------- ### GET /api/jail Source: https://context7.com/alchemillahq/sylve/llms.txt Lists all FreeBSD jails with their configuration and status. ```APIDOC ## GET /api/jail ### Description Returns all FreeBSD jails with their configuration and status. Jails provide lightweight containerization using FreeBSD's native isolation mechanisms. ### Method GET ### Endpoint /api/jail ### Response #### Success Response (200) - **status** (string) - The status of the operation. - **message** (string) - A message indicating the result of the operation. - **error** (string) - Any error message if the operation failed. - **data** (array) - An array of jail objects, each containing: - **id** (integer) - The unique identifier of the jail. - **ctid** (integer) - The container ID. - **name** (string) - The name of the jail. - **description** (string) - A description of the jail. - **hostname** (string) - The hostname of the jail. - **cores** (integer) - The number of CPU cores allocated. - **memory** (integer) - The amount of memory allocated (in MB). - **state** (string) - The current state of the jail (e.g., "running"). - **path** (string) - The file system path of the jail. - **networks** (array) - An array of network interface configurations. #### Response Example ```json { "status": "success", "message": "jail_listed", "error": "", "data": [ { "id": 1, "ctid": 200, "name": "webserver-jail", "description": "Nginx web server", "hostname": "web01.local", "cores": 2, "memory": 2048, "state": "running", "path": "/zpool1/jails/webserver-jail", "networks": [{"id": 1, "interface": "vnet0", "bridge": "jail-br0"}] } ] } ``` ``` -------------------------------- ### PPT Device Management Source: https://context7.com/alchemillahq/sylve/llms.txt APIs for adding and listing PPT devices on the system. ```APIDOC ## POST /api/system/ppt-devices ### Description Adds a new PPT device to the system. ### Method POST ### Endpoint /api/system/ppt-devices ### Parameters #### Request Body - **pciId** (string) - Required - The PCI ID of the device to add. ### Request Example ```json { "pciId": "0000:01:00.0" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **message** (string) - A message describing the result. - **error** (string) - An error message if the operation failed. - **data** (null) - Data field, usually null for this operation. #### Response Example ```json { "status": "success", "message": "ppt_device_added", "error": "", "data": null } ``` ## GET /api/system/ppt-devices ### Description Lists all configured PPT devices on the system. ### Method GET ### Endpoint /api/system/ppt-devices ### Parameters None ### Request Example ```bash curl -X GET https://localhost:8181/api/system/ppt-devices \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **message** (string) - A message describing the result. - **error** (string) - An error message if the operation failed. - **data** (array) - A list of PPT devices. #### Response Example ```json { "status": "success", "message": "ppt_devices_listed", "error": "", "data": [ { "pciId": "0000:01:00.0", "name": "Device 1" } ] } ``` ``` -------------------------------- ### GET /api/info/swap/historical Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieves historical swap memory usage statistics for the system. ```APIDOC ## GET /api/info/swap/historical ### Description Retrieves historical swap memory usage statistics for the system. ### Method GET ### Endpoint /api/info/swap/historical ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET https://localhost:8181/api/info/swap/historical \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the response ('success' or 'error'). - **message** (string) - A descriptive message about the response. - **error** (string) - An error message if the status is 'error', otherwise empty. - **data** (object) - An object containing swap usage details: - **total** (integer) - Total swap memory in bytes. - **used** (integer) - Used swap memory in bytes. - **free** (integer) - Free swap memory in bytes. #### Response Example ```json { "status": "success", "message": "ram_info", "error": "", "data": { "total": 16777216, "used": 8388608, "free": 8388608 } } ``` ``` -------------------------------- ### Manage DHCP Configuration (Bash) Source: https://context7.com/alchemillahq/sylve/llms.txt Configures DHCP server settings, including creating IP address ranges and static leases. Requires start, end, gateway, and DNS for range creation, and MAC, IP, and hostname for lease creation. ```bash # Get DHCP config curl -X GET https://localhost:8181/api/network/dhcp/config \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." # Create DHCP range curl -X POST https://localhost:8181/api/network/dhcp/range \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ "start": "192.168.1.100", "end": "192.168.1.200", "gateway": "192.168.1.1", "dns": ["8.8.8.8", "8.8.4.4"] }' # Create static lease curl -X POST https://localhost:8181/api/network/dhcp/lease \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ "mac": "52:54:00:12:34:56", "ip": "192.168.1.50", "hostname": "webserver" }' ``` -------------------------------- ### Utilities API - List Downloads Source: https://context7.com/alchemillahq/sylve/llms.txt Returns all active and completed ISO and file downloads, including progress and status. ```APIDOC ## Utilities API ### List downloads Returns all active and completed ISO and file downloads, including progress and status. ### Method GET ### Endpoint `https://localhost:8181/api/utilities/downloads` ### Parameters No parameters for this endpoint. ### Request Example ```bash curl -X GET https://localhost:8181/api/utilities/downloads \ -H "Authorization: Bearer " ``` ### Response #### Success Response (200) - **status** (string) - The status of the operation. - **message** (string) - A message describing the result. - **error** (string) - An error message if the operation failed. - **data** (array) - An array of download objects. - **id** (integer) - The unique identifier for the download. - **url** (string) - The URL of the file being downloaded. - **filename** (string) - The name of the downloaded file. - **status** (string) - The current status of the download (e.g., 'completed', 'downloading'). - **progress** (integer) - The download progress in percentage. - **size** (integer) - The total size of the file in bytes. - **downloaded** (integer) - The amount of data downloaded in bytes. - **createdAt** (string) - The timestamp when the download was initiated. #### Response Example ```json { "status": "success", "message": "downloads_listed", "error": "", "data": [ { "id": 1, "url": "https://releases.ubuntu.com/22.04/ubuntu-22.04-live-server-amd64.iso", "filename": "ubuntu-22.04-server.iso", "status": "completed", "progress": 100, "size": 1474873344, "downloaded": 1474873344, "createdAt": "2025-10-24T10:30:00Z" } ] } ``` ``` -------------------------------- ### GET /api/jail/stats/{ctid}/{timeframe} Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieves historical performance statistics for jails. ```APIDOC ## GET /api/jail/stats/{ctid}/{timeframe} ### Description Retrieve historical performance statistics for jails including CPU usage, memory consumption, and resource utilization. ### Method GET ### Endpoint /api/jail/stats/{ctid}/{timeframe} ### Parameters #### Path Parameters - **ctid** (integer) - Required - The container ID of the jail. - **timeframe** (integer) - Required - The timeframe for statistics (e.g., 50 for the last 50 minutes). ### Response #### Success Response (200) - **status** (string) - The status of the operation. - **message** (string) - A message indicating the result of the operation. - **error** (string) - Any error message if the operation failed. - **data** (array) - An array of statistics objects: - **timestamp** (string) - The timestamp of the data point. - **cpuUsage** (number) - The CPU usage percentage. - **memoryUsage** (integer) - The memory usage in MB. #### Response Example ```json { "status": "success", "message": "jail_stats_retrieved", "error": "", "data": [ { "timestamp": "2025-10-24T10:30:00Z", "cpuUsage": 25.5, "memoryUsage": 2048 } ] } ``` ``` -------------------------------- ### GET /api/vm/stats/{id}/{timeframe} Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieves historical performance statistics for VMs. ```APIDOC ## GET /api/vm/stats/{id}/{timeframe} ### Description Retrieve historical performance statistics for VMs including CPU usage, memory consumption, and network I/O. ### Method GET ### Endpoint /api/vm/stats/{id}/{timeframe} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the virtual machine. - **timeframe** (integer) - Required - The timeframe in minutes for which to retrieve statistics. ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation (e.g., 'success'). - **message** (string) - A message describing the result (e.g., 'vm_stats_retrieved'). - **error** (string) - An error message if the operation failed. - **data** (array) - An array of statistics objects. - **timestamp** (string) - The timestamp of the statistics entry in ISO 8601 format. - **cpuUsage** (number) - The CPU usage percentage. - **memoryUsage** (integer) - The memory usage in bytes. - **networkRx** (integer) - The network received bytes. - **networkTx** (integer) - The network transmitted bytes. #### Response Example ```json { "status": "success", "message": "vm_stats_retrieved", "error": "", "data": [ { "timestamp": "2025-10-24T10:30:00Z", "cpuUsage": 45.2, "memoryUsage": 4096, "networkRx": 1024000, "networkTx": 512000 } ] } ``` ``` -------------------------------- ### Disk Operations API Source: https://context7.com/alchemillahq/sylve/llms.txt Endpoints for managing disk partitions, including wiping, initializing with GPT, creating, and deleting partitions. ```APIDOC ## POST /api/disk/wipe ### Description Destroys all partitions and data on a disk, preparing it for reuse. This operation is irreversible and will erase all data. ### Method POST ### Endpoint /api/disk/wipe #### Request Body - **device** (string) - Required - The device name to wipe (e.g., "ada1"). ### Request Example ```json { "device": "ada1" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the operation status (e.g., "success"). - **message** (string) - A message indicating the result of the operation (e.g., "disk_wiped"). - **error** (string) - An empty string if the operation was successful. - **data** (null) - Placeholder for potential future data. #### Response Example ```json { "status": "success", "message": "disk_wiped", "error": "", "data": null } ``` ## POST /api/disk/initialize-gpt ### Description Creates a new GPT partition table on a disk, preparing it for ZFS pool creation or other use. ### Method POST ### Endpoint /api/disk/initialize-gpt #### Request Body - **device** (string) - Required - The device name to initialize (e.g., "ada1"). ### Request Example ```json { "device": "ada1" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the operation status (e.g., "success"). - **message** (string) - A message indicating the result of the operation (e.g., "gpt_initialized"). - **error** (string) - An empty string if the operation was successful. - **data** (null) - Placeholder for potential future data. #### Response Example ```json { "status": "success", "message": "gpt_initialized", "error": "", "data": null } ``` ## POST /api/disk/create-partitions ### Description Creates a new partition on the specified disk with the given size and type. ### Method POST ### Endpoint /api/disk/create-partitions #### Request Body - **device** (string) - Required - The device name to create the partition on (e.g., "ada1"). - **size** (string) - Required - The size of the partition (e.g., "500G"). - **type** (string) - Required - The type of the partition (e.g., "freebsd-zfs"). ### Request Example ```json { "device": "ada1", "size": "500G", "type": "freebsd-zfs" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the operation status (e.g., "success"). - **message** (string) - A message indicating the result of the operation (e.g., "partition_created"). - **error** (string) - An empty string if the operation was successful. - **data** (null) - Placeholder for potential future data. #### Response Example ```json { "status": "success", "message": "partition_created", "error": "", "data": null } ``` ## POST /api/disk/delete-partition ### Description Deletes a specified partition from a disk. ### Method POST ### Endpoint /api/disk/delete-partition #### Request Body - **device** (string) - Required - The device name containing the partition (e.g., "ada1"). - **partition** (string) - Required - The name of the partition to delete (e.g., "ada1p1"). ### Request Example ```json { "device": "ada1", "partition": "ada1p1" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the operation status (e.g., "success"). - **message** (string) - A message indicating the result of the operation (e.g., "partition_deleted"). - **error** (string) - An empty string if the operation was successful. - **data** (null) - Placeholder for potential future data. #### Response Example ```json { "status": "success", "message": "partition_deleted", "error": "", "data": null } ``` ``` -------------------------------- ### Get Jail Logs Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieve console logs from a specific jail for debugging and monitoring purposes. ```APIDOC ## GET /api/jail/{ctid}/logs ### Description Retrieve console logs from a jail for debugging and monitoring. ### Method GET ### Endpoint `/api/jail/{ctid}/logs` ### Parameters #### Path Parameters - **ctid** (integer) - Required - The identifier of the jail. ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **message** (string) - A message confirming the action. - **error** (string) - An error message if the operation failed. - **data** (string) - The jail startup logs. #### Response Example ```json { "status": "success", "message": "jail_logs_retrieved", "error": "", "data": "jail startup logs..." } ``` ``` -------------------------------- ### List VMs in Simple Format (Bash) Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieves a simplified list of VMs with essential information like ID, name, and state, suitable for quick overviews or populating dropdown menus. Requires a Bearer token. ```bash curl -X GET https://localhost:8181/api/vm/simple \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ``` -------------------------------- ### Manage ZFS Datasets (List, Create, Delete) Source: https://context7.com/alchemillahq/sylve/llms.txt Enables comprehensive management of ZFS datasets, including listing all datasets, creating new filesystems or volumes with custom properties, and performing bulk deletions using dataset GUIDs. Requires an authorization token and appropriate content types for POST requests. ```bash # List datasets curl -X GET https://localhost:8181/api/zfs/datasets \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." # Create filesystem curl -X POST https://localhost:8181/api/zfs/datasets/filesystem \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ "name": "storage", "parent": "zpool1", "properties": { "compression": "lz4", "quota": "500G" } }' # Create volume curl -X POST https://localhost:8181/api/zfs/datasets/volume \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ "name": "vm-disk", "parent": "zpool1/vms", "properties": { "volsize": "50G", "volblocksize": "16K" } }' # Flash volume (wipe all data) curl -X POST https://localhost:8181/api/zfs/datasets/volume/flash \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ "guid": "550e8400-e29b-41d4-a716-446655440000" }' # Bulk delete datasets curl -X POST https://localhost:8181/api/zfs/datasets/bulk-delete \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json" \ -d '{ "guids": [ "550e8400-e29b-41d4-a716-446655440001", "550e8400-e29b-41d4-a716-446655440002" ] }' ``` -------------------------------- ### GET /api/info/network-interfaces/historical Source: https://context7.com/alchemillahq/sylve/llms.txt Retrieves historical network interface statistics including bandwidth usage and packet counts. ```APIDOC ## GET /api/info/network-interfaces/historical ### Description Retrieves historical network interface statistics including bandwidth usage and packet counts. ### Method GET ### Endpoint /api/info/network-interfaces/historical ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET https://localhost:8181/api/info/network-interfaces/historical \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the response ('success' or 'error'). - **message** (string) - A descriptive message about the response. - **error** (string) - An error message if the status is 'error', otherwise empty. - **data** (array) - An array of historical network interface statistics objects: - **timestamp** (string) - The timestamp of the statistics in ISO 8601 format. - **interface** (string) - The name of the network interface. - **rxBytes** (integer) - The number of bytes received. - **txBytes** (integer) - The number of bytes transmitted. #### Response Example ```json { "status": "success", "message": "network_interfaces_historical", "error": "", "data": [ { "timestamp": "2025-10-24T10:30:00Z", "interface": "em0", "rxBytes": 1048576000, "txBytes": 524288000 } ] } ``` ```