Self Help Documentation
software/deploynewnodejsapp
Description
Deploys a new Node.js application for an existing domain from a given SPanel user account.
Warning
If port is provided, it must be in the range 3000-3500. If port is omitted, the system will automatically assign an available port.
Info
When application_type is n8n, the API forces deployment to the main URL path and uses a dedicated install path (N8N). The updates parameter is applicable to n8n deployments.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| token | string | Yes | Authorizing API token – check API Basics for more information. |
| accountuser | string | Yes | The SPanel user account that is being managed or viewed. |
| action | string | Yes | The category and function being executed. |
| domain | string | Yes | The domain to deploy the application on. Must be a valid domain name already available in SPanel. |
| url | string | No | The application URL path (for example: myapp). If omitted, the app will be installed in the root of the domain. Not used when application_type is n8n – it always installs in the root directory. |
| path | string | Yes | Path to the application’s executable file within the user account, for example a *.yml or *.js file. Not used when application_type is n8n. |
| port | int | No | Optional port for the application. If provided, must be between 3000 and 3500. If omitted, SPanel will auto-assign a port. Not used when application_type is n8n. |
| application_type | string | No | Application type (nodejs or n8n). Defaults to nodejs. |
| updates | bool | No | Automatic updates flag (only applicable to n8n). |
Example
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
$endpointUrl = 'https://123.123.123.123/spanel/api.php'; $postData = [ 'token' => 'provided_auth_token', 'accountuser' => 'spanelio', 'action' => 'software/deploynewnodejsapp', 'domain' => 'example.com', 'url' => 'myapp', 'path' => 'nodejsapps/myapp.js', 'port' => 3001, 'application_type' => 'nodejs', /* 'updates' => true */ ]; $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $endpointUrl); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt( $ch, CURLOPT_POST, true); curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query($postData)); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false); $jsonOutput = curl_exec( $ch ); |
You can find more information about the Endpoint URL in our API Basics article.
Output
|
1 2 3 4 5 6 7 8 |
{ "result": "success", "data": { "msg": "The Node.js app was deployed successfully at /home/spanelio/nodejsapps/myapp (example.com/myapp) on port 3001.", "port": "3001", "fullPath": "/home/spanelio/nodejsapps/myapp" } } |