API

Complete reference documentation for the Knock API.

The Knock API enables you to add a complete notification engine to your product. This API provides programmatic access to integrating Knock via a REST-ful API.

Client libraries

Knock offers native SDKs in several popular programming languages:

API keys

Knock authenticates your API requests using your account's API keys. API requests made without authentication or using an incorrect key will return a 401 error. Requests using a valid key but with insufficient permissions will return a 403 error.

You can view and manage your API keys in the Developer Dashboard. There are two types of API keys:

  • Publishable keys are only meant to identify your account with Knock. They aren't secret, and can safely be made public in any of your client-side code. Publishable keys are prefixed with pk_*.

  • Secret keys can perform any API request to Knock, they should be kept secure and private! Be sure to prevent secret keys from being made publicly accessible, such as in client-side code, GitHub, unsecured S3 buckets, and so forth. Secret keys are prefixed with sk_*.

Each Environment in your account has both a publishable and secret key pair. API requests will be scoped to the provided key's Environment.

Authentication

You must pass your API key to Knock as a Bearer token using the Authorization header.

Rate limits

Each endpoint in the Knock API is rate limited. Knock uses a tier system to determine the rate limit scale for each endpoint. When your request has been rate limited, the Knock API will return a 429 Too Many Requests error in response.

Knock's default behavior scopes rate limits based on the authorizing credential used in your requests. When you use a public or private API key to authorize a request, Knock will scope the rate limit for each endpoint by the environment associated with the key. If you use a signed user token as your authorizing credential, Knock will scope the rate limit by both the key's environment and the signing user. See our guide on enhanced security mode for more details on working with signed user tokens.

If you're concerned about exceeding a Knock rate limit, please contact us and we can help figure out a usage rate that's right for your specific needs.

ScaleLimit
Tier 11 request / second
Tier 25 requests / second
Tier 360 requests / second
Tier 4200 requests / second
Tier 51,000 requests / second

Batch and bulk endpoint deduplication rate limits

Knock's batch and bulk endpoints may also have an additional layer of rate limiting applied. For these cases, Knock will also limit the number of times you can update a specific entity over a given scale. These limits are in place to prevent too many duplicate modifications applied to the same set of entities.

When you exceed a batch deduplication rate limit, Knock will still return a success (2xx) response if it is able to handle the request. For any entities not updated due to a rate limit hit, Knock will return the data as it exists at request time. Knock will also include an x-ratelimited-{param} header. The {param} value will be the name of the request param within which the rate limit was applied. The value will be a comma-delimited string of the param values that were rejected due to a rate limit hit.

Knock can apply batch deduplication rate limits to all or part of a request. If Knock rejects a subset of your batch, you can expect to see the full set of requested entities in the response body, and the IDs of those that were rejected in the x-ratelimited-{param} header.

ScaleLimit
Batch Tier 11 update / second / entity

Idempotent requests

Knock supports idempotency so that requests can be retried safely without unintended side effects.

To perform an idempotent request, set an Idempotency-Key header on your request. This idempotency key is a unique value that you generate for each request. It is used to identify and prevent the duplicate processing of requests. If you retry a request with the same idempotency key within 24 hours from the original request, Knock will return the same response as the original request. You may use any string up to 255 characters in length as an idempotency key.

Idempotency keys can be random UUIDs, or they can have some meaning in your application. For example, if you are sending a notification after a user has placed an order, you could use a key that is a combination of the reason for the notification, the user ID, and the order ID (e.g. order-placed:user-123:order-456). If your user then cancels the order, you could use an idempotency key like order-cancelled:user-123:order-456. This will ensure each type of notification is only sent once, even if your system retries the request multiple times.

If you are making calls to Knock from a job queue, the ID of the job can be a good choice for an idempotency key. If the job fails and is retried, the same idempotency key will be used.

Supported endpoints

Data retention

Several V1 API endpoints return data that is subject to deletion according to the data retention policy associated with your account. These endpoints are tagged with the Retention policy applied badge.

For more information, see the data retention docs.

Bulk endpoints

Knock exposes several endpoints that enqueue and return a BulkOperation. These endpoints perform their logic asynchronously, and you use the BulkOperation record to track progress.

In some cases, a bulk endpoint will accept a large set of entities to perform some action upon. In others, a bulk endpoint will accept a set of filter parameters and then execute an action across a large set of data on your account.

See the Bulk operations section for more information on parsing and polling bulk operation statuses.

Trigger data filtering

Some V1 API endpoints that return lists of message data accept a trigger_data parameter. Knock uses this parameter to scope results it returns down to messages generated with the trigger data you provide.

The trigger data that Knock filters against is the combined and truncated data from the time the message was generated.

If a batch step preceded the creation of your message, the trigger data available for filtering will be the combined data for all the workflow triggers bundled into your batch. If a fetch step preceded, then the filterable data will include any data pulled in via the fetch step request.

Knock truncates trigger data for filtering to ensure it can efficiently process your request. The current data truncation rules are:

  • Nested data structures (objects and arrays) are removed. Trigger data for filtering will be a JSON object with a single level of key-value pairs.
  • Supported values are the JSON scalars string, number, boolean, and null.
  • String values are limited to 256 characters in length. Strings that exceed this limit are truncated to the maximum.

Pagination

All top-level API resources expose support for bulk fetches via a list method. For instance, you can list users, list objects in a collection, and list subscriptions.

Resources that return multiple entities support the same cursor-based pagination to interact with the resources, using after, before, and page_size parameters as well as returning a common format for the metadata associated with the page.

Query parameters

afterstring
The pagination cursor to fetch items after. Usually derived from the after cursor in `PageInfo`.
beforestring
The pagination cursor to fetch items before. Usually derived from the before cursor in `PageInfo`.
page_sizenumber (optional)
A number between 1 and 50 that represents the number of items to return in the response. Defaults to 50.

Response format

entriesobject[]
A list of items contained in this response
page_infoPageInfo
Metadata about the page of data returned

PageInfo response details

afterstring
The cursor to use to fetch items after the last item in the list. May be null when there are no other items to retrieve.
beforestring
The cursor to use to fetch items before the first item in the list. May be null when there are no other items to retrieve.
page_sizenumber
The maximum number of items requested in the page
total_countnumber
The total number of items in this resource (up-to 10,000)

Errors

Knock uses standard HTTP response codes to indicate the success or failure of your API requests.

  • 2xx success status codes confirm that your request worked as expected.

  • 4xx error status codes indicate an error caused by incorrect or missing request information (e.g. providing an incorrect API key).

  • 5xx error status codes indicate a Knock server error.

Error codes

Here's a list of common

4xx

error codes you may encounter while working with the Knock API. We also provide additional context on how to resolve them.
actor_missingYou called a workflow with an actor that has not yet been identified in Knock. To resolve, identify the actor prior to passing their ID in a workflow trigger.
api_key_expiredYour API key has expired. You can regenerate one on the developers page of the Knock dashboard.
api_key_missingThe API key you provided is invalid.
authentication_requiredThis endpoint requires authentication. Check the Authentication section of this API reference for more information.
channel_invalidThe channel you supplied in this request is invalid. A common cause of this error is that the channel you're referencing has not yet been configured in the current environment.
incorrect_token_typeYou cannot call this endpoint with this token.
invalid_paramsThe parameters supplied in your request were invalid. Check the payload you're sending to Knock to make sure it's valid.
invalid_user_tokenThe user token supplied is invalid.
missing_jwt_signing_key

Your request needs a JWT signing key. You can learn more about JWT signing keys in our client authentication docs.

missing_user_token

This environment requires that you supply a `X-Knock-User-Token` header when using a public API key. You can learn more in our client authentication docs.

workflow_inactive

The workflow you attempted to invoke is marked with an inactive status. To resolve this error, activate the workflow on its page in the dashboard.

workflow_missingThe workflow you attempted to invoke could not be found. To resolve this error, confirm that you're calling the correct environment and that your workflow has been committed to it.

Workflows

Workflow orchestrates the delivery of messages to your end users. When you configure a workflow you'll determine which channels its messages should route to, what those messages should look like on each channel, as well as any functions—batch, throttle, delay—you want applied to the messages prior to delivery.

To send notifications, you’ll trigger your workflows. A workflow is triggered by a trigger call, typically when an event occurs in your product that you want your users to know about (e.g. a new comment.)

Trigger workflow

Trigger a workflow (specified by the key) to run for the given recipients, using the parameters provided. Returns an identifier for the workflow run request. All workflow runs are executed asynchronously. This endpoint also handles inline identifications for the actor, recipient, and tenant fields.

Endpoint

POST/v1/workflows/{key}/trigger

Rate limit

Tier 5

Path parameters

key
string

Key of the workflow to trigger.

Request body

A map of properties describing a user or an object to identify in Knock and mark as who or what performed the action.

cancellation_key
string

An optional key that is used to reference a specific workflow trigger request when issuing a workflow cancellation request. Must be provided while triggering a workflow in order to enable subsequent cancellation. Should be unique across trigger requests to avoid unintentional cancellations.

data
object(any)

An optional map of data to pass into the workflow execution.

recipientsRequired

The recipients to trigger the workflow for. Can inline identify users, objects, or use a list of user IDs. Limited to 1,000 recipients.

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

Returns

TriggerWorkflowResponse

The response from triggering a workflow.

workflow_run_id
string(uuid)

This value allows you to track individual messages associated with this trigger request.

Cancel workflow

When invoked for a workflow using a specific workflow key and cancellation key, will cancel any queued workflow runs associated with that key/cancellation key pair. Can optionally be provided one or more recipients to scope the request to.

Endpoint

POST/v1/workflows/{key}/cancel

Rate limit

Tier 5

Path parameters

key
string

The key of the workflow to cancel.

Request body

cancellation_key
string
Required

An optional key that is used to reference a specific workflow trigger request when issuing a workflow cancellation request. Must be provided while triggering a workflow in order to enable subsequent cancellation. Should be unique across trigger requests to avoid unintentional cancellations.

A list of recipients to cancel the notification for. If omitted, cancels for all recipients associated with the cancellation key.

Returns

EmptyContentResponse

A 204 No Content response.

Get message

Retrieves a specific message by its ID.

Endpoint

GET/v1/messages/{message_id}

Rate limit

Tier 4

Path parameters

message_id
string

The unique identifier for the message.

Returns

Represents a single message that was generated by a workflow for a given channel.

__typename
string

The typename of the schema.

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.

archived_at
string(date-time)

Timestamp when the message was archived.

channel_id
string(uuid)

The ID for the channel the message was sent through.

clicked_at
string(date-time)

Timestamp when the message was clicked.

data
object(any)

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

engagement_statuses
enum(string)[]

A list of engagement statuses.

seenreadinteractedlink_clickedarchived
id
string

The unique identifier for the message.

inserted_at
string(date-time)

Timestamp when the resource was created.

interacted_at
string(date-time)

Timestamp when the message was interacted with.

link_clicked_at
string(date-time)

Timestamp when a link in the message was clicked.

metadata
object(any)

The metadata associated with the message.

read_at
string(date-time)

Timestamp when the message was read.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

scheduled_at
string(date-time)

Timestamp when the message was scheduled to be sent.

seen_at
string(date-time)

Timestamp when the message was seen.

source
object

The workflow that triggered the message.

__typename
string
categories
string[]

The categories associated with the message.

key
string

The key of the workflow that triggered the message.

version_id
string(uuid)

The ID of the version of the workflow that triggered the message.

status
enum(string)

The message delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
tenant
string

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The key of the workflow that generated the message.

Get message content

Returns the fully rendered contents of a message, where the response depends on which channel the message was sent through.

Endpoint

GET/v1/messages/{message_id}/content

Rate limit

Tier 4

Path parameters

message_id
string

The ID of the message to fetch contents of.

Returns

MessageContents

The content of a message.

__typename
string

The typename of the schema.

data
5 possible types

Content data specific to the channel type.

inserted_at
string(date-time)

Timestamp when the message content was created.

message_id
string

The unique identifier for the message content.

List messages

Returns a paginated list of messages for the current environment.

Endpoint

GET/v1/messages

Rate limit

Tier 4

Query parameters

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

tenant
string

Limits the results to items with the corresponding tenant.

channel_id
string

Limits the results to items with the corresponding channel ID.

status[]
enum(string)[]

Limits the results to messages with the given delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
engagement_status[]
enum(string)[]

Limits the results to messages with the given engagement status.

seenreadinteractedlink_clickedarchived
message_ids[]
string[]

Limits the results to only the message IDs given (max 50). Note: when using this option, the results will be subject to any other filters applied to the query.

workflow_categories[]
string[]

Limits the results to messages related to any of the provided categories.

source
string

Limits the results to messages triggered by the given workflow key.

workflow_run_id
string(uuid)

Limits the results to messages associated with the top-level workflow run ID returned by the workflow trigger request.

