---
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/4493/api/doc/elasticsearch/v9/operation/operation-indices-exists-template
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-indices-exists-template
products:
  - Elasticsearch
---

# Check existence of index templates

## Paths

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

#### Path parameters

- `name` (union string | string[]) — required
  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.

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

## Required authorization

- Cluster privileges: `manage_index_templates`

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

## Query string parameters

- `flat_settings` (boolean · default: false) — optional
  Indicates whether to use a flat format for the response.
- `local` (boolean · default: false) — optional — deprecated
  Indicates whether to get information from the local node only.
- `master_timeout` (string · default: 30s) — optional
  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

`application/json`

## 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"
)
```

