Skip to main content

Templates API

Manage page templates — create, update sections, publish, rollback.

Base path: /api/v1/admin/sdui/templates


List Templates

GET /api/v1/admin/sdui/templates?app=default&page=1&size=20

Response:

{
"data": [
{ "id": "t1", "app": "default", "name": "Home Page", "route": "/home", "status": "PUBLISHED", "version": 2 },
{ "id": "t2", "app": "default", "name": "Listing Detail", "route": "/listing-detail", "status": "DRAFT", "version": 0 }
],
"total": 2,
"page": 1,
"size": 20
}

Get Template by ID

GET /api/v1/admin/sdui/templates/{id}

Returns full template with parsed sections, blocks, visibility rules, and version info.


Create Template

POST /api/v1/admin/sdui/templates
{
"app": "default",
"name": "Home Page",
"route": "/home",
"description": "Main landing page",
"platform": "ALL"
}

Response 200 OK:

{
"id": "t1a2b3c4",
"app": "default",
"name": "Home Page",
"route": "/home",
"platform": "ALL",
"status": "DRAFT",
"sections": [],
"version": 0
}

Update with Sections

PUT /api/v1/admin/sdui/templates/{id}
{
"sections": [
{
"id": "hero-1",
"type": "HeroSection",
"disabled": false,
"settings": {
"title": "Welcome to ELIVAAS",
"bgColor": "#1a1a2e"
},
"blocks": [
{
"id": "btn-1",
"type": "Button",
"disabled": false,
"settings": { "label": "Explore Villas", "variant": "primary" }
}
]
},
{
"id": "visa-banner",
"type": "BannerSection",
"disabled": false,
"settings": { "text": "Exclusive 15% off with Visa Cards" },
"blocks": [],
"visibilityRules": [
{ "field": "partner_id", "operator": "EQUALS", "value": "VISA" }
]
}
]
}

Publish

POST /api/v1/admin/sdui/templates/{id}/publish

Immediate publish:

{ "publishedBy": "[email protected]" }

Scheduled with expiry:

{
"publishedBy": "[email protected]",
"publishAt": "2026-05-01T00:00:00Z",
"expireAt": "2026-06-01T00:00:00Z"
}

Response 200 OK:

{
"id": "t1a2b3c4",
"status": "PUBLISHED",
"version": 1
}

Version History

GET /api/v1/admin/sdui/templates/{id}/versions

Response 200 OK:

[
{ "id": "v2", "versionNumber": 2, "publishedBy": "[email protected]", "publishedAt": "2026-04-02T10:00:00Z" },
{ "id": "v1", "versionNumber": 1, "publishedBy": "[email protected]", "publishedAt": "2026-04-01T10:00:00Z" }
]

Rollback

Restores sections from a previous version. Sets status to DRAFT.

POST /api/v1/admin/sdui/templates/{id}/rollback/{versionNumber}

Validate

Checks all section types have active definitions.

GET /api/v1/admin/sdui/templates/{id}/validate

Response 200 OK:

[]

Or with errors:

["Unknown section type: NonExistentSection"]

Delete Template (Soft)

Soft-deletes the template. It will no longer appear in list or resolve queries.

DELETE /api/v1/admin/sdui/templates/{id}

Resolve Published Template

Finds the best-matching published template for a given app + route + platform.

GET /api/v1/admin/sdui/templates/resolve?app=default&route=/home&platform=WEB

Resolution rules:

  1. Status must be PUBLISHED or SCHEDULED (with publish_at in the past)
  2. expire_at must be null or in the future
  3. Platform-specific template preferred over ALL
  4. Highest version wins if multiple match

Returns 404 if no matching template found.


Render (Admin Preview)

Resolves and renders a template with merged settings. Disabled sections/blocks excluded. No traffic context filtering.

GET /api/v1/admin/sdui/templates/render?app=default&route=/home&platform=ALL

See Render API for full response format.


Endpoint Summary

MethodPathDescription
GET/List templates (paginated)
GET/{id}Get by ID
POST/Create (DRAFT)
PUT/{id}Update (sections, name, platform)
DELETE/{id}Soft delete
POST/{id}/publishPublish (immediate or scheduled)
GET/{id}/versionsVersion history
POST/{id}/rollback/{v}Rollback to version
GET/{id}/validateValidate section types
GET/resolveResolve published template
GET/renderRender (admin preview)