# Create a Template

Endpoint: `POST https://api.mailjet.com/v1/REST/templates`
This endpoint allows you to create a new email template in the Mailjet system. Creating a template is the first step in the process and involves setting up the basic structure, such as the template name, description and purpose.

This step is necessary before you can proceed to add content to your template.

Once your template has been successfully created, refer to the Create Template Content section for detailed instructions on how to add and customize the content of your template.

### Body Parameters

| Name | Type | Description |
|  --- | --- | --- |
| Name | string | Required. A unique identifier for the template. |
| EditMode | integer | Specifies the mode in which the template can be edited. Default value: 2. Learn more about edit modes. |
| LabelIDs | array of integers | Labels associated with the template. See how to retrieve a list of labels here. |
| Purposes | array of strings | Required if you would like the template to appear in the UI. Accepted values: marketing, transactional, automation, and opt-in. Learn more about template purposes. |
| Description | string or null | A brief description of the template. |
| IsStarred | boolean | Indicates whether the template is marked as a favorite. True = favorite. |
| IsTextPartGenerationEnabled | boolean | Determines if text part generation functionality is enabled for this template. True = enabled. |


#### Example Requests

```
curl --request POST \
  --url https://api.mailjet.com/v1/rest/templates/ \
  --header 'Authorization: Bearer 612d5125131d406081abb9cd2afdc4e3' \
  --header 'Content-Type: application/json' \
  --data '{
	"Name": "Welcome to Mailjet!",
	"EditMode": 2,
	"Purposes": ["marketing", "transactional"],
	"IsStarred": true
}'
```

Status code: `201``

### Response Data Field Structure:

| Name | Type | Description |
|  --- | --- | --- |
| ID | integer | The ID of the template. |
| Name | string | The name of the template. |
| EditMode | integer | Specifies the mode in which the template can be edited. |
| LabelIDs | array of integers | An array of IDs representing labels associated with the template. |
| Purposes | array of strings | The type of template. Learn more about template purposes |
| ExternalID | string or null | The ID that must be used to send the template. |
| Description | string or null | A brief description of the template. |
| IsPublished | boolean | Indicates whether the template is published. |
| IsStarred | boolean | Indicates whether the template is marked as a favorite. |
| IsTextPartGenerationEnabled | boolean | Determines if text part generation functionality is enabled for this template. |
| CreatedAt | Date RFC3339 | The date and time when the template was created. |
| UpdatedAt | Date RFC3339 | The date and time when the template was last updated. |


#### API Response Example

```
{
    "Count": 1,
    "Total": 1,
    "Data": [
        {
            "ID": 27,
            "OrganisationID": 2,
            "Name": "Welcome to Mailjet!",
            "EditMode": 2,
            "LabelIDs": [],
            "LastContentType": null,
            "PartialIDs": [],
            "Purposes": [
                "marketing",
                "transactional"
            ],
            "Categories": [
                "e-commerce"
            ],
            "Presets": null,
            "ExternalID": "123",
            "Description": null,
            "IsPublished": false,
            "IsStarred": true,
            "SoftDeleted": false,
            "IsTextPartGenerationEnabled": false,
            "CreatedAt": "2024-05-23T09:05:22.21546Z",
            "UpdatedAt": "2024-05-23T09:05:22.21546Z"
        }
    ]
}
```