Templates API (v0)
Download OpenAPI specification:Download
Response samples
- 200
{- "data": [
- {
- "id": "in_store_pickup_ready_email_subject"
}, - {
- "id": "in_store_pickup_ready_email"
}, - {
- "id": "sales_receipt"
}, - {
- "id": "invoice"
}, - {
- "id": "shipment_label"
}
]
}
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
- 200
{- "locale": "en_US",
- "store_address": {
- "name": "Mystore",
- "country_name": "United States",
- "country_code": "US",
- "city": "Boston",
- "zip_code": "W1F 9RF",
- "state": "",
- "address": "36 Beak St"
}, - "store_phone_number": "+1 123 456 7890",
- "order_number": "GA0000000001",
- "external_id": "GA-000-00000001",
- "currency_code": "US",
- "payment_method_label": "Credit Card",
- "amounts": {
- "shipping_and_handling": 10,
- "taxes": 10,
- "grand_total": 90,
- "sub_total": 70
}, - "billing_address": {
- "name": "Dr Mr John Christopher Doe Jr",
- "country_name": "Great Britain",
- "country_code": "GB",
- "city": "London",
- "zip_code": "FFF AAA",
- "address": "745 Atlantic Ave",
- "state": "",
- "email": "jdoe@example.com"
}, - "instruments": [
- {
- "instrument_id": "2efc6043-89fb-45bd-2e19-7ee558b5d316",
- "payment_provider": "stripe",
- "payment_method": "credit_card",
- "currency_code": "USD",
- "metadata": {
- "instrument_details": {
- "brand": "MasterCard"
}
}, - "amount": 60
}
]
}
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
- Payload
{- "template": "<html><body><p>Name:{{name_var}}, Phone:{{phonenum_var}}</p></body></html>",
- "data": {
- "name_var": "John Doe",
- "phonenum_var": "202-555-0109"
}, - "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. |