Free cookie consent management tool by TermsFeed Generator
All Products & Integrations

jalpi page builder docs

Jalpi REST API

Interact programmatically with Jalpi Page Builder canvas documents, global CSS classes, template libraries, revisions, theme templates, and site-wide design tokens.

Jalpi Core REST v1 Namespace: jalpi-page-builder/v1
6 min read Β· November 2026

Overview#

Jalpi Page Builder registers a complete WordPress REST API namespace at /wp-json/jalpi-page-builder/v1/. The API handles all state operations for the full-screen visual editor, manages the template repository, powers autosaves and revisions, and synchronizes site-wide global styling tokens.

Unlike conventional page builders that store layout strings inside post_content, Jalpi stores its complete node hierarchy as JSON in a dedicated database table ({prefix}jalpi_pages). The REST API exposes structured endpoints to read, validate, save, and publish these node trees.

Endpoints Summary#

MethodEndpointPermissionPurpose
GET/page/{post_id}edit_post on post_idLoad page JSON canvas tree, post title, and post status.
POST/page/{post_id}edit_post on post_idValidate, sanitize, and save canvas document to database.
POST/page/{post_id}/publishedit_post on post_idSet post status to publish & write static HTML fallback.
GET/page/{post_id}/historyedit_post on post_idGet recent undo/redo snapshots from post meta.
GET/classesedit_postsList all site-wide reusable global CSS classes.
POST/classesmanage_optionsCreate a reusable global CSS class with StyleMap.
PUT/classes/{key}manage_optionsUpdate an existing global CSS class definition.
DELETE/classes/{key}manage_optionsDelete a global class row.
GET/templatesedit_postsSearch and paginate template library.
POST/templatesedit_postsSave canvas layout as a reusable template.
GET/templates/{id}edit_postsRetrieve full template document including node tree.
GET/templates/categoriesedit_postsRetrieve the 24 fixed template category slugs.
GET/revisions/{post_id}edit_post on post_idList saved revision history snapshots for a post.
POST/revisions/{post_id}/{revision_id}/restoreedit_post on post_idRestore a revision snapshot to the live canvas document.
GET/theme-templatesedit_theme_optionsList theme templates (headers, footers, singles, archives).
POST/theme-templatesedit_theme_optionsCreate a theme template with conditional rules.
GET/design-systemedit_postsRetrieve site-wide Design System token set.
POST/design-systemmanage_optionsUpdate site-wide Design System token set.
GET/dynamic-tagsedit_postsRetrieve list of registered dynamic tag tokens.
GET/nav-menusedit_postsRetrieve WordPress navigation menus for header elements.

Authentication & Permissions#

Every route in the Jalpi REST API requires an authenticated WordPress user session. There are no unauthenticated public endpoints in the API.

  • Authentication: Standard WordPress cookie authentication via the logged_in cookie, paired with the X-WP-Nonce header (generated via wp_create_nonce('wp_rest')).
  • Permission Callbacks:
    • Jalpi_API::check_edit_post_permission: Verifies current_user_can( 'edit_post', $post_id ).
    • Jalpi_Classes_API::write_permission: Verifies current_user_can( apply_filters( 'jalpi_design_system_capability', 'manage_options' ) ).
    • Jalpi_Templates::read_permission: Verifies current_user_can( 'edit_posts' ).
    • Jalpi_Theme_API::check_permission: Verifies current_user_can( 'edit_theme_options' ).

GET /page/{post_id}#

Loads a page document, including its post title, status, and the complete JSON canvas tree from {prefix}jalpi_pages. If no layout exists yet, returns a clean default scaffold.

Parameters

ParameterInTypeRequiredDescription
post_idpathintegerYesTarget WordPress post ID. Sanitized with absint().

Request

GET /wp-json/jalpi-page-builder/v1/page/105 HTTP/1.1
Host: example.com
X-WP-Nonce: 4a8b2c1d3e

Response

{
  "post_id": 105,
  "post_title": "About Us",
  "post_status": "publish",
  "page_data": {
    "version": 1,
    "sections": [
      {
        "id": "sec_9a1b2c",
        "type": "section",
        "settings": { "layout": "boxed" },
        "children": [
          {
            "id": "col_3d4e5f",
            "type": "column",
            "settings": { "width": "100%" },
            "children": [
              {
                "id": "wid_6g7h8i",
                "type": "heading",
                "settings": { "title": "About Our Studio", "tag": "h1" }
              }
            ]
          }
        ]
      }
    ]
  }
}

POST /page/{post_id}#

Validates, sanitizes, and persists a complete page document. There is no partial patch save; the client submits the full updated tree.

