Skip to content

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/v1

Endpoints

List Templates

GET /api/v1/templates

Returns all templates for your organization. Tokens with TEMPLATE_MANAGE_TENANT see both enabled and disabled templates; other tokens see only enabled templates.

Terminal window
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/:id

Returns a single template by UUID.

Terminal window
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/templates

Creates a new content template. Requires TEMPLATE_MANAGE_TENANT privilege.

Request Body

FieldTypeRequiredDescription
namestringYesTemplate name (must be unique within the tenant)
templateobjectNoTemplate schema object (see Template Schema Structure)
Terminal window
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"

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/:id

Updates a template’s name, schema, or enabled status.

Terminal window
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"

Response

{
"success": true,
"template": {
"id": "tmpl-550e8400-uuid",
"name": "Company Announcement",
...
}
}

Delete Template

DELETE /api/v1/templates/:id

Deletes 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
Terminal window
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

TypeDescriptionStored In
textSingle-line text inputJSON (sections)
multilineMulti-line textareaJSON
rich_textRich text editor (HTML rendered in feed)JSON
numberNumeric inputJSON
urlURL input with validationJSON
emailEmail input with validationJSON
selectDropdown selectJSON
dateDate pickerJSON
datetimeDate and time pickerJSON
toggleBoolean toggleJSON
imageImage uploadJSON
fileFile uploadJSON
referenceReference to another content itemJSON
descriptionBuilt-in description fieldColumn
feature_imageBuilt-in cover image fieldColumn
event_start_dateBuilt-in event startColumn
event_end_dateBuilt-in event endColumn
location_nameBuilt-in location nameColumn
location_linkBuilt-in location URLColumn
location_geoBuilt-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:

  1. 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"
  2. 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"
  3. 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"
  4. Verify via the public Feed API (no auth needed)

    Terminal window
    curl "https://your-org.flarebuilder.com/feed?templates=Press%20Release"

Error Responses

StatusDescription
200Success
201Created
400Validation error or cannot delete (has content, last enabled, or is default)
401Missing or invalid API token
403Insufficient privileges or plan limit reached
404Template not found
409Template name already exists
500Server 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."
}