GET/v1/templates/{id}/fields
The fields a template asks for: its placeholders and each layer's main property
A form for the template, for no-code tools and your own UI. variable fields are the template's {{placeholders}} (send them in variables); modification fields are each layer's main property that no placeholder fills: a text layer's text, an image's src, a QR code's data, a chart's values, a bar or rating's value, a rectangle's fill (send them in modifications). type says what a value is (text, image_url, color, number, numbers) and default is what the template has now.
PARAMETERS
- idpath · stringREQUIRED
- The template ide.g. tpl_4nq8vzk2hdyw7bxme3rc
REQUEST
curl "https://api.imageapis.com/v1/templates/tpl_4nq8vzk2hdyw7bxme3rc/fields" \ -H "X-API-Key: YOUR_KEY"
import requests
r = requests.get("https://api.imageapis.com/v1/templates/tpl_4nq8vzk2hdyw7bxme3rc/fields", headers={"X-API-Key": "YOUR_KEY"})
print(r.status_code, r.headers.get("X-Gw-Remaining"))
print(r.json())
const r = await fetch("https://api.imageapis.com/v1/templates/tpl_4nq8vzk2hdyw7bxme3rc/fields", {
headers: { "X-API-Key": "YOUR_KEY" }
});
console.log(r.status, r.headers.get("X-Gw-Remaining"));
console.log(await r.json());
RESPONSE
200OK
{
"template": {
"id": "tpl_4nq8vzk2hdyw7bxme3rc",
"name": "Blog post card",
"engine": "layers",
"width": 1200,
"height": 630,
"animated": false
},
"fields": [
{
"key": "title",
"kind": "variable",
"label": "Title",
"type": "text"
},
{
"key": "site.text",
"kind": "modification",
"label": "Site (text)",
"type": "text",
"layer": "site",
"property": "text",
"default": "apidirectory.com"
},
{
"key": "accent.fill",
"kind": "modification",
"label": "Accent (colour)",
"type": "color",
"layer": "accent",
"property": "fill",
"default": "#6366f1",
"help": "A CSS colour: #ff5733, rgb(…) or a name."
}
],
"example": {
"template": "tpl_4nq8vzk2hdyw7bxme3rc",
"variables": {
"title": "Title"
}
}
}
401Missing or invalid API key (from the gateway)
404No such template or record on this account
{
"error": "string",
"message": "string",
"param": "string"
}