Docs
/
/

Email layouts Management API reference

Complete reference documentation for the Email layouts resource.

Email layouts

#

Email layouts wrap email message templates to share consistent design components between the email notifications that your recipients receive.

You can create and update email layouts in your development environment, as well as retrieve or list all layouts in a given environment.

List email layouts

#

Returns a paginated list of email layouts available in a given environment.

Endpoint

GET/v1/email_layouts

Query parameters

environment
string

The environment slug.

branch
string

The slug of a branch to use. This option can only be used when environment is "development".

annotate
boolean

Whether to annotate the resource. Only used in the Knock CLI.

hide_uncommitted_changes
boolean

Whether to hide uncommitted changes. When true, only committed changes will be returned. When false, both committed and uncommitted changes will be returned.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

limit
integer

The number of entries to fetch per-page.

Returns

PaginatedEmailLayoutResponse

A paginated list of EmailLayout. Contains a list of entries and page information.

A list of entries.

created_at
string(date-time)
Required

The timestamp of when the email layout was created.

environment
string

The environment of the email layout.

footer_links
object[]

A list of one or more items to show in the footer of the email layout.

text
string
Required

The text to display as the link.

url
string
Required

The URL to link to.

html_layout
string
Required

The complete HTML content of the email layout.

key
string
Required

The unique key for this email layout.

name
string
Required

The human-readable name of this email layout.

sha
string
Required

The SHA of the email layout.

text_layout
string
Required

The complete plaintext content of the email layout.

updated_at
string(date-time)

The timestamp of when the email layout was last updated.

page_info

The information about a paginated result.

after
string

The cursor to fetch entries after. Will only be present if there are more entries to fetch.

before
string

The cursor to fetch entries before. Will only be present if there are more entries to fetch before the current page.

page_size
integer

The number of entries to fetch per-page.

Get email layout

#

Retrieve an email layout by its key, in a given environment.

Endpoint

GET/v1/email_layouts/{email_layout_key}

Path parameters

email_layout_key
string

The key of the email layout to show.

Query parameters

environment
string

The environment slug.

branch
string

The slug of a branch to use. This option can only be used when environment is "development".

annotate
boolean

Whether to annotate the resource. Only used in the Knock CLI.

hide_uncommitted_changes
boolean

Whether to hide uncommitted changes. When true, only committed changes will be returned. When false, both committed and uncommitted changes will be returned.

Returns

A versioned email layout used within an environment.

created_at
string(date-time)

The timestamp of when the email layout was created.

environment
string

The environment of the email layout.

footer_links
object[]

A list of one or more items to show in the footer of the email layout.

text
string
Required

The text to display as the link.

url
string
Required

The URL to link to.

html_layout
string

The complete HTML content of the email layout.

key
string

The unique key for this email layout.

name
string

The human-readable name of this email layout.

sha
string

The SHA of the email layout.

text_layout
string

The complete plaintext content of the email layout.

updated_at
string(date-time)

The timestamp of when the email layout was last updated.

Upsert email layout

#

Updates an email layout, or creates a new one if it does not yet exist.

Note: this endpoint only operates in the "development" environment.

Endpoint

PUT/v1/email_layouts/{email_layout_key}

Path parameters

email_layout_key
string

The key of the email layout to upsert.

Query parameters

environment
string

The environment slug.

branch
string

The slug of a branch to use. This option can only be used when environment is "development".

annotate
boolean

Whether to annotate the resource. Only used in the Knock CLI.

commit
boolean

Whether to commit the resource at the same time as modifying it.

commit_message
string

The message to commit the resource with, only used if commit is true.

Request body

email_layout
EmailLayoutRequest

A request to update or create an email layout.

footer_links
object[]

A list of one or more items to show in the footer of the email layout.

text
string
Required

The text to display as the link.

url
string
Required

The URL to link to.

html_layout
string
Required

The complete HTML content of the email layout.

name
string
Required

The friendly name of this email layout.

text_layout
string
Required

The complete plain text content of the email layout.

Returns

WrappedEmailLayoutResponse

Wraps the EmailLayout response under the email_layout key.

email_layout

A versioned email layout used within an environment.

created_at
string(date-time)

The timestamp of when the email layout was created.

environment
string

The environment of the email layout.

footer_links
object[]

A list of one or more items to show in the footer of the email layout.

text
string
Required

The text to display as the link.

url
string
Required

The URL to link to.

html_layout
string

The complete HTML content of the email layout.

key
string

The unique key for this email layout.

name
string

The human-readable name of this email layout.

sha
string

The SHA of the email layout.

text_layout
string

The complete plaintext content of the email layout.

updated_at
string(date-time)

The timestamp of when the email layout was last updated.

Validate email layout

#

Validates an email layout payload without persisting it.

Note: this endpoint only operates in the "development" environment.

Endpoint

PUT/v1/email_layouts/{email_layout_key}/validate

Path parameters

email_layout_key
string

The key of the email layout to validate.

Query parameters

environment
string

The environment slug.

branch
string

The slug of a branch to use. This option can only be used when environment is "development".

Request body

email_layout
EmailLayoutRequest

A request to update or create an email layout.

footer_links
object[]

A list of one or more items to show in the footer of the email layout.

text
string
Required

The text to display as the link.

url
string
Required

The URL to link to.

html_layout
string
Required

The complete HTML content of the email layout.

name
string
Required

The friendly name of this email layout.

text_layout
string
Required

The complete plain text content of the email layout.

Returns

WrappedEmailLayoutResponse

Wraps the EmailLayout response under the email_layout key.

email_layout

A versioned email layout used within an environment.

created_at
string(date-time)

The timestamp of when the email layout was created.

environment
string

The environment of the email layout.

footer_links
object[]

A list of one or more items to show in the footer of the email layout.

text
string
Required

The text to display as the link.

url
string
Required

The URL to link to.

html_layout
string

The complete HTML content of the email layout.

key
string

The unique key for this email layout.

name
string

The human-readable name of this email layout.

sha
string

The SHA of the email layout.

text_layout
string

The complete plaintext content of the email layout.

updated_at
string(date-time)

The timestamp of when the email layout was last updated.

EmailLayout

#

A versioned email layout used within an environment.

Attributes

created_at
string(date-time)

The timestamp of when the email layout was created.

environment
string

The environment of the email layout.

footer_links
object[]

A list of one or more items to show in the footer of the email layout.

text
string
Required

The text to display as the link.

url
string
Required

The URL to link to.

html_layout
string

The complete HTML content of the email layout.

key
string

The unique key for this email layout.

name
string

The human-readable name of this email layout.

sha
string

The SHA of the email layout.

text_layout
string

The complete plaintext content of the email layout.

updated_at
string(date-time)

The timestamp of when the email layout was last updated.

New chat