Skip to content

Public API, AI assistance ​

Overview

Export templates are how ClariNet turns case and portfolio data into files that people and systems can use: Excel workbooks, Word letters, CSV extracts, JSON feeds and more. A template is an ordinary file containing tags such as <<Case.CaseReference>>. When the template runs, ClariNet replaces each tag with live data and produces the finished output.

The Export Templates API gives you programmatic control over the whole lifecycle. You can manage the template library, discover exactly which data and functions a template can use, and preview template content against real cases before anyone saves it. This lets you keep templates in source control, deploy them between environments, build tooling around them, or let an AI assistant draft them for you.

With this API you can:

  • Manage templates. List, read, create, update and delete export templates and packages, including their parameters, output formats and visibility settings.
  • Manage template files. Download the current or any earlier version of a template file, and upload new versions without losing history.
  • Discover the data model. Retrieve every tag, entity and function available to you, tailored to your permissions and your organisation's custom fields.
  • Preview safely. Render text, spreadsheet or Word template content against a case or portfolio and inspect the result as JSON or download the rendered file. Nothing is saved.

If you are new to export templates, read Export Templates overview and Expression Syntax first. This page assumes you understand what a tag expression is and focuses on the API.

Key concepts

ConceptWhat it means
Export templateA named template backed by a single file, such as XLSX, DOCX or a text-based format. It also has settings: where it appears in ClariNet, which parameters it asks for and which output formats it can produce.
PackageA template with no file of its own. It runs several individual templates together and returns their outputs as one ZIP archive.
File versionEach upload of a template file is kept as a version. Versions are identified by a GUID, not a sequence number. The newest version is the one ClariNet uses.
TagA named piece of data, such as Case.CaseReference or Case.Policy.FaceAmount. Tags are written between double angle brackets in a template.
EntityA type of object in the data model, such as a case, policy or insured life. Tags that return an entity let you drill further into its own tags.
FunctionA built-in operation used in a tag expression, such as Sum, Where, SortBy or Format.
ParameterA value the user supplies when running the template, such as a valuation date. It is referenced in the template as $Name.
Execution modeCase runs the template for one case. Portfolio runs it across the cases in a portfolio, which are available to the template as $Cases.

A typical workflow

  1. Call GET /meta and GET /functions to learn which tags and functions are available.
  2. Draft the template content and call POST /preview against a representative case or portfolio. Repeat until the output is right.
  3. Build the final template file and create it with POST /exporttemplates, or upload it as a new version of an existing template with PUT /{publicId}/template.
  4. Adjust settings such as parameters, formats and visibility with PUT /{publicId}.
  5. Run the template from ClariNet in the usual way, from a case or from the portfolio reporting tab.

Using an AI assistant to build templates

This API is designed to be used by AI assistants as well as by people. The discovery endpoints describe the data model in a compact, self-contained way, and the preview endpoint gives an assistant a safe way to test its work against real data. Together they let an assistant write a template, check the result and correct its own mistakes before you commit anything.

To get good results, give the assistant three things:

  1. This page. Ask the assistant to read it in full. It defines every endpoint, request body and rule the assistant needs.
  2. The data model. Supply the responses from GET /meta and GET /functions, or let the assistant call them itself. Tag names vary between organisations because of custom fields, so the assistant should never guess them.
  3. A clear brief and a test subject. Describe the output you want and give the public ID of a case or portfolio it can preview against.

A prompt along these lines works well:

plain
Read the ClariNet Export Templates Public API documentation at
https://help.clarinetlive.com/content/public-api/export-templates-public-api.html

Using the tags from GET /api/v4/exporttemplates/meta and the functions from
GET /api/v4/exporttemplates/functions, build a spreadsheet template that lists every
case in a portfolio with its case reference, primary insured name, face amount and
status, followed by a total face amount row.

