Add tags to template
Add tags to an existing template.
This endpoint allows you to append new tags to a template without removing existing ones.
Request Body
Section titled “Request Body”The request body should be an array of strings containing the tags you want to add.
Sample Request
Section titled “Sample Request”Here’s a sample request to add tags to a template:
POST /v1/template/{templateId}/tagsfetch(`https://api.templated.io/v1/template/${template_id}/tags`, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify([ "social-media", "instagram", "story" ])}).then(response => response.json()).then(data => console.log(data)).catch(error => console.error('Error:', error));import requests
api_key = 'API_KEY'template_id = 'template_id'url = f'https://api.templated.io/v1/template/{template_id}/tags'
headers = { 'Authorization': f'Bearer {api_key}', 'Content-Type': 'application/json'}
tags = [ "social-media", "instagram", "story"]
response = requests.post(url, json=tags, 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.OutputStream;import java.io.BufferedReader;import java.io.InputStreamReader;
public class AddTemplateTags { public static void main(String[] args) { try { String apiKey = "API_KEY"; String templateId = "template_id"; String url = "https://api.templated.io/v1/template/" + templateId + "/tags";
String jsonTags = """ ["social-media", "instagram", "story"] """;
URL apiUrl = new URL(url); HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Authorization", "Bearer " + apiKey); connection.setRequestProperty("Content-Type", "application/json"); connection.setDoOutput(true);
try (OutputStream os = connection.getOutputStream()) { byte[] input = jsonTags.getBytes("utf-8"); os.write(input, 0, input.length); }
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';$templateId = 'template_id';
$tags = [ "social-media", "instagram", "story"];
$url = "https://api.templated.io/v1/template/{$templateId}/tags";
$options = [ 'http' => [ 'header' => "Authorization: Bearer {$apiKey}\r\n" . "Content-Type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($tags) ]];
$context = stream_context_create($options);$result = file_get_contents($url, false, $context);
if ($result === FALSE) { echo "Error adding tags";} else { $data = json_decode($result, true); print_r($data);}?>