//Custom Variables & Templates
Custom Variables & Template Engine
ButtrBase provides a Custom Variables* API for storing org-scoped key-value configuration, and a *Templates API for managing, rendering, and generating documents with variable substitution.
---
Custom Variables
Org-scoped key-value pairs used across CMS templates, pricing rules, and regional routing.
GET /api/ops/custom-variables
curl https://api.buttrbase.com/api/ops/custom-variables \
-H "Authorization: Bearer "
{
"data": [
{"id":1,"key":"ppp_discount_in","value":"0.40","scope":"global"},
{"id":2,"key":"db_region","value":"eu-west-1","scope":"global"}
]
}
POST /api/ops/custom-variables
curl -X POST https://api.buttrbase.com/api/ops/custom-variables \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{"key":"ppp_discount_in","value":"0.40","scope":"global"}'
{"data":{"id":1,"key":"ppp_discount_in","value":"0.40","scope":"global"}}
---
Templates
Manage email, CV, proposal, and report templates with {{variable}} substitution.
GET /api/templates
List all templates for the authenticated org.
curl https://api.buttrbase.com/api/templates \
-H "Authorization: Bearer "
{
"data": [
{
"id":"42",
"name":"Welcome Email",
"category":"email",
"variables":["first_name","product_name"],
"created_at":"2026-01-15T10:00:00Z"
}
]
}
POST /api/templates
curl -X POST https://api.buttrbase.com/api/templates \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{"name":"Welcome Email","category":"email","variables":["first_name","product_name"]}'
POST /api/templates/render
Render a template with variable values. Returns substituted HTML.
curl -X POST https://api.buttrbase.com/api/templates/render \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{"template_id":"42","variables":{"first_name":"Alice","product_name":"Acme"},"format":"html"}'
{"html":"Hello Alice, welcome to Acme!
","message":"Rendered as html"}
POST /api/templates/cv/generate
Generate a formatted HTML CV from structured personal/experience/education/skills data.
curl -X POST https://api.buttrbase.com/api/templates/cv/generate \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{
"personal":{"full_name":"Jane Smith","title":"Software Engineer","email":"jane@example.com"},
"experience":[{"company":"Acme","role":"Lead Engineer","start":"2022","end":"Present","description":"Built distributed systems"}],
"education":[{"institution":"MIT","degree":"B.Sc Computer Science","year":"2021"}],
"skills":["Rust","TypeScript","PostgreSQL"]
}'
Returns {"html":"...","message":"CV generated successfully."}
DELETE /api/templates/{id}
curl -X DELETE https://api.buttrbase.com/api/templates/42 \
-H "Authorization: Bearer "
{"deleted":true}