Import a template from HTML
POST
/api/templates/import
const url = 'https://api.usegro.co/api/templates/import';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"name":"example","html":"example","subject":"example","preheader":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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 }}.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Media typeapplication/json
object
name
required
string
html
required
string
subject
string
preheader
string
Example generated
{ "name": "example", "html": "example", "subject": "example", "preheader": "example"}Responses
Section titled “Responses”Media typeapplication/json
object
data
object
data
required
object
id
required
string
name
required
string
created_at
string
updated_at
string
account_id
required
string
background_color
string
type
required
string
description
string
preview_image
string
metric_id
string
is_transactional
required
boolean
template_json
object
id
string
name
string
layouts
Array<object>
object
id
string
type
string
order
number
styles
object
backgroundImageGenerate
backgroundPosition
columns
Array<object>
object
id
string
blocks
Array<object>
object
id
string
type
string
order
number
props
One of:
object
type
string
content
string
object
type
string
src
string
alt
string
object
type
string
text
string
href
string
object
type
string
src
string
alt
string
object
type
string
height
number
object
type
string
code
string
object
type
string
items
One of:
string
Array<object>
object
id
string
platform
string
url
string
object
type
string
html
string
object
type
string
items
One of:
string
Array<object>
object
id
string
label
string
url
string
object
type
string
object
type
string
repeat
condition
repeat
condition
globalStyles
object
savedColors
One of:
string
Array<string>
design
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
body
string
colours
Array<string>
pageBackground
string
origin
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" } }}