# Create template

> Creates a template.

Source: https://mailvina.com/docs/api-reference/templates/create-template · Base URL: https://api.mailvina.com · Guide: https://mailvina.com/docs/templates

`POST /templates`

**Body parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | yes | Unique within your team. |
| `alias` | `string` | no | Stable identifier you can send with, unique within your team. Made from the name when you leave it out: `Welcome email` becomes `welcome-email`. Renaming a template keeps its alias. |
| `subject` | `string` | no | Supports variables. |
| `html` | `string` | no | Supports variables. |
| `text` | `string` | no | Plain-text version. |
| `from` | `string` | no | Default sender. |
| `reply_to` | `string` | no | Default Reply-To. |

**Request**

```bash
curl -X POST 'https://api.mailvina.com/templates' \
  -H 'Authorization: Bearer mv_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Welcome email",
  "subject": "Welcome, {{name|friend}}!",
  "html": "<h1>Hi {{name|there}}</h1>"
}'
```

```js
const res = await fetch('https://api.mailvina.com/templates', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.MAILVINA_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "Welcome email",
    "subject": "Welcome, {{name|friend}}!",
    "html": "<h1>Hi {{name|there}}</h1>"
  }),
});
const data = await res.json();
```

```python
import os, requests

res = requests.post(
    "https://api.mailvina.com/templates",
    headers={"Authorization": f"Bearer {os.environ['MAILVINA_API_KEY']}"},
    json={
        "name": "Welcome email",
        "subject": "Welcome, {{name|friend}}!",
        "html": "<h1>Hi {{name|there}}</h1>"
    },
)
print(res.json())
```

**Response**

```json
{
  "object": "template",
  "id": "f3b9756c-f4f4-44da-bc00-9f7903c8a83f"
}
```
