Developer tools
Management API

Management API

Learn more about the Knock management API for programmatically interacting with your Knock dashboard resources.

The Knock management API provides you with a programmatic way to interact with the resources you create and manage in your Knock dashboard, including workflows, templates, and translations. It's separate from the Knock API and only provides access to a limited subset of resources.

You can use the Knock management API to:

  • Create, update, and manage your Knock workflows and the notification templates within those workflows.
  • Create, update and manage your email layouts.
  • Create and manage the translations used by your notification templates.
  • Create, update, and manage your partials.
  • Commit and promote changes between your Knock environments.

View management API reference

Interacting with the management API

#

Knock provides a Node.js SDK for the management API. You can also use the CLI for easily interacting with the resources in your Knock account.

Use cases

#

Previewing templates

#

Using the management API, you can generate previews of the templates within your workflows. One example use case is providing a way for your users to customize the content of notifications sent through Knock.

To preview a template, you use the preview template endpoint exposed by the management API. This API endpoint accepts a workflow key, and a step reference (ref) for the step that contains the template you want to preview.

Using the endpoint, you pass through details about the recipient, actor, tenant, and any other data variables that are used within the template. The endpoint will return a JSON object with fully rendered template generated using the data you provided. It will be the same as previewing the template in the Knock dashboard.


Committing changes

#

You can commit and promote changes between your Knock environments using the management API. This includes empty commits, which let you publish a versioned resource without changing its content.

Targeted empty commit

#

Use PUT /v1/commits with allow_empty=true to create an empty commit for a single resource that has already been published and has no unpublished changes. You must specify both resource_type and resource_id.


See the commit all changes endpoint for the full list of query parameters.

Upsert with an empty commit

#

You can also create an empty commit when upserting a resource by passing commit=true and allow_empty=true as query parameters on the resource PUT route. This is useful when you re-upsert an unchanged resource payload and want to create a new commit log entry.

Query parameters:

  • allow_empty — Optional boolean. On PUT /v1/commits, requires a single resource_type and resource_id. On versioned resource PUT routes, use alongside commit=true.
  • commit_message — Optional message stored in commit audit metadata. Your account may require a commit message.

This pattern applies to PUT routes for workflows, partials, email layouts, guides, audiences, message types, and translations.

New chat