List Templates

Lists document templates

Endpoint URLSDK Method
N/ATemplate.list()

Request properties

PropertyTypeRequiredDescription
pageIntegerNoThe page of the list you want to pull. The default is 1.
page_sizeIntegerNoThe number of records to pull per page. The default is 25.
sortStringNoThe sort key. If the key is preceded with a -, the request will sort the records in descending order. Otherwise it will sort in ascending order.
searchStringNoThe search key. The request will only return records with this key.

Response properties

PropertyTypeDescription
itemsObject[]An array of templates.
metadataObjectMetadata relating to the list.

items

PropertyTypeDescription
created_atStringThe date and time the template was created.
created_byObjectThe user or API key that created the template.
descriptionStringThe description of the template.
heightFloatThe height of documents generated by the template if source equals html.
idStringThe ID of 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_historyObject[]The version history of the template.
widthFloatThe width of documents generated by the template if source equals html.

created_by

PropertyTypeDescription
first_nameStringThe first name of the user who created the template.
last_nameStringThe last name of the user who created the template.
nameStringThe name of the API key that created the template.

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:
   # List all templates
   resp = inkit.Template.list()
   # Print the repsonse code of the API call
   print(json.dumps(dict(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 list templates
listTemplates();

// List all templates
async function listTemplates() {
    try {
        const result = await Inkit.Template.list();
        // 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);
    }
}
{
   "items": [
      {
         "created_at": "2023-09-06T14:43:36.773986Z",
         "description": "",
         "height": 11.0,
         "id": "tmpl_27i7Mb5bBIKzXVHOKfSedc",
         "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
      }
   ],
   "metadata": {
      "pagination": {
         "current_page": 1,
         "next_page": null,
         "page_count": 1,
         "page_size": 25,
         "prev_page": null,
         "total_count": 1
      },
      "sort": {
         "key": "updated_at",
         "order": 1
      }
   }
}