Hooks API
Modules react to events (an invoice paid, a client created) through hooks: methods of a module’s service that listen for an event. These calls list the connected hooks, reconnect them after a module change, and fire an event by hand. See Events for the events and how to listen for one.
Admin calls need Module access on the Hook card of the staff group’s Permissions tab, plus each call’s own permission below (Super Administrators have all). See Authentication.
Admin calls
Section titled “Admin calls”get_list
Section titled “get_list”POST /api/admin/hook/get_list
Lists the connected hooks: one row per module method that listens for an event.
Permission: View hooks (hook.view)
| Parameter | Type | Description |
|---|---|---|
page |
integer | Page number, from 1. Default 1. |
per_page |
integer | Rows per page, 1 to 500. Default 100. |
Returns: A paged list. Each row has id, rel_type (always mod), rel_id (the module name), event (the listening method, such as onAfterAdminInvoicePaymentReceived), created_at and updated_at.
Example
Request parameters:
{ "per_page": 2}result:
{ "pages": 41, "page": 1, "per_page": 2, "total": 82, "list": [ { "id": 1, "rel_type": "mod", "rel_id": "client", "event": "onAfterClientSignUp", "created_at": "2026-11-17 09:12:04", "updated_at": "2026-11-17 09:12:04" }, { "id": 2, "rel_type": "mod", "rel_id": "invoice", "event": "onAfterAdminInvoicePaymentReceived", "created_at": "2026-11-17 09:12:04", "updated_at": "2026-11-17 09:12:04" } ]}POST /api/admin/hook/call
Fires an event now, so every hook listening for it runs. Use it to test a listener of your own module.
Permission: Trigger hooks (hook.trigger_hooks), and only a Super Administrator may call it
| Parameter | Type | Description |
|---|---|---|
event |
string, required | The event name, such as onAfterClientSignUp. Without it nothing runs and the call returns false. |
params |
object | The event’s parameters, as the listeners read them with $event->getParameters(). |
subject |
mixed | The event’s subject, passed to the listeners. |
Returns: The value the listeners set as the event’s return value, or null when none did; false when event is missing.
Errors:
- Only Super Administrators can call hooks. (code 403) for every other staff account.
The listeners run for real: a listener that sends email or changes data does so. Fire events on a test install.
batch_connect
Section titled “batch_connect”POST /api/admin/hook/batch_connect
Reconnects the hooks: removes those of modules that are no longer active, then connects every listening method of the active modules (or of one module). Cron does this on its own; call it after installing or changing a module.
Permission: Manage hooks (hook.manage_hooks)
| Parameter | Type | Description |
|---|---|---|
mod |
string | One module’s name, such as invoice, to connect only its hooks. Leave it out for all active modules. |
Returns: true when the hooks were reconnected; false when another reconnect was already running and did not finish within 5 seconds.

