Back to docs

Developer API

GJS Builder is a platform, and its public API is the whole point: the same API that ships the default blocks, SEO and tools is the one you use. There is no private back door.

The JavaScript API

On the editor screen the core exposes two globals synchronously, before the editor initializes:

window.grapesjs   // the GrapesJS factory
window.GjsBuilder // GJS integration surface

The load-order guarantee

The core calls grapesjs.init() only after DOMContentLoaded. That deferral is a guarantee: any script that runs earlier can register its blocks, panels or SEO provider first, and the editor will pick them up. No races, no ordering hacks.

// Register a block the same way the core does
window.GjsBuilder.on('editor:init', (editor) => {
  editor.BlockManager.add('my-hero', {
    label: 'Hero',
    content: '<section class="hero"><h1>Hello</h1></section>',
  });
});

SEO providers

An in-editor SEO plugin writes to WordPress storage through the provider bridge:

window.GjsBuilder.registerSeoProvider(myProvider);

Any SEO plugin can replace the default via this contract — see SEO.

PHP filters & actions

The core is customizable through WordPress filters and actions (marketplace URL, build URL, featured plugins, extension schemas, and more). Because they're standard hooks, you extend GJS without forking it.

// Point the builder at your own catalog
add_filter('gjs_builder/marketplace_url', fn() => 'https://market.example.com');

REST API

All editor operations run over the gjs-builder/v1 namespace with a unified { success, data | error } envelope:

RoutePurpose
GET/POST /pages/{id}Load / save a page
POST /pages/{id}/autosaveAutosave draft
GET/POST /pages/{id}/settingsPage settings
GET/POST /pages/{id}/seoSEO document
GET/POST /assetsMedia library
/extensions/*Catalog, install, enable, settings, updates

A minimal add-on

A complete block-and-plugin add-on is only a few dozen lines. See the examples/ folder in the plugin for gjs-builder-example-addon and gjs-builder-example-seo.

Build your own

Once your extension works locally, publish it through GJS Market so others can install it — from the marketplace, npm, or Git.