# Update a template

> **PUT** `https://api.us.nylas.com/v3/grants/{grant_id}/templates/{template_id}`

Source: https://developer.nylas.com/docs/reference/api/grant-level-templates/update-grant-level-template/

Updates the specified grant-level template.

**Authentication:** NYLAS_API_KEY, ACCESS_TOKEN

## Parameters

### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `grant_id` | string | Yes | ID of the grant to access. You can also use the email address associated with the grant, or use `/me/` to refer to the grant associated with an access token. |
| `template_id` | string | Yes | The ID of the template to access. |

## Request body

Update template request

Content-Type: application/json

- `body` (string) - The body content of the template, in HTML format.
- `engine` (string) - The templating engine to use.
- `name` (string) - The name of the template.
- `subject` (string) - 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 PUT \
  --url "https://api.us.nylas.com/v3/grants/<NYLAS_GRANT_ID>/templates/<TEMPLATE_ID>" \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
    "body": "<p>Test from {{user.name}}</p>",
    "name": "Update Template",
    "subject": "Test from {{user.name}}",
    "engine": "mustache"
  }'
```
