Skip to main content

Templates API (v0)

Download OpenAPI specification:Download

List_templates

Returns a list of IDs of the available templates.

Related methods:

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get_sample_data

Returns the sample data matching the template's data definition.

path Parameters
template
required
string

The ID of the template. To retrieve the ID, use the List templates method.

Responses

Response samples

Content type
application/json
{
  • "locale": "en_US",
  • "store_address": {
    },
  • "store_phone_number": "+1 123 456 7890",
  • "order_number": "GA0000000001",
  • "external_id": "GA-000-00000001",
  • "currency_code": "US",
  • "payment_method_label": "Credit Card",
  • "amounts": {
    },
  • "billing_address": {
    },
  • "instruments": [
    ]
}

Get_sample_data_documentation

Returns the template's data definition as an HTML table. The HTML table contains 3 columns: the name of the field, its description, and its type.

Related methods:

path Parameters
template
required
string

The ID of the template. To retrieve the ID, use the List templates method.

Responses

Preview_document

Renders the template with the provided data and style and returns the output. Use it to test your template during development.

path Parameters
template
required
string

The ID of the template. To retrieve the ID, use the List templates method.

Request Body schema: application/json
template
required
string non-empty

The template document.

data
required
object

The data to feed to the template.

style
string

An optional stylesheet to render the template with. This overrides the stylesheet specified in the template.

locale
string

The locale used to select the template according to language and region. Example: en_DE, de_DE, english, EN etc.

content_type
string
Default: "text"
Enum: "html" "text" "pdf"

The format of the generated content.

Responses

Request samples

Content type
application/json
{
  • "template": "<html><body><p>Name:{{name_var}}, Phone:{{phonenum_var}}</p></body></html>",
  • "data": {
    },
  • "locale": "en_US",
  • "content_type": "html"
}

Get_template

Returns the template. The format of the response depends on the template you used. Document and email templates return text/html content. Push notification template return JSON content.

path Parameters
locale
required
string

The accepted language|locale.

template
required
string

The ID of the template. To retrieve the ID, use the List templates method.

Responses

Update_template

Updates the template.

path Parameters
locale
required
string

The accepted language|locale.

template
required
string

The ID of the template. To retrieve the ID, use the List templates method.

Responses

List_styles

Gets the list of available styles.

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get_style

Returns the CSS code of the style.

path Parameters
style
required
string

The name of a style representing a CSS file.

Responses

Update_style

Updates the style.

path Parameters
style
required
string

The name of a style representing a CSS file.

Responses