API Templates

The Template object

A template is a layout that once filled with variables will allow to create a document.


A template is made of the following fields:


  • id : a 6 digit unique identifier


  • title : any string that might make sense to you to name your template


  • description : text given to describe the template


  • variables : list of variables used in the template. A variable is a dynamic placeholder that will allow to insert dynamic content inside the template such as any text, number or date.


  • created_at : the creation date (ISO-8601) of the templateupdated_atthe last update date (ISO-8601) of the template. Note that if a variable is updated, added or destroyed it will also actualize this value.publishedWether the template is published or not (default). Only published template will be available throughout the DocLift ™ API.




Listing the templates

To list the published templates of an account you can perform the following request :


GET https://app.doclift.io/api/v1/templates


You'll get :

1
2[
3    {
4        "id": 100011,
5        "title": "Template 1",
6        "description": "Template 1 amazing description",
7        "variables": [
8            {
9                "title": "client_firstname",
10                "description": "description of the client_firstname variable"
11            },
12            {
13              "title": "client_lastname",
14              "description": "description of the client_lastname variable"
15            },            
16            ...
17            {
18                "title": "today_date",
19                "description": "Description of today_date format (could be JJ/MM/AAAA)"
20            }
21        ]
22    },
23    ...
24    {
25      "id": 100012,
26      "title": "Template 2",
27      "description": "Template 2 amazing description",
28      "variables": [
29          {
30              "title": "client_firstname",
31              "description": "description of the client_firstname variable"
32          },
33          {
34            "title": "client_lastname",
35            "description": "description of the client_lastname variable"
36          },
37          ...
38          {
39              "title": "today_date",
40              "description": "Description of today_date format (could be JJ/MM/AAAA)"
41          }
42      ]
43  }
44]
45


This result is paginated. See paginations chapter for more informations about pagination.



Viewing a template

To view detailed informations about a template, you can perform the following request :


GET https://app.doclift.io/api/v1/templates/<TEMPLATE_ID>


You'll get :


1
2{
3        "id": 100011,
4        "title": "Template 1",
5        "description": "Template 1 amazing description",
6        "variables": [
7            {
8                "title": "client_firstname",
9                "description": "description of the client_firstname variable"
10            },
11            {
12              "title": "client_lastname",
13              "description": "description of the client_lastname variable"
14            },
15            ...
16            {
17                "title": "today_date",
18                "description": "Description of today_date format (could be JJ/MM/AAAA)"
19            }
20        ],
21        "created_at": "2021-02-28 21:48:03 +0100",
22        "updated_at": "2021-02-28 21:48:58 +0100"
23}
24


Note that you can view only published templates through the DocLift™ API, otherwise you'll get a 404 error response.



;