Retrieve Template Information

Retrieves information about a document template

Endpoint URLSDK Method
N/ATemplate.get()

Request properties

PropertyTypeRequiredDescription
templateIdStringYesThe ID of a template that was previously created.

Response properties

PropertyTypeDescription
created_atStringThe date and time the template was created.
descriptionStringThe description of the template.
destinationsObjectDetails about where and how to store documents generated from the template.
fileStringThe contents of the template if source equals docx or pdf.
file_nameStringThe file name of the template source if source equals docx or pdf.
heightFloatThe height of documents generated by the template if source equals html.
htmlStringThe template's HTML code if source equals html.
idStringThe ID of the template.
merge_paramsObjectThe descriptions and locations of merge fields if source equals pdf.
merge_variablesObjectThe key-value pairs used when generating documents from the template.
nameStringThe name of the template.
sourceStringThe source format of the template. Valid values are docx, html and pdf.
unitStringThe unit of measurement for documents generated by the template. Valid values are in and cm.
updated_atStringThe date and time the template was updated.
versionIntegerThe version number of the template.
version_historyObjectThe version history of the template.
widthStringThe width of documents generated by the template if source equals html.

merge_params

PropertyTypeDescription
alignStringThe text alignment of the field.
fontnameStringThe font name of the field.
fontsizeStringThe font size of the field.
nameStringThe name of the field.
pageStringThe page number of the PDF where the field exists.
text_colorInteger[]The text color of the field.
x_leftIntegerThe left coordinate of the field.
x_rightIntegerThe right coordinate of the field.
y_lowerIntegerThe bottom coordinate of the field.
y_upperIntegerThe top coordinate of the field.

version_history

PropertyTypeDescription
created_atStringThe date and time the template version was created.
edited_by_first_nameStringThe first name of the user who edited the template.
edited_by_last_nameStringThe last name of the user who edited the template.
versionIntegerThe template version number.

Example request and response

# Import the Inkit Python package
import inkit
from inkit.exceptions import InkitResponseException
# Import json package
import json

# Replace the string below with your API key
inkit.api_token = "ENTER YOUR API KEY"

try:
   # Get data about a template
   resp = inkit.Template.get('ENTER YOUR TEMPLATE ID')
   # Print the repsonse code of the API call
   print(json.dumps(resp.data, indent = 3))
except InkitResponseException as err:
   # Print any error
   print(err.response.data)
// Import the Inkit Node.js package
const Inkit = require("inkit");

// Replace the string below with your API key
Inkit.apiToken = "ENTER YOUR API KEY";

// Call get template
getTemplate();

// Get data about a template
async function getTemplate() {
    try {
        const result = await Inkit.Template.get('ENTER YOUR TEMPLATE ID');
        // Print the JSON response of the API call
        console.log(JSON.stringify(result.data, null, 3));
    } catch (error) {
        // Print any error
        console.error(error.response.status, error.response.statusText);
    }
}
{
   "created_at": "2023-09-06T14:43:36.773986Z",
   "description": "",
   "destinations": [
      {
         "expire_after_n_views": null,
         "folder_id": null,
         "id": "dest_4UNZXxK3OYqBIYPPB5mu4P",
         "name": "inkit_storage",
         "required": true,
         "retain_for": null
      }
   ],
   "height": 11.0,
   "html": "<html>{{Name}}</html>",
   "id": "tmpl_27i7Mb5bBIKzXVHOKfSedc",
   "merge_variables": {
      "Name": null
   },
   "name": "Test",
   "source": "html",
   "unit": "in",
   "updated_at": "2023-09-06T14:43:36.773997Z",
   "version": 1,
   "version_history": [
      {
         "created_at": "2023-09-06T14:43:36.773997Z",
         "edited_by_first_name": "John",
         "edited_by_last_name": "Doe",
         "version": 1
      }
   ],
   "width": 8.5
}