Docs
/
/

Commits mAPI reference

Complete reference documentation for the Commits resource.

Commits

#

To version the changes you make in your environments, Knock uses a commit model. When you make changes to a workflow, a layout, or a translation, you will need to commit them in your development environment, then promote to subsequent environments before those changes will appear in the respective environments.

You can retrieve all commits in a given environment, or show the details of one single commit based on the target commit id.

List commits

#

Returns a paginated list of commits in a given environment. The commits are ordered from most recent first.

Endpoint

GET/v1/commits

Query parameters

environment
string

The environment slug. When omitted, the account's default environment is used.

branch
string

The slug of a branch to use. When environment is omitted, the branch is resolved from Development after the account default is injected. When environment is supplied, it must be "development".

promoted
boolean

Whether to show commits in the given environment that have not been promoted to the subsequent environment (false) or commits which have been promoted (true).

resource_type
2 possible types

Filter commits by resource type(s). Accepts a single type or array of types. Can be combined with resource_id to filter for specific resources.

resource_id
string

Filter commits by resource identifier. Must be used together with resource_type. For most resources, this will be the resource key. In the case of translations, this will be the locale code and namespace, separated by a /. For example, en/courses or en.

promote_group_id
string(uuid)

Filter commits to those created by a single promote. Every commit copied into an environment by the same promote shares one promote_group_id.

promoted_from_environment
string

Filter promoted commits by the slug of the environment or branch they were promoted from.

since
string(date-time)

Only return commits created at or after this RFC 3339 timestamp. Useful for catching up after missed webhooks.

until
string(date-time)

Only return commits created at or before this RFC 3339 timestamp.

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

PaginatedCommitResponse

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

entries

A list of entries.

author
CommitAuthor
Required

The author of the commit.

email
string
Required

The email address of the commit author.

name
string

The name of the commit author.

commit_message
string

The optional message about the commit.

created_at
string(date-time)
Required

The timestamp of when the commit was created.

environment
string
Required

The environment of the commit.

id
string(uuid)
Required

The unique identifier for the commit.

promote_group_id
string(uuid)
Required

The identifier of the promote that created this commit, shared by every commit copied into the environment by the same promote. Null if the commit was not created by a promote.

promoted_from_commit_id
string(uuid)
Required

The ID of the commit this commit was promoted from. Null if the commit was not created by a promote.

resource
CommitResource
Required

The resource object associated with the commit.

identifier
string
Required

The unique identifier for the resource.

type
enum(string)
Required

The type of the resource object.

audienceemail_layoutguidemessage_typepartialreusable_requesttranslationworkflow
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.

Commit all changes

#

Commit all changes across all resources in the given environment. When writes are limited to development, this endpoint accepts the development environment.

Endpoint

PUT/v1/commits

Query parameters

environment
string

The environment slug. When omitted, the account's default environment is used.

branch
string

The slug of a branch to use. When environment is omitted, the branch is resolved from Development after the account default is injected. When environment is supplied, it must be "development".

commit_message
string

An optional message to include in a commit.

allow_empty
boolean

When used with a single resource_type and resource_id, creates a new version with identical content and commits it if there are no unpublished changes.

resource_type
2 possible types

Filter changes to commit by resource type(s). Accepts a single type or array of types. Can be combined with resource_id to filter for specific resources.

resource_id
string

Filter changes to commit by resource identifier. Must be used together with resource_type.

Returns

CommitAllResponse

The response from committing all changes.

result
string

The result of the commit operation.

Get a commit

#

Retrieve a single commit by its ID.

Endpoint

GET/v1/commits/{id}

Path parameters

id
string(uuid)

The id of the commit to retrieve.

Returns

A commit is a change to a resource within an environment, made by an author.

author
CommitAuthor

The author of the commit.

email
string

The email address of the commit author.

name
string

The name of the commit author.

commit_message
string

The optional message about the commit.

created_at
string(date-time)

The timestamp of when the commit was created.

environment
string

The environment of the commit.

id
string(uuid)

The unique identifier for the commit.

promote_group_id
string(uuid)

The identifier of the promote that created this commit, shared by every commit copied into the environment by the same promote. Null if the commit was not created by a promote.

promoted_from_commit_id
string(uuid)

The ID of the commit this commit was promoted from. Null if the commit was not created by a promote.

resource
CommitResource

The resource object associated with the commit.

