Skip to content

Create a builder page ​

Last updated View as Markdown

Endpoint: https://api.youcan.shop/pages/builder

Method: POST

Creates a landing page with the page builder. The content is validated against the page builder schema and built before it is saved. On a validation error, the page is not created.

Required Scopes ​

  • edit-pages

Parameters ​

Param NameParam TypeDescriptionRequired
namestringPage nameyes
slugstringPage slugno
visibilitybooleanPage visibility. Default false, so you can check a preview firstno
metaobjecttitle and description of the pageno
settingsobjectPage settings, keyed by setting nameno
sectionsarraySections of the page, in order. See Page contentno

Response ​

[201] Created

json
{
    "id": "8b6d1a24-5c4e-4a5f-9d1e-0f2c3b4a5d6e",
    "name": "Summer collection",
    "slug": "summer-collection",
    "visibility": "0",
    "public_url": null,
    "type": "landing",
    "settings": {
        "page-direction": "ltr",
        "is-full-width": true
    },
    "sections": [
        {
            "id": "hero",
            "name": "html-editor",
            "label": "Hero",
            "blocks": {
                "parameters": { "htmlText": "<div class=\"kb-hero\"><h1>Summer collection</h1></div>" },
                "style": { "css-content": ".kb-hero { padding: 48px; }" }
            },
            "children": []
        }
    ],
    "ignored": []
}

ignored lists the paths of page settings that were not applied, such as settings.unknown-setting.

[422] Unprocessable Entity

Each error has the exact path of the value:

json
{
    "errors": {
        "sections.0.blocks.parameters.htmlText": ["may not contain scripts, event handlers or a javascript: or data: url"]
    }
}