Codex Carousel Preview
Submit a preview payload via POST /api/preview/generate and open the returned URL to preview and export slides.
Canonical template contract: contracts/templates/fact.json. Human-readable generated doc: contracts/generated/fact.md.
POST /api/preview/generate
{
"templateId": "fact",
"folderName": "my-carousel-01",
"slides": [
{
"type": "cover",
"hookText": "Why **morning protein** helps steady cravings",
"ctaText": "Swipe to find out"
},
{
"type": "content",
"title": "Morning",
"paragraphs": [
"Eating 20 grams of protein at breakfast can reduce rebound hunger later, which makes the next food choice easier."
]
},
{
"type": "content",
"title": "Energy",
"paragraphs": [
"A stable morning meal supports steadier energy and usually beats chasing cravings with coffee or snacks alone."
]
},
{
"type": "cta",
"headline": "Comment **CALM**",
"subtext": "to get a free 7-day breakfast reset checklist."
},
{
"type": "sources",
"headerText": "For informational purposes only, not medical advice.",
"brandName": "cento",
"brandUrl": "centocare.com",
"citations": [
"Leidy HJ, et al. The role of protein in weight loss. Am J Clin Nutr. 2015."
]
}
]
}Preview Route
Generated previews are served from /preview/[folderName]. This route is intentionally separate from the live OpenClaw /c/[folderName] path.
Docs Editor
The minimal whitelisted Markdown editor is available at /editor.
Response
// Success
{ "success": true, "url": "http://127.0.0.1:3101/preview/my-carousel-01", "viewerPath": "/preview/my-carousel-01", "artifactDir": "artifacts/previews/my-carousel-01" }
// Validation error
{ "success": false, "validationErrors": [{ "path": "slides.0.hookText", "message": "Validation messages are derived from the current template contract." }] }