ServerAvatarDocs
API Reference

PHP, Node.js and build tools API

List, install, remove and set the default PHP and Node.js versions, edit php.ini and extensions, manage ionCube, and install the build tools through the OSS Panel API.

The runtimes your applications run on are managed server-wide: PHP versions (with their php.ini, extensions and the ionCube Loader), Node.js versions (with npm), and the compiler toolchain npm falls back to for native modules. Installs take minutes, so the install endpoints answer 202 and run in the background; you poll the matching GET endpoint for progress.

All paths are relative to https://<your-panel-host>/api. Read Authentication first. The examples use:

PANEL=https://panel.example.com
TOKEN='1|xcMq8K3vZ2pL…'

Permissions

KeyTitle in RolesUsed for
phpPHPEverything under /php.
nodeNode.jsEverything under /node and /build-tools. Build tools have no permission of their own.

Reading needs view; every endpoint marked manage needs manage, which implies view. None of these routes has a limit of its own. They draw on the shared budget (see Rate limits), except GET /php, GET /node and GET /build-tools, which are polled while an install runs and sit outside that budget.

The routes only exist where they make sense:

  • /php/… answers 409 on a server that hosts containers, because it serves no PHP applications (This server hosts containers, so it serves no PHP applications…).
  • /node/… answers 409 on a server that runs no applications on the host itself.

Endpoint index

MethodPathPermissionPurpose
GET/phpphpPHP versions, default, install progress.
PUT/php/defaultphp manageSet the default version.
POST/php/versionsphp manageInstall a version.
DELETE/php/versions/{version}php manageRemove a version, or clear a failed install.
GET/php/versions/{version}/iniphpRead the whole php.ini.
PUT/php/versions/{version}/iniphp manageReplace the whole php.ini.
GET/php/versions/{version}/settingsphpRead the common settings.
PUT/php/versions/{version}/settingsphp manageChange the common settings.
GET/php/versions/{version}/extensionsphpList extensions.
PUT/php/versions/{version}/extensions/{extension}php manageTurn an extension on or off.
GET/php/versions/{version}/ioncubephpionCube Loader status.
POST/php/versions/{version}/ioncubephp manageInstall the ionCube Loader.
DELETE/php/versions/{version}/ioncubephp manageRemove the ionCube Loader.
GET/nodenodeNode.js versions, default, npm.
PUT/node/defaultnode manageSet the default version.
POST/node/versionsnode manageInstall a version.
DELETE/node/versions/{version}node manageRemove a version, or clear a failed install.
POST/node/versions/{version}/npmnode manageUpdate npm for one version.
GET/build-toolsnodeBuild tools status.
POST/build-tools/installnode manageInstall the build tools.

PHP

A version is written major.minor, for example 8.3. {version} in a path is that string.

GET /php

curl "$PANEL/api/php" \
  -H "Authorization: Bearer $TOKEN" -H 'Accept: application/json'
{
  "php": {
    "default": "8.3",
    "default_full_version": "8.3.14",
    "panel_version": "8.3",
    "versions": [
      {
        "version": "8.3",
        "status": "ready",
        "full_version": "8.3.14",
        "in_use_by": 2,
        "sites": ["shop", "blog"],
        "sites_truncated": false,
        "service": "php8.3-fpm",
        "ini_path": "/etc/php/8.3/fpm/php.ini",
        "missing_packages": []
      }
    ],
    "installable": [{"version": "8.4"}],
    "lifecycle_available": true
  }
}

panel_version is the version the panel itself runs on: it cannot be removed. in_use_by counts the applications pinned to a version and sites names them. installable lists versions you can still install. lifecycle (support dates) is added to each entry when available. While a version installs or is removed, its entry carries the progress status.

PUT /php/default

Body default (required): a version string such as 8.3. The version must be installed, otherwise 422. Returns {"php": { … }, "cronjobs_on_default_php": [ … ]}: the overview and the cron jobs that follow the server default and so changed version with it.

POST /php/versions

Body version (required): major.minor, and a version the server's package sources offer. A version below the lowest the panel offers, or one that is not available, is refused with 422.

Answers 202 with {"message": "…"} and installs in the background. If the version is already installed and complete you get 200 with a message instead.

DELETE /php/versions/{version}

Answers 202 with {"message": "…"} and removes it in the background. For a version whose install failed, it only clears the failed entry and answers 204. It is refused with 422 when the version:

  • is the one the panel runs on,
  • is pinned by applications (the message names them),
  • is named by cron jobs (the message names them), or
  • is the default.

An unknown version answers 404.

GET /php/versions/{version}/ini and PUT …/ini