workflow_recipient_run_id
string(uuid)

Limits the results to messages for a specific recipient's workflow run.

trigger_data
string

Limits the results to only messages that were generated with the given data. See trigger data filtering for more information.

inserted_at.gte
string

Limits the results to messages inserted after or on the given date.

inserted_at.lte
string

Limits the results to messages inserted before or on the given date.

inserted_at.gt
string

Limits the results to messages inserted after the given date.

inserted_at.lt
string

Limits the results to messages inserted before the given date.

Returns

ListMessagesResponse

A paginated list of messages.

entries

A list of messages.

__typename
string

The typename of the schema.

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.

archived_at
string(date-time)

Timestamp when the message was archived.

channel_id
string(uuid)

The ID for the channel the message was sent through.

clicked_at
string(date-time)

Timestamp when the message was clicked.

data
object(any)

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

engagement_statuses
enum(string)[]

A list of engagement statuses.

seenreadinteractedlink_clickedarchived
id
string

The unique identifier for the message.

inserted_at
string(date-time)

Timestamp when the resource was created.

interacted_at
string(date-time)

Timestamp when the message was interacted with.

link_clicked_at
string(date-time)

Timestamp when a link in the message was clicked.

metadata
object(any)

The metadata associated with the message.

read_at
string(date-time)

Timestamp when the message was read.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

scheduled_at
string(date-time)

Timestamp when the message was scheduled to be sent.

seen_at
string(date-time)

Timestamp when the message was seen.

source
object

The workflow that triggered the message.

__typename
string
Required
categories
string[]
Required

The categories associated with the message.

key
string
Required

The key of the workflow that triggered the message.

version_id
string(uuid)
Required

The ID of the version of the workflow that triggered the message.

status
enum(string)

The message delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
tenant
string

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The key of the workflow that generated the message.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

List events

Returns a paginated list of events for the specified message.

Endpoint

GET/v1/messages/{message_id}/events

Rate limit

Tier 3

Path parameters

message_id
string

The ID of the message to fetch events for.

Query parameters

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Returns

ListMessageEventsResponse

Returns a paginated list of delivery and engagement events for the specified message.

A list of message events.

__typename
string
Required

The typename of the schema.

data
object(any)

The data associated with the message event. Only present for some event types.

id
string
Required

The unique identifier for the message event.

inserted_at
string(date-time)
Required

Timestamp when the event was created.

recipient
2 possible types
Required

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

type
enum(string)
Required

The type of event that occurred.

message.archivedmessage.bouncedmessage.deliveredmessage.delivery_attemptedmessage.interactedmessage.link_clickedmessage.not_sentmessage.queuedmessage.readmessage.seenmessage.sentmessage.unarchivedmessage.undeliveredmessage.unreadmessage.unseen
page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

List delivery logs

Returns a paginated list of delivery logs for the specified message.

Endpoint

GET/v1/messages/{message_id}/delivery_logs

Rate limit

Tier 3

Path parameters

message_id
string

The ID of the message to fetch delivery logs for.

Query parameters

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Returns

ListMessageDeliveryLogsResponse

A message delivery log response.

Returns a paginated list of delivery logs from the downstream provider for the specified message. For Knock in-app channels, the delivery logs will always be an empty list.

__typename
string
Required

The typename of the schema.

environment_id
string(uuid)
Required

The ID of the environment in which the message delivery occurred.

id
string
Required

The unique identifier for the message delivery log.

inserted_at
string
Required

Timestamp when the message delivery log was created.

request
MessageDeliveryLogRequest
Required

A message delivery log request.

body
2 possible types

The body content that was sent with the request.

headers
object(any)

The headers that were sent with the request.

host
string

The host to which the request was sent.

method
enum(string)

The HTTP method used for the request.

GETPOSTPUTDELETEPATCH
path
string

The path of the URL that was requested.

query
string

The query string of the URL that was requested.

response
MessageDeliveryLogResponse
Required

A message delivery log response.

body
2 possible types

The body content that was received with the response.

headers
object(any)

The headers that were received with the response.

status
integer

The HTTP status code of the response.

service_name
string
Required

The name of the service that processed the delivery.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

List activities

Returns a paginated list of activities for the specified message.

Endpoint

GET/v1/messages/{message_id}/activities

Rate limit

Tier 4

Path parameters

message_id
string

The ID of the message to fetch activities for.

Query parameters

trigger_data
string

The trigger data to filter activities by.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Returns

ListActivitiesResponse

Returns a paginated list of activities associated with a given message. For messages produced after a batch step, this will contain one or more activities. Non-batched messages will always return a single activity.

A list of activities.

__typename
string

The typename of the schema.

The actor who performed the activity.

data
object(any)

The workflow trigger data payload associated with the activity.

id
string

Unique identifier for the activity.

inserted_at
string(date-time)

Timestamp when the activity was created.

recipient
2 possible types

A recipient of a notification, which is either a user or an object.

updated_at
string(date-time)

Timestamp when the activity was last updated.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Mark message as seen

Marks a message as seen. This indicates that the user has viewed the message in their feed or inbox. Read more about message engagement statuses here.

Endpoint

PUT/v1/messages/{message_id}/seen

Rate limit

Tier 2

Path parameters

message_id
string

The unique identifier for the message.

Returns

Represents a single message that was generated by a workflow for a given channel.

__typename
string

The typename of the schema.

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.

archived_at
string(date-time)

Timestamp when the message was archived.

channel_id
string(uuid)

The ID for the channel the message was sent through.

clicked_at
string(date-time)

Timestamp when the message was clicked.

data
object(any)

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

engagement_statuses
enum(string)[]

A list of engagement statuses.

seenreadinteractedlink_clickedarchived
id
string

The unique identifier for the message.

inserted_at
string(date-time)

Timestamp when the resource was created.

interacted_at
string(date-time)

Timestamp when the message was interacted with.

link_clicked_at
string(date-time)

Timestamp when a link in the message was clicked.

metadata
object(any)

The metadata associated with the message.

read_at
string(date-time)

Timestamp when the message was read.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

scheduled_at
string(date-time)

Timestamp when the message was scheduled to be sent.

seen_at
string(date-time)

Timestamp when the message was seen.

source
object

The workflow that triggered the message.

__typename
string
categories
string[]

The categories associated with the message.

key
string

The key of the workflow that triggered the message.

version_id
string(uuid)

The ID of the version of the workflow that triggered the message.

status
enum(string)

The message delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
tenant
string

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The key of the workflow that generated the message.

Mark message as unseen

Marks a message as unseen. This reverses the seen state. Read more about message engagement statuses here.

Endpoint

DELETE/v1/messages/{message_id}/seen

Rate limit

Tier 2

Path parameters

message_id
string

The unique identifier for the message.

Returns

Represents a single message that was generated by a workflow for a given channel.

__typename
string

The typename of the schema.

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.

archived_at
string(date-time)

Timestamp when the message was archived.

channel_id
string(uuid)

The ID for the channel the message was sent through.

clicked_at
string(date-time)

Timestamp when the message was clicked.

data
object(any)

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

engagement_statuses
enum(string)[]

A list of engagement statuses.

seenreadinteractedlink_clickedarchived
id
string

The unique identifier for the message.

inserted_at
string(date-time)

Timestamp when the resource was created.

interacted_at
string(date-time)

Timestamp when the message was interacted with.

link_clicked_at
string(date-time)

Timestamp when a link in the message was clicked.

metadata
object(any)

The metadata associated with the message.

read_at
string(date-time)

Timestamp when the message was read.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

scheduled_at
string(date-time)

Timestamp when the message was scheduled to be sent.

seen_at
string(date-time)

Timestamp when the message was seen.

source
object

The workflow that triggered the message.

__typename
string
categories
string[]

The categories associated with the message.

key
string

The key of the workflow that triggered the message.

version_id
string(uuid)

The ID of the version of the workflow that triggered the message.

status
enum(string)

The message delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
tenant
string

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The key of the workflow that generated the message.

Mark message as read

Marks a message as read. This indicates that the user has read the message content. Read more about message engagement statuses here.

Endpoint

PUT/v1/messages/{message_id}/read

Rate limit

Tier 2

Path parameters

message_id
string

The unique identifier for the message.

Returns

Represents a single message that was generated by a workflow for a given channel.

__typename
string

The typename of the schema.

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.

archived_at
string(date-time)

Timestamp when the message was archived.

channel_id
string(uuid)

The ID for the channel the message was sent through.

clicked_at
string(date-time)

Timestamp when the message was clicked.

data
object(any)

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

engagement_statuses
enum(string)[]

A list of engagement statuses.

seenreadinteractedlink_clickedarchived
id
string

The unique identifier for the message.

inserted_at
string(date-time)

Timestamp when the resource was created.

interacted_at
string(date-time)

Timestamp when the message was interacted with.

link_clicked_at
string(date-time)

Timestamp when a link in the message was clicked.

metadata
object(any)

The metadata associated with the message.

read_at
string(date-time)

Timestamp when the message was read.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

scheduled_at
string(date-time)

Timestamp when the message was scheduled to be sent.

seen_at
string(date-time)

Timestamp when the message was seen.

source
object

The workflow that triggered the message.

__typename
string
categories
string[]

The categories associated with the message.

key
string

The key of the workflow that triggered the message.

version_id
string(uuid)

The ID of the version of the workflow that triggered the message.

status
enum(string)

The message delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
tenant
string

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The key of the workflow that generated the message.

Mark message as unread

Marks a message as unread. This reverses the read state. Read more about message engagement statuses here.

Endpoint

DELETE/v1/messages/{message_id}/read

Rate limit

Tier 2

Path parameters

message_id
string

The unique identifier for the message.

Returns

Represents a single message that was generated by a workflow for a given channel.

__typename
string

The typename of the schema.

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.

archived_at
string(date-time)

Timestamp when the message was archived.

channel_id
string(uuid)

The ID for the channel the message was sent through.

clicked_at
string(date-time)

Timestamp when the message was clicked.

data
object(any)

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

engagement_statuses
enum(string)[]

A list of engagement statuses.

seenreadinteractedlink_clickedarchived
id
string

The unique identifier for the message.

inserted_at
string(date-time)

Timestamp when the resource was created.

interacted_at
string(date-time)

Timestamp when the message was interacted with.

link_clicked_at
string(date-time)

Timestamp when a link in the message was clicked.

metadata
object(any)

The metadata associated with the message.

read_at
string(date-time)

Timestamp when the message was read.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

scheduled_at
string(date-time)

Timestamp when the message was scheduled to be sent.

seen_at
string(date-time)

Timestamp when the message was seen.

source
object

The workflow that triggered the message.

__typename
string
categories
string[]

The categories associated with the message.

key
string

The key of the workflow that triggered the message.

version_id
string(uuid)

The ID of the version of the workflow that triggered the message.

status
enum(string)

The message delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
tenant
string

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The key of the workflow that generated the message.

Mark message as interacted

Marks a message as interacted with by the user. This can include any user action on the message, with optional metadata about the specific interaction. Cannot include more than 5 key-value pairs, must not contain nested data. Read more about message engagement statuses here.

Endpoint

PUT/v1/messages/{message_id}/interacted

Rate limit

Tier 2

Path parameters

message_id
string

The unique identifier for the message.

Request body

metadata
object(any)

Metadata about the interaction.

Returns

Represents a single message that was generated by a workflow for a given channel.

__typename
string

The typename of the schema.

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.

archived_at
string(date-time)

Timestamp when the message was archived.

channel_id
string(uuid)

The ID for the channel the message was sent through.

clicked_at
string(date-time)

Timestamp when the message was clicked.

data
object(any)

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

engagement_statuses
enum(string)[]

A list of engagement statuses.

seenreadinteractedlink_clickedarchived
id
string

The unique identifier for the message.

inserted_at
string(date-time)

Timestamp when the resource was created.

interacted_at
string(date-time)

Timestamp when the message was interacted with.

link_clicked_at
string(date-time)

Timestamp when a link in the message was clicked.

metadata
object(any)

The metadata associated with the message.

read_at
string(date-time)

Timestamp when the message was read.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

scheduled_at
string(date-time)

Timestamp when the message was scheduled to be sent.

seen_at
string(date-time)

Timestamp when the message was seen.

source
object

The workflow that triggered the message.

__typename
string
categories
string[]

The categories associated with the message.

key
string

The key of the workflow that triggered the message.

version_id
string(uuid)

The ID of the version of the workflow that triggered the message.

status
enum(string)

The message delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
tenant
string

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The key of the workflow that generated the message.

Archive message

Archives a message for the user. Archived messages are hidden from the default message list in the feed but can still be accessed and unarchived later.

Endpoint

PUT/v1/messages/{message_id}/archived

Rate limit

Tier 2

Path parameters

message_id
string