Preview it against portfolio 7c1e2f4a-5b6d-4e8f-9a0b-1c2d3e4f5a6b using POST /preview
and fix any errors or empty values. When the output is correct, show me the preview
and the request body you would use to create the template. Do not create it until I approve.

Keep a person in the loop. Preview is read-only, so it is safe to let an assistant iterate freely. Creating, updating and deleting templates changes what your users see, so review those requests before they are sent. Give an assistant an API key with only the permissions it needs, and never paste API keys into a prompt.


Getting started

Base URL

All endpoints on this page are relative to:

plain
https://www.clarinetlive.com/api/v4/exporttemplates

Authentication

Authenticate with an API key in the Authorization header. Requests with a JSON body must also send a Content-Type header. See Authentication, API keys and general notes for how to create a key.

plain
Authorization: ApiKey XXXXXXXX
Content-Type: application/json

Permissions

Each endpoint requires a specific permission on the user that owns the API key.

PermissionGrants access to
ExportTemplates_ViewList, get details, download template files, metadata, functions and preview
ExportTemplates_AddCreate templates and packages
ExportTemplates_EditUpdate settings and upload new file versions
ExportTemplates_DeleteDelete templates

Conventions

  • Templates are identified by their publicId, a GUID returned when you list or create them.
  • JSON property names are camelCase, and enumerations are sent and returned as strings, for example "Spreadsheet".
  • Template management responses always include every property, using null where there is no value. Metadata, function and preview responses omit null, false and empty values to stay compact, so treat a missing property as its default.
  • Files are sent to the API as base64 in a JSON body. Files are returned from the API as a normal binary download.
  • Errors are returned as application/problem+json. See Errors at the end of this page.

List export templates

Returns a page of the export templates in your organisation, ordered by name.

GET

plain
/api/v4/exporttemplates?page=1&pageSize=50

Query parameters

NameTypeDescription
pageintegerPage number, starting at 1. Defaults to 1.
pageSizeintegerNumber of templates per page, from 1 to 500. Defaults to 50.

Response

json
{
  "currentPage": 1,
  "pageSize": 50,
  "totalResults": 2,
  "items": [
    {
      "publicId": "4269913a-095d-4c62-a6ca-37f6be951d3d",
      "name": "Case summary",
      "fileName": "case-summary.xlsx",
      "createdDate": "2026-03-02T09:15:00Z",
      "modifiedDate": "2026-03-04T16:40:12Z"
    },
    {
      "publicId": "b5d0a6f1-2c39-4e7a-8f11-6f0e2d9c4a77",
      "name": "Quarterly pack",
      "fileName": null,
      "createdDate": "2026-03-05T11:02:41Z",
      "modifiedDate": "2026-03-05T11:02:41Z"
    }
  ]
}

fileName is the name of the current template file. It is null for packages, which have no file of their own.

Get an export template

Returns the full definition of one template, including its settings, parameters, output formats, package members and file version history.

GET

plain
/api/v4/exporttemplates/{publicId}

Response

json
{
  "publicId": "4269913a-095d-4c62-a6ca-37f6be951d3d",
  "name": "Case summary",
  "description": "One-page summary of a case and its policy.",
  "fileName": "case-summary.xlsx",
  "isPackage": false,
  "isPdf": false,
  "showForCaseExport": true,
  "showForPortfolioExport": true,
  "showForLcssExport": false,
  "requiresPortfolioValuation": false,
  "aggregateExecutionMode": false,
  "groupingExpression": null,
  "namingExpression": "CaseReference",
  "parameters": [
    {
      "parameterName": "AsAtDate",
      "label": "As at date",
      "description": "Date the summary is prepared for.",
      "isRequired": true,
      "parameterType": "Date",
      "listValues": []
    }
  ],
  "formats": [
    {
      "mimeType": "ApplicationMsExcel_xlsx",
      "description": "Microsoft Excel Document",
      "extension": "XLSX",
      "isDefault": true,
      "zipOutput": false
    },
    {
      "mimeType": "Application_pdf",
      "description": "PDF data",
      "extension": "PDF",
      "isDefault": false,
      "zipOutput": false
    }
  ],
  "packagedTemplates": [],
  "documentVersions": [
    {
      "versionId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
      "version": 1,
      "fileName": "case-summary.xlsx",
      "createdDate": "2026-03-02T09:15:00Z",
      "createdBy": "Jane Smith"
    },
    {
      "versionId": "8f6e7d2b-3c41-4a5e-9b67-0d1c2e3f4a5b",
      "version": 2,
      "fileName": "case-summary.xlsx",
      "createdDate": "2026-03-04T16:40:12Z",
      "createdBy": "Jane Smith"
    }
  ],
  "supportedOutputFormats": ["BMP", "CSV", "HTML", "JPG", "PDF", "PNG", "XLS", "XLSX"],
  "createdDate": "2026-03-02T09:15:00Z",
  "modifiedDate": "2026-03-04T16:40:12Z"
}

