---
type: api
title: Delete component templates
description: Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch-serverless/operation/operation-cluster-delete-component-template
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch-serverless/operation/operation-cluster-delete-component-template
products:
  - Elasticsearch Serverless
---

# Delete component templates

## Paths

- `DELETE` `/_component_template/{name}`

#### Path parameters

- `name` (union string | string[]) — required
  Comma-separated list or wildcard expression of component template names used to limit the request.

## Description

Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

## Required authorization

- Cluster privileges: `manage_index_templates`

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs use 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}"
  ```
  
  For more information about where to find API keys for the Elasticsearch endpoint (${ES_URL}) for a project, go to [Get started with Elasticsearch Serverless](https://www.elastic.co/docs/solutions/search/serverless-elasticsearch-get-started).

## Query string parameters

- `master_timeout` (string · default: 30s) — optional
  Period to wait for a connection to the master node.
If no response is received before the timeout expires, the request fails and returns an error.
- `timeout` (string · default: 30s) — optional
  Period to wait for a response.
If no response is received before the timeout expires, the request fails and returns an error.

## Response

`application/json`

- `acknowledged` (boolean)
  For a successful response, this value is always true. On failure, an exception is returned instead.
## Code examples

#### Console

```console
DELETE _component_template/template_1
```

#### JavaScript

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

#### Python

```python
resp = client.cluster.delete_component_template(
    name="template_1",
)
```

#### curl

```curl
curl -X DELETE "$ELASTICSEARCH_URL/_component_template/template_1" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.cluster().deleteComponentTemplate(d -> d
    .name("template_1")
);
```

#### C#

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

#### PHP

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

#### Ruby

```ruby
response = client.cluster.delete_component_template(
  name: "template_1"
)
```

