Guide

REST API

Every Mantle endpoint lives under the mantle/v1 namespace. REST_Base composes that namespace from a base path of mantle and a version of v1, so all controllers inherit it.

Authentication

Mantle's routes are cookie-and-nonce authenticated like the rest of the WordPress REST API, and each route declares a permission_callback that checks a Mantle capability. From the browser, use the nonce WordPress already provides; from a script, use an authentication plugin appropriate to your site.

Request GET /wp-json/mantle/v1/settings
HeadersKey: value
Accept application/jsonX-WP-Nonce REPLACE_WITH_REST_NONCE
Response 200 OK
BodyJSON
{
  "maintenance_enabled": false,
  "security_enabled": false,
  "hosting_provider": ""
}

Enumerate the routes on your own site

Because the surface is module-dependent, list it rather than trusting a static table:

List every mantle/v1 route bash
wp eval '$r = rest_get_server()->get_routes(); foreach ( $r as $route => $h ) { if ( 0 === strpos( $route, "/mantle/v1" ) ) { echo $route . PHP_EOL; } }'
/mantle/v1
/mantle/v1/settings
/mantle/v1/settings/reset
/mantle/v1/modules
...

Core routes

Registered by controllers in includes/Controller/REST/, independent of module state.

Settings

RouteMethods
/mantle/v1/settingsGET, POST
/mantle/v1/settings/<setting_key>GET, POST
/mantle/v1/settings/resetDELETE

setting_key matches [a-zA-Z0-9_]+. String values are sanitised with sanitize_text_field() unless the key is in the controller's textarea allow-list.

Setup and connection

RouteMethods
/mantle/v1/setupGET, POST
/mantle/v1/setup/<setting_key>GET, POST
/mantle/v1/pinPOST
/mantle/v1/pin/<pin>POST
/mantle/v1/connectorGET
/mantle/v1/connector/callbackGET
/mantle/v1/auth/google/refreshPOST
/mantle/v1/orderPOST

pin matches exactly four digits (\d{4}).

Modules

RouteMethods
/mantle/v1/modulesGET
/mantle/v1/modules/<module_id>POST

module_id matches [a-zA-Z0-9_-]+.

Capabilities, roles, and users

RouteMethods
/mantle/v1/capabilitiesGET
/mantle/v1/capabilities/checkGET
/mantle/v1/capabilities/syncPOST
/mantle/v1/capabilities/resetPOST
/mantle/v1/rolesGET
/mantle/v1/roles/<role>/capabilitiesPOST
/mantle/v1/power-admin/usersGET
/mantle/v1/power-admin/checkGET
/mantle/v1/power-admin/assignPOST

Licence and deployment

RouteMethods
/mantle/v1/licenseGET, POST
/mantle/v1/license/remote/registerGET
/mantle/v1/deploymentsGET

WAF

RouteMethods
/mantle/v1/wafGET, POST, DELETE
/mantle/v1/waf/syncGET
/mantle/v1/waf/<key>GET
/mantle/v1/waf/<id>DELETE

Plugin and theme commands

RouteMethods
/mantle/v1/plugins/commandPOST
/mantle/v1/plugins/command/batchPOST
/mantle/v1/plugins/command/logGET

Module routes

These are registered through get_rest_controllers() when their module initialises, so they exist only while the owning module is enabled — with the AI Chatbot group noted below as an exception.

Convergence Cache (convergence_cache)

RouteMethods
/mantle/v1/cache/infoGET
/mantle/v1/cache/providerPOST
/mantle/v1/cache/cloudflare/enablePOST
/mantle/v1/cache/admin-bar/enablePOST
/mantle/v1/cache/clear/objectPOST
/mantle/v1/cache/clear/pagePOST
/mantle/v1/cache/clear/edgePOST
/mantle/v1/cache/clear/allPOST
/mantle/v1/cache/clear/pressablePOST
/mantle/v1/cache/clear/wpenginePOST
/mantle/v1/cache/clear/pantheonPOST
/mantle/v1/cache/clear/cloudflarePOST

Monitoring (monitoring)

RouteMethods
/mantle/v1/monitoring/pagespeed/GET
/mantle/v1/monitoring/pagespeed/<identifier>/GET
/mantle/v1/monitoring/contact-groups/GET
/mantle/v1/monitoring/uptime/GET
/mantle/v1/monitoring/uptime/<identifier>/GET
/mantle/v1/monitoring/uptime/<identifier>/historyGET
/mantle/v1/monitoring/uptime/<identifier>/periods/GET
/mantle/v1/monitoring/uptime/<identifier>/alerts/GET
/mantle/v1/monitoring/ssl/GET
/mantle/v1/monitoring/ssl/<identifier>/GET
/mantle/v1/monitoring/heartbeat/GET
/mantle/v1/monitoring/heartbeat/<identifier>/GET

identifier matches [0-9]+. Note that the history sub-route has no trailing slash while its siblings do.

Plugin Sync (plugin_sync)

RouteMethods
/mantle/v1/plugins/statusGET
/mantle/v1/plugins/syncPOST
/mantle/v1/plugins/sync/statusGET
/mantle/v1/plugins/command/enablePOST
/mantle/v1/plugins/command/disablePOST
/mantle/v1/themes/statusGET

Client Info (client_info, core)

RouteMethods
/mantle/v1/clientsGET, POST
/mantle/v1/clients/logoPOST

AI Chatbot

RouteMethods
/mantle/v1/ai-chatbot/conversationsGET, POST
/mantle/v1/ai-chatbot/conversations/<id>GET, POST, PUT, PATCH, DELETE
/mantle/v1/ai-chatbot/messagesGET, POST, DELETE
/mantle/v1/ai/generate-blockPOST
/mantle/v1/ai/plan-editPOST
/mantle/v1/ai/rewrite-blockPOST

id matches [0-9]+.

Communication (communication)

RouteMethods
/mantle/v1/channelsGET
/mantle/v1/slack/<channel_name>GET
/mantle/v1/chat/slack/channelPOST
/mantle/v1/chat/slack/ws-tokenGET
/mantle/v1/chat/slack/usersGET
/mantle/v1/chat/attachmentsPOST

channel_name matches \d+. The users route accepts an ids argument; attachments handles uploads. Both are declared to the front end by Communication_Module as usersRoute and attachmentsRoute.

Linchpin Licenses (linchpin_licenses)

RouteMethods
/mantle/v1/licenses/request-installPOST

Adding routes from a module

Override get_rest_controllers() on your module. Mantle registers the returned controllers when the module initialises, so the routes automatically disappear when the module is disabled.

php includes/Modules/Reports/Reports_Module.php
/** * REST controllers owned by this module. * * @return array */protected function get_rest_controllers(): array {	return [		new Reports_REST(),	];}
Returned controllers are registered only while the module is enabled.

Abstract_Module declares get_rest_controllers() as protected and returns an empty array by default, so override it with the same visibility.

See Creating a module for the full module contract.

Was this helpful?