The unique identifier for the message.

Returns

Represents a single message that was generated by a workflow for a given channel.

__typename
string

The typename of the schema.

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.

archived_at
string(date-time)

Timestamp when the message was archived.

channel_id
string(uuid)

The ID for the channel the message was sent through.

clicked_at
string(date-time)

Timestamp when the message was clicked.

data
object(any)

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

engagement_statuses
enum(string)[]

A list of engagement statuses.

seenreadinteractedlink_clickedarchived
id
string

The unique identifier for the message.

inserted_at
string(date-time)

Timestamp when the resource was created.

interacted_at
string(date-time)

Timestamp when the message was interacted with.

link_clicked_at
string(date-time)

Timestamp when a link in the message was clicked.

metadata
object(any)

The metadata associated with the message.

read_at
string(date-time)

Timestamp when the message was read.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

scheduled_at
string(date-time)

Timestamp when the message was scheduled to be sent.

seen_at
string(date-time)

Timestamp when the message was seen.

source
object

The workflow that triggered the message.

__typename
string
categories
string[]

The categories associated with the message.

key
string

The key of the workflow that triggered the message.

version_id
string(uuid)

The ID of the version of the workflow that triggered the message.

status
enum(string)

The message delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
tenant
string

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The key of the workflow that generated the message.

Unarchive message

Removes a message from the archived state, making it visible in the default message list in the feed again.

Endpoint

DELETE/v1/messages/{message_id}/archived

Rate limit

Tier 2

Path parameters

message_id
string

The unique identifier for the message.

Returns

Represents a single message that was generated by a workflow for a given channel.

__typename
string

The typename of the schema.

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.

archived_at
string(date-time)

Timestamp when the message was archived.

channel_id
string(uuid)

The ID for the channel the message was sent through.

clicked_at
string(date-time)

Timestamp when the message was clicked.

data
object(any)

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

engagement_statuses
enum(string)[]

A list of engagement statuses.

seenreadinteractedlink_clickedarchived
id
string

The unique identifier for the message.

inserted_at
string(date-time)

Timestamp when the resource was created.

interacted_at
string(date-time)

Timestamp when the message was interacted with.

link_clicked_at
string(date-time)

Timestamp when a link in the message was clicked.

metadata
object(any)

The metadata associated with the message.

read_at
string(date-time)

Timestamp when the message was read.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

scheduled_at
string(date-time)

Timestamp when the message was scheduled to be sent.

seen_at
string(date-time)

Timestamp when the message was seen.

source
object

The workflow that triggered the message.

__typename
string
categories
string[]

The categories associated with the message.

key
string

The key of the workflow that triggered the message.

version_id
string(uuid)

The ID of the version of the workflow that triggered the message.

status
enum(string)

The message delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
tenant
string

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The key of the workflow that generated the message.

Batch get message contents

Get the contents of multiple messages in a single request.

Endpoint

GET/v1/messages/batch/content

Rate limit

Tier 4

Query parameters

message_ids[]
string[]

The IDs of the messages to fetch contents of.

Returns

BatchGetMessageContentsResponse

A list of MessageContents

Mark messages as seen

Marks the given messages as seen. This indicates that the user has viewed the message in their feed or inbox. Read more about message engagement statuses here.

Endpoint

POST/v1/messages/batch/seen

Rate limit

Tier 3

Request body

message_ids
string[]
Required

The message IDs to update the status of.

Returns

BatchListMessagesResponse

The list of messages that were updated.

Mark messages as unseen

Marks the given messages as unseen. This reverses the seen state. Read more about message engagement statuses here.

Endpoint

POST/v1/messages/batch/unseen

Rate limit

Tier 3

Request body

message_ids
string[]
Required

The message IDs to update the status of.

Returns

BatchListMessagesResponse

The list of messages that were updated.

Mark messages as read

Marks the given messages as read. Read more about message engagement statuses here.

Endpoint

POST/v1/messages/batch/read

Rate limit

Tier 3

Request body

message_ids
string[]
Required

The message IDs to update the status of.

Returns

BatchListMessagesResponse

The list of messages that were updated.

Mark messages as unread

Marks the given messages as unread. This reverses the read state. Read more about message engagement statuses here.

Endpoint

POST/v1/messages/batch/unread

Rate limit

Tier 3

Request body

message_ids
string[]
Required

The message IDs to update the status of.

Returns

BatchListMessagesResponse

The list of messages that were updated.

Mark messages as interacted

Marks the given messages as interacted with by the user. This can include any user action on the message, with optional metadata about the specific interaction. Cannot include more than 5 key-value pairs, must not contain nested data. Read more about message engagement statuses here.

Endpoint

POST/v1/messages/batch/interacted

Rate limit

Tier 3

Request body

message_ids
string[]
Required

The message IDs to batch mark as interacted with.

metadata
object(any)

Metadata about the interaction.

Returns

BatchListMessagesResponse

The list of messages that were updated.

Mark messages as archived

Marks the given messages as archived. Archived messages are hidden from the default message list in the feed but can still be accessed and unarchived later.

Endpoint

POST/v1/messages/batch/archived

Rate limit

Tier 3

Request body

message_ids
string[]
Required

The message IDs to update the status of.

Returns

BatchListMessagesResponse

The list of messages that were updated.

Mark messages as unarchived

Marks the given messages as unarchived. This reverses the archived state. Archived messages are hidden from the default message list in the feed but can still be accessed and unarchived later.

Endpoint

POST/v1/messages/batch/unarchived

Rate limit

Tier 3

Request body

message_ids
string[]
Required

The message IDs to update the status of.

Returns

BatchListMessagesResponse

The list of messages that were updated.

List activities

Returns a paginated list of activities for the specified message.

Endpoint

GET/v1/messages/{message_id}/activities

Rate limit

Tier 4

Path parameters

message_id
string

The ID of the message to fetch activities for.

Query parameters

trigger_data
string

The trigger data to filter activities by.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Returns

ListActivitiesResponse

Returns a paginated list of activities associated with a given message. For messages produced after a batch step, this will contain one or more activities. Non-batched messages will always return a single activity.

A list of activities.

__typename
string

The typename of the schema.

The actor who performed the activity.

data
object(any)

The workflow trigger data payload associated with the activity.

id
string

Unique identifier for the activity.

inserted_at
string(date-time)

Timestamp when the activity was created.

recipient
2 possible types

A recipient of a notification, which is either a user or an object.

updated_at
string(date-time)

Timestamp when the activity was last updated.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Message

Represents a single message that was generated by a workflow for a given channel.

Attributes

__typename
string

The typename of the schema.

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.

archived_at
string(date-time)

Timestamp when the message was archived.

channel_id
string(uuid)

The ID for the channel the message was sent through.

clicked_at
string(date-time)

Timestamp when the message was clicked.

data
object(any)

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

engagement_statuses
enum(string)[]

A list of engagement statuses.

seenreadinteractedlink_clickedarchived
id
string

The unique identifier for the message.

inserted_at
string(date-time)

Timestamp when the resource was created.

interacted_at
string(date-time)

Timestamp when the message was interacted with.

link_clicked_at
string(date-time)

Timestamp when a link in the message was clicked.

metadata
object(any)

The metadata associated with the message.

read_at
string(date-time)

Timestamp when the message was read.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

scheduled_at
string(date-time)

Timestamp when the message was scheduled to be sent.

seen_at
string(date-time)

Timestamp when the message was seen.

source
object

The workflow that triggered the message.

__typename
string
categories
string[]

The categories associated with the message.

key
string

The key of the workflow that triggered the message.

version_id
string(uuid)

The ID of the version of the workflow that triggered the message.

status
enum(string)

The message delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
tenant
string

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The key of the workflow that generated the message.

Activity

An activity associated with a workflow trigger request. Messages produced after a batch step can be associated with one or more activities. Non-batched messages will always be associated with a single activity.

Attributes

__typename
string

The typename of the schema.

The actor who performed the activity.

data
object(any)

The workflow trigger data payload associated with the activity.

id
string

Unique identifier for the activity.

inserted_at
string(date-time)

Timestamp when the activity was created.

recipient
2 possible types

A recipient of a notification, which is either a user or an object.

updated_at
string(date-time)

Timestamp when the activity was last updated.

MessageDeliveryLog

A message delivery log contains a request from Knock to a downstream provider and the response that was returned.

Attributes

__typename
string

The typename of the schema.

environment_id
string(uuid)

The ID of the environment in which the message delivery occurred.

id
string

The unique identifier for the message delivery log.

inserted_at
string

Timestamp when the message delivery log was created.

request
MessageDeliveryLogRequest

A message delivery log request.

body
2 possible types

The body content that was sent with the request.

headers
object(any)

The headers that were sent with the request.

host
string

The host to which the request was sent.

method
enum(string)

The HTTP method used for the request.

GETPOSTPUTDELETEPATCH
path
string

The path of the URL that was requested.

query
string

The query string of the URL that was requested.

response
MessageDeliveryLogResponse

A message delivery log response.

body
2 possible types

The body content that was received with the response.

headers
object(any)

The headers that were received with the response.

status
integer

The HTTP status code of the response.

service_name
string

The name of the service that processed the delivery.

MessageEvent

A message event. Occurs when a message delivery or engagement status changes.

Attributes

__typename
string

The typename of the schema.

data
object(any)

The data associated with the message event. Only present for some event types.

id
string

The unique identifier for the message event.

inserted_at
string(date-time)

Timestamp when the event was created.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

type
enum(string)

The type of event that occurred.

message.archivedmessage.bouncedmessage.deliveredmessage.delivery_attemptedmessage.interactedmessage.link_clickedmessage.not_sentmessage.queuedmessage.readmessage.seenmessage.sentmessage.unarchivedmessage.undeliveredmessage.unreadmessage.unseen

Channels

A Channel is a delivery method for a message.

Bulk

Bulk operations available for messages of a given channel.

Bulk update message statuses for channel

Bulk update the status of messages for a specific channel. The channel is specified by the channel_id parameter. The action to perform is specified by the action parameter, where the action is a status change action (e.g. archive, unarchive).

Endpoint

POST/v1/channels/{channel_id}/messages/bulk/{action}

Rate limit

Tier 2

Path parameters

channel_id
string(uuid)

The ID of the channel to update messages for.

action
enum(string)

The target status to be applied to the messages.

seenunseenreadunreadarchivedunarchivedinteractedarchiveunarchivedelete

Request body

archived
enum(string)

Limits the results to messages with the given archived status.

excludeincludeonly
delivery_status
enum(string)

Limits the results to messages with the given delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
engagement_status
enum(string)

Limits the results to messages with the given engagement status.

seenunseenreadunreadarchivedunarchivedlink_clickedinteracted
has_tenant
boolean

Limits the results to messages that have a tenant or not.

newer_than
string(date-time)

Limits the results to messages inserted after the given date.

older_than
string(date-time)

Limits the results to messages inserted before the given date.

recipient_ids
string[]

Limits the results to messages with the given recipient IDs.

tenants
string[]

Limits the results to messages with the given tenant IDs.

trigger_data
string

Limits the results to only messages that were generated with the given data. See trigger data filtering for more information.

workflows
string[]

Limits the results to messages with the given workflow keys.

Returns

A bulk operation entity.

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

Get user

Retrieve a specific user by their ID.

Endpoint

GET/v1/users/{user_id}

Rate limit

Tier 4

Path parameters

user_id
string

The ID of the user to retrieve.

Returns

A User represents an individual in your system who can receive notifications through Knock. Users are the most common recipients of notifications and are always referenced by your internal identifier.

__typename
string

The typename of the schema.

avatar
string

URL to the user's avatar image.

created_at
string(date-time)

The creation date of the user from your system.

email
string

The primary email address for the user.

id
string

The ID for the user that you set when identifying them in Knock.

name
string

Display name of the user.

phone_number
string

The E.164 phone number of the user (required for SMS channels).

timezone
string

The timezone of the user. Must be a valid tz database time zone string. Used for recurring schedules.

updated_at
string(date-time)

The timestamp when the resource was last updated.

*
object(any)

Any additional custom properties.

List users

Retrieve a paginated list of users in the environment. Defaults to 50 users per page.

Endpoint

GET/v1/users

Rate limit

Tier 4

Query parameters

include[]
enum(string)[]

Associated resources to include in the response.

preferences
after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Returns

ListUsersResponse

A paginated list of users.

entries

A list of users.

__typename
string
Required

The typename of the schema.

avatar
string

URL to the user's avatar image.

created_at
string(date-time)

The creation date of the user from your system.

email
string

The primary email address for the user.

id
string
Required

The ID for the user that you set when identifying them in Knock.

name
string

Display name of the user.

phone_number
string

The E.164 phone number of the user (required for SMS channels).

timezone
string

The timezone of the user. Must be a valid tz database time zone string. Used for recurring schedules.

