Skip to main content

Timplit API (v1)

Download OpenAPI specification:Download

Introduction

The Timplit API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded and multipart-form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

The Timplit API doesn't support bulk updates. You can only work on one object per request.

Authentication

The Timplit API uses API keys to authenticate requests. You can view and manage your API keys in the Timplit dashboard

Your API keys carry many privileges, so be sure to keep them secure! Do not share your API keys in publicly accessible areas such as GitHub, client side code, etc.

To authenticate you need to add an Authorization header with the contents of the header being Bearer 123456789 where 123456789 is your API key.

Authorization: Bearer 123456789

Response Codes

Timplit uses standard HTTP codes to indicate the success or failure of your requests.

In general, 2xx HTTP codes correspond to success, 4xx codes are for user-related failures, and 5xx codes are for infrastructure issues.

Status Description
200 Successful request.
400 Check that the request parameters were correct.
403 The API key was missing or invalid.
429 The rate limit was exceeded.
5xx Indicates an error with Timplit's servers

Templates

A template is the primary object you will work with. Templates are either a Microsoft Word document (docx) or a Libre Office document (odt). Upon a template upload, Timplit will respond with a 'templateId' which can be used to identify the template for subsequent operations.

Render a template

Render a template with the provided variable contexts.

In the body of the request, global parameters represent individual variables, e.g. Variable("EMAIL", "[email protected]). This would replace instances of {{ EMAIL }} in the template with the string [email protected].

Tables in office documents (docx, odt) can be used to construct repeating instances of data. For example, a list of items a user has purchased.

In this example, products is the top level table identifier, while NAME, PRICE, and PURCHASED_AT are the identifiers for the individual variables included in each row of the table.

Product Name Product Price Purchased At
{{LIST products}}{{ products.NAME }} {{ products.PRICE }} {{ products.PURCHASED_AT }}

See the Timplit tutorial for more detailed examples on how to write a correctly formatted template.

path Parameters
templateId
required
string

The id of the template to be rendered.

Request Body schema: application/json
required
outputDocumentKind
required
string
Enum: "OFFICE_DOCUMENT" "PDF"
required
Array of objects (Variable)
Array of objects (Table)

Responses

Request samples

Content type
application/json
{
  • "outputDocumentKind": "OFFICE_DOCUMENT",
  • "globalParameters": [
    ],
  • "tables": [
    ]
}

Get the metadata for the templates belonging to the active group

All template metadata belonging to the active group will be returned. The active group is determined using the owner of the api key used as authorization.

Responses

Upload a new template

Use a multipart/form-data request to upload a new template document. A template must be a Microsoft word document (docx) or a Libre Office document (odt). See the Timplit tutorial on how to write a correctly formatted template.

Request Body schema: multipart/form-data
template
required
string <binary>

Docx or LibreOffice file

Responses

Get a template's metadata, by its id

Returns a template's metadata, with fields such as file name, and created date. To download a template as the original uploaded file, use the /download endpoint.

path Parameters
templateId
required
string

The id of the template, used to get metadata.

Responses

Delete the given template

Permanently delete a template. Proceed with caution, as this operation cannot be undone.

path Parameters
templateId
required
string

The id of the template to be deleted.

Responses

Update the template contents

Upload a docx or libre office file to replace the existing template. A template must be a Microsoft word document (docx) or a Libre Office document (odt). See the Timplit tutorial on how to write a correctly formatted template.

path Parameters
templateId
required
string
Request Body schema: multipart/form-data
template
required
string <binary>

Docx or LibreOffice file

Responses

Get a preview thumbnail image of a given template as a PNG file

path Parameters
templateId
required
string

The id of the template, used to generate a preview PNG image.

Responses

Get sample data for a given template

Timplit will extract variables from your template, and generate a default JSON object. The JSON object could be used to construct a subsequent render template request.

path Parameters
templateId
required
string

The id of the template, used to generate sample data.

Responses

Download a template as an attachment

Download a template as the original Microsoft Word or Libre Office file. The file will be downloaded with an attachment content-disposition.

path Parameters
templateId
required
string

The id of the template to be downloaded.

Responses