documentVersions is ordered oldest first, so the last entry is the current file. supportedOutputFormats lists every format the template file could produce; formats lists the ones this template is configured to offer.

Download a template file

Downloads the template file itself as a binary stream, with the original file name and MIME type in the response headers. Without a version, you get the current file. To download an earlier file, pass the versionId GUID from documentVersions in the template details, or the numeric version.

GET

plain
/api/v4/exporttemplates/{publicId}/template
/api/v4/exporttemplates/{publicId}/template/{versionId}
/api/v4/exporttemplates/{publicId}/template/{version}

Response

The raw file, for example:

plain
HTTP/1.1 200 OK
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Disposition: attachment; filename=case-summary.xlsx

Packages have no file of their own, so this endpoint returns 404 for a package.

Create an export template

Creates either an individual template with a file, or a package of existing templates. Requires ExportTemplates_Add.

POST

plain
/api/v4/exporttemplates

Request fields

FieldTypeDescription
namestringRequired. Up to 255 characters and unique within your organisation.
descriptionstringOptional. Up to 1,024 characters.
showForCaseExportbooleanShow the template in the export menu for a case.
showForPortfolioExportbooleanShow the template on the portfolio reporting tab.
showForLcssExportbooleanShow the template for LCSS export.
requiresPortfolioValuationbooleanGenerate a portfolio valuation and make it available to the template when run for a portfolio.
aggregateExecutionModebooleanFor portfolio runs, true produces one file for the whole portfolio. False produces one file per case, or per group, in a ZIP archive.
groupingExpressionstringOptional, used when aggregateExecutionMode is false. Chooses what each file is produced for. Up to 2,048 characters.
namingExpressionstringOptional, used when aggregateExecutionMode is false. Builds the suffix for each file name. Up to 2,048 characters.
parametersarrayValues the user is asked for when running the template. See Parameters below.
formatsarrayOutput formats the template offers. See Output formats below.
packagedTemplatesarrayPackages only. The templates included in the package.
fileobjectIndividual templates only. The template file as fileName and contentBase64.

Grouping and naming expressions are written without the surrounding angle brackets. For example, Entities.Where($c, $c.Policy.FaceAmount > 10000000) produces one file per case with a face amount above 10 million, and CaseReference + "-" + PrimaryInsured.LastName names each file after its case.

Parameters

FieldDescription
parameterNameRequired. Letters and digits only, unique within the template. Referenced in the template as $ParameterName.
labelRequired. The label shown to the user.
descriptionOptional help text, up to 1,024 characters.
isRequiredWhether the user must provide a value.
parameterTypeOne of Text, Integer, Decimal, Currency, Percentage, Date or List.
listValuesFor List parameters, the choices offered as displayName and value pairs.

Output formats

Each entry in formats has a mimeType, an isDefault flag and a zipOutput flag. Each format can appear once, and at most one can be the default. The formats you can choose depend on the template file type:

