[data-reveal]{opacity:1!important;transform:none!important}
Extending
API

Extending

Automation nodes, role permissions on the console's blocks, and how routes from your modules are classified and documented.

The module has no interface to implement: it watches the routes registered with the API provider. This page covers what other modules can rely on.

Automation nodes

When @antelopejs/dms-automation is loaded, the module registers three nodes. Without it, the registration is a silent no-op.

Route unhealthy trigger

api.route-unhealthy fires when a route enters a bad state by the API health rules. It runs on one node of a cluster.

ConfigTypeDefaultDescription
intervalSecondsnumber60 (min. 10)How often the routes are checked.
flags("broken" | "slow" | "warn")[]["broken", "slow"]broken: failing on its 5xx rate. slow: p95 at or above the slow threshold. warn: many 4xx.

Output: routeKey, method, uri, flag, errorRate, averageLatencyMs, requestsLast24h.

Get API health action

api.get-api-health returns the KPIs of the routes in scope: totalRoutes, failingRoutes, slowRoutesCount, averageLatencyMs, callsToday, errors24h, and a status breakdown (success, clientErrors, serverErrors, total). The optional days input restricts the breakdown to the last N days.

Query request logs action

api.query-request-logs reads captured requests under the active scope. Inputs: routeId, uri, method, statusClass (success, client-error, server-error), statusMin, statusMax, and limit (default 50, max 200). It returns results and a nextCursor to read the next page.

Role permissions

Every block of the console is declared with .meta({ name, icon }) and its routes are guarded with @AuthUserWithPermission(<block>). In the DMS role editor, each block (the health hero, the request tables, the route explorer, the Tester, the settings form) is a permission of its own: give a role the Request logs without the Tester, or the Overview only.

Own routes and module routes

The console sorts each route by where its controller comes from: own routes from the project's code, module routes from installed AntelopeJS modules. The scope setting picks which ones the pages watch. A distributable module that adds routes shows up under Module routes.

Make the documentation tab accurate

The Documentation tab infers a route's contract from its handler and its traffic:

  • Guard routes with the DMS auth decorators, or name your auth middlewares to match authMiddlewareNamePatterns (^auth_, ^requireAuth, ^session_ by default), so the route reads as authenticated.
  • Parameters and bodies come from captured client requests. Make a representative call from your application or an API client, then open the Documentation tab. Tester calls are excluded from contract inference; they cannot populate missing examples.
LinkOpens
/modules/api/routes?route=<METHOD> <path>&tab=statistics|documentation|testerA route on one of its tabs
/modules/api/logs?record=<requestId>A request in its side panel
/modules/api/logs?since=<iso>&until=<iso>The requests of a time range
?api.period=last-hour|last-24h|last-7-days|last-30-daysA page on a period
?live=0A page paused