updated_at
string(date-time)
Required

The timestamp when the resource was last updated.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Identify user

Create or update a user with the provided identification data. When you identify an existing user, the system merges the properties you specific with what is currently set on the user, updating only the fields included in your requests.

Endpoint

PUT/v1/users/{user_id}

Rate limit

Tier 3

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

Request body

avatar
string

URL to the user's avatar image.

Channel-specific information that's needed to deliver a notification to an end provider.

created_at
string(date-time)

The creation date of the user from your system.

email
string

The primary email address for the user.

locale
string

The locale of the user. Used for message localization.

name
string

Display name of the user.

phone_number
string

The E.164 phone number of the user (required for SMS channels).

A set of preferences for the user.

timezone
string

The timezone of the user. Must be a valid tz database time zone string. Used for recurring schedules.

*
object(any)

Any additional custom properties.

Returns

A User represents an individual in your system who can receive notifications through Knock. Users are the most common recipients of notifications and are always referenced by your internal identifier.

__typename
string

The typename of the schema.

avatar
string

URL to the user's avatar image.

created_at
string(date-time)

The creation date of the user from your system.

email
string

The primary email address for the user.

id
string

The ID for the user that you set when identifying them in Knock.

name
string

Display name of the user.

phone_number
string

The E.164 phone number of the user (required for SMS channels).

timezone
string

The timezone of the user. Must be a valid tz database time zone string. Used for recurring schedules.

updated_at
string(date-time)

The timestamp when the resource was last updated.

*
object(any)

Any additional custom properties.

Merge users

Merge two users together, where the user specified with the from_user_id param will be merged into the user specified by user_id.

Endpoint

POST/v1/users/{user_id}/merge

Rate limit

Tier 2

Path parameters

user_id
string

The id of the user to merge into.

Request body

from_user_id
string
Required

The user ID to merge from.

Returns

A User represents an individual in your system who can receive notifications through Knock. Users are the most common recipients of notifications and are always referenced by your internal identifier.

__typename
string

The typename of the schema.

avatar
string

URL to the user's avatar image.

created_at
string(date-time)

The creation date of the user from your system.

email
string

The primary email address for the user.

id
string

The ID for the user that you set when identifying them in Knock.

name
string

Display name of the user.

phone_number
string

The E.164 phone number of the user (required for SMS channels).

timezone
string

The timezone of the user. Must be a valid tz database time zone string. Used for recurring schedules.

updated_at
string(date-time)

The timestamp when the resource was last updated.

*
object(any)

Any additional custom properties.

Delete user

Permanently delete a user and all associated data.

Endpoint

DELETE/v1/users/{user_id}

Rate limit

Tier 2

Path parameters

user_id
string

The ID of the user to delete.

Returns

EmptyContentResponse

A 204 No Content response.

List user messages

Returns a paginated list of messages for a specific user. Allows filtering by message status and provides various sorting options. Messages outside the account's retention window will not be included in the results.

Endpoint

GET/v1/users/{user_id}/messages

Rate limit

Tier 4

Path parameters

user_id
string

The user ID to list messages for.

Query parameters

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

tenant
string

Limits the results to items with the corresponding tenant.

channel_id
string

Limits the results to items with the corresponding channel ID.

status[]
enum(string)[]

Limits the results to messages with the given delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
engagement_status[]
enum(string)[]

Limits the results to messages with the given engagement status.

seenreadinteractedlink_clickedarchived
message_ids[]
string[]

Limits the results to only the message IDs given (max 50). Note: when using this option, the results will be subject to any other filters applied to the query.

workflow_categories[]
string[]

Limits the results to messages related to any of the provided categories.

source
string

Limits the results to messages triggered by the given workflow key.

workflow_run_id
string(uuid)

Limits the results to messages associated with the top-level workflow run ID returned by the workflow trigger request.

workflow_recipient_run_id
string(uuid)

Limits the results to messages for a specific recipient's workflow run.

trigger_data
string

Limits the results to only messages that were generated with the given data. See trigger data filtering for more information.

inserted_at.gte
string

Limits the results to messages inserted after or on the given date.

inserted_at.lte
string

Limits the results to messages inserted before or on the given date.

inserted_at.gt
string

Limits the results to messages inserted after the given date.

inserted_at.lt
string

Limits the results to messages inserted before the given date.

Returns

ListMessagesResponse

A paginated list of messages.

entries

A list of messages.

__typename
string

The typename of the schema.

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.

archived_at
string(date-time)

Timestamp when the message was archived.

channel_id
string(uuid)

The ID for the channel the message was sent through.

clicked_at
string(date-time)

Timestamp when the message was clicked.

data
object(any)

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

engagement_statuses
enum(string)[]

A list of engagement statuses.

seenreadinteractedlink_clickedarchived
id
string

The unique identifier for the message.

inserted_at
string(date-time)

Timestamp when the resource was created.

interacted_at
string(date-time)

Timestamp when the message was interacted with.

link_clicked_at
string(date-time)

Timestamp when a link in the message was clicked.

metadata
object(any)

The metadata associated with the message.

read_at
string(date-time)

Timestamp when the message was read.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

scheduled_at
string(date-time)

Timestamp when the message was scheduled to be sent.

seen_at
string(date-time)

Timestamp when the message was seen.

source
object

The workflow that triggered the message.

__typename
string
Required
categories
string[]
Required

The categories associated with the message.

key
string
Required

The key of the workflow that triggered the message.

version_id
string(uuid)
Required

The ID of the version of the workflow that triggered the message.

status
enum(string)

The message delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
tenant
string

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The key of the workflow that generated the message.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

List user schedules

Returns a paginated list of schedules for a specific user, in descending order.

Endpoint

GET/v1/users/{user_id}/schedules

Rate limit

Tier 4

Path parameters

user_id
string

The user ID to list schedules for.

Query parameters

workflow
string

The workflow key to filter schedules for.

tenant
string

The tenant ID to filter schedules for.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Returns

ListSchedulesResponse

A response containing a list of schedules.

entries

A list of schedules.

__typename
string

The typename of the schema.

A map of properties describing a user or an object to identify in Knock and mark as who or what performed the action.

data
object(any)

An optional map of data to pass into the workflow execution.

id
string(uuid)
Required

Unique identifier for the schedule.

inserted_at
string(date-time)
Required

Timestamp when the resource was created.

last_occurrence_at
string(date-time)

The last occurrence of the schedule.

next_occurrence_at
string(date-time)

The next occurrence of the schedule.

recipient
2 possible types
Required

A recipient of a notification, which is either a user or an object.

repeatsRequired

The repeat rule for the schedule.

__typename
string
Required

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)
Required

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

tenant
string

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

updated_at
string(date-time)
Required

The timestamp when the resource was last updated.

workflow
string
Required

The workflow the schedule is applied to.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

List user subscriptions

Retrieves a paginated list of subscriptions for a specific user, in descending order.

Endpoint

GET/v1/users/{user_id}/subscriptions

Rate limit

Tier 4

Path parameters

user_id
string

The user ID to list subscriptions for.

Query parameters

include[]
enum(string)[]

Associated resources to include in the response.

preferences
objects[]
string[]

Only returns subscriptions for the specified object GIDs.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Returns

ListSubscriptionsResponse

A response containing a list of subscriptions.

A list of subscriptions.

__typename
string
Required

The typename of the schema.

inserted_at
string(date-time)
Required

Timestamp when the resource was created.

objectRequired

A custom Object entity which belongs to a collection.

__typename
string
Required

The typename of the schema.

collection
string
Required

The collection this object belongs to.

created_at
string(date-time)

Timestamp when the resource was created.

id
string
Required

Unique identifier for the object.

updated_at
string(date-time)
Required

The timestamp when the resource was last updated.

properties
object(any)

The custom properties associated with the subscription relationship.

recipient
2 possible types
Required

A recipient of a notification, which is either a user or an object.

updated_at
string(date-time)
Required

The timestamp when the resource was last updated.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

List user preference sets

Retrieves a list of all preference sets for a specific user.

Endpoint

GET/v1/users/{user_id}/preferences

Rate limit

Tier 4

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

Returns

ListUserPreferenceSetsResponse

A list of preference sets for the user.

Get user preference set

Retrieves a specific preference set for a user identified by the preference set ID.

Endpoint

GET/v1/users/{user_id}/preferences/{id}

Rate limit

Tier 4

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

id
string

Unique identifier for the preference set.

Query parameters

tenant
string

The unique identifier for the tenant.

Returns

A preference set represents a specific set of notification preferences for a recipient. A recipient can have multiple preference sets.

categories
PreferenceSetCategories

An object where the key is the category and the values are the preference settings for that category.

An object where the key is the channel type and the values are the preference settings for that channel type.

id
string

Unique identifier for the preference set.

workflows
PreferenceSetWorkflows

An object where the key is the workflow key and the values are the preference settings for that workflow.

Update user preference set

Updates a complete preference set for a user. This is a destructive operation that will replace the existing preference set for the user.

Endpoint

PUT/v1/users/{user_id}/preferences/{id}

Rate limit

Tier 3

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

id
string

Unique identifier for the preference set.

Request body

categories
PreferenceSetRequestCategories

An object where the key is the category and the values are the preference settings for that category.

An object where the key is the channel type and the values are the preference settings for that channel type.

workflows
PreferenceSetRequestWorkflows

An object where the key is the workflow key and the values are the preference settings for that workflow.

Returns

A preference set represents a specific set of notification preferences for a recipient. A recipient can have multiple preference sets.

categories
PreferenceSetCategories

An object where the key is the category and the values are the preference settings for that category.

An object where the key is the channel type and the values are the preference settings for that channel type.

id
string

Unique identifier for the preference set.

workflows
PreferenceSetWorkflows

An object where the key is the workflow key and the values are the preference settings for that workflow.

Get channel data

Retrieves the channel data for a specific user and channel ID.

Endpoint

GET/v1/users/{user_id}/channel_data/{channel_id}

Rate limit

Tier 4

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

channel_id
string(uuid)

The unique identifier for the channel.

Returns

Channel data for a given channel type.

__typename
string

The typename of the schema.

channel_id
string(uuid)

The unique identifier for the channel.

data
5 possible types

Channel data for a given channel type.

provider
enum(string)

The type of provider.

push_fcmpush_apnspush_expopush_one_signalchat_slackchat_ms_teamschat_discordhttp_knock_webhook

Set channel data

Updates or creates channel data for a specific user and channel ID.

Endpoint

PUT/v1/users/{user_id}/channel_data/{channel_id}

Rate limit

Tier 3

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

channel_id
string(uuid)

The unique identifier for the channel.

Request body

data
5 possible types
Required

Channel data for a given channel type.

Returns

Channel data for a given channel type.

__typename
string

The typename of the schema.

channel_id
string(uuid)

The unique identifier for the channel.

data
5 possible types

Channel data for a given channel type.

provider
enum(string)

The type of provider.

push_fcmpush_apnspush_expopush_one_signalchat_slackchat_ms_teamschat_discordhttp_knock_webhook

Unset channel data

Deletes channel data for a specific user and channel ID.

Endpoint

DELETE/v1/users/{user_id}/channel_data/{channel_id}

Rate limit

Tier 3

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

channel_id
string(uuid)

The unique identifier for the channel.

Returns

EmptyContentResponse

A 204 No Content response.

Feeds

A feed exposes the messages delivered to an in-app feed channel, formatted specially to be consumed in a notification feed.

A feed will always return a list of FeedItems, which are pointers to a message delivered and contain all of the information needed in order to render an item within a notification feed.

Note: feeds are a specialized form of messages that are designed purely for in-app rendering, and as such return information that is required on the client to do so

List feed items

Returns a paginated list of feed items for a user, including metadata about the feed.

Endpoint

GET/v1/users/{user_id}/feeds/{id}

Rate limit

Tier 2

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

id
string(uuid)

The unique identifier for the channel.

Query parameters

status
enum(string)

The status of the feed items.

unreadreadunseenseenall
source
string

The source of the feed items.

tenant
string

The tenant associated with the feed items.

has_tenant
boolean

Whether the feed items have a tenant.

workflow_categories[]
string[]

The workflow categories of the feed items.

archived
enum(string)

The archived status of the feed items.

excludeincludeonly
trigger_data
string

The trigger data of the feed items (as a JSON string).

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Returns

UserInAppFeedResponse

A paginated list of feed items.

entries
InAppFeedItem[]

The list of feed items in the user's feed.

__typename
string
Required

The typename of the schema.

activitiesRequired

List of activities associated with this feed item.

__typename
string

The typename of the schema.

The actor who performed the activity.

data
object(any)

The workflow trigger data payload associated with the activity.

id
string

Unique identifier for the activity.

inserted_at
string(date-time)

Timestamp when the activity was created.

recipient
2 possible types

