Skip to content

Powered by Grav + Helios

Blueprints

Blueprints

Endpoints for retrieving blueprint schemas used for page templates, user accounts, and permission definitions.

Endpoints for retrieving blueprint schemas used for page templates, user accounts, and permission definitions.

List Page Types

GET /blueprints/pages
List all available page templates (blueprints) registered in the system.
JSON
{"data": [{"type": "default", "label": "Default"}, {"type": "blog", "label": "Blog"}, {"type": "post", "label": "Post"}]}

Response Codes

200 Success
401 Unauthorized

Get Page Blueprint

GET /blueprints/pages/{template}
Get the fully resolved blueprint schema for a page template, including inherited fields and imports.

Parameters

Name Type Description
template required string The page template name (e.g. default, blog, post)
JSON
{"data": {"name": "default", "title": "Default", "validation": "loose", "fields": [{"name": "header.title", "type": "text", "label": "Title"}]}}

Response Codes

200 Success
401 Unauthorized
404 Template blueprint not found

Get User Blueprint

GET /blueprints/users
Get the user account blueprint schema for rendering the user edit form.
JSON
{"data": {"name": "account", "title": "Account", "validation": "loose", "fields": [{"name": "username", "type": "text", "label": "Username"}]}}

Response Codes

200 Success
401 Unauthorized
404 User blueprint not found

Get Permissions

GET /blueprints/users/permissions
Get all registered permission actions in the system, organized hierarchically with translated labels.
JSON
{"data": [{"name": "admin", "label": "Admin", "children": [{"name": "admin.login", "label": "Login"}]}]}

Response Codes

200 Success
401 Unauthorized

Get Plugin Page Blueprint

GET /blueprints/plugins/{plugin}/pages/{pageId}
Get a custom page blueprint for a plugin. Loads the YAML file from admin/blueprints/{pageId}.yaml within the plugin directory and returns it as a serialized blueprint with resolved fields.

Parameters

Name Type Description
plugin required string The plugin slug
pageId required string The page blueprint identifier (matches the filename without extension)
JSON
{"data": {"name": "licenses", "title": "Licenses", "type": null, "child_type": null, "validation": "loose", "fields": [{"name": "licenses", "type": "array", "label": "Licenses"}]}}

Response Codes

200 Success
401 Unauthorized
404 Plugin or page blueprint not found

Get Plugin Blueprint

GET /blueprints/plugins/{plugin}
Return a plugin's `blueprints.yaml` with fields resolved (labels translated, data options expanded). Fires the `onApiBlueprintResolved` event so plugins can mutate the serialized fields (e.g., inject dynamic options).

Parameters

Name Type Description
plugin required string Plugin slug.
JSON
{"data": {"id": "simplesearch", "name": "SimpleSearch", "fields": {"enabled": {"type": "toggle", "label": "Enabled"}}}}

Response Codes

200 Blueprint returned.
401 Unauthorized.
403 Missing `api.config.read` permission.
404 Plugin or its `blueprints.yaml` not found.

Get Theme Blueprint

GET /blueprints/themes/{theme}
Return a theme's `blueprints.yaml` with resolved fields.

Parameters

Name Type Description
theme required string Theme slug.
JSON
{"data": {"id": "quark", "name": "Quark", "fields": {"dropdown.enabled": {"type": "toggle"}}}}

Response Codes

200 Blueprint returned.
401 Unauthorized.
403 Missing `api.config.read` permission.
404 Theme or its `blueprints.yaml` not found.

Get Config Blueprint

GET /blueprints/config/{scope}
Return the blueprint that describes a system/site config scope. Admin2 pairs this with `GET /config/{scope}` to render configuration forms. Looks up the blueprint via the `blueprints://` stream so plugin overrides (e.g. the admin plugin's `media.yaml`) are honored, then falls back to `system://blueprints/config/{scope}.yaml`.

Parameters

Name Type Description
scope required string One of: `system`, `site`, `media`, `security`, `scheduler`, `backups`.
JSON
{"data": {"id": "system", "name": "System Configuration", "fields": {"cache.enabled": {"type": "toggle", "label": "Enabled"}}}}

Response Codes

200 Blueprint returned.
401 Unauthorized.
403 Missing `api.config.read` permission.
404 Unknown scope, or blueprint file not found.

Resolve Data Options

GET /data/resolve
Resolve `data-options@: \Some\Class::method` directives used in blueprint field definitions (e.g., the list of page templates, the list of themes). Admin2 calls this when rendering a blueprint whose select/checkboxes field references a callable. Only whitelisted namespaces and Class::method callables are accepted — an allow-list prevents arbitrary code execution. Results are shape-normalized to `[{value, label}]` for select-compatible consumption.

Parameters

Name Type Description
callable required string Fully-qualified `\Class\Name::method` to invoke. Must start with a whitelisted namespace.
type optional string Extra arg passed when `callable` is `Grav\Common\Page\Pages::pageTypes` (`standard` / `modular`). Defaults to `standard`.
JSON
{"data": [{"value": "default", "label": "Default"}, {"value": "blog", "label": "Blog"}]}

Response Codes

200 Options returned (empty array if the method does not return an array).
400 Missing/invalid `callable`, or namespace is not in the allow-list, or not in `Class::method` format.
401 Unauthorized.
403 Missing `api.pages.read` permission.
404 Class or method does not exist.