---
title: "Create a template"
method: POST
path: "/v1/projectId/{projectId}/templates"
tags: ["Templates"]
---

# Create a template

`POST /v1/projectId/{projectId}/templates`

## Request

- Base URL: `https://api.bluefox.email`
- URL: `https://api.bluefox.email/v1/projectId/{projectId}/templates`
- Auth: HTTP bearer

## Path parameters

- `projectId` string, required

## Request body

- TemplateInput
  - `name` string, required
  - `subject` string, required
  - `previewText` string: On PATCH, pass an empty string to clear it.
  - `document` unknown, required
  - `tags` string[]
  - `onProjectCreation` 'do-nothing' | 'set-as-transactional' | 'set-as-triggered' | 'set-as-campaign'

## Response `201`

Created

- object
  - `status` integer
  - `result` Template
    - `_id` string
    - `name` string
    - `subject` string
    - `previewText` string
    - `tags` string[]
    - `onProjectCreation` 'do-nothing' | 'set-as-transactional' | 'set-as-triggered' | 'set-as-campaign'
    - `usedVariables` string[]
    - `usedComponents` string[]
    - `createdAt` string, date-time
    - `updatedAt` string, date-time

## Other responses

- `400`: Invalid request body or query - every violation found (missing/invalid/unexpected fields) is reported in one response, semicolon-separated, not just the first one hit.
- `403`: Missing or invalid API key

---

[API](https://skmtc.dev/bluefox/apis/bluefox-email-public-api.md) · [All operations](https://skmtc.dev/bluefox/apis/bluefox-email-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/bluefox/apis/bluefox-email-public-api/revisions/fa1a0a835c7f?raw)
