# Templates

<div class="section route">

<div class="primary">

## Schema

The schema defines all the fields that exist within a template record. Any response from these endpoints can be expected to contain the fields below unless the \`\_filter\` query parameter is used or the schema field only appears in a specific context.

<table class="attributes">
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr id="schema-id">
<td><code>id</code></td>
<td>ID of template.
<p>JSON data type: string</p>
<p>Read only</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-slug">
<td><code>slug</code></td>
<td>Unique slug identifying the template.
<p>JSON data type: string</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-theme">
<td><code>theme</code></td>
<td>Theme identifier for the template.
<p>JSON data type: string</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-type">
<td><code>type</code></td>
<td>Type of template.
<p>JSON data type: string</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-source">
<td><code>source</code></td>
<td>Source of template
<p>JSON data type: string</p>
<p>Read only</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-origin">
<td><code>origin</code></td>
<td>Source of a customized template
<p>JSON data type: string</p>
<p>Read only</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-content">
<td><code>content</code></td>
<td>Content of template.
<p>JSON data type: object or string</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-title">
<td><code>title</code></td>
<td>Title of template.
<p>JSON data type: object or string</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-description">
<td><code>description</code></td>
<td>Description of template.
<p>JSON data type: string</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-status">
<td><code>status</code></td>
<td>Status of template.
<p>JSON data type: string</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p>
<p>One of: <code>publish</code>, <code>future</code>, <code>draft</code>, <code>pending</code>, <code>private</code></p></td>
</tr>
<tr id="schema-wp_id">
<td><code>wp_id</code></td>
<td>Post ID.
<p>JSON data type: integer</p>
<p>Read only</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-has_theme_file">
<td><code>has_theme_file</code></td>
<td>Theme file exists.
<p>JSON data type: bool</p>
<p>Read only</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-author">
<td><code>author</code></td>
<td>The ID for the author of the template.
<p>JSON data type: integer</p>
<p>Context: <code>view</code>, <code>edit</code>, <code>embed</code></p></td>
</tr>
<tr id="schema-modified">
<td><code>modified</code></td>
<td>The date the template was last modified, in the site’s timezone.
<p>JSON data type: string,<br />
Format: datetime (<a href="https://core.trac.wordpress.org/ticket/41032">details</a>)</p>
<p>Read only</p>
<p>Context: <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-is_custom">
<td><code>is_custom</code></td>
<td>Whether a template is a custom template.
<p>JSON data type: bool</p>
<p>Read only</p>
<p>Context: <code>embed</code>, <code>view</code>, <code>edit</code></p></td>
</tr>
</tbody>
</table>

</div>

</div>

<div>

<div class="section route">

<div class="primary">

## Retrieve a Template

### Definition & Example Request

`GET /wp/v2/templates`

Query this endpoint to retrieve a specific template record.

`$ curl https://example.com/wp-json/wp/v2/templates`

</div>

<div class="secondary">

### Arguments

<table class="arguments">
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td><code>context</code></td>
<td>Scope under which the request is made; determines fields present in response.
<p>Default: <code>view</code></p>
<p>One of: <code>view</code>, <code>embed</code>, <code>edit</code></p></td>
</tr>
<tr>
<td><code>wp_id</code></td>
<td>Limit to the specified post id.</td>
</tr>
<tr>
<td><code>area</code></td>
<td>Limit to the specified template part area.</td>
</tr>
<tr>
<td><code>post_type</code></td>
<td>Post type to get the templates for.</td>
</tr>
</tbody>
</table>

</div>

</div>

<div class="section route">

<div class="primary">

## Create a Template

### Arguments

<table class="arguments">
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td><a href="#schema-slug"><code>slug</code></a></td>
<td>Unique slug identifying the template.
<p>Required: 1</p></td>
</tr>
<tr>
<td><a href="#schema-theme"><code>theme</code></a></td>
<td>Theme identifier for the template.</td>
</tr>
<tr>
<td><a href="#schema-type"><code>type</code></a></td>
<td>Type of template.</td>
</tr>
<tr>
<td><a href="#schema-content"><code>content</code></a></td>
<td>Content of template.</td>
</tr>
<tr>
<td><a href="#schema-title"><code>title</code></a></td>
<td>Title of template.</td>
</tr>
<tr>
<td><a href="#schema-description"><code>description</code></a></td>
<td>Description of template.</td>
</tr>
<tr>
<td><a href="#schema-status"><code>status</code></a></td>
<td>Status of template.
<p>Default: <code>publish</code></p>
<p>One of: <code>publish</code>, <code>future</code>, <code>draft</code>, <code>pending</code>, <code>private</code></p></td>
</tr>
<tr>
<td><a href="#schema-author"><code>author</code></a></td>
<td>The ID for the author of the template.</td>
</tr>
</tbody>
</table>

</div>

<div class="secondary">

### Definition

`POST /wp/v2/templates`

</div>

</div>

<div class="section route">

<div class="primary">

## Retrieve a Template

### Definition & Example Request

`GET /wp/v2/templates/<id>?)[\/\w%-]+)`

Query this endpoint to retrieve a specific template record.

`$ curl https://example.com/wp-json/wp/v2/templates/<id>?)[\/\w%-]+)`

</div>

<div class="secondary">

### Arguments

<table class="arguments">
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td><code>id</code></td>
<td>The id of a template</td>
</tr>
<tr>
<td><code>context</code></td>
<td>Scope under which the request is made; determines fields present in response.
<p>Default: <code>view</code></p>
<p>One of: <code>view</code>, <code>embed</code>, <code>edit</code></p></td>
</tr>
</tbody>
</table>

</div>

</div>

<div class="section route">

<div class="primary">

## Update a Template

### Arguments

<table class="arguments">
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td><a href="#schema-id"><code>id</code></a></td>
<td>The id of a template</td>
</tr>
<tr>
<td><a href="#schema-slug"><code>slug</code></a></td>
<td>Unique slug identifying the template.</td>
</tr>
<tr>
<td><a href="#schema-theme"><code>theme</code></a></td>
<td>Theme identifier for the template.</td>
</tr>
<tr>
<td><a href="#schema-type"><code>type</code></a></td>
<td>Type of template.</td>
</tr>
<tr>
<td><a href="#schema-content"><code>content</code></a></td>
<td>Content of template.</td>
</tr>
<tr>
<td><a href="#schema-title"><code>title</code></a></td>
<td>Title of template.</td>
</tr>
<tr>
<td><a href="#schema-description"><code>description</code></a></td>
<td>Description of template.</td>
</tr>
<tr>
<td><a href="#schema-status"><code>status</code></a></td>
<td>Status of template.<br />
One of: <code>publish</code>, <code>future</code>, <code>draft</code>, <code>pending</code>, <code>private</code></td>
</tr>
<tr>
<td><a href="#schema-author"><code>author</code></a></td>
<td>The ID for the author of the template.</td>
</tr>
</tbody>
</table>

</div>

<div class="secondary">

### Definition

`POST /wp/v2/templates/<id>?)[\/\w%-]+)`

### Example Request

</div>

</div>

<div class="section route">

<div class="primary">

## Delete a Template

### Arguments

|         |                                             |
|---------|---------------------------------------------|
| `id`    | The id of a template                        |
| `force` | Whether to bypass Trash and force deletion. |

</div>

<div class="secondary">

### Definition

`DELETE /wp/v2/templates/<id>?)[\/\w%-]+)`

### Example Request

`$ curl -X DELETE https://example.com/wp-json/wp/v2/templates/<id>?)[\/\w%-]+)`

</div>

</div>

</div>