WebApp
Web Apps

Redeploy an application, pulling source updates first.

Changed on

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.

post/WebApp/redeploy

Request

  • Base URL
    https://cpanel-server.tld:2083/execute
  • Auth
    HTTP basic

Query parameters

namestring required
Example:my-app

The application's unique name (slug).

Request body application/x-www-form-urlencoded

sshkeypassstring

The one-off passphrase to unlock the source's selected SSH key for this pull only; it is never stored. Required when that key is currently passphrase-protected; irrelevant, and ignored, otherwise.

Security note: This parameter carries a secret and must ride only in the POST request body. The system rejects both a non-POST request and a sshkeypass key in the URL query string before it reads the passphrase, so it cannot leak into access logs, proxy logs, or browser history. This check does not apply to the bin/uapi CLI or LiveAPI Perl/PHP bindings; on the CLI in particular, passing sshkeypass inline puts it in ps output and shell history, so prefer an interactive or file-based passphrase input there instead.

Example request

{
  "sshkeypass": "correct-horse-battery-staple"
}

Response

HTTP Request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "apiversion": 3,
  "func": "redeploy",
  "module": "WebApp",
  "result": {
    "data": {
      "deploy_id": "dp-20260612-0002",
      "sse_url": "/sse/UserTasks/00000000_5c6c8b18228a35/deploy.log",
      "task_id": "00000000/5c76ec5566332c"
    },
    "status": 1
  }
}

Changes