← Back
Editing: create_section.json
{ "name": "create_section", "description": "Add one section to working canvas source. On a page canvas, this appends the section at the end. On a blank reusable canvas, this creates its first source and is valid only when the reusable has no source; after bootstrap, use edit_part kind=global_part. This never updates a live page; a human must Publish or Update live in the Manual editor. Returns the created section ID, preview URL, warnings, and NEXT STEP.", "http": { "method": "POST", "path": "/wp-json/uncanny-page-builder/v1/agent/page/{page_id}/sections" }, "parameters": [ { "name": "page_id", "type": "integer", "required": false, "in": "path", "description": "Uncanny Page Builder canvas page ID. Pass this when the user provides a canvas_id or a page_id known to be an Uncanny Page Builder canvas. For ordinary WordPress page URLs or names, resolve the target first; do not assume any page_id is editable. Omit only for the current page canvas. For a blank reusable canvas, pass its explicit ID.", "inject_from": "current_page_id" }, { "name": "name", "type": "string", "required": true, "in": "body", "description": "Display name for the section (e.g. 'Hero Section', 'Pricing Table')." }, { "name": "html", "type": "string", "required": true, "in": "body", "description": "Section HTML markup. Must have a single root element with a unique class." }, { "name": "css", "type": "string", "required": true, "in": "body", "description": "Scoped CSS for the section. Use canvas-local selectors such as the section root class, child classes, :target, and local state classes. Avoid document-level selectors like body, html, and :root; if submitted, the write is accepted but returns a WARNING because compiled canvas CSS may filter those selectors." } ], "output": { "content_type": "text/plain", "description": "Plain-text result. A page append returns PAGE_ID, SECTION_ID, POSITION, NAME, SOURCE_GENERATION, PREVIEW, optional WARNING lines, and NEXT STEP. A blank reusable bootstrap returns KIND: global_part, GLOBAL_PART_ID, PART_TYPE, SECTION_ID, POSITION, NAME, SOURCE_GENERATION, PREVIEW as the authenticated working preview, optional WARNING lines, and NEXT STEP." }, "errors": { "422": "HTML validation failure — single root element required, no forbidden tags/attributes, valid editables and bindings.", "404": "Page or reusable canvas not found.", "403": "Page or reusable canvas is not editable by the current user.", "409": "The working source changed before the write committed. Read current source before retrying." }, "auto_approve": false, "group": "write" }
Save File
Cancel