Build and connect with Templafy's platform

Strong open API for building smart solutions for enterprise document management and creation

Documentation Get started

Open API for enterprise content management

Templafy is a cloud-based template and document asset management platform for large organizations


Templafy’s open API for developers can connect entire enterprise content management ecosystems. Build integrations to ease the way businesses and employees work with documents, presentations and emails.


 

Digital asset management integration


Bring access to assets stored in DAM via the Templafy task pane integrated into document creation applications


 

Sync with storage systems


Centralize the management of document assets and sync other storage systems like SharePoint, Dropbox and Box with Templafy


 

Embed access to Templafy with external systems


Embed Templafy as an iFrame or pop-up window in other external systems such as CMS or CRM

Get started with Templafy's Asset API

 
 
 
Authentication


.NET


Node


cURL


Java


.NET

using System;
using System.Collections.Generic;
using System.Net.Http;
using Newtonsoft.Json;
// This is your Templafy subdomain, i.e., https://{TenantId}.templafy.com
const string tenantId = "{TenantId}";
// This can be found under the Public API section in the Settings tab of the Templafy administration page
const string apiKey = "{APIKey}";
Dictionary requestParameters = new Dictionary
{
    { "grant_type", "client_credentials" },
    { "client_id", tenantId },
    { "client_secret", apiKey }
};
FormUrlEncodedContent requestContent = new FormUrlEncodedContent(requestParameters);
HttpResponseMessage response = await client.PostAsync("oauth2/token", requestContent);
if (!response.IsSuccessStatusCode)
{
    throw new Exception("Authentication failed");
}
string responseContent = await response.Content.ReadAsStringAsync();
AuthenticationResponse authenticationResponse = JsonConvert.DeserializeObject(responseContent);
// Automatically include the access token in future requests from the client
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {authenticationResponse.AccessToken}");
public class AuthenticationResponse
{
    [JsonProperty("access_token")]
    public string AccessToken { get; set; }
    [JsonProperty("expires_in")]
    public int ExpiresIn { get; set; }
    [JsonProperty("token_type")]
    public string TokenType { get; set; }
}


Node

const tenantId = "{TenantId}";
const apiKey = "{APIKey}";
const axios = require("axios");
const querystring = require("querystring");
const client = axios.create({
    baseURL: "https://api-v1.templafy.com"
});
const parameters = {
    "grant_type": "client_credentials",
    "client_id": tenantId,
    "client_secret": apiKey
};
let response;
try {
    response = await client.post("oauth2/token", querystring.stringify(parameters));
} catch (error) {
    throw new Error(`Authentication failed: ${error}`);
}
client.defaults.headers.common["Authorization"] = `Bearer ${response.data.access_token}`;


cURL

curl -d "grant_type=client_credentials&client_id={TenantId}&client_secret={APIKey}" "https://api-v1.templafy.com/oauth2/token"


Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
// This is your Templafy subdomain, i.e., https://{TenantId}.templafy.com
String tenantId = "{TenantId}";
// This can be found under the Public API section in the Settings tab of the Templafy administration page
String apiKey = "{APIKey}";
URI baseUri = URI.create("https://api-v1.templafy.com/");
HttpClient httpClient = HttpClient.newHttpClient();
Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
String requestBody = new StringBuilder()
        .append("grant_type=client_credentials")
        .append("&client_id=" + tenantId)
        .append("&client_secret=" + apiKey)
        .toString();
HttpRequest authRequest = HttpRequest.newBuilder()
        .uri(baseUri.resolve("oauth2/token"))
        .POST(HttpRequest.BodyPublishers.ofString(requestBody))
        .build();
String accessToken;
try {
    HttpResponse response = httpClient.send(authRequest, HttpResponse.BodyHandlers.ofString());
    AuthenticationReponse authenticationReponse = gson.fromJson(response.body(), AuthenticationReponse.class);
    accessToken = authenticationReponse.AccessToken;
} catch (Exception e) {
    e.printStackTrace();
    return;
}
System.out.println("Access Token: " + accessToken);
public class AuthenticationReponse {
    public String AccessToken;
    public int ExpiresIn;
    public String TokenType;
}

Get asset/your first call


.NET


Node


cURL


Java


.NET

// Fetch all images from the root folder of the Images library
HttpResponseMessage response = await client.GetAsync("images");
if (!response.IsSuccessStatusCode)
{
    throw new Exception("Fetching images failed");
}
string responseContent = await response.Content.ReadAsStringAsync();
IEnumerable images = JsonConvert.DeserializeObject>(responseContent);
foreach (Image image in images)
{
    Console.WriteLine($"Image {image.Name}");
}
public class Image
{
    public string Id { get; set; }
    public string Name { get; set; }
    public string FolderId { get; set; }
    public string Tags { get; set; }
    public string MimeType { get; set; }
    public int Width { get; set; }
    public int Height { get; set; }
    public string ExternalData { get; set; }
    public long FileSize { get; set; }
    public string Checksum { get; set; }
}


Node

let response;
try {
    response = await client.get("images");
} catch {
    throw new Error(`Fetching images failed: ${error}`);
}
for (const image of response.data) {
    console.log(`Image: ${image.name}`);
}


cURL

curl --header "Authorization: Bearer {AccessToken}" "https://api-v1.templafy.com/images"


Java

// Fetch all images from the root folder of the Images library
HttpRequest assetsRequest = HttpRequest.newBuilder()
        .uri(baseUri.resolve("images"))
        .header("Authorization", "Bearer " + accessToken)
        .GET()
        .build();
Image[] images;
try {
    HttpResponse response = httpClient.send(assetsRequest, HttpResponse.BodyHandlers.ofString());
    images = gson.fromJson(response.body(), Image[].class);
} catch (Exception e) {
    e.printStackTrace();
    return;
}
for (Image image : images) {
    System.out.println("Image " + image.Name);
}
public class Image {
    public String Id;
    public String Name;
    public String FolderId;
    public String Tags;
    public String MimeType;
    public int Width;
    public int Height;
    public String ExternalData;
    public long FileSize;
    public String Checksum;
}

Trusted by global enterprises and other enterprise content management technologies


Templafy’s integrations unify entire content management IT infrastructures. Connect the most common document creation programs for an intelligent and secure document workflow from creation to storage.

Over 300 businesses worldwide, including global enterprises with over 20,000 employees, are connecting systems in their document and content management infrastructure with Templafy.

Get started with Templafy open API