
mxHeadless
REST API gateway for headless frontends on MODX 3. Resources, objects, OpenAPI, API keys, and OAuth
- MODX 3
- PHP 8.1


MiniShop3 connects through the Extension API. mxHeadless core has no shop dependency. MS3 docs on this site: /components/minishop3/.
| Public name | Description |
|---|---|
products | Products (price, SKU, options) |
categories | Categories |
orders | Orders (protected, not public) |
order_addresses | Addresses |
product_options | Options |
product_links | Links / upsell |
Orders need scope orders.read (pattern {name}.read) and ACL. Never public.
<?php
use MxHeadless\Definition\ObjectDefinition;
use MxHeadless\Definition\RelationDefinition;
/** @var \MxHeadless\Extension\ExtensionApi $api */
$api = $modx->event->params['api'];
$api->registerObject(
ObjectDefinition::create('products')
->setName('products')
->class('MiniShop3\\Model\\msProduct')
->fields(['id', 'pagetitle', 'alias', 'uri', 'price', 'article', 'parent', 'published'])
->filterable(['id', 'parent', 'price', 'published', 'article'])
->sorts(['id', 'price', 'pagetitle'])
->readable()
);
$api->registerRelation('products', RelationDefinition::create('category')
->to('categories')
->toOne()
->foreignKeyField('parent')
->fields(['id', 'pagetitle', 'alias'])
);Full example with orders is in the repository.
# Category grid
curl -s 'https://example.com/api/v1/objects/products?filter[parent]=15&filter[published]=1&sort=price&limit=24'
# Product with category
curl -s 'https://example.com/api/v1/objects/products/101?include=category'| mxHeadless | MiniShop3 Web API | |
|---|---|---|
| Purpose | Catalog, CMS, admin orders | Cart, checkout, customer token |
| Entry | /api/v1/... | assets/components/minishop3/api.php?route=/api/v1/... |
| Envelope | { data, meta, links } | { success, message, data, ... } |
Pretty URL /api/v1/cart/... is intercepted by mxHeadless → 404. Call cart via api.php?route=.
CORS: align mxheadless_cors_* and ms3_cors_allowed_origins.
Two base URLs (cms + shop), a BFF, or careful nginx split. Nuxt/Next guides: docs/examples in the repository.