# Web Apps

Web Server Management / Web Apps

Web Apps is the recommended feature for deploying new web applications on cPanel. It deploys container-based applications and supersedes the older Application Manager (PassengerApps) feature. Prefer Web Apps for all new deployments; use Application Manager only to manage existing Passenger applications.

## Update an application's configuration.

 - [GET /WebApp/configure](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-configure.md): This function updates an application's configuration. Only the
parameters you pass change; omitted parameters keep their current
values.

Important:

  The env parameter uses replace-all semantics — the value you
  pass becomes the application's complete set of environment
  variables. To change one variable, read the current set first and
  resubmit it with your change applied. env_text is the same
  operation with the same semantics, for a caller pasting a whole
  .env file instead of assembling an object; pass one or the other,
  never both.

## Delete an application.

 - [GET /WebApp/delete](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-delete.md): This function deletes an application: it stops the application's
running process and removes its container, moves the application's
directory aside to a .bak sibling (kept for verification or rollback
rather than deleted), and removes the application from the account's
registry.

Deleting an application cannot be undone, so it requires an explicit
confirmation: verify must be 1 to proceed. A verify of 0 makes
no changes and returns a confirmation-required error.

The application's domain is not affected; subdomains are managed
independently.

On failure, the metadata.error_category field carries a
machine-readable failure category.

Important:

  The verify parameter is required and has no default. You must
  set it to 1 to confirm this irreversible operation.

## Deploy an application.

 - [GET /WebApp/deploy](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-deploy.md): Web Apps is the recommended feature for deploying new web applications; prefer it over the older Application Manager (PassengerApps) feature for new deployments.

This function deploys an application: it installs dependencies, runs
the build, and promotes the result to the live environment.

Note:

  This function starts an asynchronous task and returns immediately.
  Stream the returned sse_url for live progress, or poll the task.
  While the task runs, the application's status is deploying. When
  the task finishes the status transitions to running on success or
  errored on failure. Use WebApp::list to read the current status
  and inspect last_deploy for the outcome and any failure category.

Important:

  This function is idempotent. If you call it while a deploy for the
  same application is already running, it returns the in-flight
  task's identifiers instead of starting a new deploy.

If this call fails before the task is dispatched (for example, when
the application does not exist), metadata.error_category carries a
machine-readable failure category. Build and runtime failures occur
inside the background task and are recorded asynchronously in
last_deploy.error_category, which is accessible via WebApp::list.

## Check a web app now and report what is wrong.

 - [GET /WebApp/diagnose](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-diagnose.md): This function checks one web application now and reports what is
wrong with it, the evidence for that, and what would repair it.

This is the escalation path from list. list reports what the
scheduled health check last found, so it is at most one check
interval old; this function runs the check live.

It is read-only. It makes no start, stop, restart or redeploy call,
and it rewrites no reverse-proxy configuration, even when the
action it reports recommends one.

It records what it found as the application's health, so a
subsequent list reports this verdict rather than the older one. It
does not add to the application's incident history: that history is
the scheduled check's record of what it found, and this function can
be called at will.

## Fetch an application's runtime or build logs.

 - [GET /WebApp/fetch_logs](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-fetch_logs.md): This function fetches an application's runtime or build logs. It
returns the most recent lines from the log the container persists on
disk. It returns a static tail; live streaming of new lines is not yet
available.

## List available application runtimes and limits.

 - [GET /WebApp/get_available](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-get_available.md): This function returns the account's application capacity: the
account-wide application pool, and — per App Type enabled on the
server — the runtime's supported version tags and their package
managers and the account's current per-type usage.

Call this function first to determine what kinds of applications the
account can deploy.

## Return application domains

 - [GET /WebApp/get_owned_domains](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-get_owned_domains.md): This function reports which of the account's domains are served by a
deployed web application.


Note:

This function does not require the webapp
account feature. Turning the feature off does not stop or remove a
running application, so an interface needs a way to tell that an
application still owns a domain.