A recipient of a notification, which is either a user or an object.

updated_at
string(date-time)

Timestamp when the activity was last updated.

actorsRequired

List of actors associated with this feed item.

archived_at
string

Timestamp when the feed item was archived.

blocks
object[]
Required

Content blocks that make up the feed item.

clicked_at
string

Timestamp when the feed item was clicked.

data
object(any)
Required

Additional data associated with the feed item.

id
string
Required

Unique identifier for the feed.

inserted_at
string
Required

Timestamp when the resource was created.

interacted_at
string

Timestamp when the feed item was interacted with.

link_clicked_at
string

Timestamp when a link within the feed item was clicked.

read_at
string

Timestamp when the feed item was marked as read.

seen_at
string

Timestamp when the feed item was marked as seen.

source
object
Required

Source information for the feed item.

__typename
string
Required

The typename of the schema.

categories
string[]
Required

Categories this workflow belongs to.

key
string
Required

The key of the workflow.

version_id
string(uuid)
Required

The workflow version ID.

tenant
string
Required

Tenant ID that the feed item belongs to.

total_activities
integer
Required

Total number of activities related to this feed item.

total_actors
integer
Required

Total number of actors related to this feed item.

updated_at
string
Required

The timestamp when the resource was last updated.

meta
object

The metadata for the user's feed.

__typename
string

The typename of the schema.

total_count
integer

The total number of feed items in the user's feed.

unread_count
integer

The number of unread feed items in the user's feed.

unseen_count
integer

The number of unseen feed items in the user's feed.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

vars
object(any)

Additional variables for the feed item.

Get feed settings

Returns the feed settings for a user.

Endpoint

GET/v1/users/{user_id}/feeds/{id}/settings

Rate limit

Tier 4

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

id
string(uuid)

The unique identifier for the channel.

Returns

UserInAppFeedSettingsResponse

The response for the user's feed settings.

features
object

Features configuration for the user's feed.

branding_required
boolean

Whether branding is required for the user's feed.

List guides

Returns a list of eligible in-app guides for a specific user and channel.

Endpoint

GET/v1/users/{user_id}/guides/{channel_id}

Rate limit

Tier 2

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

channel_id
string(uuid)

The unique identifier for the channel.

Query parameters

tenant
string

The tenant ID to use for targeting and rendering guides.

data
string

The data (JSON encoded object) to use for targeting and rendering guides.

type
string

The type of guides to filter by.

Returns

GuidesResponse

A response for a list of guides.

guides
object[]

A list of guides.

content
string

The content of the guide.

id
string(uuid)

The unique identifier for the guide.

metadata
object(any)

The metadata of the guide.

title
string

The title of the guide.

recipient
object

The recipient of the guide.

Mark guide as seen

Records that a guide has been seen by a user, triggering any associated seen events.

Endpoint

PUT/v1/users/{user_id}/guides/messages/{message_id}/seen

Rate limit

Tier 2

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

message_id
string

The unique identifier for the message.

Request body

channel_id
string(uuid)
Required

The unique identifier for the channel.

content
object(any)

The content of the guide.

data
object(any)

The data of the guide.

guide_id
string(uuid)
Required

The unique identifier for the guide.

guide_key
string
Required

The key of the guide.

guide_step_ref
string
Required

The step reference of the guide.

is_final
boolean

Whether the guide is final.

metadata
object(any)

The metadata of the guide.

tenant
string

The tenant ID of the guide.

Returns

GuideActionResponse

A response for a guide action.

status
string

The status of a guide's action.

Mark guide as interacted

Records that a user has interacted with a guide, triggering any associated interacted events.

Endpoint

PUT/v1/users/{user_id}/guides/messages/{message_id}/interacted

Rate limit

Tier 2

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

message_id
string

The unique identifier for the message.

Request body

channel_id
string(uuid)
Required

The unique identifier for the channel.

content
object(any)

The content of the guide.

data
object(any)

The data of the guide.

guide_id
string(uuid)
Required

The unique identifier for the guide.

guide_key
string
Required

The key of the guide.

guide_step_ref
string
Required

The step reference of the guide.

is_final
boolean

Whether the guide is final.

metadata
object(any)

The metadata of the guide.

tenant
string

The tenant ID of the guide.

Returns

GuideActionResponse

A response for a guide action.

status
string

The status of a guide's action.

Mark guide as archived

Records that a guide has been archived by a user, triggering any associated archived events.

Endpoint

PUT/v1/users/{user_id}/guides/messages/{message_id}/archived

Rate limit

Tier 2

Path parameters

user_id
string

The ID for the user that you set when identifying them in Knock.

message_id
string

The unique identifier for the message.

Request body

channel_id
string(uuid)
Required

The unique identifier for the channel.

content
object(any)

The content of the guide.

data
object(any)

The data of the guide.

guide_id
string(uuid)
Required

The unique identifier for the guide.

guide_key
string
Required

The key of the guide.

guide_step_ref
string
Required

The step reference of the guide.

is_final
boolean

Whether the guide is final.

metadata
object(any)

The metadata of the guide.

tenant
string

The tenant ID of the guide.

Returns

GuideActionResponse

A response for a guide action.

status
string

The status of a guide's action.

Bulk operations

Bulk operations available for users. These endpoints return a BulkOperation that executes the job asynchronously. Progress can be tracked via the Bulk operations API.

Bulk identify users

Identifies multiple users in a single operation. Allows creating or updating up to 100 users in a single batch with various properties, preferences, and channel data.

Endpoint

POST/v1/users/bulk/identify

Rate limit

Tier 1

Request body

A list of users.

Channel-specific information that's needed to deliver a notification to an end provider.

created_at
string(date-time)

The creation date of the user from your system.

email
string

The primary email address for the user.

id
string
Required

The ID for the user that you set when identifying them in Knock.

name
string

Display name of the user.

A set of preferences for the user.

timezone
string

The timezone of the user. Must be a valid tz database time zone string. Used for recurring schedules.

Returns

A bulk operation entity.

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

Bulk set preferences

Sets preferences for multiple users in a single operation. Supports either setting the same preferences for multiple users or specific preferences for each user.

Endpoint

POST/v1/users/bulk/preferences

Rate limit

Tier 1

Request body

preferencesRequired

A request to set a preference set for a recipient.

categories
PreferenceSetRequestCategories

An object where the key is the category and the values are the preference settings for that category.

An object where the key is the channel type and the values are the preference settings for that channel type.

workflows
PreferenceSetRequestWorkflows

An object where the key is the workflow key and the values are the preference settings for that workflow.

user_ids
string[]
Required

A list of user IDs.

Returns

A bulk operation entity.

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

Bulk delete users

Deletes multiple users in a single operation. Accepts up to 100 user IDs to delete and returns a bulk operation that can be queried for progress.

Endpoint

POST/v1/users/bulk/delete

Rate limit

Tier 1

Request body

user_ids
string[]
Required

A list of user IDs.

Returns

A bulk operation entity.

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

User

A User represents an individual in your system who can receive notifications through Knock. Users are the most common recipients of notifications and are always referenced by your internal identifier.

Attributes

__typename
string

The typename of the schema.

avatar
string

URL to the user's avatar image.

created_at
string(date-time)

The creation date of the user from your system.

email
string

The primary email address for the user.

id
string

The ID for the user that you set when identifying them in Knock.

name
string

Display name of the user.

phone_number
string

The E.164 phone number of the user (required for SMS channels).

timezone
string

The timezone of the user. Must be a valid tz database time zone string. Used for recurring schedules.

updated_at
string(date-time)

The timestamp when the resource was last updated.

*
object(any)

Any additional custom properties.

IdentifyUserRequest

A set of parameters to identify a user with. Does not include the user ID, as that's specified elsewhere in the request. You can supply any additional properties you'd like to upsert for the user.

Attributes

avatar
string

URL to the user's avatar image.

Channel-specific information that's needed to deliver a notification to an end provider.

created_at
string(date-time)

The creation date of the user from your system.

email
string

The primary email address for the user.

locale
string

The locale of the user. Used for message localization.

name
string

Display name of the user.

phone_number
string

The E.164 phone number of the user (required for SMS channels).

A set of preferences for the user.

timezone
string

The timezone of the user. Must be a valid tz database time zone string. Used for recurring schedules.

*
object(any)

Any additional custom properties.

InlineIdentifyUserRequest

A set of parameters to inline-identify a user with. Inline identifying the user will ensure that the user is available before the request is executed in Knock. It will perform an upsert for the user you're supplying, replacing any properties specified.

Attributes

Channel-specific information that's needed to deliver a notification to an end provider.

created_at
string(date-time)

The creation date of the user from your system.

email
string

The primary email address for the user.

id
string

The ID for the user that you set when identifying them in Knock.

name
string

Display name of the user.

A set of preferences for the user.

timezone
string

The timezone of the user. Must be a valid tz database time zone string. Used for recurring schedules.

*
object(any)

Any additional custom properties.

Set an object

Creates a new object or updates an existing one in the specified collection. This operation is used to identify objects with their properties, as well as optional preferences and channel data.

Endpoint

PUT/v1/objects/{collection}/{id}

Rate limit

Tier 3

Path parameters

collection
string

The collection this object belongs to.

id
string

Unique identifier for the object.

Request body

A request to set channel data for a type of channel inline.

locale
string

The locale of the object. Used for message localization.

Inline set preferences for a recipient, where the key is the preference set id.

timezone
string

The timezone of the object. Must be a valid tz database time zone string. Used for recurring schedules.

*
object(any)

Any additional custom properties.

Returns

A custom Object entity which belongs to a collection.

__typename
string

The typename of the schema.

collection
string

The collection this object belongs to.

created_at
string(date-time)

Timestamp when the resource was created.

id
string

Unique identifier for the object.

updated_at
string(date-time)

The timestamp when the resource was last updated.

*
object(any)

Any additional custom properties.

Get an object

Retrieves a specific object by its ID from the specified collection. Returns the object with all its properties.

Endpoint

GET/v1/objects/{collection}/{id}

Rate limit

Tier 4

Path parameters

collection
string

The collection this object belongs to.

id
string

Unique identifier for the object.

Returns

A custom Object entity which belongs to a collection.

__typename
string

The typename of the schema.

collection
string

The collection this object belongs to.

created_at
string(date-time)

Timestamp when the resource was created.

id
string

Unique identifier for the object.

updated_at
string(date-time)

The timestamp when the resource was last updated.

*
object(any)

Any additional custom properties.

List objects in a collection

Returns a paginated list of objects from the specified collection. Optionally includes preference data for the objects.

Endpoint

GET/v1/objects/{collection}

Rate limit

Tier 4

Path parameters

collection
string

The collection this object belongs to.

Query parameters

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

include[]
enum(string)[]

Includes preferences of the objects in the response.

preferences

Returns

ListObjectsResponse

A paginated list of objects in a collection.

entries

A list of objects.

__typename
string
Required

The typename of the schema.

collection
string
Required

The collection this object belongs to.

created_at
string(date-time)

Timestamp when the resource was created.

id
string
Required

Unique identifier for the object.

updated_at
string(date-time)
Required

The timestamp when the resource was last updated.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Delete an object

Permanently removes an object from the specified collection. This operation cannot be undone.

Endpoint

DELETE/v1/objects/{collection}/{id}

Rate limit

Tier 3

Path parameters

collection
string

The collection this object belongs to.

id
string

Unique identifier for the object.

Returns

EmptyContentResponse

A 204 No Content response.

List preference sets

Returns a paginated list of preference sets for the specified object.

Endpoint

GET/v1/objects/{collection}/{object_id}/preferences

Rate limit

Tier 4

Path parameters

object_id
string

Unique identifier for the object.

collection
string

The collection this object belongs to.

Returns

ListObjectPreferenceSetsResponse

A list of preference sets for the object

Get object preference set

Returns the preference set for the specified object and preference set id.

Endpoint

GET/v1/objects/{collection}/{object_id}/preferences/{id}

Rate limit

Tier 4

Path parameters

object_id
string

Unique identifier for the object.

collection
string

The collection this object belongs to.

id
string

Unique identifier for the preference set.

Returns

A preference set represents a specific set of notification preferences for a recipient. A recipient can have multiple preference sets.

categories
PreferenceSetCategories

An object where the key is the category and the values are the preference settings for that category.

An object where the key is the channel type and the values are the preference settings for that channel type.

id
string

Unique identifier for the preference set.

workflows
PreferenceSetWorkflows

An object where the key is the workflow key and the values are the preference settings for that workflow.

Update a preference set

Sets preferences within the given preference set. This is a destructive operation and will replace any existing preferences with the preferences given. If no object exists in the current environment for the given :collection and :object_id, Knock will create the object as part of this request. The preference set :id can be either default or a tenant.id. Learn more about per-tenant preferences.

Endpoint

