# Create a template

> **POST** `https://api.us.nylas.com/v3/templates`

Source: https://developer.nylas.com/docs/reference/api/application-level-templates/create-app-level-template/

Creates an application-level template.

**Authentication:** NYLAS_API_KEY

## Request body

Create template request

Content-Type: application/json

- `body` (string) **(required)** - The body content of the template, in HTML format.
- `engine` (string) - The templating engine to use.
- `name` (string) **(required)** - The name of the template.
- `subject` (string) **(required)** - The subject line of the template.

## Responses

### 200 - Success. Returns template.

- `request_id` (string) **(required)** - The ID of the request.
- `data` (object) **(required)** - A custom message template.
  - `app_id` (string,null) - The ID of the Nylas application associated with the template. Returned only if the template is
configured at the application level.
  - `body` (string) **(required)** - The body content of the template, in HTML format.
  - `created_at` (integer) **(required)** - When the template was created, in seconds using the Unix timestamp format.
  - `engine` (string) **(required)** - The templating engine.
  - `grant_id` (string,null) - The ID of the grant associated with the template. Returned only if the template is configured
at the grant level.
  - `id` (string) **(required)** - The template ID.
  - `name` (string) **(required)** - The name of the template.
  - `object` (string) **(required)** - The object type identifier.
  - `subject` (string) **(required)** - The subject line of the template.
  - `updated_at` (integer) **(required)** - When the template was last updated, in seconds using the Unix timestamp format.

### 400 - Error: Bad request

- `request_id` (string) **(required)** - The ID of the request.
- `error` (object) **(required)**
  - `type` (string) **(required)** - The type of error that occurred.
  - `message` (string) **(required)** - A human-readable message describing the error.

## Code samples

### cURL

```bash
curl --request POST \
  --url "https://api.us.nylas.com/v3/templates" \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
    "body": "<p>Hello from {{user}}</p>",
    "name": "Nylas Alias",
    "subject": "New notification for {{user}}",
    "engine": "mustache"
  }'
```