Template fileAllowed mimeType values
Excel (XLSX)ApplicationMsExcel_xlsx, ApplicationMsExcel_xls, Application_pdf, TextCsv, Image_jpeg, Image_png, Image_bmp, TextHtml
Word (DOCX)ApplicationMsWord_docx
Text (TXT, JSON, CSV, HTML, XML, XSD, XSLT)TextPlain_txt, ApplicationJson, TextXml_xml, TextHtml, TextCsv
PDFNone. A PDF template is a fixed file and cannot have parameters or formats.

Template files

Send the file as base64 in file.contentBase64, with its name in file.fileName. The file extension decides the template type. The file must not be empty and can be up to 10 MiB before encoding. The whole request can be up to 15 MiB.

Example: individual template

This creates a text template whose file contains Case: <<Case.CaseReference>>.

json
{
  "name": "Case reference note",
  "description": "Plain text note containing the case reference.",
  "showForCaseExport": true,
  "showForPortfolioExport": true,
  "aggregateExecutionMode": false,
  "namingExpression": "CaseReference",
  "parameters": [
    {
      "parameterName": "Region",
      "label": "Region",
      "description": "Region shown in the note header.",
      "isRequired": true,
      "parameterType": "List",
      "listValues": [
        { "displayName": "United States", "value": "US" },
        { "displayName": "United Kingdom", "value": "UK" }
      ]
    }
  ],
  "formats": [
    { "mimeType": "TextPlain_txt", "isDefault": true },
    { "mimeType": "TextCsv" }
  ],
  "file": {
    "fileName": "case-reference.txt",
    "contentBase64": "Q2FzZTogPDxDYXNlLkNhc2VSZWZlcmVuY2U+Pg=="
  }
}

Example: package

A package lists existing individual templates and an optional file name expression for each. It must not include file, parameters or formats. Package members must be individual templates with a file, in the same organisation.

json
{
  "name": "Quarterly pack",
  "description": "Case summary and reference note in one ZIP file.",
  "showForCaseExport": true,
  "packagedTemplates": [
    {
      "publicId": "4269913a-095d-4c62-a6ca-37f6be951d3d",
      "fileNameExpression": "\"Summary-\" + CaseReference"
    },
    {
      "publicId": "9d3b6c2e-7f41-4b8a-a5d9-2e0c1f7b6a34"
    }
  ]
}

Response

201 Created, with a Location header pointing at the new template and the full template definition in the body, in the same shape as Get an export template. A template with the same name already existing returns 409 Conflict.

Update template settings

Replaces the settings of an existing template or package. This is a full replacement, not a partial update: any field you leave out returns to its default, and any list you leave out becomes empty. Read the template first, change what you need and send the whole definition back. Requires ExportTemplates_Edit.

PUT

plain
/api/v4/exporttemplates/{publicId}

Request

The same fields as Create an export template, except file. To change the file, use Upload a new template file version.

json
{
  "name": "Case reference note",
  "description": "Plain text note with the case reference and region.",
  "showForCaseExport": true,
  "showForPortfolioExport": false,
  "parameters": [
    {
      "parameterName": "Region",
      "label": "Region",
      "isRequired": true,
      "parameterType": "List",
      "listValues": [
        { "displayName": "United States", "value": "US" },
        { "displayName": "United Kingdom", "value": "UK" },
        { "displayName": "Ireland", "value": "IE" }
      ]
    }
  ],
  "formats": [
    { "mimeType": "TextPlain_txt", "isDefault": true }
  ]
}

Response

200 OK with the updated template definition.

A template that already has file history cannot be turned into a package, and a template that is a member of a package cannot become a package itself.

Upload a new template file version

Adds a new version of the template file. Earlier versions are kept and can still be downloaded. The new file must be compatible with the template's existing parameters and formats. Requires ExportTemplates_Edit.

PUT

plain
/api/v4/exporttemplates/{publicId}/template

Request

json
{
  "fileName": "case-reference.txt",
  "contentBase64": "Q2FzZTogPDxDYXNlLkNhc2VSZWZlcmVuY2U+Pg=="
}

