Templates API
EnterpriseCreate, version, and render NetStacks Controller config templates through the API, and list the automation platforms they target.
Overview
Config templates are MiniJinja (Jinja-style) text that renders into device configuration. They are the building blocks of stacks. The same templates appear under Config Automation → Templates in the Admin Console. For template syntax, see Template syntax.
All endpoints are under /api/config and need devices.access. These endpoints are not in the Swagger UI.
Endpoints
| Method | Path | Purpose | Permission |
|---|---|---|---|
GET | /api/config/templates | List templates. Query: platform, limit, offset | devices.access |
POST | /api/config/templates | Create a template | devices.access |
GET | /api/config/templates/:id | Get a template, including its source | devices.access |
PUT | /api/config/templates/:id | Update a template (only the fields you send) | devices.access |
DELETE | /api/config/templates/:id | Delete a template (204) | devices.access |
POST | /api/config/templates/:id/render | Render with sample variables (nothing is sent to devices) | devices.access |
GET | /api/config/templates/:id/versions | List saved versions | devices.access |
GET | /api/config/templates/:id/versions/:version | Get one version's source | devices.access |
GET | /api/config/platforms | List automation platforms | devices.access |
GET | /api/config/platforms/:id | Get one platform | devices.access |
Platforms
Each template targets a platform, which sets the transport, port, and format used to push it. GET /api/config/platforms returns an array:
[
{
"id": "e2b4...",
"name": "eos-gnmi",
"display_name": "Arista EOS (gNMI)",
"transport": "gnmi",
"default_port": 6030,
"config_format": "json",
"capabilities": { "openconfig": true },
"created_at": "2026-06-01T00:00:00Z"
}
]Use the platform name (for example eos-gnmi, junos-netconf, or iosxr-netconf) in the template's platform field. Deployments push config over gNMI or NETCONF.
Create a template
curl -s --cacert netstacks-ca.pem -X POST https://controller.example.com:3000/api/config/templates \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d @template.json{
"name": "snmp-baseline",
"description": "SNMP community and location",
"platform": "eos-gnmi",
"config_format": "cli",
"target_path": "snmp-server",
"operation": "merge",
"source": "snmp-server community {{ community }} ro\nsnmp-server location {{ location }}"
}| Field | Type | Notes |
|---|---|---|
name | string | Required. |
platform | string | Required. A platform name from /api/config/platforms. |
config_format | string | Required. json, xml, or cli. |
source | string | Required. The template text. |
operation | string | replace (default), merge, or delete. |
target_path | string | Optional. The YANG / OpenConfig path to write to, or a label for CLI templates. |
description | string | Optional. |
The response is 201 with the template. The Controller reads the template source and fills in variables for you, for example [{"name":"community","type":"string","required":true}, …]. A variable used in a {% for %} loop is typed list.
Update and versions
PUT /api/config/templates/:id takes the same fields, all optional. Send null for target_path or operation to clear them.
Each time source changes, the Controller saves a new version and increments current_version. Changing only the name or description doesn't create a version. List versions with GET /api/config/templates/:id/versions. Each item has version, source, variables, created_by, and created_at.
Stacks reference templates by ID. A deployment always renders the template's current source.
Render a preview
POST /api/config/templates/:id/render renders the template with the variables you pass. Nothing is sent to any device. Add version to render an older version.
curl -s --cacert netstacks-ca.pem -X POST \
https://controller.example.com:3000/api/config/templates/7c90.../render \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"variables": {"community": "n0c-ro", "location": "DC1 Row 4"}}'{
"rendered": "snmp-server community n0c-ro ro\nsnmp-server location DC1 Row 4",
"format": "cli"
}A template error returns 400 with {"error":"Render error: …"}.