latestOpenAPI 3.0.2cPanel License2026-08-106251554.3 MB

3da41671c02c

Script Hooks
Scripts Hooks

Update script hook

This function edits a script hook.

get/edit_hook

Query parameters

idstring required
Example:HzEpGvT6QGUYwxuX3hWB8AUq

The script hook's ID.

Note:

To retrieve a hook's ID, use the WHM API 1 list_hooks function.

checkstring
Example:/scripts/postcourier-authlibup

The absolute file path to the script that runs after the hook script to check the results.

enabled0 | 1
Example:1

Whether the hook script is enabled.

  • 1 — Enabled.
  • 0 — Disabled.
escalateprivs0 | 1

Whether to escalate privileges to run the hook script as root.

  • 1 — Escalate privileges.
  • 0 — Do not escalate privileges.

Note:

  • This parameter only applies to script hooks and not module hooks.
  • Module hooks cannot escalate privileges.
exectype'script' | 'module'
Example:script

The type of function that the script hook launches.

  • script — Runs a script.
  • module — Calls a function in a module.
hookstring
Example:/scripts/postcourier-authlibup

The hook script's absolute file path or its module::subroutine invocation.

notesstring
Example:Note.

The script hook's notes.

rollbackstring
Example:/scripts/postcourier-authlibup

The absolute file path to the script that rolls back the hook script.

stage'pre' | 'post'
Example:post

The condition when the hook script executes.

  • pre — The script runs before the function.
  • post — The script runs after the function.
weightinteger
Example:100

The script hook's priority in the hook's stage, where a lower value runs before a higher value.

Response

HTTP Request was successful.

Example response

{
  "metadata": {
    "command": "edit_hook",
    "reason": "OK",
    "result": 1,
    "version": 1
  }
}