Contents

API Reference

Maya already published her homepage hero to Production. The React SDK and <rulecms-widget> already call this GET for her. This page is when her app — a PHP host, a cache warmer, a test — fetches that snapshot itself. You send a token and a published key. You get back the same payload those clients render.

What you can do

You already published Maya's homepage hero to Production. The React SDK and <rulecms-widget> already call this GET for her. This page is when her app — a PHP host, a cache warmer, a test — fetches that snapshot itself.

Two everyday jobs:

  • Pull the published hero from something that is not React. Send a Staging or Production token and the published key. Read data.widget.itemList. Render it however that host already renders cards.
  • Prove the token and published key work before you wire a new host. One GET. A 200 with her name and itemList is the smoke test.

She builds with the ten built-in cards — Text, Image, Video, Icon, Button, Divider, Embed, List, Accordion, Custom — or a library she registered. Ask AI can compose. It cannot publish. This GET only returns what she already published.

A ruleset that chooses among published heroes is a different request. That is Resolve from your app, a POST. This page is the hard-coded get.

How it thinks

You send two query parameters: a token and a published key. The token names the team and environment. The published key names the snapshot. The widget must belong to that same team and environment. Mix them and the request fails.

This path returns the last published snapshot, not the live composer draft. Unpublished heads are not found. A Staging or Production token — no dev. prefix — plus a published key {environmentId}---widget-… loads from https://widget-cache.rulecms.com. That response is cached until she republishes.

Here is the case that surprises people. Maya pastes a draft widget-… key next to a Production token, or she sends widgetKey on this URL the way Development does. This GET wants publishedKey. Development is a different host, a different query name, and a dev. token. That runbook is Development Integration. Do not mix the samples.

The Default Widget is Production-only. Promote copies the draft to the next environment; it does not publish. Copy To is only for extra environments she named herself. See Widgets and Publishing.

DevelopmentStaging / Production
Hosthttps://rulecms.comhttps://widget-cache.rulecms.com
PathGET /api/v1/c/dev/widget/getGET /api/v1/c/widget/get
TokenStarts with dev.No prefix
You sendwidgetKey (draft widget-…)publishedKey ({environmentId}---widget-…)
It returnsThe live draftThe published snapshot
CachingDisabled (Cache-Control: no-store)Cached until republish

This page is the published column. Only GET is supported. Prefer a server-side token when you can — a token in HTML source is visible, which HTML Custom Element Embed already said. Dashboard routes under /api/v1/d/* are for signed-in RuleCMS users. They are not this public GET.

Fetch Maya's published hero

You do this on the published widget page in Staging or Production. The tab is labeled Integration, not Integrate. If the hero still lives only in Development, promote the draft and publish first — then come back here.

  1. Open the organization → team → project → environment where she published the hero. Staging is the QA stop. Production is the live site.
  2. Open Maya's homepage hero — the published widget, not the composer.
  3. Open the Integration tab.
  4. Copy the PublishedKey. It looks like {environmentId}---widget-….
  5. Copy (or create) an enabled client token for that same environment. It must not start with dev.. Tokens live on that tab and on Projects, Environments & Tokens.
  6. GET the snapshot. Query names are token and publishedKey. Look at data.widget.itemList. That is a safe stop.
curl "https://widget-cache.rulecms.com/api/v1/c/widget/get?token=YOUR_STAGING_OR_PRODUCTION_TOKEN&publishedKey=ENVIRONMENT_ID---widget-…"

The same request as fetch:

const res = await fetch(
  "https://widget-cache.rulecms.com/api/v1/c/widget/get?" +
    new URLSearchParams({
      token: process.env.RULECMS_TOKEN,
      publishedKey: process.env.HERO_PUBLISHED_KEY,
    })
);
const body = await res.json();
const itemList = body.data.widget.itemList;

A 200 looks like this. The rows in itemList are the cards she dropped.

{
  "success": true,
  "data": {
    "widget": {
      "publishedKey": "{environmentId}---widget-…",
      "name": "Homepage hero",
      "version": "1.0.0",
      "environmentName": "Production",
      "itemList": { "rows": [ … ] },
      "lastPublishedAt": "…"
    },
    "childCollections": { }
  }
}

childCollections, the CSS catalogs, published-key formats, and what a non-200 usually means live on Response and published keys.

For a Development draft, do not use this Integration tab or this host. Open the widget in Development and use the Integrate tab — a dev. token and the draft widget-… key as widgetKey on https://rulecms.com/api/v1/c/dev/widget/get. See Development Integration.

What to read next

This page is the story and the first GET. The rest of the 200, drafts, and the other hosts live on the pages below.

How this fits

This GET does not replace the React SDK or the HTML embed. Those clients already call it. This page is when Maya fetches the snapshot herself. Widgets is how she creates the hero. Publishing is how the site gets a snapshot. Tokens live on Projects, Environments & Tokens.

The Default Widget is in Production. She published this hero. Promote copies the draft; it does not publish. When she wants the live draft instead, Development Integration is the Integrate tab. A browser preview on RuleCMS itself is /render?publishedKey=…&appToken=…. Use it to glance at the snapshot. Build on this GET, the SDK, or the HTML embed.