---
title: "Create a new template"
method: POST
path: "/templates"
tags: ["templates"]
---

# Create a new template

`POST /templates`

## Request body

- Template — A template
  - `link` Link — URI of resource.
    - `rel` string, required
    - `href` string, url, required
  - `id` string — Template ID
  - `type` string — Template type, one of 'stream' or 'batch'
  - `script` string — TICKscript content
  - `vars` object — Set of variables from the TICKscript with their type and default value.
  - `dot` string — Graphviz DOT syntax representation of the template DAG
  - `error` unknown
  - `created` string, dateTime — Date template was first created
  - `modified` string, dateTime — Date template was last modified

## Response `200`

Template ID

- Template — A template
  - `link` Link — URI of resource.
    - `rel` string, required
    - `href` string, url, required
  - `id` string — Template ID
  - `type` string — Template type, one of 'stream' or 'batch'
  - `script` string — TICKscript content
  - `vars` object — Set of variables from the TICKscript with their type and default value.
  - `dot` string — Graphviz DOT syntax representation of the template DAG
  - `error` unknown
  - `created` string, dateTime — Date template was first created
  - `modified` string, dateTime — Date template was last modified

## Other responses

- `default` — A processing or an unexpected error.

## Changes

- **2016-05-31** (v1) `f5d749289fee` — 1 info
  - endpoint added
- **2016-05-03** (v1) `1d344321a0cc` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/influxdata/apis/kapacitor/changes/templates/post.md)

---

[API](https://skmtc.dev/influxdata/apis/kapacitor.md) · [All operations](https://skmtc.dev/influxdata/apis/kapacitor/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/influxdata/kapacitor/revisions/796853de0228/schema)
