List all templates
Lists all templates of an user.
You can filter and customize the results using various query parameters.
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 (comma-separated) |
includeLayers | boolean | false | Include template layers in response |
Sample Request
Here’s a sample request to list all user’s templates:
GET /v1/templates
fetch(`https://api.templated.io/v1/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'url = 'https://api.templated.io/v1/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 ListTemplates { public static void main(String[] args) { try { String apiKey = "API_KEY";
// 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/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';
// 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/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);}?>