PUT/v1/objects/{collection}/{object_id}/preferences/{id}

Rate limit

Tier 3

Path parameters

object_id
string

Unique identifier for the object.

collection
string

The collection this object belongs to.

id
string

Unique identifier for the preference set.

Request body

categories
PreferenceSetRequestCategories

An object where the key is the category and the values are the preference settings for that category.

An object where the key is the channel type and the values are the preference settings for that channel type.

workflows
PreferenceSetRequestWorkflows

An object where the key is the workflow key and the values are the preference settings for that workflow.

Returns

A preference set represents a specific set of notification preferences for a recipient. A recipient can have multiple preference sets.

categories
PreferenceSetCategories

An object where the key is the category and the values are the preference settings for that category.

An object where the key is the channel type and the values are the preference settings for that channel type.

id
string

Unique identifier for the preference set.

workflows
PreferenceSetWorkflows

An object where the key is the workflow key and the values are the preference settings for that workflow.

List object schedules

Returns a paginated list of schedules for an object.

Endpoint

GET/v1/objects/{collection}/{id}/schedules

Rate limit

Tier 4

Path parameters

id
string

The ID of the object to list schedules for.

collection
string

The collection of the object to list schedules for.

Query parameters

tenant
string

Filter schedules by tenant id.

workflow
string

Filter schedules by workflow id.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Returns

ListSchedulesResponse

A response containing a list of schedules.

entries

A list of schedules.

__typename
string

The typename of the schema.

A map of properties describing a user or an object to identify in Knock and mark as who or what performed the action.

data
object(any)

An optional map of data to pass into the workflow execution.

id
string(uuid)
Required

Unique identifier for the schedule.

inserted_at
string(date-time)
Required

Timestamp when the resource was created.

last_occurrence_at
string(date-time)

The last occurrence of the schedule.

next_occurrence_at
string(date-time)

The next occurrence of the schedule.

recipient
2 possible types
Required

A recipient of a notification, which is either a user or an object.

repeatsRequired

The repeat rule for the schedule.

__typename
string
Required

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)
Required

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

tenant
string

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

updated_at
string(date-time)
Required

The timestamp when the resource was last updated.

workflow
string
Required

The workflow the schedule is applied to.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

List messages

Returns a paginated list of messages for a specific object in the given collection. Allows filtering by message status and provides various sorting options.

Endpoint

GET/v1/objects/{collection}/{id}/messages

Rate limit

Tier 4

Path parameters

collection
string

The collection this object belongs to.

id
string

Unique identifier for the object.

Query parameters

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

tenant
string

Limits the results to items with the corresponding tenant.

channel_id
string

Limits the results to items with the corresponding channel ID.

status[]
enum(string)[]

Limits the results to messages with the given delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
engagement_status[]
enum(string)[]

Limits the results to messages with the given engagement status.

seenreadinteractedlink_clickedarchived
message_ids[]
string[]

Limits the results to only the message IDs given (max 50). Note: when using this option, the results will be subject to any other filters applied to the query.

workflow_categories[]
string[]

Limits the results to messages related to any of the provided categories.

source
string

Limits the results to messages triggered by the given workflow key.

workflow_run_id
string(uuid)

Limits the results to messages associated with the top-level workflow run ID returned by the workflow trigger request.

workflow_recipient_run_id
string(uuid)

Limits the results to messages for a specific recipient's workflow run.

trigger_data
string

Limits the results to only messages that were generated with the given data. See trigger data filtering for more information.

inserted_at.gte
string

Limits the results to messages inserted after or on the given date.

inserted_at.lte
string

Limits the results to messages inserted before or on the given date.

inserted_at.gt
string

Limits the results to messages inserted after the given date.

inserted_at.lt
string

Limits the results to messages inserted before the given date.

Returns

ListMessagesResponse

A paginated list of messages.

entries

A list of messages.

__typename
string

The typename of the schema.

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.

archived_at
string(date-time)

Timestamp when the message was archived.

channel_id
string(uuid)

The ID for the channel the message was sent through.

clicked_at
string(date-time)

Timestamp when the message was clicked.

data
object(any)

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

engagement_statuses
enum(string)[]

A list of engagement statuses.

seenreadinteractedlink_clickedarchived
id
string

The unique identifier for the message.

inserted_at
string(date-time)

Timestamp when the resource was created.

interacted_at
string(date-time)

Timestamp when the message was interacted with.

link_clicked_at
string(date-time)

Timestamp when a link in the message was clicked.

metadata
object(any)

The metadata associated with the message.

read_at
string(date-time)

Timestamp when the message was read.

recipient
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

scheduled_at
string(date-time)

Timestamp when the message was scheduled to be sent.

seen_at
string(date-time)

Timestamp when the message was seen.

source
object

The workflow that triggered the message.

__typename
string
Required
categories
string[]
Required

The categories associated with the message.

key
string
Required

The key of the workflow that triggered the message.

version_id
string(uuid)
Required

The ID of the version of the workflow that triggered the message.

status
enum(string)

The message delivery status.

queuedsentdelivereddelivery_attemptedundeliverednot_sentbounced
tenant
string

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The key of the workflow that generated the message.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Get channel data

Returns the channel data for the specified object and channel.

Endpoint

GET/v1/objects/{collection}/{object_id}/channel_data/{channel_id}

Rate limit

Tier 4

Path parameters

object_id
string

Unique identifier for the object.

collection
string

The collection this object belongs to.

channel_id
string(uuid)

The unique identifier for the channel.

Returns

Channel data for a given channel type.

__typename
string

The typename of the schema.

channel_id
string(uuid)

The unique identifier for the channel.

data
5 possible types

Channel data for a given channel type.

provider
enum(string)

The type of provider.

push_fcmpush_apnspush_expopush_one_signalchat_slackchat_ms_teamschat_discordhttp_knock_webhook

Set channel data

Sets the channel data for the specified object and channel. If no object exists in the current environment for the given collection and object_id, Knock will create the object as part of this request.

Endpoint

PUT/v1/objects/{collection}/{object_id}/channel_data/{channel_id}

Rate limit

Tier 3

Path parameters

object_id
string

Unique identifier for the object.

collection
string

The collection this object belongs to.

channel_id
string(uuid)

The unique identifier for the channel.

Request body

data
5 possible types
Required

Channel data for a given channel type.

Returns

Channel data for a given channel type.

__typename
string

The typename of the schema.

channel_id
string(uuid)

The unique identifier for the channel.

data
5 possible types

Channel data for a given channel type.

provider
enum(string)

The type of provider.

push_fcmpush_apnspush_expopush_one_signalchat_slackchat_ms_teamschat_discordhttp_knock_webhook

Unset channel data

Unsets the channel data for the specified object and channel.

Endpoint

DELETE/v1/objects/{collection}/{object_id}/channel_data/{channel_id}

Rate limit

Tier 3

Path parameters

object_id
string

Unique identifier for the object.

collection
string

The collection this object belongs to.

channel_id
string(uuid)

The unique identifier for the channel.

Returns

EmptyContentResponse

A 204 No Content response.

List subscriptions

List subscriptions for an object. Either list the recipients that subscribe to the provided object, or list the objects that the provided object is subscribed to. Determined by the mode query parameter.

Endpoint

GET/v1/objects/{collection}/{object_id}/subscriptions

Rate limit

Tier 4

Path parameters

object_id
string

Unique identifier for the object.

collection
string

The collection this object belongs to.

Query parameters

mode
enum(string)

Mode of the request. recipient to list the objects that the provided object is subscribed to, object to list the recipients that subscribe to the provided object.

recipientobject
include[]
enum(string)[]

Additional fields to include in the response.

preferences

Recipients to filter by (only used if mode is object).

objects[]
ObjectReference[]

Objects to filter by (only used if mode is recipient).

collection
string

The collection the recipient object belongs to.

id
string

An identifier for the recipient object.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Returns

ListSubscriptionsResponse

A response containing a list of subscriptions.

A list of subscriptions.

__typename
string
Required

The typename of the schema.

inserted_at
string(date-time)
Required

Timestamp when the resource was created.

objectRequired

A custom Object entity which belongs to a collection.

__typename
string
Required

The typename of the schema.

collection
string
Required

The collection this object belongs to.

created_at
string(date-time)

Timestamp when the resource was created.

id
string
Required

Unique identifier for the object.

updated_at
string(date-time)
Required

The timestamp when the resource was last updated.

properties
object(any)

The custom properties associated with the subscription relationship.

recipient
2 possible types
Required

A recipient of a notification, which is either a user or an object.

updated_at
string(date-time)
Required

The timestamp when the resource was last updated.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Add subscriptions

Add subscriptions for an object. If a subscription already exists, it will be updated. This endpoint also handles inline identifications for the recipient.

Endpoint

POST/v1/objects/{collection}/{object_id}/subscriptions

Rate limit

Tier 3

Path parameters

object_id
string

Unique identifier for the object.

collection
string

The collection this object belongs to.

Request body

properties
object(any)

The custom properties associated with the subscription relationship.

recipientsRequired

The recipients of the subscription. You can subscribe up to 100 recipients to an object at a time.

Returns

SubscriptionsResponse

A response containing a list of subscriptions.

Delete subscriptions

Delete subscriptions for the specified recipients from an object. Returns the list of deleted subscriptions.

Endpoint

DELETE/v1/objects/{collection}/{object_id}/subscriptions

Rate limit

Tier 3

Path parameters

object_id
string

Unique identifier for the object.

collection
string

The collection this object belongs to.

Request body

recipientsRequired

The recipients of the subscription. You can subscribe up to 100 recipients to an object at a time.

Returns

SubscriptionsResponse

A response containing a list of subscriptions.

Bulk operations

Bulk operations available for objects. These endpoints return a BulkOperation that executes the job asynchronously. Progress can be tracked via the Bulk operations API.

Bulk set objects

Bulk sets up to 1,000 objects at a time in the specified collection.

Endpoint

POST/v1/objects/{collection}/bulk/set

Rate limit

Tier 1

Path parameters

collection
string

The collection this object belongs to.

Request body

A list of objects.

An optional set of channel data for the object. This is a list of ChannelData objects.

collection
string
Required

The collection this object belongs to.

created_at
string(date-time)

Timestamp when the resource was created.

id
string
Required

Unique identifier for the object.

An optional set of preferences for the object.

Returns

A bulk operation entity.

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

Bulk add subscriptions

Add subscriptions for all objects in a single collection. If a subscription for an object in the collection already exists, it will be updated. This endpoint also handles inline identifications for the recipient field.

Endpoint

POST/v1/objects/{collection}/bulk/subscriptions/add

Rate limit

Tier 1

Path parameters

collection
string

The collection this object belongs to.

Request body

subscriptions
object[]
Required

A list of subscriptions.

properties
object(any)

The custom properties associated with the subscription relationship.

recipientsRequired

The recipients of the subscription. You can subscribe up to 100 recipients to an object at a time.

Returns

A bulk operation entity.

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

Bulk delete objects

Bulk deletes objects from the specified collection.

Endpoint

POST/v1/objects/{collection}/bulk/delete

Rate limit

Tier 1

Path parameters

collection
string

The collection this object belongs to.

Request body

object_ids
string[]
Required

List of object IDs to delete.

Returns

A bulk operation entity.

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

Object

A custom Object entity which belongs to a collection.

Attributes

__typename
string

The typename of the schema.

collection
string

The collection this object belongs to.

created_at
string(date-time)

Timestamp when the resource was created.

id
string

Unique identifier for the object.

updated_at
string(date-time)

The timestamp when the resource was last updated.

*
object(any)

Any additional custom properties.

InlineIdentifyObjectRequest

A custom Object entity which belongs to a collection.

Attributes

An optional set of channel data for the object. This is a list of ChannelData objects.

collection
string

The collection this object belongs to.

created_at
string(date-time)

Timestamp when the resource was created.

id
string

Unique identifier for the object.

An optional set of preferences for the object.

*
object(any)

Any additional custom properties.

Tenants

A Tenant a grouping with configurable settings that can be applied to a workflow when it's triggered in order to override account-level settings such as branding. Use tenants when sending a notification to user(s) that you want to configure specific brand elements for, such as a separate organization logo.

Delete a tenant

Delete a tenant and all associated data. This operation cannot be undone.

Endpoint

DELETE/v1/tenants/{id}

Rate limit

Tier 2

Path parameters

id
string

The unique identifier for the tenant.

Returns

EmptyContentResponse

A 204 No Content response.

Get a tenant

Get a tenant by ID.

Endpoint

GET/v1/tenants/{id}

Rate limit

Tier 4

Path parameters

id
string

The unique identifier for the tenant.

Returns

A tenant entity.

__typename
string

The typename of the schema.

id
string

The unique identifier for the tenant.

name
string

An optional name for the tenant.

settings
object

The settings for the tenant. Includes branding and preference set.

