List folder templates
Lists all templates of a folder.
You can filter and customize the results using various query parameters.
Parameters
id string
REQUIRED
The folder id that you want to retrieve the templates.
Query Parameters
Parameter | Type | Default | Description |
---|---|---|---|
query | string | - | Filter templates by name |
page | integer | 0 | Page number for pagination |
limit | integer | 25 | Number of results per page |
width | integer | - | Filter templates by width |
height | integer | - | Filter templates by height |
tags | string | - | Filter templates by tags |
includeLayers | boolean | false | Include template layers in response |
Sample Request
Here’s a sample request to list all templates of a folder:
GET /v1/folder/:id/templates
fetch(`https://api.templated.io/v1/folder/${id}/templates`, { method: 'GET', headers: { 'Authorization': `Bearer ${API_KEY}` }, // Example with all query parameters params: { query: 'Template Name', page: 0, limit: 25, width: 1920, height: 1080, tags: 'tag1,tag2', includeLayers: true }}).then(response => response.json()).then(data => console.log(data)).catch(error => console.error('Error:', error));
import requests
api_key = 'API_KEY'folder_id = 'id'url = f'https://api.templated.io/v1/folder/{folder_id}/templates'
# Example with all query parametersparams = { 'query': 'Template Name', 'page': 0, 'limit': 25, 'width': 1920, 'height': 1080, '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)
import java.net.HttpURLConnection;import java.net.URL;import java.io.BufferedReader;import java.io.InputStreamReader;import java.net.URLEncoder;
public class ListFolderTemplates { public static void main(String[] args) { try { String apiKey = "API_KEY"; String folderId = "id";
// Example with all query parameters String queryParams = String.format("?query=%s&page=%d&limit=%d&width=%d&height=%d&includeLayers=%b", URLEncoder.encode("Template Name", "UTF-8"), 0, 25, 1920, 1080, true );
URL url = new URL("https://api.templated.io/v1/folder/" + folderId + "/templates" + queryParams);
HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("Authorization", "Bearer " + apiKey);
int responseCode = connection.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String inputLine; StringBuilder response = new StringBuilder(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); } else { System.out.println("Request failed. Response Code: " + responseCode); } } catch (Exception e) { e.printStackTrace(); } }}
<?php$apiKey = 'API_KEY';$folderId = 'id';
// Example with all query parameters$params = array( 'query' => 'Template Name', 'page' => 0, 'limit' => 25, 'width' => 1920, 'height' => 1080, 'includeLayers' => 'true');
$url = "https://api.templated.io/v1/folder/{$folderId}/templates?" . 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);}?>
Response
The API returns an array of JSON objects with the template details.
[ { "id": "tpl_123abc", "name": "Instagram Post", "width": 1080, "height": 1080, "thumbnail": "https://templated-assets.s3.amazonaws.com/thumbnail-123.png", "folderId": "fld_456def", "layersCount": 5, "createdAt": "2024-03-20T10:30:00Z", "updatedAt": "2024-03-20T10:30:00Z", }]