Templates API
The Templates API lets you create, read, update, and delete content templates programmatically. Templates define the structure of your content items — the sections, fields, validation rules, and field types.
All requests require a Bearer token with the TEMPLATE_MANAGE_TENANT privilege.
Base URL
https://your-org.flarebuilder.com/api/v1Endpoints
List Templates
GET /api/v1/templatesReturns all templates for your organization. Tokens with TEMPLATE_MANAGE_TENANT see both enabled and disabled templates; other tokens see only enabled templates.
curl -H "Authorization: Bearer fb_sk_a1b2c3d4..." \ "https://your-org.flarebuilder.com/api/v1/templates"Response
{ "success": true, "templates": [ { "id": "tmpl-550e8400-uuid", "name": "Blog Post", "template": "{\"schema_version\":\"6.0\",\"name\":\"Blog Post\", ...}", "enabled": true, "content_count": 24, "tenant_id": "tenant-uuid", "date_created": "2026-01-15T10:00:00.000Z", "date_modified": "2026-02-20T14:30:00.000Z" }, { "id": "tmpl-660f9511-uuid", "name": "Event", "template": "{\"schema_version\":\"6.0\",\"name\":\"Event\", ...}", "enabled": true, "content_count": 8, "tenant_id": "tenant-uuid", "date_created": "2026-01-15T10:00:00.000Z", "date_modified": "2026-02-18T09:15:00.000Z" } ]}Get Template
GET /api/v1/templates/:idReturns a single template by UUID.
curl -H "Authorization: Bearer fb_sk_a1b2c3d4..." \ "https://your-org.flarebuilder.com/api/v1/templates/tmpl-550e8400-uuid"Response
{ "template": { "id": "tmpl-550e8400-uuid", "name": "Blog Post", "template": "{\"schema_version\":\"6.0\", ...}", "enabled": true, "content_count": 24, "tenant_id": "tenant-uuid", "date_created": "2026-01-15T10:00:00.000Z", "date_modified": "2026-02-20T14:30:00.000Z" }}Create Template
POST /api/v1/templatesCreates a new content template. Requires TEMPLATE_MANAGE_TENANT privilege.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Template name (must be unique within the tenant) |
template | object | No | Template schema object (see Template Schema Structure) |
curl -X POST \ -H "Authorization: Bearer fb_sk_a1b2c3d4..." \ -H "Content-Type: application/json" \ -d '{ "name": "Announcement", "template": { "schema_version": "6.0", "name": "Announcement", "title": { "label": "Title", "placeholder": "Enter announcement title...", "validation": { "required": { "value": true, "message": "Title is required" }, "maxLength": { "value": 256, "message": "Max 256 characters" } } }, "sections": [ { "id": "content", "label": "Content", "fields": [ { "id": "description", "label": "Summary", "type": "multiline", "enabled": true, "validation": { "maxLength": { "value": 500, "message": "Max 500 characters" } } }, { "id": "main_content", "label": "Body", "type": "rich_text", "enabled": true } ] } ] } }' \ "https://your-org.flarebuilder.com/api/v1/templates"curl -X POST \ -H "Authorization: Bearer fb_sk_a1b2c3d4..." \ -H "Content-Type: application/json" \ -d '{ "name": "Event", "template": { "schema_version": "6.0", "name": "Event", "title": { "label": "Event Name", "placeholder": "Name of the event...", "validation": { "required": { "value": true, "message": "Event name is required" } } }, "sections": [ { "id": "details", "label": "Event Details", "fields": [ { "id": "description", "label": "Description", "type": "multiline", "enabled": true }, { "id": "image", "label": "Event Image", "type": "image", "enabled": true }, { "id": "registration_url", "label": "Registration Link", "type": "url", "enabled": true, "validation": { "pattern": { "value": "^https?://", "message": "Must be a valid URL" } } } ] } ] } }' \ "https://your-org.flarebuilder.com/api/v1/templates"Response (201)
{ "success": true, "template": { "id": "tmpl-newly-created-uuid", "name": "Announcement", "date_created": "2026-02-24T12:00:00.000Z", "date_modified": "2026-02-24T12:00:00.000Z", "content_count": 0 }}Update Template
PUT /api/v1/templates/:idUpdates a template’s name, schema, or enabled status.
curl -X PUT \ -H "Authorization: Bearer fb_sk_a1b2c3d4..." \ -H "Content-Type: application/json" \ -d '{ "name": "Company Announcement" }' \ "https://your-org.flarebuilder.com/api/v1/templates/tmpl-550e8400-uuid"curl -X PUT \ -H "Authorization: Bearer fb_sk_a1b2c3d4..." \ -H "Content-Type: application/json" \ -d '{ "template": { "schema_version": "6.0", "name": "Announcement", "title": { "label": "Title", "validation": {} }, "sections": [ { "id": "content", "label": "Content", "fields": [ { "id": "description", "label": "Summary", "type": "multiline", "enabled": true }, { "id": "main_content", "label": "Body", "type": "rich_text", "enabled": true }, { "id": "priority", "label": "Priority", "type": "select", "enabled": true, "options": ["low", "medium", "high"] } ] } ] } }' \ "https://your-org.flarebuilder.com/api/v1/templates/tmpl-550e8400-uuid"# Disable a templatecurl -X PUT \ -H "Authorization: Bearer fb_sk_a1b2c3d4..." \ -H "Content-Type: application/json" \ -d '{ "enabled": false }' \ "https://your-org.flarebuilder.com/api/v1/templates/tmpl-550e8400-uuid"Response
{ "success": true, "template": { "id": "tmpl-550e8400-uuid", "name": "Company Announcement", ... }}Delete Template
DELETE /api/v1/templates/:idDeletes a template. A template cannot be deleted if:
- It has content items assigned to it
- It is the tenant’s default template
- It is the last enabled template
curl -X DELETE \ -H "Authorization: Bearer fb_sk_a1b2c3d4..." \ "https://your-org.flarebuilder.com/api/v1/templates/tmpl-550e8400-uuid"Response
{ "success": true, "message": "Template deleted successfully"}Template Schema Structure
The template field contains a JSON schema that defines the content structure. A formal JSON Schema (Draft-07) is available for programmatic validation — use it to validate templates in your build pipeline or import it into code generators.
Here is a summary of the key elements:
{ "schema_version": "6.0", "name": "Template Display Name", "title": { "label": "Title", "description": "Optional helper text", "placeholder": "Enter title...", "validation": { "required": { "value": true, "message": "Title is required" }, "maxLength": { "value": 256, "message": "Max 256 characters" } } }, "sections": [ { "id": "section_id", "label": "Section Label", "description": "Optional section description", "fields": [ { "id": "field_id", "label": "Field Label", "type": "text", "enabled": true, "description": "Optional help text", "validation": { ... } } ] } ]}Field Types
| Type | Description | Stored In |
|---|---|---|
text | Single-line text input | JSON (sections) |
multiline | Multi-line textarea | JSON |
rich_text | Rich text editor (HTML rendered in feed) | JSON |
number | Numeric input | JSON |
url | URL input with validation | JSON |
email | Email input with validation | JSON |
select | Dropdown select | JSON |
date | Date picker | JSON |
datetime | Date and time picker | JSON |
toggle | Boolean toggle | JSON |
image | Image upload | JSON |
file | File upload | JSON |
reference | Reference to another content item | JSON |
description | Built-in description field | Column |
feature_image | Built-in cover image field | Column |
event_start_date | Built-in event start | Column |
event_end_date | Built-in event end | Column |
location_name | Built-in location name | Column |
location_link | Built-in location URL | Column |
location_geo | Built-in coordinates (lat/lon/alt) | Column |
Fields with “Column” storage map to dedicated database columns and are set as top-level fields on the content item. Fields with “JSON” storage are nested inside the metadata/sections object.
Workflow: Create a Template, Then Content
A typical integration flow:
-
List existing templates to check what’s available
Terminal window curl -H "Authorization: Bearer fb_sk_a1b2c3d4..." \"https://your-org.flarebuilder.com/api/v1/templates" -
Create a template (or use an existing one)
Terminal window curl -X POST \-H "Authorization: Bearer fb_sk_a1b2c3d4..." \-H "Content-Type: application/json" \-d '{"name":"Press Release","template":{"schema_version":"6.0","name":"Press Release","title":{"label":"Headline"},"sections":[{"id":"body","label":"Content","fields":[{"id":"main_content","label":"Body","type":"rich_text","enabled":true}]}]}}' \"https://your-org.flarebuilder.com/api/v1/templates" -
Create content using the template ID from step 2
Terminal window curl -X POST \-H "Authorization: Bearer fb_sk_a1b2c3d4..." \-H "Content-Type: application/json" \-d '{"title": "Q1 Earnings Report","template_id": "tmpl-id-from-step-2","date_published": "2026-03-15T09:00:00Z","metadata": {"body": {"main_content": "<p>We are pleased to report...</p>"}}}' \"https://your-org.flarebuilder.com/api/v1/content" -
Verify via the public Feed API (no auth needed)
Terminal window curl "https://your-org.flarebuilder.com/feed?templates=Press%20Release"
Error Responses
| Status | Description |
|---|---|
200 | Success |
201 | Created |
400 | Validation error or cannot delete (has content, last enabled, or is default) |
401 | Missing or invalid API token |
403 | Insufficient privileges or plan limit reached |
404 | Template not found |
409 | Template name already exists |
500 | Server error |
{ "error": "Cannot delete template. This template is currently applied to 12 content."}Plan limit errors:
{ "error": "Your Spark plan allows a maximum of 5 templates."}