## Report whether the Web Apps feature is available.

 - [GET /WebApp/has_feature](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-has_feature.md): This function reports whether the Web Apps feature is available
to the current account, so an interface can decide whether to surface
it.

It is available when the server has the feature enabled, the
account's package feature list includes the feature, and the account is
allowed at least one application.

## List the account's web applications.

 - [GET /WebApp/list](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-list.md): This function lists the account's web applications and their current
state.

## Redeploy an application, pulling source updates first.

 - [GET /WebApp/redeploy](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-redeploy.md): This function redeploys an already-deployed application. For
Git-sourced applications, it pulls the latest changes from the
configured branch before deploying. Otherwise it behaves exactly
like WebApp::deploy.

Note:

  This function starts an asynchronous task and returns immediately.
  Stream the returned sse_url for live progress, or poll the task.
  While the task runs, the application's status is deploying. When
  the task finishes the status transitions to running on success or
  errored on failure. Use WebApp::list to read the current status
  and inspect last_deploy for the outcome and any failure category.

Important:

  This function is idempotent. If you call it while a deploy for the
  same application is already running, it returns the in-flight
  task's identifiers instead of starting a new deploy.

If this call fails before the task is dispatched (for example, when
the application does not exist), metadata.error_category carries a
machine-readable failure category. Build and runtime failures occur
inside the background task and are recorded asynchronously in
last_deploy.error_category, which is accessible via WebApp::list.

