Timplit API (v1)
Download OpenAPI specification:Download
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.
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
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 |
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/jsonrequired
| outputDocumentKind required | string Enum: "OFFICE_DOCUMENT" "PDF" |
required | Array of objects (Variable) |
Array of objects (Table) |
Responses
Request samples
- Payload
{- "outputDocumentKind": "OFFICE_DOCUMENT",
- "globalParameters": [
- {
- "identifier": "string",
- "value": "string"
}
], - "tables": [
- {
- "identifier": "string",
- "rows": [
- {
- "variables": [
- {
- "identifier": "string",
- "value": "string"
}
]
}
]
}
]
}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
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 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. |