---
type: api
title: Check existence of index templates
description: Get information about whether index templates exist.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-indices-exists-template
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-indices-exists-template
products:
  - Elasticsearch
---

# Check existence of index templates

Availability:

## Paths

- `HEAD` `/_template/{name}`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#bearerauth)

#### Path Parameters

- `name` (union Name | [] Name)
  A comma-separated list of index template names used to limit the request.
Wildcard (`*`) expressions are supported.

## Description

Get information about whether index templates exist.
Index templates define settings, mappings, and aliases that can be applied automatically to new indices.

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

## Required authorization

* Cluster privileges: `manage_index_templates`

[Learn more about templates](https://www.elastic.co/docs/manage-data/data-store/templates)

## Query String Parameters

- `flat_settings` (boolean · default: false)
  Indicates whether to use a flat format for the response.
- `local` (boolean · default: false) — deprecated
  Indicates whether to get information from the local node only.
- `master_timeout` (string Duration · default: 30s)
  The period to wait for the master node.
If the master node is not available before the timeout expires, the request fails and returns an error.
To indicate that the request should never timeout, set it to `-1`.

## Response

## Code Examples

#### Console

```console
HEAD /_template/template_1
```

#### JavaScript

```javascript
const response = await client.indices.existsTemplate({
  name: "template_1",
});
```

#### Python

```python
resp = client.indices.exists_template(
    name="template_1",
)
```

#### curl

```curl
curl "$ELASTICSEARCH_URL/_template/template_1" \
  --head \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.indices().existsTemplate(e -> e
    .name("template_1")
);
```

#### C#

```c#
var response = await client.Indices.ExistsTemplateAsync(name: new[] { "template_1" });
```

#### PHP

```php
$resp = $client->indices()->existsTemplate([
    "name" => "template_1",
]);
```

#### Ruby

```ruby
response = client.indices.exists_template(
  name: "template_1"
)
```