When the source's selected SSH key is currently passphrase-protected,
the pull cannot happen inside the asynchronous task -- its arguments
are serialized to disk, and a passphrase must never persist there --
so this function requires sshkeypass, validates it, and runs the
pull synchronously (adding to this call's latency) before queuing the
rest of the pipeline, which never needs the key.

A currently passphrase-protected selected SSH key cannot be unlocked
on this GET operation -- use POST with sshkeypass in the request
body instead.

## Redeploy an application, pulling source updates first.

 - [POST /WebApp/redeploy](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-redeploy-post.md): This function redeploys an already-deployed application. For
Git-sourced applications, it pulls the latest changes from the
configured branch before deploying. Otherwise it behaves exactly
like WebApp::deploy.

Note:

  This function starts an asynchronous task and returns immediately.
  Stream the returned sse_url for live progress, or poll the task.
  While the task runs, the application's status is deploying. When
  the task finishes the status transitions to running on success or
  errored on failure. Use WebApp::list to read the current status
  and inspect last_deploy for the outcome and any failure category.

Important:

  This function is idempotent. If you call it while a deploy for the
  same application is already running, it returns the in-flight
  task's identifiers instead of starting a new deploy.

If this call fails before the task is dispatched (for example, when
the application does not exist), metadata.error_category carries a
machine-readable failure category. Build and runtime failures occur
inside the background task and are recorded asynchronously in
last_deploy.error_category, which is accessible via WebApp::list.

When the source's selected SSH key is currently passphrase-protected,
the pull cannot happen inside the asynchronous task -- its arguments
are serialized to disk, and a passphrase must never persist there --
so this function requires sshkeypass, validates it, and runs the
pull synchronously (adding to this call's latency) before queuing the
rest of the pipeline, which never needs the key.

GET is also available, without a request body, when the source's
selected SSH key is not currently passphrase-protected.

## Restart an application's server process.

 - [GET /WebApp/restart](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-restart.md): This function restarts an application's server process.

Important:

  This function only applies to applications in the server
  category. Calling it on a static application fails with the
  invalid_category error category. It also requires the
  application to have finished at least one deploy; calling it
  before then fails with the not_deployed error category.

## Set an application's run mode.

 - [GET /WebApp/set_mode](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-set_mode.md): This function sets an application's run mode, applies it to the
container's environment (for example, NODE_ENV for a Node.js
application), and recreates the container so the change takes
effect immediately.

Important:

  This function only applies to applications in the server
  category. Calling it on a static application fails with the
  invalid_category error category. It also requires the
  application to have finished at least one deploy; calling it
  before then fails with the not_deployed error category.

## Register a new web application.

 - [GET /WebApp/stage](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-stage.md): Web Apps is the recommended feature for deploying new web applications, and this function is the entry point. Prefer it over the older Application Manager (PassengerApps) feature for new deployments.

This function registers a new web application from an uploaded
archive or a Git repository. Once the source is placed on disk, it
runs a preflight that inspects the source and detects the
application's framework and category, records them on the
application, and derives suggested configuration defaults. The
detection confidence and the suggested defaults are returned so
you can pass them to WebApp::configure. The application is
registered but not deployed — call WebApp::configure (optional)
and then WebApp::deploy to bring it live.

The preflight never fails the stage: a source with no recognizable
markers is registered with a none confidence and generic defaults.

Registering a name that is still staged (not yet deployed)
overwrites it: the previously staged application and its source are
replaced, and the response warnings array reports that the old
files were overwritten.

Registering a name that is already deployed leaves the running
application untouched — its container and live routing are never
disturbed — but the new application cannot reuse the deployed
application's display name, or WebApp::list and bare-name
addressing could not tell the two apart. So it is registered under
the next free -N (for example, my-app-2), and the response
warnings array reports the assigned name. Read the assigned name
from the response data.name: you must pass that name (not the one
you requested) to WebApp::configure and WebApp::deploy to act on
this application, which stands up as its own separate container.

On failure, the metadata.error_category field carries a
machine-readable failure category.

A currently passphrase-protected ssh_key_name cannot be unlocked on
this GET operation -- use POST with sshkeypass in the request body
instead.

## Register a new web application.

 - [POST /WebApp/stage](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-stage-post.md): Web Apps is the recommended feature for deploying new web applications, and this function is the entry point. Prefer it over the older Application Manager (PassengerApps) feature for new deployments.

This function registers a new web application from an uploaded
archive or a Git repository. Once the source is placed on disk, it
runs a preflight that inspects the source and detects the
application's framework and category, records them on the
application, and derives suggested configuration defaults. The
detection confidence and the suggested defaults are returned so
you can pass them to WebApp::configure. The application is
registered but not deployed — call WebApp::configure (optional)
and then WebApp::deploy to bring it live.

The preflight never fails the stage: a source with no recognizable
markers is registered with a none confidence and generic defaults.

Registering a name that is still staged (not yet deployed)
overwrites it: the previously staged application and its source are
replaced, and the response warnings array reports that the old
files were overwritten.

Registering a name that is already deployed leaves the running
application untouched — its container and live routing are never
disturbed — but the new application cannot reuse the deployed
application's display name, or WebApp::list and bare-name
addressing could not tell the two apart. So it is registered under
the next free -N (for example, my-app-2), and the response
warnings array reports the assigned name. Read the assigned name
from the response data.name: you must pass that name (not the one
you requested) to WebApp::configure and WebApp::deploy to act on
this application, which stands up as its own separate container.

On failure, the metadata.error_category field carries a
machine-readable failure category.

GET is also available, without a request body, for calls that do not
need to unlock a passphrase-protected ssh_key_name.

## Start an application's server process.

 - [GET /WebApp/start](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-start.md): This function starts an application's server process.

Important:

  This function only applies to applications in the server
  category. Calling it on a static application fails with the
  invalid_category error category. It also requires the
  application to have finished at least one deploy; calling it
  before then fails with the not_deployed error category.

## Stop an application's server process.

 - [GET /WebApp/stop](https://api.docs.cpanel.net/specifications/cpanel.openapi/web-apps/webapp-stop.md): This function stops an application's server process.

Important:

  This function only applies to applications in the server
  category. Calling it on a static application fails with the
  invalid_category error category. It also requires the
  application to have finished at least one deploy; calling it
  before then fails with the not_deployed error category.