identifier
string

The unique identifier for the resource.

type
enum(string)

The type of the resource object.

audienceemail_layoutguidemessage_typepartialreusable_requesttranslationworkflow

Promote all changes

#

Promote all changes across all resources to the target environment from its preceding environment.

Endpoint

PUT/v1/commits/promote

Query parameters

to_environment
string

A slug of the target environment to which you want to promote all changes from its directly preceding environment.

For example, if you have three environments “development”, “staging”, and “production” (in that order), setting this param to “production” will promote all commits not currently in production from staging.

When this param is set to "development", the "branch" param must be provided.

branch
string

The slug of the branch to promote all changes from.

resource_type
2 possible types

Filter commits to promote by resource type(s). Accepts a single type or array of types. Can be combined with resource_id to filter for specific resources.

resource_id
string

Filter commits to promote by resource identifier. Must be used together with resource_type.

Returns

PromoteAllResponse

The response from promoting all changes.

promote_group

A summary of the promote, or null if there were no changes to promote.

result
string

The result of the promote operation.

Promote one commit

#

Promotes one change to the subsequent environment.

Endpoint

PUT/v1/commits/{id}/promote

Path parameters

id
string

The target commit ID to promote to the subsequent environment.

Returns

WrappedCommitResponse

Wraps the Commit response under the commit key.

commit

A commit is a change to a resource within an environment, made by an author.

author
CommitAuthor

The author of the commit.

email
string
Required

The email address of the commit author.

name
string

The name of the commit author.

commit_message
string

The optional message about the commit.

created_at
string(date-time)

The timestamp of when the commit was created.

environment
string

The environment of the commit.

id
string(uuid)

The unique identifier for the commit.

promote_group_id
string(uuid)

The identifier of the promote that created this commit, shared by every commit copied into the environment by the same promote. Null if the commit was not created by a promote.

promoted_from_commit_id
string(uuid)

The ID of the commit this commit was promoted from. Null if the commit was not created by a promote.

resource
CommitResource

The resource object associated with the commit.

identifier
string
Required

The unique identifier for the resource.

type
enum(string)
Required

The type of the resource object.

audienceemail_layoutguidemessage_typepartialreusable_requesttranslationworkflow
promote_group

A summary of a promote. Every commit copied into the destination environment by the same promote shares the group's ID, which you can use to list them with the promote_group_id filter on the list commits endpoint.

actor
object

The user who performed the promote.

email
string
name
string
commit_count
integer

The number of commits copied into the destination environment.

created_at
string(date-time)

The timestamp of when the promote happened.

id
string(uuid)

The unique identifier for the promote group.

source
string

The slug of the environment or branch the commits were promoted from.

source_type
enum(string)

Whether the source is an environment or a branch.

environmentbranch
to_environment
string

The slug of the environment the commits were promoted to.

Commit

#

A commit is a change to a resource within an environment, made by an author.

Attributes

author
CommitAuthor

The author of the commit.

email
string

The email address of the commit author.

name
string

The name of the commit author.

commit_message
string

The optional message about the commit.

created_at
string(date-time)

The timestamp of when the commit was created.

environment
string

The environment of the commit.

id
string(uuid)

The unique identifier for the commit.

promote_group_id
string(uuid)

The identifier of the promote that created this commit, shared by every commit copied into the environment by the same promote. Null if the commit was not created by a promote.

promoted_from_commit_id
string(uuid)

The ID of the commit this commit was promoted from. Null if the commit was not created by a promote.

resource
CommitResource

The resource object associated with the commit.

identifier
string

The unique identifier for the resource.

type
enum(string)

The type of the resource object.

audienceemail_layoutguidemessage_typepartialreusable_requesttranslationworkflow

PromoteGroup

#

A summary of a promote. Every commit copied into the destination environment by the same promote shares the group's ID, which you can use to list them with the promote_group_id filter on the list commits endpoint.

Attributes

actor
object

The user who performed the promote.

email
string
name
string
commit_count
integer

The number of commits copied into the destination environment.

created_at
string(date-time)

The timestamp of when the promote happened.

id
string(uuid)

The unique identifier for the promote group.

source
string

The slug of the environment or branch the commits were promoted from.

source_type
enum(string)

Whether the source is an environment or a branch.

environmentbranch
to_environment
string

The slug of the environment the commits were promoted to.

New chat