# Retrieve a template

Retrieves a single Template object referenced by its unique ID.

## Path Parameters

### id
`string``REQUIRED`

The template id of the template that will be retrieved.

## Query Parameters

| Parameter       | Type    | Default | Description                                            |
|-----------------|---------|---------|--------------------------------------------------------|
| `includeLayers` | boolean | false   | Include template layers in response                     |
| `includePages`  | boolean | false   | Include template pages and layers in response          |

## Sample Request

Here’s a sample request to retrieve a template:

```
GET /v1/template/:id
```

### JavaScript

```javascript
fetch(`https://api.templated.io/v1/template/${id}?includeLayers=true`, {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${API_KEY}`
  }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

### Python

```python
import requests

api_key = 'API_KEY'
template_id = 'template_id'

url = f'https://api.templated.io/v1/template/{template_id}'
params = { 'includeLayers': True }
headers = {'Authorization': f'Bearer {api_key}' }

response = requests.get(url, params=params, headers=headers)
if response.status_code == 200:
    print(response.json())
else:
    print('Request failed. Response code:', response.status_code)
    print(response.text)
```

### PHP

```php
<?php
$apiKey = 'API_KEY';
$templateId = 'template_id';
$params = array( 'includeLayers' => 'true' );
$url = "https://api.templated.io/v1/template/{$templateId}?" . http_build_query($params);
$options = [
    'http' => [
        'header' => "Authorization: Bearer {$apiKey}\r\n",
        'method' => 'GET'
    ]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) {
    echo "Error fetching data";
} else {
    $data = json_decode($result, true);
    print_r($data);
}
?>
```
