Skip to content

Import a template from HTML

POST
/api/templates/import
curl --request POST \
--url https://api.usegro.co/api/templates/import \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <X-API-Key>' \
--data '{ "name": "example", "html": "example", "subject": "example", "preheader": "example" }'

Saves a full HTML email (for example one exported from Stripo) as an email template. The HTML is kept as one HTML block, with CSS inlined. An unsubscribe footer is added when the HTML has no {{ unsubscribe_link }}.

Media typeapplication/json
object
name
required
string
>= 1 characters <= 255 characters
html
required
string
>= 1 characters <= 5000000 characters
subject
string
<= 998 characters
preheader
string
<= 500 characters

Example generated

{
"name": "example",
"html": "example",
"subject": "example",
"preheader": "example"
}
Media typeapplication/json
object
data
object
data
required
object
id
required
string
name
required
string
created_at
string
nullable
updated_at
string
nullable
account_id
required
string
background_color
string
nullable
type
required
string
Allowed values: html drag_drop simple plain_text
description
string
nullable
preview_image
string
nullable
metric_id
string
nullable
is_transactional
required
boolean
template_json
object
id
string
name
string
layouts
Array<object>
object
id
string
type
string
Allowed values: 1-col 2-col 3-col
order
number
styles
object
borderColor
One of:
string
backgroundColor
One of:
string
sectionBackgroundColor
One of:
string
backgroundImage
One of:
string
backgroundImageGenerate
One of:
string
backgroundImageTarget
One of:
string
backgroundSize
One of:
string
backgroundPosition
One of:
string
paddingTop
One of:
string
paddingRight
One of:
string
paddingBottom
One of:
string
paddingLeft
One of:
string
borderRadiusTopLeft
One of:
string
borderRadiusTopRight
One of:
string
borderRadiusBottomRight
One of:
string
borderRadiusBottomLeft
One of:
string
verticalAlignment
One of:
string
borderWidth
One of:
string
borderStyle
One of:
string
columnBackgroundColor
One of:
string
columnBorderWidth
One of:
string
columnBorderColor
One of:
string
columnBorderRadius
One of:
string
columnGap
One of:
string
columns
Array<object>
object
id
string
blocks
Array<object>
object
id
string
type
string
Allowed values: discount text button unsubscribe image product logo spacer divider social-links html menu
order
number
props
One of:
object
type
string
Allowed values: text
content
string
fontSize
One of:
string
fontFamily
One of:
string
paddingTop
One of:
string
paddingRight
One of:
string
paddingBottom
One of:
string
paddingLeft
One of:
string
alignment
One of:
string
headingFontFamily
One of:
string
lineHeight
One of:
string
deviceVisibility
One of:
string
repeat
One of:
string
condition
One of:
string
linkedBlockId
One of:
string
width
One of:
string
span
One of:
string
repeat
One of:
string
stackOnMobile
One of:
string
columnWidthPreset
One of:
string
condition
One of:
string
linkedLayoutId
One of:
string
globalStyles
object
textColor
One of:
string
backgroundColor
One of:
string
fontFamily
One of:
string
headingFontFamily
One of:
string
contentWidth
One of:
string
linkColor
One of:
string
marginTop
One of:
string
subject
One of:
string
preheader
One of:
string
savedColors
One of:
string
design
One of:
string
isPlainText
One of:
string
plainTextContent
One of:
string
createdAt
One of:
string
updatedAt
One of:
string
design_meta
object
tags
Array<string>
contents
object
products
number
blocks
object
images
object
filled
number
generating
number
placeholders
number
layouts
object
sections
number
features
Array<string>
fonts
object
heading
string
nullable
body
string
nullable
colours
Array<string>
pageBackground
string
nullable
origin
One of:
string
declared
One of:
string
transactional_status
One of:
string
nullable

Example

{
"data": {
"data": {
"type": "html",
"template_json": {
"layouts": [
{
"type": "1-col",
"styles": {
"backgroundImageTarget": "content",
"backgroundSize": "auto",
"backgroundPosition": "top left",
"verticalAlignment": "top",
"borderStyle": "solid"
},
"columns": [
{
"blocks": [
{
"type": "discount",
"props": {
"type": "text",
"alignment": "left",
"deviceVisibility": "all"
},
"condition": {
"operator": "equals"
}
}
]
}
],
"condition": {
"operator": "equals"
}
}
],
"design": {
"imagery": "generated"
}
},
"design_meta": {
"origin": {
"source": "gro_agent"
},
"declared": {
"imagery": "generated"
}
},
"transactional_status": "pending"
}
}
}