Program Control
Section titled “Program Control”The Program Control API lets you toggle program registration with supervisord and start or stop running processes. Use these endpoints to activate or deactivate programs, and to trigger lifecycle transitions on demand. For port-range programs, individual instances are controlled by specifying a port.
Enable a program
Section titled “Enable a program”POST /api/v1/daemon/programs/{id}/enable
Enables the program and registers it with supervisord. Use this to activate a previously disabled program.
Parameters
Section titled “Parameters”| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer | Yes | Unique numeric identifier of the program |
This endpoint takes no request body.
curl -X POST "https://api.hoody.com/api/v1/daemon/programs/1/enable" \ -H "Authorization: Bearer <token>"const result = await client.daemon.control.enable({ id: 1 });{ "success": true, "program": { "id": 1, "name": "web-server", "description": "Nginx web server", "enabled": true, "command": "nginx -g \"daemon off;\"", "boot": true, "delay_seconds": 5, "autorestart": "unexpected", "user": "www-data", "environment": {}, "directory": "/var/www", "priority": 999 }}{ "success": false, "error": "Program with ID 999 not found"}Disable a program
Section titled “Disable a program”POST /api/v1/daemon/programs/{id}/disable
Disables the program and removes it from supervisord configuration. The program will be stopped if currently running.
Parameters
Section titled “Parameters”| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer | Yes | Unique numeric identifier of the program |
This endpoint takes no request body.
curl -X POST "https://api.hoody.com/api/v1/daemon/programs/1/disable" \ -H "Authorization: Bearer <token>"const result = await client.daemon.control.disable({ id: 1 });{ "success": true, "program": { "id": 1, "name": "web-server", "description": "Nginx web server", "enabled": false, "command": "nginx -g \"daemon off;\"", "boot": true, "delay_seconds": 5, "autorestart": "unexpected", "user": "www-data", "environment": {}, "directory": "/var/www", "priority": 999 }}{ "success": false, "error": "Program with ID 999 not found"}Start a program or port instance
Section titled “Start a program or port instance”POST /api/v1/daemon/programs/{id}/start
Starts the program immediately via supervisorctl. For port-range programs, the port parameter is required to specify which instance to start. Set wait: true to block until the program reaches the RUNNING state. Set if_not_running: true for idempotent calls (safe to invoke multiple times) — recommended for Hoody Proxy automation. The program must be enabled.
Parameters
Section titled “Parameters”| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer | Yes | Unique numeric identifier of the program |
Request Body
Section titled “Request Body”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
port | integer | No | — | Port number to start (required for port-range programs). Range: 1–65535. |
wait | boolean | No | false | Wait for the program to reach RUNNING state before returning. |
timeout | integer | No | 30 | Timeout in seconds when wait is true. Range: 1–300. |
if_not_running | boolean | No | false | Only start if not already running (idempotent mode). Returns an already_running field in the response. Use this for Hoody Proxy automation. |
Example: Start specific port instance
{ "port": 8042}Example: Start and wait for RUNNING state
{ "port": 8042, "wait": true, "timeout": 60}Example: Idempotent start (Hoody Proxy usage)
{ "port": 8042, "if_not_running": true}Example: Idempotent start with wait
{ "port": 8042, "if_not_running": true, "wait": true, "timeout": 60}curl -X POST "https://api.hoody.com/api/v1/daemon/programs/42/start" \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "port": 8042, "wait": true, "timeout": 60 }'const result = await client.daemon.control.start({ id: 42, data: { port: 8042, wait: true, timeout: 60 }});{ "success": true, "instance": { "port": 8042, "instance_name": "api-server_8042", "status": "STARTING" }}{ "success": true, "already_running": true, "instance": { "port": 8042, "instance_name": "api-server_8042", "status": "RUNNING", "pid": 12345, "uptime": "0:15:30" }}{ "success": true, "already_running": false, "instance": { "port": 8042, "instance_name": "api-server_8042", "status": "STARTING" }}{ "success": false, "error": "Port parameter is required for port-range programs"}{ "success": false, "error": "Port must be between 1 and 65535"}{ "success": false, "error": "Program with ID 999 not found"}Stop a program or port instance
Section titled “Stop a program or port instance”POST /api/v1/daemon/programs/{id}/stop
Stops the program immediately via supervisorctl. For port-range programs, specify port to stop a specific instance or all: true to stop all instances.
Parameters
Section titled “Parameters”| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer | Yes | Unique numeric identifier of the program |
Request Body
Section titled “Request Body”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
port | integer | No | — | Specific port instance to stop. Range: 1–65535. |
all | boolean | No | — | Stop all instances (for port-range programs). |
Example: Stop specific port instance
{ "port": 8042}Example: Stop all instances
{ "all": true}curl -X POST "https://api.hoody.com/api/v1/daemon/programs/42/stop" \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "port": 8042 }'const result = await client.daemon.control.stop({ id: 42, data: { port: 8042 }});{ "success": true}{ "success": false, "error": "Specify either 'port' or 'all: true', not both"}{ "success": false, "error": "Program with ID 999 not found"}