List templates
curl --request GET \
--url https://api.pictify.io/templates \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.pictify.io/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pictify.io/templates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pictify.io/templates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.pictify.io/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"templates": [
{
"uid": "<string>",
"name": "<string>",
"engine": "fabric",
"html": "<string>",
"fabricJSData": {},
"jsEnabled": false,
"strictVariables": false,
"type": "<string>",
"category": "<string>",
"tags": [
"<string>"
],
"width": 123,
"height": 123,
"thumbnail": "<string>",
"outputFormat": "image",
"pdfPreset": "A4",
"variableDefinitions": [
{
"name": "<string>",
"type": "text",
"defaultValue": "<unknown>",
"description": "<string>",
"allowRawHtml": false,
"validation": {
"required": true,
"minLength": 123,
"maxLength": 123
}
}
],
"pages": [
{
"pageNumber": 123,
"name": "<string>",
"fabricJSData": {}
}
],
"layouts": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"pagination": {
"page": 123,
"limit": 123,
"total": 123,
"totalPages": 123,
"hasNext": true,
"hasPrev": true
}
}Templates
Templates
Create, manage, and render reusable templates
GET
/
templates
List templates
curl --request GET \
--url https://api.pictify.io/templates \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.pictify.io/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pictify.io/templates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pictify.io/templates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.pictify.io/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"templates": [
{
"uid": "<string>",
"name": "<string>",
"engine": "fabric",
"html": "<string>",
"fabricJSData": {},
"jsEnabled": false,
"strictVariables": false,
"type": "<string>",
"category": "<string>",
"tags": [
"<string>"
],
"width": 123,
"height": 123,
"thumbnail": "<string>",
"outputFormat": "image",
"pdfPreset": "A4",
"variableDefinitions": [
{
"name": "<string>",
"type": "text",
"defaultValue": "<unknown>",
"description": "<string>",
"allowRawHtml": false,
"validation": {
"required": true,
"minLength": 123,
"maxLength": 123
}
}
],
"pages": [
{
"pageNumber": 123,
"name": "<string>",
"fabricJSData": {}
}
],
"layouts": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"pagination": {
"page": 123,
"limit": 123,
"total": 123,
"totalPages": 123,
"hasNext": true,
"hasPrev": true
}
}Templates
Templates are reusable designs with dynamic variables. Create once, render with different data.For expression syntax and conditional rendering, see Expressions.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET | /templates | List templates |
POST | /templates | Create template |
GET | /templates/{uid} | Get template |
PUT | /templates/{uid} | Update template |
DELETE | /templates/{uid} | Delete template |
POST | /templates/{uid}/render | Render template to an image |
GET | /templates/{uid}/variables | Get variables defined in a template |
Variable Types
Templates support different variable types in{{variable}} placeholders:
| Type | Example | Description |
|---|---|---|
string | "Hello World" | Text content |
number | 42, 3.14 | Numeric values |
boolean | true, false | Conditional rendering |
array | ["a", "b"] | Lists for iteration |
object | {name: "..."} | Nested data |
Using Variables in Templates
Simple Interpolation
<h1>{{title}}</h1>
<p>By {{author}}</p>
Conditional Rendering
<div _if="showBadge" class="badge">Premium</div>
Expressions
<p>Total: {{currency(price * quantity, 'USD')}}</p>
Layout Variants
Templates support multiple layout variants for different platforms. Each layout stores a separate canvas design optimized for a specific size (e.g., Twitter 1200x675, Instagram 1080x1080).- Layouts are created via the AI Resize feature in the editor
- Variables are shared across all layouts
- Render a specific layout with the
layoutparameter, or multiple withlayouts - The
defaultlayout key refers to the base template
# Render specific layout
curl -X POST /templates/{uid}/render \
-d '{"variables": {"title": "Hello"}, "layout": "twitter-post"}'
# Render multiple layouts
curl -X POST /templates/{uid}/render \
-d '{"variables": {"title": "Hello"}, "layouts": ["default", "twitter-post", "facebook-post"]}'
Template Content
A template requires eitherhtml or fabricJSData (FabricJS canvas JSON), but not both.
Either
html or fabricJSData is required when creating a template. You cannot provide both.Authorizations
API key obtained from the Pictify dashboard
Query Parameters
Required range:
x <= 100Available options:
newest, oldest, name Available options:
all, image, pdf