NetStacksNetStacks

Templates API

Enterprise

Create, 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

MethodPathPurposePermission
GET/api/config/templatesList templates. Query: platform, limit, offsetdevices.access
POST/api/config/templatesCreate a templatedevices.access
GET/api/config/templates/:idGet a template, including its sourcedevices.access
PUT/api/config/templates/:idUpdate a template (only the fields you send)devices.access
DELETE/api/config/templates/:idDelete a template (204)devices.access
POST/api/config/templates/:id/renderRender with sample variables (nothing is sent to devices)devices.access
GET/api/config/templates/:id/versionsList saved versionsdevices.access
GET/api/config/templates/:id/versions/:versionGet one version's sourcedevices.access
GET/api/config/platformsList automation platformsdevices.access
GET/api/config/platforms/:idGet one platformdevices.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
template.jsonjson
{
  "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 }}"
}
FieldTypeNotes
namestringRequired.
platformstringRequired. A platform name from /api/config/platforms.
config_formatstringRequired. json, xml, or cli.
sourcestringRequired. The template text.
operationstringreplace (default), merge, or delete.
target_pathstringOptional. The YANG / OpenConfig path to write to, or a label for CLI templates.
descriptionstringOptional.

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 use the current version

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: …"}.