branding
object

The branding for the tenant.

icon_url
string(uri)

The icon URL for the tenant. Must point to a valid image with an image MIME type.

logo_url
string(uri)

The logo URL for the tenant. Must point to a valid image with an image MIME type.

primary_color
string

The primary color for the tenant, provided as a hex value.

primary_color_contrast
string

The primary color contrast for the tenant, provided as a hex value.

preference_set

The preference set for the tenant. Used to override the default preference set.

*
object(any)

Any additional custom properties.

Set a tenant

Sets a tenant within an environment, performing an upsert operation. Any existing properties will be merged with the incoming properties.

Endpoint

PUT/v1/tenants/{id}

Rate limit

Tier 3

Path parameters

id
string

The unique identifier for the tenant.

Request body

The channel data for the tenant.

The preferences for the tenant.

settings
object

The settings for the tenant. Includes branding and preference set.

branding
object

The branding for the tenant.

icon_url
string

The icon URL for the tenant. Must point to a valid image with an image MIME type.

logo_url
string

The logo URL for the tenant. Must point to a valid image with an image MIME type.

primary_color
string

The primary color for the tenant, provided as a hex value.

primary_color_contrast
string

The primary color contrast for the tenant, provided as a hex value.

preference_set

The preference set for the tenant. Used to override the default preference set.

*
object(any)

Any additional custom properties.

Returns

SetTenantResponse

The response from setting a tenant.

List tenants

List tenants for the current environment.

Endpoint

GET/v1/tenants

Rate limit

Tier 4

Query parameters

tenant_id
string

Filter tenants by ID.

name
string

Filter tenants by name.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Returns

ListTenantsResponse

A response containing a list of tenants.

entries

A list of tenants.

__typename
string
Required

The typename of the schema.

id
string
Required

The unique identifier for the tenant.

name
string

An optional name for the tenant.

settings
object

The settings for the tenant. Includes branding and preference set.

branding
object

The branding for the tenant.

icon_url
string(uri)

The icon URL for the tenant. Must point to a valid image with an image MIME type.

logo_url
string(uri)

The logo URL for the tenant. Must point to a valid image with an image MIME type.

primary_color
string

The primary color for the tenant, provided as a hex value.

primary_color_contrast
string

The primary color contrast for the tenant, provided as a hex value.

preference_set

The preference set for the tenant. Used to override the default preference set.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Bulk operations

Bulk operations available for tenants. These endpoints return a BulkOperation that executes the job asynchronously. Progress can be tracked via the Bulk operations API.

Bulk delete tenants

Delete multiple tenants in a single operation. This operation cannot be undone.

Endpoint

POST/v1/tenants/bulk/delete

Rate limit

Tier 1

Query parameters

tenant_ids[]
string[]

The IDs of the tenants to delete.

Returns

A bulk operation entity.

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

Bulk set tenants

Set or update up to 1,000 tenants in a single operation.

Endpoint

POST/v1/tenants/bulk/set

Rate limit

Tier 1

Request body

tenantsRequired

The tenants to be upserted.

Returns

A bulk operation entity.

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

Tenant

A tenant entity.

Attributes

__typename
string

The typename of the schema.

id
string

The unique identifier for the tenant.

name
string

An optional name for the tenant.

settings
object

The settings for the tenant. Includes branding and preference set.

branding
object

The branding for the tenant.

icon_url
string(uri)

The icon URL for the tenant. Must point to a valid image with an image MIME type.

logo_url
string(uri)

The logo URL for the tenant. Must point to a valid image with an image MIME type.

primary_color
string

The primary color for the tenant, provided as a hex value.

primary_color_contrast
string

The primary color contrast for the tenant, provided as a hex value.

preference_set

The preference set for the tenant. Used to override the default preference set.

*
object(any)

Any additional custom properties.

TenantRequest

A tenant to be set in the system. You can supply any additional properties on the tenant object.

Attributes

The channel data for the tenant.

id
string

The unique identifier for the tenant.

The preferences for the tenant.

settings
object

The settings for the tenant. Includes branding and preference set.

branding
object

The branding for the tenant.

icon_url
string

The icon URL for the tenant. Must point to a valid image with an image MIME type.

logo_url
string

The logo URL for the tenant. Must point to a valid image with an image MIME type.

primary_color
string

The primary color for the tenant, provided as a hex value.

primary_color_contrast
string

The primary color contrast for the tenant, provided as a hex value.

preference_set

The preference set for the tenant. Used to override the default preference set.

*
object(any)

Any additional custom properties.

InlineTenantRequest

An request to set a tenant inline.

Attributes

InlineTenantRequest
2 possible types

An request to set a tenant inline.

Recipients

Recipient represents a person or a non-user entity from your system, represented in Knock. They are most commonly the recipient of a notification, but can also be used to denote an actor that a notification is sent on behalf of.

Subscriptions

Subscriptions express the relationship between a Recipient (the subscriber) and an Object. Subscribers are notified when the object that they are subscribed to is a recipient on a workflow trigger request.

Subscription

A subscription object.

Attributes

__typename
string

The typename of the schema.

inserted_at
string(date-time)

Timestamp when the resource was created.

object

A custom Object entity which belongs to a collection.

__typename
string

The typename of the schema.

collection
string

The collection this object belongs to.

created_at
string(date-time)

Timestamp when the resource was created.

id
string

Unique identifier for the object.

updated_at
string(date-time)

The timestamp when the resource was last updated.

properties
object(any)

The custom properties associated with the subscription relationship.

recipient
2 possible types

A recipient of a notification, which is either a user or an object.

updated_at
string(date-time)

The timestamp when the resource was last updated.

Preferences

Preferences determine whether a recipient should receive a particular type of notification. By default all preferences are opted in unless a preference explicitly opts the recipient out of the notification.

The preference set :id can be either "default" or a tenant.id. Learn more about per-tenant preferences.

PreferenceSet

A preference set represents a specific set of notification preferences for a recipient. A recipient can have multiple preference sets.

Attributes

categories
PreferenceSetCategories

An object where the key is the category and the values are the preference settings for that category.

An object where the key is the channel type and the values are the preference settings for that channel type.

id
string

Unique identifier for the preference set.

workflows
PreferenceSetWorkflows

An object where the key is the workflow key and the values are the preference settings for that workflow.

PreferenceSetRequest

A request to set a preference set for a recipient.

Attributes

categories
PreferenceSetRequestCategories

An object where the key is the category and the values are the preference settings for that category.

An object where the key is the channel type and the values are the preference settings for that channel type.

workflows
PreferenceSetRequestWorkflows

An object where the key is the workflow key and the values are the preference settings for that workflow.

InlinePreferenceSetRequest

Inline set preferences for a recipient, where the key is the preference set id.

Attributes

*
object(any)

Any additional custom properties.

PreferenceSetChannelTypes

Channel type preferences.

Attributes

chat
2 possible types

Whether the channel type is enabled for the preference set.

email
2 possible types

Whether the channel type is enabled for the preference set.

http
2 possible types

Whether the channel type is enabled for the preference set.

in_app_feed
2 possible types

Whether the channel type is enabled for the preference set.

push
2 possible types

Whether the channel type is enabled for the preference set.

sms
2 possible types

Whether the channel type is enabled for the preference set.

PreferenceSetChannelTypeSetting

A set of settings for a channel type. Currently, this can only be a list of conditions to apply.

Attributes

conditions

A list of conditions to apply to a channel type.

argument
string
Required

The argument value to compare against in the condition.

operator
enum(string)
Required

The operator to use in the condition evaluation.

equal_tonot_equal_togreater_thanless_thangreater_than_or_equal_toless_than_or_equal_tocontainsnot_containsemptynot_emptycontains_allis_timestampis_not_timestampis_timestamp_afteris_timestamp_beforeis_timestamp_betweenis_audience_memberis_not_audience_member
variable
string
Required

The variable to be evaluated in the condition.

Channel data

Channel data is channel-specific information stored on a Knock user or object that's needed to deliver a notification to an end provider.

For a push channel, this includes device-specific tokens that map the recipient to the device they use. For chat apps, such as Slack, this includes the access token used to send notifications to a customer's Slack channel.

The shape of the data payload varies depending on the channel type; you can learn more about channel data schemas here.

ChannelData

Channel data for a given channel type.

Attributes

__typename
string

The typename of the schema.

channel_id
string(uuid)

The unique identifier for the channel.

data
5 possible types

Channel data for a given channel type.

provider
enum(string)

The type of provider.

push_fcmpush_apnspush_expopush_one_signalchat_slackchat_ms_teamschat_discordhttp_knock_webhook

ChannelDataRequest

A request to set channel data for a type of channel.

Attributes

data
5 possible types

Channel data for a given channel type.

PushChannelData

The content of a push notification.

Attributes

tokens
string[]

A list of push channel tokens.

SlackChannelData

Slack channel data

Attributes

connections
object[]

List of Slack channel connections.

token
SlackChannelDataTokenObject

A Slack connection token.

access_token
string

A Slack access token.

MsTeamsChannelData

Microsoft Teams channel connection.

Attributes

connections
object[]

List of Microsoft Teams connections.

ms_teams_tenant_id
string(uuid)

Microsoft Teams tenant ID.

DiscordChannelData

Discord channel data.

Attributes

connections
object[]

List of Discord channel connections.

OneSignalChannelData

OneSignal channel data.

Attributes

player_ids
string(uuid)[]

A list of OneSignal player IDs.

InlineChannelDataRequest

A request to set channel data for a type of channel inline.

Attributes

*
object(any)

Any additional custom properties.

Recipient

A recipient of a notification, which is either a user or an object.

Attributes

Recipient
2 possible types

A recipient of a notification, which is either a user or an object.

RecipientRequest

Specifies a recipient in a request. This can either be a user identifier (string), an inline user request (object), or an inline object request, which is determined by the presence of a collection property.

Attributes

RecipientRequest
3 possible types

Specifies a recipient in a request. This can either be a user identifier (string), an inline user request (object), or an inline object request, which is determined by the presence of a collection property.

RecipientReference

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

Attributes

RecipientReference
2 possible types

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

Schedules

A Schedule allows you to automatically trigger a workflow at a given time for one or more recipients. You can think of a schedule as a managed, recipient-timezone-aware cron job that Knock will run on your behalf.

Create schedules

Creates one or more schedules for a workflow with the specified recipients, timing, and data. Schedules can be one-time or recurring. This endpoint also handles inline identifications for the actor, recipient, and tenant fields.

Endpoint

POST/v1/schedules

Rate limit

Tier 3

Request body

data
object(any)

An optional map of data to pass into the workflow execution.

ending_at
string(date-time)

The ending date and time for the schedule.

recipientsRequired

The recipients to trigger the workflow for. Can inline identify users, objects, or use a list of user IDs. Limited to 1,000 recipients.

repeatsRequired

The repeat rule for the schedule.

__typename
string
Required

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)
Required

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

scheduled_at
string(date-time)

The starting date and time for the schedule.

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

workflow
string
Required

The key of the workflow.

Returns

SchedulesResponse

A list of schedules.

List schedules

Returns a paginated list of schedules for the current environment, filtered by workflow and optionally by recipients and tenant.

Endpoint

GET/v1/schedules

Rate limit

Tier 4

Query parameters

workflow
string

Filter by workflow key.

recipients[]
string[]

Filter by recipient IDs.

tenant
string

Filter by tenant ID.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Returns

ListSchedulesResponse

A response containing a list of schedules.

entries

A list of schedules.

__typename
string

The typename of the schema.

A map of properties describing a user or an object to identify in Knock and mark as who or what performed the action.

data
object(any)

An optional map of data to pass into the workflow execution.

id
string(uuid)
Required

Unique identifier for the schedule.

inserted_at
string(date-time)
Required

Timestamp when the resource was created.

last_occurrence_at
string(date-time)

The last occurrence of the schedule.

next_occurrence_at
string(date-time)

The next occurrence of the schedule.

recipient
2 possible types
Required

A recipient of a notification, which is either a user or an object.

repeatsRequired

The repeat rule for the schedule.

__typename
string
Required

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)
Required

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

tenant
string

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

updated_at
string(date-time)
Required

The timestamp when the resource was last updated.

workflow
string
Required

The workflow the schedule is applied to.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Update schedules

Updates one or more existing schedules with new timing, data, or other properties. All specified schedule IDs will be updated with the same values. This endpoint also handles inline identifications for the actor, recipient, and tenant fields.

Endpoint

PUT/v1/schedules

Rate limit

Tier 3

Request body

A map of properties describing a user or an object to identify in Knock and mark as who or what performed the action.

data
object(any)

An optional map of data to pass into the workflow execution.

ending_at
string(date-time)

The ending date and time for the schedule.

The repeat rule for the schedule.

__typename
string
Required

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)
Required

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