GET returns {"php_ini": {"version", "path", "contents"}}.

PUT replaces the whole file and returns the same shape.

FieldRules
contentsRequired, string, up to 262144 bytes (256 KiB).
acknowledgedRequired and accepted (true): you confirm a raw edit.
safety_copyOptional boolean, default true: keep a copy of the previous file.

The panel tests the new file. If PHP rejects it, the previous one is restored, nothing is reloaded and the answer is an error (PHP rejected that configuration, so the previous one was restored.). Extension lines may only load from PHP's own extension folder.

GET /php/versions/{version}/settings and PUT …/settings

The common directives as fields. GET returns {"version", "settings": { … }}, and PUT changes only the lines you send and returns the same shape.

FieldRules
memory_limitSize: -1, or a number with an optional K, M or G, up to 12 characters.
upload_max_filesizeSize, as above.
post_max_sizeSize, as above. Must not be below upload_max_filesize, unless it is -1.
max_execution_timeInteger 0 to 3600 seconds.
max_input_timeInteger -1 to 3600 seconds.
max_input_varsInteger 100 to 100000.
safety_copyOptional boolean, default true.

GET /php/versions/{version}/extensions

Returns:

{
  "extensions": [
    {
      "name": "gd",
      "package": "php8.3-gd",
      "modules": ["gd"],
      "installed": true,
      "enabled": true,
      "builtin": false,
      "summary": null,
      "sapis": []
    }
  ],
  "toggle_supported": true,
  "panel_required": []
}

builtin extensions are compiled into PHP and cannot be turned off. toggle_supported is false on stacks that cannot enable or disable extensions (the request is then refused). panel_required names what the panel itself needs when {version} is the panel's own version. An unknown or uninstalled version answers 404.

PUT /php/versions/{version}/extensions/{extension}

Body enabled (required, boolean).

  • Turning an extension on that is not installed starts an install and answers 202 with {"message": "…"}.
  • Otherwise it answers 200 with {"extension": { … }}.
  • A built-in extension, or one the panel needs on its own PHP version, cannot be turned off: 422.

ionCube Loader

GET /php/versions/{version}/ioncube returns {"ioncube": { … }} with the Loader's state plus status (idle, installing, ready or failed), reason, message and reference.

POST installs it and answers 202 with {"ioncube": { … }}. DELETE removes it and answers 200 with {"ioncube": { … }}. Both take an optional safety_copy boolean (default true) for the PHP configuration files they touch. POST is refused with 422 when ionCube publishes no Loader for that PHP version, or when the Loader was installed outside the panel (by a system package, or by ServerAvatar v7).

Node.js

A version is written major.minor.patch, for example 22.11.0.

GET /node

Returns {"node": { … }} with manager, default, versions, system, installable and installable_error. Each entry of versions has version, npm_version, npm_latest, npm_update_available, in_use_by, sites and sites_truncated, and carries its install status while it installs.

PUT /node/default

Body default (required): major.minor.patch. It must be installed (422 otherwise). Returns {"node": { … }}.

POST /node/versions

Body version (required): major.minor.patch, and a release that exists (Node.js <version> does not exist. Choose a version from the list. is a 422). Answers 202 with {"message": "…"}. Already installed: 200. Already being installed or removed: 409 with reason: "install_in_progress".

DELETE /node/versions/{version}

Answers 204 when the version is removed, or when it was a failed install and the failed entry is cleared. Refused with 422 when applications use the version (the message names them), when it is the default, or when it is the one the panel runs on. Unknown: 404.

POST /node/versions/{version}/npm

No body. Updates npm for that Node version to the newest release it can run. Returns {"message", "npm_version", "npm_latest", "npm_update_available"}. If the npm release list cannot be reached the answer is 422.

Build tools

GET /build-tools

{
  "build_tools": {
    "installed": false,
    "missing": ["build-essential", "python3"],
    "install_status": null,
    "install_reason": null,
    "install_message": null
  }
}

POST /build-tools/install

No body. Answers 202 with {"message": "…"}. 422 when the tools are already installed, 409 when an install is already running.

Common errors

StatusMessage or cause
403Your role does not include management for PHP. (or Node.js).
404Unknown or uninstalled version, extension or failed install.
409The server runs no PHP or host applications; an install of that Node.js version or of the build tools is already running.
422Validation ({"message", "errors": {"field": ["…"]}}); a version that is in use, the default, or the panel's own; a built-in extension; an invalid php.ini.
429Over a limit; wait for Retry-After.
500{"message", "reference"}: find the reference in the error log. The change was made, but PHP … could not be reloaded means the file is saved but not active yet.

On this page