Docs
/
/

Partials Management API reference

Complete reference documentation for the Partials resource.

Partials

#

Partials are reusable pieces of content you can use across your channel templates.

You can retrieve, update, and create partials as well as list all partials in a given environment. Partials are identified by their unique partial key.

List partials

#

List all partials for a given environment.

Endpoint

GET/v1/partials

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

PaginatedPartialResponse

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

entries

A list of entries.

content
string
Required

The partial content.

description
string

An arbitrary string attached to a partial object. Useful for adding notes about the partial for internal purposes. Maximum of 280 characters allowed.

environment
string

The slug of the environment in which the partial exists.

icon_name
string

The name of the icon to be used in the visual editor.

input_schema
object[]

The field types available for the partial.

inserted_at
string(date-time)
Required

The timestamp of when the partial was created.

key
string
Required

The unique key string for the partial object. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string
Required

A name for the partial. Must be at maximum 255 characters in length.

type
enum(string)
Required

The partial type. One of 'html', 'json', 'markdown', 'text'.

htmltextjsonmarkdown
updated_at
string(date-time)
Required

The timestamp of when the partial was last updated.

valid
boolean
Required

Whether the partial and its content are in a valid state.

visual_block_enabled
boolean

Indicates whether the partial can be used in the visual editor. Only applies to HTML partials.

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 a partial

#

Get a partial by its key.

Endpoint

GET/v1/partials/{partial_key}

Path parameters

partial_key
string

The key of the partial to retrieve.

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 partial is a reusable piece of content that can be used in a template.

content
string

The partial content.

description
string

An arbitrary string attached to a partial object. Useful for adding notes about the partial for internal purposes. Maximum of 280 characters allowed.

environment
string

The slug of the environment in which the partial exists.

icon_name
string

The name of the icon to be used in the visual editor.

input_schema
object[]

The field types available for the partial.

inserted_at
string(date-time)

The timestamp of when the partial was created.

key
string

The unique key string for the partial object. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string

A name for the partial. Must be at maximum 255 characters in length.

type
enum(string)

The partial type. One of 'html', 'json', 'markdown', 'text'.

htmltextjsonmarkdown
updated_at
string(date-time)

The timestamp of when the partial was last updated.

valid
boolean

Whether the partial and its content are in a valid state.

visual_block_enabled
boolean

Indicates whether the partial can be used in the visual editor. Only applies to HTML partials.

Upsert a partial

#

Updates a partial of a given key, or creates a new one if it does not yet exist.

Note: this endpoint only operates on partials in the “development” environment.

Endpoint

PUT/v1/partials/{partial_key}

Path parameters

partial_key
string

The key of the partial 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

partial
PartialRequest

A partial object with attributes to update or create a partial.

content
string
Required

The content of the partial.

description
string

The description of the partial.

icon_name
string

The name of the icon to be used in the visual editor. Only relevant when visual_block_enabled is true.

name
string
Required

The name of the partial.

type
enum(string)
Required

The type of the partial.

htmltextjsonmarkdown
visual_block_enabled
boolean

Indicates whether the partial can be used in the visual editor. Only applies to HTML partials.

Returns

WrappedPartialResponse

Wraps the Partial response under the partial key.

partial

A partial is a reusable piece of content that can be used in a template.

content
string

The partial content.

description
string

An arbitrary string attached to a partial object. Useful for adding notes about the partial for internal purposes. Maximum of 280 characters allowed.

environment
string

The slug of the environment in which the partial exists.

icon_name
string

The name of the icon to be used in the visual editor.

input_schema
object[]

The field types available for the partial.

inserted_at
string(date-time)

The timestamp of when the partial was created.

key
string

The unique key string for the partial object. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string

A name for the partial. Must be at maximum 255 characters in length.

type
enum(string)

The partial type. One of 'html', 'json', 'markdown', 'text'.

htmltextjsonmarkdown
updated_at
string(date-time)

The timestamp of when the partial was last updated.

valid
boolean

Whether the partial and its content are in a valid state.

visual_block_enabled
boolean

Indicates whether the partial can be used in the visual editor. Only applies to HTML partials.

Validate a partial

#

Validates a partial payload without persisting it.

Note: this endpoint only operates on partials in the “development” environment.

Endpoint

PUT/v1/partials/{partial_key}/validate

Path parameters

partial_key
string

The key of the partial 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

partial
PartialRequest

A partial object with attributes to update or create a partial.

content
string
Required

The content of the partial.

description
string

The description of the partial.

icon_name
string

The name of the icon to be used in the visual editor. Only relevant when visual_block_enabled is true.

name
string
Required

The name of the partial.

type
enum(string)
Required

The type of the partial.

htmltextjsonmarkdown
visual_block_enabled
boolean

Indicates whether the partial can be used in the visual editor. Only applies to HTML partials.

Returns

WrappedPartialResponse

Wraps the Partial response under the partial key.

partial

A partial is a reusable piece of content that can be used in a template.

content
string

The partial content.

description
string

An arbitrary string attached to a partial object. Useful for adding notes about the partial for internal purposes. Maximum of 280 characters allowed.

environment
string

The slug of the environment in which the partial exists.

icon_name
string

The name of the icon to be used in the visual editor.

input_schema
object[]

The field types available for the partial.

inserted_at
string(date-time)

The timestamp of when the partial was created.

key
string

The unique key string for the partial object. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string

A name for the partial. Must be at maximum 255 characters in length.

type
enum(string)

The partial type. One of 'html', 'json', 'markdown', 'text'.

htmltextjsonmarkdown
updated_at
string(date-time)

The timestamp of when the partial was last updated.

valid
boolean

Whether the partial and its content are in a valid state.

visual_block_enabled
boolean

Indicates whether the partial can be used in the visual editor. Only applies to HTML partials.

Partial

#

A partial is a reusable piece of content that can be used in a template.

Attributes

content
string

The partial content.

description
string

An arbitrary string attached to a partial object. Useful for adding notes about the partial for internal purposes. Maximum of 280 characters allowed.

environment
string

The slug of the environment in which the partial exists.

icon_name
string

The name of the icon to be used in the visual editor.

input_schema
object[]

The field types available for the partial.

inserted_at
string(date-time)

The timestamp of when the partial was created.

key
string

The unique key string for the partial object. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string

A name for the partial. Must be at maximum 255 characters in length.

type
enum(string)

The partial type. One of 'html', 'json', 'markdown', 'text'.

htmltextjsonmarkdown
updated_at
string(date-time)

The timestamp of when the partial was last updated.

valid
boolean

Whether the partial and its content are in a valid state.

visual_block_enabled
boolean

Indicates whether the partial can be used in the visual editor. Only applies to HTML partials.

New chat