Skip to content
mxHeadless
REST API gateway for headless frontends on MODX 3. Resources, objects, OpenAPI, API keys, and OAuth
  1. Extras
  2. mxHeadless

mxHeadless

REST API gateway for MODX Revolution 3. Exposes resources, pages, elements, contexts, and registered xPDO objects as JSON for Nuxt, Next.js, SvelteKit, mobile apps, and custom clients.

Release 1.0.42. License GPL-2.0-or-later, no feature tiers.

Source: Ibochkarev/mxHeadless.

Features

  • /api/v1 prefix via the OnHandleRequest plugin (configurable)
  • Only registered objects and fields appear in the API
  • PSR-7/15 middleware: CORS, rate limit, CSRF, idempotency, HTTP cache, audit, webhooks
  • Live OpenAPI and Swagger UI at /api/v1/docs
  • API keys (mxh_*), OAuth (mxt_*), Manager session
  • Extension API (OnMxHeadlessRegister) for MiniShop3 and custom extras

Requirements

Version
MODX Revolution3.2.3+ (transport declares modx >= 3.0.0, follow the package README)
PHP8.1+
DatabaseMySQL / MariaDB (InnoDB), xPDO 3

Details: Requirements.

Installation

Install via modstore.pro in Package Management, or build the transport from source:

bash
cd _build
php build.php

Next: Installation, Web server, Quick start.

Base URL

text
https://your-site.example/api/v1
bash
curl -s https://your-site.example/api/v1 | jq
curl -s https://your-site.example/api/v1/health | jq

Interactive spec: /api/v1/docs. Details: Swagger and OpenAPI.

Fallback without rewrite: assets/components/mxheadless/api.php?route=/v1/health.

Response format

Success:

json
{
  "data": {},
  "meta": {
    "total": 100,
    "count": 20,
    "limit": 20,
    "offset": 0,
    "has_more": true
  },
  "links": {
    "self": "/api/v1/resources?limit=20&offset=0",
    "next": "/api/v1/resources?limit=20&offset=20"
  }
}

Errors: RFC 9457 (application/problem+json). See Errors.

How access works

An object appears in the API only after registration in ObjectRegistry with explicit fields, filters, and permissions. The URL name (resources, products) always maps to an ObjectDefinition, not an arbitrary PHP class. QueryParser accepts only fields, filters, and sorts from the definition.

mxHeadless and mxApi

mxApi is a transport and registry for third-party endpoints. mxHeadless ships resources and registered objects with a fixed envelope and live OpenAPI. Both packages can run on different prefixes.

TopicLink
Quick startquick-start
System settingssettings
Authenticationauthentication
Resourcesapi/resources
Swagger and OpenAPIapi/swagger
MiniShop3extensions/minishop3
Webhooksoperations/webhooks