Create Content from Template
curl --request POST \
--url https://api.example.com/app/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>"
}
'import requests
url = "https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/content/from-template"
payload = {
"templateId": "<string>",
"name": "<string>",
"description": "<string>",
"content": {},
"tags": ["<string>"],
"folderId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
templateId: '<string>',
name: '<string>',
description: '<string>',
content: {},
tags: ['<string>'],
folderId: '<string>'
})
};
fetch('https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/content/from-template', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/content/from-template",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'templateId' => '<string>',
'name' => '<string>',
'description' => '<string>',
'content' => [
],
'tags' => [
'<string>'
],
'folderId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/content/from-template"
payload := strings.NewReader("{\n \"templateId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"content\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"folderId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/content/from-template")
.header("Content-Type", "application/json")
.body("{\n \"templateId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"content\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"folderId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/content/from-template")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"templateId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"content\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"folderId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyContent
Create Content from Template
Create new content based on an existing template
POST
/
app
/
v1
/
organizations
/
{organizationId}
/
projects
/
{projectId}
/
content
/
from-template
Create Content from Template
curl --request POST \
--url https://api.example.com/app/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>"
}
'import requests
url = "https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/content/from-template"
payload = {
"templateId": "<string>",
"name": "<string>",
"description": "<string>",
"content": {},
"tags": ["<string>"],
"folderId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
templateId: '<string>',
name: '<string>',
description: '<string>',
content: {},
tags: ['<string>'],
folderId: '<string>'
})
};
fetch('https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/content/from-template', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/content/from-template",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'templateId' => '<string>',
'name' => '<string>',
'description' => '<string>',
'content' => [
],
'tags' => [
'<string>'
],
'folderId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/content/from-template"
payload := strings.NewReader("{\n \"templateId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"content\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"folderId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/content/from-template")
.header("Content-Type", "application/json")
.body("{\n \"templateId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"content\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"folderId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/app/v1/organizations/{organizationId}/projects/{projectId}/content/from-template")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"templateId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"content\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"folderId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyCreates 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
Organization ID
Project ID
Request Body
ID of the template content to use
Display name for the new content
Description for the new content (overrides template description)
Content data that overrides template values. Merged with template content.
Tags for the new content (replaces template tags if provided)
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/app/v1/organizations/org123/projects/proj456/content/from-template" \
-H "Authorization: Bearer YOUR_JWT" \
-H "Content-Type: application/json" \
-d '{
"templateId": "cont123",
"name": "My New Article",
"content": {
"title": "Custom Title",
"author": "John Smith"
}
}'
const response = await fetch(
'https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/content/from-template',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_JWT',
'Content-Type': 'application/json'
},
body: JSON.stringify({
templateId: 'cont123',
name: 'My New Article',
content: {
title: 'Custom Title',
author: 'John Smith'
}
})
}
);
const content = await response.json();
console.log(`Created content from template: ${content.id}`);
⌘I