Skip to main content
POST
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
content
/
from-template
Create Content from Template
curl --request POST \
  --url https://api.example.com/v1/organizations/{organizationId}/projects/{projectId}/content/from-template \
  --header 'Content-Type: application/json' \
  --data '
{
  "templateId": "<string>",
  "name": "<string>",
  "description": "<string>",
  "content": {},
  "tags": [
    "<string>"
  ],
  "folderId": "<string>"
}
'
Creates a new content item using an existing template as a starting point. The new content inherits the template’s structure, ContentType, and package version.

Path Parameters

organizationId
string
required
Organization ID
projectId
string
required
Project ID

Request Body

templateId
string
required
ID of the template content to use
name
string
required
Display name for the new content
description
string
Description for the new content (overrides template description)
content
object
Content data that overrides template values. Merged with template content.
tags
string[]
Tags for the new content (replaces template tags if provided)
folderId
string
Folder ID for organization

Example Request

{
  "templateId": "cont123",
  "name": "My New Article",
  "description": "Custom Article. A personalized article based on the template.",
  "content": {
    "title": "Custom Title",
    "subtitle": "My custom subtitle",
    "author": "John Smith",
    "components": [
      {
        "type": "ArticleParagraph",
        "text": "This is my custom opening paragraph..."
      }
    ]
  }
}

Response

Returns the created Content object.
{
  "id": "cont126",
  "typeId": "ct123",
  "typeVersion": 1,
  "version": null,
  "lastPublishedVersion": null,
  "packageVersion": "1.0.0",
  "name": "My New Article",
  "description": "Custom Article. A personalized article based on the template.",
  "status": "draft",
  "isTemplate": false,
  "content": {
    "title": "Custom Title",
    "subtitle": "My custom subtitle",
    "heroImage": "asset123",
    "author": "John Smith",
    "publishDate": "2024-03-21",
    "components": [
      {
        "type": "ArticleParagraph",
        "text": "This is my custom opening paragraph..."
      }
    ]
  },
  "compiled": "const body = () => { ... }",
  "tags": ["Template", "Article"],
  "metadata": {
    "author": "user123",
    "locale": "en-US"
  },
  "createdAt": "2024-03-22T10:00:00Z",
  "updatedAt": "2024-03-22T10:00:00Z"
}
Content created from a template inherits the template’s typeId, typeVersion, and packageVersion. The provided content object is merged with the template’s content, allowing you to override specific fields.

Error Responses

Template Not Found

{
  "error": {
    "code": "TEMPLATE_NOT_FOUND",
    "message": "Template content not found",
    "details": {
      "templateId": "cont123"
    }
  }
}

Not a Template

{
  "error": {
    "code": "NOT_A_TEMPLATE",
    "message": "Content is not marked as a template",
    "details": {
      "contentId": "cont123"
    }
  }
}

Validation Failed

{
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "Merged content does not match schema",
    "details": {
      "errors": [...]
    }
  }
}

Code Examples

curl -X POST "https://api.metabind.ai/v1/organizations/org123/projects/proj456/content/from-template" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "cont123",
    "name": "My New Article",
    "content": {
      "title": "Custom Title",
      "author": "John Smith"
    }
  }'