schedule_ids
string(uuid)[]
Required

A list of schedule IDs.

scheduled_at
string(date-time)

The starting date and time for the schedule.

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

Returns

SchedulesResponse

A list of schedules.

Delete schedules

Permanently deletes one or more schedules identified by the provided schedule IDs. This operation cannot be undone.

Endpoint

DELETE/v1/schedules

Rate limit

Tier 3

Request body

schedule_ids
string[]
Required

A list of schedule IDs.

Returns

SchedulesResponse

A list of schedules.

Bulk schedules

Bulk operations available for schedules.

Create schedules in bulk

Bulk creates up to 1,000 schedules at a time. This endpoint also handles inline identifications for the actor, recipient, and tenant fields.

Endpoint

POST/v1/schedules/bulk/create

Rate limit

Tier 1

Request body

schedules
object[]
Required

A list of schedules.

A map of properties describing a user or an object to identify in Knock and mark as who or what performed the action.

data
object(any)

An optional map of data to pass into the workflow execution.

ending_at
string(date-time)

The ending date and time for the schedule.

recipient
3 possible types

Specifies a recipient in a request. This can either be a user identifier (string), an inline user request (object), or an inline object request, which is determined by the presence of a collection property.

The repeat rule for the schedule.

__typename
string
Required

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)
Required

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

scheduled_at
string(date-time)

The starting date and time for the schedule.

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

workflow
string
Required

The key of the workflow.

Returns

A bulk operation entity.

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

Schedule

A schedule represents a recurring workflow execution.

Attributes

__typename
string

The typename of the schema.

A map of properties describing a user or an object to identify in Knock and mark as who or what performed the action.

data
object(any)

An optional map of data to pass into the workflow execution.

id
string(uuid)

Unique identifier for the schedule.

inserted_at
string(date-time)

Timestamp when the resource was created.

last_occurrence_at
string(date-time)

The last occurrence of the schedule.

next_occurrence_at
string(date-time)

The next occurrence of the schedule.

recipient
2 possible types

A recipient of a notification, which is either a user or an object.

The repeat rule for the schedule.

__typename
string
Required

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)
Required

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

tenant
string

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The workflow the schedule is applied to.

ScheduleRepeatRule

The repeat rule for the schedule.

Attributes

__typename
string

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

Audiences

An Audience represents a user segment. Use the Audiences API to sync user segments from your data warehouse to Knock. Audiences can be used to target messages or orchestrate workflows via branch and step conditions. They can also be used as the recipient of a Broadcast.

Add members

Adds one or more members to the specified audience.

Endpoint

POST/v1/audiences/{key}/members

Rate limit

Tier 3

Path parameters

key
string

The key of the audience.

Request body

members
AudienceMemberRequest[]
Required

A list of audience members to add.

tenant
string

The unique identifier for the tenant.

user
object
Required

An object containing the user's ID.

id
string

The ID for the user that you set when identifying them in Knock.

Returns

EmptyContentResponse

A 204 No Content response.

List members

Returns a paginated list of members for the specified audience.

Endpoint

GET/v1/audiences/{key}/members

Rate limit

Tier 4

Path parameters

key
string

The key of the audience.

Returns

ListAudienceMembersResponse

A paginated list of audience members.

A list of audience members.

__typename
string
Required

The typename of the schema.

added_at
string(date-time)
Required

Timestamp when the resource was created.

tenant
string

The unique identifier for the tenant.

userRequired

A User represents an individual in your system who can receive notifications through Knock. Users are the most common recipients of notifications and are always referenced by your internal identifier.

__typename
string
Required

The typename of the schema.

avatar
string

URL to the user's avatar image.

created_at
string(date-time)

The creation date of the user from your system.

email
string

The primary email address for the user.

id
string
Required

The ID for the user that you set when identifying them in Knock.

name
string

Display name of the user.

phone_number
string

The E.164 phone number of the user (required for SMS channels).

timezone
string

The timezone of the user. Must be a valid tz database time zone string. Used for recurring schedules.

updated_at
string(date-time)
Required

The timestamp when the resource was last updated.

user_id
string
Required

The ID for the user that you set when identifying them in Knock.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.

Remove members

Removes one or more members from the specified audience.

Endpoint

DELETE/v1/audiences/{key}/members

Rate limit

Tier 3

Path parameters

key
string

The key of the audience.

Request body

members
AudienceMemberRequest[]
Required

A list of audience members to remove.

tenant
string

The unique identifier for the tenant.

user
object
Required

An object containing the user's ID.

id
string

The ID for the user that you set when identifying them in Knock.

Returns

EmptyContentResponse

A 204 No Content response.

AudienceMember

An audience member.

Attributes

__typename
string

The typename of the schema.

added_at
string(date-time)

Timestamp when the resource was created.

tenant
string

The unique identifier for the tenant.

user

A User represents an individual in your system who can receive notifications through Knock. Users are the most common recipients of notifications and are always referenced by your internal identifier.

__typename
string

The typename of the schema.

avatar
string

URL to the user's avatar image.

created_at
string(date-time)

The creation date of the user from your system.

email
string

The primary email address for the user.

id
string

The ID for the user that you set when identifying them in Knock.

name
string

Display name of the user.

phone_number
string

The E.164 phone number of the user (required for SMS channels).

timezone
string

The timezone of the user. Must be a valid tz database time zone string. Used for recurring schedules.

updated_at
string(date-time)

The timestamp when the resource was last updated.

user_id
string

The ID for the user that you set when identifying them in Knock.

Bulk operations

A Bulk Operation is a set of changes applied across 0 or more records triggered via a call to the Knock API and performed asynchronously. The BulkOperation record represents the state of the operation, including recording the number of rows that have been modified during the operation.

Please note here: the estimated_total_rows field may have a different value to the processed_rows field due to the asynchronous nature of the operation.

Get bulk operation

Retrieves a bulk operation (if it exists) and displays the current state of it.

Endpoint

GET/v1/bulk_operations/{id}

Rate limit

Tier 4

Path parameters

id
string(uuid)

The ID of the bulk operation to retrieve.

Returns

A bulk operation entity.

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

BulkOperation

A bulk operation entity.

Attributes

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

Providers

A Provider is a channel-specific configuration that determines how a message is delivered to a recipient.

Slack

A Slack provider is a channel-specific configuration that determines how a message is delivered to a recipient via Slack.

List channels

List Slack channels for a Slack workspace.

Endpoint

GET/v1/providers/slack/{channel_id}/channels

Rate limit

Tier 2

Path parameters

channel_id
string

The ID of the Knock Slack channel to get channels for.

Query parameters

access_token_object
string

A JSON encoded string containing the access token object reference.

query_options.cursor
string

Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection.

query_options.limit
integer

The maximum number of channels to return.

query_options.exclude_archived
boolean

Set to true to exclude archived channels from the list.

query_options.types
string

Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.

query_options.team_id
string

Encoded team ID (T1234) to list channels in, required if org token is used.

Returns

ChannelsForSlackProviderResponse

The response from a Slack provider request, containing a list of channels.

next_cursor
string

Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection.

slack_channels
object[]

List of Slack channels.

context_team_id
string
Required

The team ID that the Slack channel belongs to.

id
string
Required

A Slack channel ID from the Slack provider.

is_im
boolean
Required

Whether the Slack channel is an IM channel.

is_private
boolean
Required

Whether the Slack channel is private.

name
string
Required

Slack channel name.

Check auth

Check if a Slack channel is authenticated.

Endpoint

GET/v1/providers/slack/{channel_id}/auth_check

Rate limit

Tier 2

Path parameters

channel_id
string

The ID of the Knock Slack channel to check.

Query parameters

access_token_object
string

A JSON encoded string containing the access token object reference.

Returns

SlackAuthCheckResponse

The response from a Slack auth check request.

connection
object

A Slack connection object.

ok
boolean

Whether the Slack connection is valid.

reason
string

The reason for the Slack connection if it is not valid.

Revoke access

Revoke access for a Slack channel.

Endpoint

PUT/v1/providers/slack/{channel_id}/revoke_access

Rate limit

Tier 2

Path parameters

channel_id
string

The ID of the Knock Slack channel to revoke access for.

Query parameters

access_token_object
string

A JSON encoded string containing the access token object reference.

Returns

SuccessResponse

A response indicating the operation was successful.

ok
string

OK response.

AuthenticationError

Authentication error response

code
string

The error code.

message
string

The error message.

status
integer

The HTTP status code.

type
string

The error type.

Microsoft Teams

A Microsoft Teams provider is a channel-specific configuration that determines how a message is delivered to a recipient via Microsoft Teams.

List channels

List the Microsoft Teams channels within a team. By default, archived and private channels are excluded from the results.

Endpoint

GET/v1/providers/ms-teams/{channel_id}/channels

Rate limit

Tier 2

Path parameters

channel_id
string

The ID of the Knock Microsoft Teams channel to get channels for.

Query parameters

ms_teams_tenant_object
string

A JSON encoded string containing the Microsoft Teams tenant object reference.

team_id
string

Microsoft Teams team ID.

query_options.$filter
string

OData param passed to the Microsoft Graph API to filter channels.

query_options.$select
string

OData param passed to the Microsoft Graph API to select specific properties.

Returns

ChannelsForMsTeamsProviderResponse

The response from a Microsoft Teams provider request, containing a list of channels.

ms_teams_channels
object[]

List of Microsoft Teams channels.

createdDateTime
string

Microsoft Teams channel created date and time.

description
string

Microsoft Teams channel description.

displayName
string
Required

Microsoft Teams channel name.

id
string
Required

Microsoft Teams channel ID.

isArchived
boolean

Whether the Microsoft Teams channel is archived.

membershipType
string

Microsoft Teams channel membership type.

List teams

Get a list of teams belonging to the Microsoft Entra tenant. By default, archived and private channels are excluded from the results.

Endpoint

GET/v1/providers/ms-teams/{channel_id}/teams

Rate limit

Tier 2

Path parameters

channel_id
string

The ID of the Knock Microsoft Teams channel to get teams for.

Query parameters

ms_teams_tenant_object
string

A JSON encoded string containing the Microsoft Teams tenant object reference.

query_options.$filter
string

OData param passed to the Microsoft Graph API to filter teams.

query_options.$select
string

OData param passed to the Microsoft Graph API to select fields on a team.

query_options.$top
integer

OData param passed to the Microsoft Graph API to limit the number of teams returned.

query_options.$skiptoken
string

OData param passed to the Microsoft Graph API to retrieve the next page of results.

Returns

TeamsForMsTeamsProviderResponse

The response from a Microsoft Teams provider request, containing a list of teams.

ms_teams_teams
object[]

List of Microsoft Teams teams.

description
string

Microsoft Teams team description.

displayName
string
Required

Microsoft Teams team display name.

id
string
Required

Microsoft Teams team ID.

skip_token
string

OData param passed to the Microsoft Graph API to retrieve the next page of results.

Check auth

Check if a connection to Microsoft Teams has been authorized for a given Microsoft Teams tenant object.

Endpoint

GET/v1/providers/ms-teams/{channel_id}/auth_check

Rate limit

Tier 2

Path parameters

channel_id
string

The ID of the Knock Microsoft Teams channel to check.

Query parameters

ms_teams_tenant_object
string

A JSON encoded string containing the Microsoft Teams tenant object reference.

Returns

MsTeamsAuthCheckResponse

The response from a Microsoft Teams auth check request.

connection
object

A Microsoft Teams connection object.

ok
boolean

Whether the Microsoft Teams connection is valid.

reason
string

The reason for the Microsoft Teams connection if it is not valid.

Revoke access

Remove a Microsoft Entra tenant ID from a Microsoft Teams tenant object.

Endpoint

PUT/v1/providers/ms-teams/{channel_id}/revoke_access

Rate limit

Tier 2

Path parameters

channel_id
string

The ID of the Knock Microsoft Teams channel to revoke access for.

Query parameters

ms_teams_tenant_object
string

A JSON encoded string containing the Microsoft Teams tenant object reference.

Returns

SuccessResponse

A response indicating the operation was successful.

ok
string

OK response.

AuthenticationError

Authentication error response

code
string

The error code.

message
string

The error message.

status
integer

The HTTP status code.

type
string

The error type.

Shared

Resources that are shared across the API.

Condition

A condition to be evaluated.

Attributes

argument
string

The argument value to compare against in the condition.

operator
enum(string)

The operator to use in the condition evaluation.

equal_tonot_equal_togreater_thanless_thangreater_than_or_equal_toless_than_or_equal_tocontainsnot_containsemptynot_emptycontains_allis_timestampis_not_timestampis_timestamp_afteris_timestamp_beforeis_timestamp_betweenis_audience_memberis_not_audience_member
variable
string

The variable to be evaluated in the condition.

PageInfo

Pagination information for a list of resources.

Attributes

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page.