Response

200 OK with the updated template definition. The new file appears last in documentVersions.

Delete an export template

Deletes a template or package. Requires ExportTemplates_Delete.

DELETE

plain
/api/v4/exporttemplates/{publicId}

Response

200 OK with no body.


Discover tags and entities

Returns the data model you can use in a template: the tags available at the top level, and the tags available on each entity type. The response reflects your permissions and your organisation's custom fields, so it can differ between users and environments. Always use it rather than assuming a tag exists.

GET

plain
/api/v4/exporttemplates/meta

Reading the response

tags lists the top-level tags, such as Case. When a tag returns an entity, its entityType matches the type of an item in entities, where you will find that entity's own tags. Follow these links to build a path such as Case.Policy.FaceAmount.

FieldDescription
preferredNameThe name to use in a template.
aliasesOther names that also work. Omitted when there are none.
typeA friendly value type such as String, Decimal, Date or Boolean. Entity tags use their entity type instead.
isEnumerableThe tag returns a collection. Use functions such as First, Where or Sum, or iterate over it.
isEntityThe tag returns a single entity.
isEntityListThe tag returns a collection of entities.
entityTypeThe entity type to look up in entities.

Response

json
{
  "tags": [
    {
      "preferredName": "Case",
      "type": "Case",
      "isEntity": true,
      "entityType": "Case"
    },
    {
      "preferredName": "Portfolio",
      "type": "Portfolio",
      "isEntity": true,
      "entityType": "Portfolio"
    }
  ],
  "entities": [
    {
      "name": "Case",
      "type": "Case",
      "tags": [
        { "preferredName": "CaseReference", "aliases": ["Case Reference"], "type": "String" },
        { "preferredName": "Policy", "type": "Policy", "isEntity": true, "entityType": "Policy" },
        { "preferredName": "InsuredLives", "type": "InsuredLife", "isEnumerable": true, "isEntityList": true, "entityType": "InsuredLife" }
      ]
    },
    {
      "name": "Policy",
      "type": "Policy",
      "tags": [
        { "preferredName": "PolicyNumber", "type": "String" },
        { "preferredName": "FaceAmount", "type": "Decimal" }
      ]
    }
  ]
}

This example is abridged. A real response contains many more tags and entities.

Discover functions

Returns the functions you can use in tag expressions, with descriptions, examples and parameters.

GET

plain
/api/v4/exporttemplates/functions

Reading the response

FieldDescription
functionNameThe name to use in an expression.
descriptionWhat the function does.
exampleAn example expression.
isStaticThe function is called on its own rather than on a value.
isForEnumerableThe function operates on a collection.
returnTypeThe type the function returns.
returnIsCollectionThe function returns a collection.
returnDescriptionA description of the return value.
parametersThe function's parameters, each with name, ordinal, description, optional and multiple.
appliesToTypesThe value types the function can be called on. Omitted when it applies to any type.

As with metadata, false flags and empty values are omitted.

Response

json
[
  {
    "functionName": "Count",
    "description": "Returns the number of items contained in a collection, or zero if the collection is empty.",
    "example": "Case.InsuredLives.Count()",
    "isForEnumerable": true,
    "returnDescription": "The number of items contained in a collection, or zero if the collection is empty."
  },
  {
    "functionName": "SortBy",
    "description": "Sorts a collection, using a given set of sub-fields in a given direction.",
    "example": "Case.PremiumSchedules.SortBy(PricingDate, \"ASC\")",
    "isForEnumerable": true,
    "returnDescription": "The collection, sorted by the specified parameters.",
    "returnIsCollection": true,
    "parameters": [
      { "description": "Name of the sub-field to use for sorting the collection.", "ordinal": 0, "multiple": true, "name": "SortField" },
      { "optional": true, "description": "Whether the preceding sort is applied in ASC or DESC order. Defaults to ASC.", "ordinal": 1, "name": "AscOrDesc" }
    ]
  }
]

