--- name: clickfunnels-pages description: > Create, read, and update ClickFunnels 2.0 pages programmatically - funnel pages, site pages, checkout pages, opt-ins. The page body is authored in PML (Page Markup Language); the DSL itself lives in the Page Markup Skill. version: "1.0" author: ClickFunnels tools: - http references: - path: https://accounts.myclickfunnels.com/llms.txt description: Quick-reference index - product overview, login, funnels, broadcasts, API docs. - path: https://accounts.myclickfunnels.com/.well-known/page-markup/skill.md description: PML reference - elements, attributes, design system, examples. Read this before authoring any `markup` field. - path: https://accounts.myclickfunnels.com/.well-known/blogs/skill.md description: Companion API for managing blog posts (also use PML for the body). - path: https://accounts.myclickfunnels.com/.well-known/funnels/skill.md description: Funnel workflow APIs that wire pages into split tests and conditional splits. --- # ClickFunnels Pages Skill The HTTP surface for creating and updating CF2 pages. The body of every page is authored in **PML (Page Markup Language)** - for the DSL itself (elements, attributes, design system), see the [Page Markup Skill](https://accounts.myclickfunnels.com/.well-known/page-markup/skill.md). This document covers the API surrounding that field: authentication, the page CRUD endpoints, and the checkout-products attachment shape. ## When to use this skill - Creating a new funnel or site page from a brief or prompt - Reading back the current markup of an existing page (`GET ... ?expand[]=markup`) - Replacing or extending an existing page's content programmatically - Attaching or removing products from a checkout page - Building multi-page funnels via the API (one page per call, then compose with the [Funnels Skill](https://accounts.myclickfunnels.com/.well-known/funnels/skill.md)) ## Authentication OAuth2 password grant using OAuth application credentials. ``` POST /oauth/token Content-Type: application/x-www-form-urlencoded grant_type=password client_id= client_secret= username= password= scope=read write delete ``` Store the `access_token` from the response. It is long-lived. ## Reading Current Markup Before editing a page, read its current markup to understand the existing structure: ``` GET /api/v2/pages/:page_id?expand[]=markup Authorization: Bearer ``` Response: **200 OK** (the page resource, with the `markup` field included) ```json { "id": 42, "name": "Landing Page", "markup": "
...
" } ``` Markup serialization is per-page work, so it is opt-in via `expand[]=markup` on every endpoint (show, list, create, update). Returns an empty string `""` when the page has no content yet. Always read first when the task is to modify or extend an existing page rather than replace it. **This read is lossy.** The serializer only has an equivalent for the elements documented in the Page Markup Skill. Anything else the ClickFunnels editor supports is dropped from the string with no error and no placeholder, so what you get back can be an incomplete picture of the real page. Never treat a round-tripped read as a safe basis for a rewrite: see [STOP: get approval before overwriting an existing page](https://accounts.myclickfunnels.com/.well-known/page-markup/skill.md#stop-get-approval-before-overwriting-an-existing-page). ## Add a tracking pixel or custom code **Never use `markup` for this.** Adding a Meta/Facebook pixel, a Google tag, or any other script or style is what `head_code`, `footer_code` and `custom_css` are for. They are additive: `append` mode (the default) adds to whatever is already there and touches nothing else on the page. A `markup` write, by contrast, replaces the page's entire tree, so using it to inject a pixel means rewriting every section from scratch and risking the whole page for a one-line change. ``` PATCH /api/v2/pages/:page_id Authorization: Bearer Content-Type: application/json { "page": { "head_code": "", "head_code_mode": "append" } } ``` - `head_code` injects before `` - use this for pixel base code. - `footer_code` injects before `` - use this for anything that must run after the page renders. - `custom_css` is raw CSS with no `