Parameters

ParameterInTypeRequiredDescription
post_idpathintegerYesTarget WordPress post ID.
page_databodyobjectYesFull canvas document. Must contain a sections array.

Response

{
  "success": true,
  "post_id": 105
}

POST /page/{post_id}/publish#

Sets post_status to publish and executes Jalpi_Renderer::render_page() to generate clean, semantic HTML and CSS, which is saved into the standard WordPress post_content column. This ensures complete SEO indexing and zero content lock-in if the plugin is ever deactivated.

Response

{
  "success": true,
  "post_id": 105,
  "permalink": "https://example.com/about-us/"
}

Classes API (/classes)#

Site-wide reusable CSS classes are stored in {prefix}jalpi_classes. Elements attach to a class via its class_key.

POST /wp-json/jalpi-page-builder/v1/classes HTTP/1.1
Content-Type: application/json
X-WP-Nonce: 4a8b2c1d3e

{
  "name": "Hero Title",
  "styles": {
    "color": { "desktop": "#0f172a" },
    "fontSize": { "desktop": "48px", "mobile": "32px" },
    "fontWeight": { "desktop": "800" },
    "lineHeight": { "desktop": "1.2" }
  }
}

Response:

{
  "success": true,
  "class_key": "hero_title_4b8f",
  "class": {
    "class_key": "hero_title_4b8f",
    "name": "Hero Title",
    "styles": {
      "color": { "desktop": "#0f172a" },
      "fontSize": { "desktop": "48px", "mobile": "32px" }
    },
    "favorite": 0,
    "sort_order": 1
  }
}

Templates API (/templates)#

Manages saved user templates, kit templates, and categories. Supports pagination, filtering by category, and full import/export.

GET /wp-json/jalpi-page-builder/v1/templates?category=hero-sections&per_page=12 HTTP/1.1
X-WP-Nonce: 4a8b2c1d3e

Revisions API (/revisions)#

Manages auto-saves and named snapshots stored in {prefix}jalpi_revisions. Supports restoring any previous state without affecting live frontend visitors until published.

Theme Templates API (/theme-templates)#

Manages global theme templates (Header, Footer, Single, Archive, 404). Each template carries display conditions evaluated by Jalpi_Theme_Builder::match_template().

Design System API (/design-system)#

Reads and writes the site-wide design token dictionary: colors, font families, font sizes, line heights, letter spacings, border radii, box shadows, and spacing scales.

Error Handling#

All endpoints return standard WordPress WP_Error responses with appropriate HTTP status codes:

StatusCodeCause
401rest_not_logged_inMissing authentication session or expired nonce.
403rest_forbiddenUser lacks required capability (e.g. edit_post, manage_options).
404invalid_postThe requested post ID does not exist in the database.
400rest_invalid_paramMissing required fields (e.g. page_data without sections).
500encode_failedJSON encoding failed on save.
500db_errorDatabase table write failed.

Error response format:

{
  "code": "rest_forbidden",
  "message": "Sorry, you are not allowed to edit this post.",
  "data": {
    "status": 403
  }
}

JavaScript Example#

Using the Jalpi REST API from the visual editor or custom admin scripts with fetch:

// Example: Loading a page document and saving an updated title
async function updateJalpiPage(postId, updatedPageData) {
  const nonce = window.jalpiEditorConfig?.nonce || window.wpApiSettings?.nonce;
  const apiUrl = '/wp-json/jalpi-page-builder/v1';

  // 1. Fetch current page
  const getRes = await fetch(`${apiUrl}/page/${postId}`, {
    headers: { 'X-WP-Nonce': nonce }
  });
  if (!getRes.ok) throw new Error(`Failed to load page: ${getRes.status}`);
  const page = await getRes.json();
  console.log('Current page:', page);

  // 2. Save updated canvas tree
  const postRes = await fetch(`${apiUrl}/page/${postId}`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-WP-Nonce': nonce
    },
    body: JSON.stringify({ page_data: updatedPageData })
  });
  const result = await postRes.json();
  console.log('Save result:', result);
}

PHP Example#

Internal WordPress plugins can call the Jalpi REST API directly without HTTP networking overhead using rest_do_request():

// Example: Reading a Jalpi page document programmatically in PHP
function get_jalpi_page_document( int $post_id ) {
    $request = new WP_REST_Request( 'GET', '/jalpi-page-builder/v1/page/' . $post_id );
    $response = rest_do_request( $request );

    if ( $response->is_error() ) {
        return $response->as_error();
    }

    $data = $response->get_data();
    return $data['page_data'] ?? null;
}