This example is abridged. A real response contains every available function.


Preview a template

Renders template content against a case or portfolio and returns the result without saving anything. Use it to check tag expressions while you write them, or to let an AI assistant test and refine a template. Requires ExportTemplates_View.

POST

plain
/api/v4/exporttemplates/preview
/api/v4/exporttemplates/preview?download=true

By default the result is returned as JSON, which is easy to inspect in code. Add ?download=true to receive the rendered file instead.

Request fields

FieldTypeDescription
executionModestringCase or Portfolio.
entityPublicIdGUIDThe public ID of the case or portfolio to run against.
contentTypestringText, Spreadsheet or Document.
textTemplatestringThe template text. Use with Text.
spreadsheetTemplateobjectA workbook described as JSON. Use with Spreadsheet.
documentBase64stringA DOCX file as base64. Use with Document.
documentFileNamestringOptional name for the DOCX file. Used as the download file name.
parametersarrayOptional parameter values, each with name, type and value.

Supply exactly one template field, matching contentType. Parameter values must match their type: numbers for Integer, Decimal, Currency and Percentage, an ISO date string for Date, and a string for Text and List. Reference a parameter in the template as $Name. The names Cases and Portfolio are reserved.

In Portfolio mode, the portfolio's cases are available to the template as $Cases. The portfolio must contain cases, you must have access to every case in it, and your normal reporting limit applies.

Example: text template

json
{
  "executionMode": "Case",
  "entityPublicId": "03644cd4-0406-4c22-8dd9-bd91d64b57b4",
  "contentType": "Text",
  "textTemplate": "Case <<Case.CaseReference>> prepared for <<$Recipient>>. Insured lives: <<Case.InsuredLives.Count()>>",
  "parameters": [
    { "name": "Recipient", "type": "Text", "value": "Investment Committee" }
  ]
}

Example: spreadsheet template

A spreadsheet is described as a list of worksheets, each with a list of cells. Each cell has an A1-style address and either a value or a formula. A value has a type of String, Number, Boolean or DateTime. Tag expressions go inside string values. Formatting is optional: fontName, fontSize, bold, italic, fontColor, fillColor, horizontalAlignment and numberFormat. Colours use #RRGGBB.

json
{
  "executionMode": "Case",
  "entityPublicId": "03644cd4-0406-4c22-8dd9-bd91d64b57b4",
  "contentType": "Spreadsheet",
  "spreadsheetTemplate": {
    "worksheets": [
      {
        "name": "Summary",
        "cells": [
          {
            "address": "A1",
            "value": { "type": "String", "value": "Case reference" },
            "formatting": { "bold": true, "fillColor": "#DDEBF7" }
          },
          {
            "address": "B1",
            "value": { "type": "String", "value": "<<Case.CaseReference>>" }
          },
          {
            "address": "A2",
            "value": { "type": "String", "value": "Face amount" },
            "formatting": { "bold": true, "fillColor": "#DDEBF7" }
          },
          {
            "address": "B2",
            "value": { "type": "String", "value": "<<Case.Policy.FaceAmount>>" },
            "formatting": { "numberFormat": "#,##0", "horizontalAlignment": "Right" }
          },
          {
            "address": "A3",
            "value": { "type": "String", "value": "Doubled" }
          },
          {
            "address": "B3",
            "formula": "B2*2",
            "formatting": { "numberFormat": "#,##0" }
          }
        ]
      }
    ]
  }
}

Example: Word document template

Send the DOCX file as base64. The value below is shortened for readability; send the complete encoded file.

json
{
  "executionMode": "Case",
  "entityPublicId": "03644cd4-0406-4c22-8dd9-bd91d64b57b4",
  "contentType": "Document",
  "documentFileName": "case-letter.docx",
  "documentBase64": "UEsDBBQABgAIAAAAIQDfpNJsWgEAACAFAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAAC...",
  "parameters": [
    { "name": "LetterDate", "type": "Date", "value": "2026-03-31" }
  ]
}

