Add a template entry

Registers an `emails/*.tsx` file in an existing template project as its own template and returns it with status 201.

POST
/v1/templates/projects/{projectId}/entries

Registers an emails/*.tsx file in an existing template project as its own template and returns it with status 201. The file does not need to exist yet; publishing fails until a commit contains it. Repeating the call with the same entry path, name, and slug returns the existing template.

x-api-key<token>

In: header

Path Parameters

projectId*string
Match^tproj_[0-9a-hjkmnp-tv-z]{16,24}$

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

entryPath*string
Match^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.{1,2}(?:\/|$))(?!.*(?:^|\/)\.git(?:\/|$))emails\/.+\.tsx$
Lengthlength <= 1024
name*string
Length1 <= length <= 200
slug*string
Match^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$
description?string|null|null
category?|null|null

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/templates/projects/string/entries" \  -H "Content-Type: application/json" \  -d '{    "entryPath": "string",    "name": "string",    "slug": "string"  }'
{  "id": "string",  "organizationId": "string",  "projectId": "string",  "entryPath": "string",  "name": "string",  "slug": "string",  "familyId": "string",  "channel": "email",  "description": "string",  "category": "string",  "fromDefault": {    "email": "string",    "name": "string"  },  "replyToDefault": [    "string"  ],  "trackingDefault": {    "opens": true,    "clicks": true  },  "email": {    "subject": "string",    "preheader": "string",    "headers": {      "property1": "string",      "property2": "string"    }  },  "publicationId": "string",  "inputContractId": "string",  "inputSchema": {},  "usageCount": 0,  "lastUsedAt": "string",  "status": "string",  "isActive": true,  "isDefault": true,  "publishedAt": "string",  "publishedBy": "string",  "createdAt": "string",  "updatedAt": "string"}

Related documentation