Example: portfolio template

json
{
  "executionMode": "Portfolio",
  "entityPublicId": "7c1e2f4a-5b6d-4e8f-9a0b-1c2d3e4f5a6b",
  "contentType": "Text",
  "textTemplate": "Cases: <<$Cases.Count()>>\nTotal face: <<$Cases.Sum($Case, $Case.Case.FaceAmount)>>"
}

Response

The JSON response always includes contentType, fileName and mimeType, plus one result field: text, spreadsheet or documentBase64. A text preview looks like this:

json
{
  "contentType": "Text",
  "fileName": "preview.txt",
  "mimeType": "text/plain",
  "text": "Case LS-10234 prepared for Investment Committee. Insured lives: 2"
}

A spreadsheet preview returns the rendered workbook in the same shape as the request. Formulas are kept, and formatting includes only the properties that are set.

json
{
  "contentType": "Spreadsheet",
  "fileName": "preview.xlsx",
  "mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
  "spreadsheet": {
    "worksheets": [
      {
        "name": "Summary",
        "cells": [
          {
            "address": "A1",
            "value": { "type": "String", "value": "Case reference" },
            "formatting": { "fontName": "Calibri", "fontSize": 11, "bold": true, "italic": false, "fontColor": "#000000", "fillColor": "#DDEBF7", "horizontalAlignment": "General" }
          },
          {
            "address": "B1",
            "value": { "type": "String", "value": "LS-10234" },
            "formatting": { "fontName": "Calibri", "fontSize": 11, "bold": false, "italic": false, "fontColor": "#000000", "horizontalAlignment": "General" }
          }
        ]
      }
    ]
  }
}

A document preview returns the rendered DOCX in documentBase64.

Downloading the rendered file

With ?download=true, the response is the rendered file instead of JSON: preview.txt for text, preview.xlsx for spreadsheets, and the supplied documentFileName (or preview.docx) for documents. This is the quickest way to open a preview in Excel or Word.

Limits

ItemLimit
Request size12,000,000 bytes
Text template1,000,000 characters
Parameters100
DOCX input4,000,000 bytes, 512 archive entries, 24,000,000 bytes uncompressed
Spreadsheet worksheets20
Spreadsheet cells20,000 in total
Spreadsheet rows and columnsRows 1 to 10,000 and columns 1 to 256
Spreadsheet formula8,192 characters
Rendered outputText 8,000,000 bytes, XLSX 16,000,000 bytes, DOCX 4,000,000 bytes

Errors

Errors are returned as application/problem+json with a short title and a detail message. Messages describe what is wrong with the request.

StatusMeaning
400 Bad RequestThe request is invalid, for example a missing field, an unsupported file type, invalid base64 or a file over 10 MiB. Validation errors list each failing field.
401 UnauthorizedThe API key is missing or invalid.
403 ForbiddenThe key's user lacks the required permission, or cannot access the case or portfolio.
404 Not FoundThe template, file version, case or portfolio does not exist.
409 ConflictA template with the same name already exists.
413 Payload Too LargeThe request body exceeds the size limit for the endpoint.
415 Unsupported Media TypeThe request body was not sent as application/json.
422 Unprocessable EntityA preview could not be rendered, or its output exceeded a limit.
429 Too Many RequestsRate limit reached. Wait and try again.
500 Internal Server ErrorAn unexpected error. Contact support if it persists.

Preview rendering failures use a problem type you can test for in code: urn:clearlife:clarinet:problem:export-template-execution when the template cannot be rendered, and urn:clearlife:clarinet:problem:export-template-output-limit when the output is too large.

json
{
  "type": "urn:clearlife:clarinet:problem:export-template-execution",
  "title": "Template execution failed",
  "status": 422,
  "detail": "A template tag could not be evaluated. Check referenced tags, parameter names, and value types."
}