Docs
/
/

Data sources mAPI reference

Complete reference documentation for the Data sources resource.

List sources

#

Returns connected sources for the project.

Endpoint

GET/v1/sources

Query parameters

environment
string

The environment slug.

Returns

Sources connected to the project.

entries
object[]

Sources.

custom_image_url
string

Custom image URL for the source.

description
string

Source description.

key
string
Required

Source key.

name
string
Required

Source display name.

Get a source

#

Returns a source with environment-specific settings, preprocess scripts, and event mappings.

Endpoint

GET/v1/sources/{key}

Path parameters

key
string

The key of the source to retrieve.

Query parameters

environment
string

The environment slug.

Returns

A source that receives external events and maps them to Knock actions.

created_at
string(date-time)

The timestamp of when the source was created.

custom_image_url
string

An optional URL for a custom image representing the source.

description
string

An optional description of the source.

environment_settings
object(any)

Per-environment settings keyed by environment slug.

key
string

The unique key for the source within the project.

name
string

The human-readable name of the source.

updated_at
string(date-time)

The timestamp of when the source was last updated.

Upsert a source

#

Creates or updates a source with environment-specific settings, preprocess scripts, and event mappings.

Endpoint

PUT/v1/sources/{key}

Path parameters

key
string

The key of the source to upsert.

Query parameters

environment
string

The environment slug.

Request body

A source request for setting a source and its environment-specific configuration.

custom_image_url
string

An optional URL for a custom image representing the source.

description
string

An optional description of the source.

environment_settings
object(any)

Per-environment settings keyed by environment slug.

name
string
Required

The human-readable name of the source.

preconfigured_provider
string

When creating a source, bootstraps configuration from a preconfigured provider template. Ignored when updating an existing source.

Returns

WrappedSourceResponse

Wraps the Source response under the source key.

source

A source that receives external events and maps them to Knock actions.

created_at
string(date-time)

The timestamp of when the source was created.

custom_image_url
string

An optional URL for a custom image representing the source.

description
string

An optional description of the source.

environment_settings
object(any)

Per-environment settings keyed by environment slug.

key
string

The unique key for the source within the project.

name
string

The human-readable name of the source.

updated_at
string(date-time)

The timestamp of when the source was last updated.

Get source status

#

Returns source activity and workflow-trigger mappings that need action in the requested environment.

Endpoint

GET/v1/sources/{key}/status

Path parameters

key
string

The key of the source whose status should be retrieved.

Query parameters

environment
string

The environment slug.

Returns

Status information for a source in an environment.

events_count
integer

The number of source events received in the last 30 days.

last_event_received
string

The timestamp of the most recently received source event.

mappings_count
integer

The total number of event action mappings for the source environment.

mappings_requiring_commit
object[]

Workflow trigger event action mappings that need a workflow commit before their changes are applied.

action_type
enum(string)
Required

The action that is performed when this mapping matches a source event.

workflows_trigger
event_type
string
Required

The decoded event type that triggers the action.

inactive_at
string(date-time)

The timestamp of when the mapping was deactivated.

is_deleted
boolean
Required

Whether the mapping is pending deletion.

resource_key
string
Required

The key of the workflow resource referenced by the mapping.

status
enum(string)
Required

Whether the mapping is pending deletion or update.

deletedupdated

Rehearse a source event

#

Sends an arbitrary payload through the source's parse, preprocess, and mapping pipeline in the requested environment. This endpoint cannot be run in production environments.

Endpoint

POST/v1/sources/{key}/rehearse

Path parameters

key
string

The key of the source to rehearse.

Query parameters

environment
string

The environment slug.

Request body

payload
object(any)
Required

An arbitrary payload to send through the source's parse, preprocess, and mapping pipeline.

Returns

The result of a simulated source event rehearsal.

action_logs_count
integer

The total number of action logs produced by the rehearsal.

errors
object[]

Errors returned while rehearsing the source event.

field
string
Required
message
string
Required
failed_action_logs_count
integer

The number of failed action logs produced by the rehearsal.

log_id
string

The ID of the source event log created by the rehearsal.

status
enum(string)

Whether the rehearsal completed without action errors.

okerror
successful_action_logs_count
integer

The number of successful action logs produced by the rehearsal.

List source events

#

Returns known unique events received by a source in the requested environment.

Endpoint

GET/v1/sources/{key}/events

Path parameters

key
string

The key of the source whose events should be listed.

Query parameters

environment
string

The environment slug.

Returns

A list of known unique source events.

The known unique events for the requested source and environment.

event
string
Required

The decoded event name.

last_received_at
string(date-time)
Required

The timestamp of when this event was last received.

List source logs

#

Returns event logs received by a source in the requested environment. Supports filtering by date/time, event, and log ID.

Endpoint

GET/v1/sources/{key}/logs

Path parameters

key
string

The key of the source whose logs should be listed.

Query parameters

environment
string

The environment slug.

date
string

Returns event logs that were produced on this date.

starting_at
string(date-time)

Only return source logs at or after this timestamp.

ending_at
string(date-time)

Only return source logs at or before this timestamp.

event
string

The event name to filter by.

id
string

The log ID to filter by.

includes
enum(string)[]

Associated resources to include in the response. Accepts actions to include the actions executed after receiving each source event.

actions
after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

limit
integer

The number of entries to fetch per-page.

Returns

A paginated list of source logs. Include actions in the includes query parameter to return action details for each log.

The source logs for the requested source and environment.

The actions executed after receiving the source event. Only present when includes contains actions.

action_parameters
object(any)

The configured mapping parameters used to derive the action payload.

action_payload
object(any)

The parsed values generated from the mapping parameters for this action.

action_result
object(any)

The result returned by the action.

action_status
string

The status of the action.

action_type
string

The type of action that was executed.

id
string
Required

The action log ID.

inserted_at
string(date-time)

The timestamp of when the action log was created.

data
object(any)

The data payload parsed by the source.

event
string
Required

The decoded source event name.

id
string
Required

The source log ID.

inserted_at
string(date-time)

The timestamp of when the source log was created.

preprocess_output
object(any)

The output returned by the preprocess script.

source
string

Indicates the origin of the log; if the log is a product of a test event. This is typically null for regular source events received from the data source.

verification_status
string

The verification status for the received event.

page_info

The information about a paginated result.

after
string

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

before
string

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

page_size
integer

The number of entries to fetch per-page.

List source providers

#

Returns the source provider templates available for creating sources.

Endpoint

GET/v1/source_providers

Returns

Source providers available for creating sources.

entries
object[]

Source providers.

key
string
Required

Provider key.

provider
object
Required

Provider display metadata.

description
string
Required

Provider display description.

name
string
Required

Provider display name.

version
string
Required

Provider version.

Get a source provider

#

Returns a source provider template available for creating sources.

Endpoint

GET/v1/source_providers/{key}

Path parameters

key
string

The source provider key to retrieve.

Query parameters

includes
enum(string)[]

Associated resources to include in the response. Accepts branding, default_action_mappings, example_payloads, preprocessing_script, static_fields.

brandingdefault_action_mappingsexample_payloadspreprocessing_scriptstatic_fields

Returns

A source provider available for creating sources.

default_action_mappings
object[]

Default event action mappings for the provider. Only present when includes contains default_action_mappings.

action_parameters
object(any)
Required

Action-specific data paths and options.

action_type
enum(string)
Required

The action performed when the mapping matches a source event.

workflows_triggerusers_identifyusers_deleteobjects_setobjects_deleteobjects_subscribeobjects_unsubscribetenants_settenants_deleteaudiences_add_memberaudiences_remove_member
event_type
string
Required

Event type to match.

default_settings
object

Default source settings for this provider.

enforce_verification
boolean

Whether the source should enforce webhook verification.

event_type_path
string

Path to find the event type from the data.

idempotency_key_path
string

Path to find the idempotency key from the data.

preprocessing_script
object

Verification script source code. Only present when includes contains preprocessing_script.

timestamp_path
string

Path to find the timestamp from the data.

example_payloads
object(any)

Example payloads keyed by event type. Only present when includes contains example_payloads.

key
string

Provider key.

provider
object

Provider display metadata.

branding
object

Provider branding assets. Only present when includes contains branding.

categories
enum(string)[]

Provider categories for filtering and grouping.

BillingInfrastructureAnalyticsCRMEcommerceCommunicationsIdentity
description
string

Provider display description.

knock_tutorial_url
string

Knock tutorial URL for setting up the provider.

name
string

Provider display name.

webhook_config_deep_link
string

Provider webhook configuration URL.

webhook_docs_url
string

Provider webhook documentation URL.

website_url
string

Provider website URL.

static_fields
object(any)

JSON Schema fields needed to configure the source. Only present when includes contains static_fields.

version
string

Provider version.

Source

#

A source that receives external events and maps them to Knock actions.

Attributes

created_at
string(date-time)

The timestamp of when the source was created.

custom_image_url
string

An optional URL for a custom image representing the source.

description
string

An optional description of the source.

environment_settings
object(any)

Per-environment settings keyed by environment slug.

key
string

The unique key for the source within the project.

name
string

The human-readable name of the source.

updated_at
string(date-time)

The timestamp of when the source was last updated.

SourceRequest

#

A source request for setting a source and its environment-specific configuration.

Attributes

custom_image_url
string

An optional URL for a custom image representing the source.

description
string

An optional description of the source.

environment_settings
object(any)

Per-environment settings keyed by environment slug.

name
string

The human-readable name of the source.

preconfigured_provider
string

When creating a source, bootstraps configuration from a preconfigured provider template. Ignored when updating an existing source.

SourcePreprocessScript

#

A script that runs before source events are mapped.

Attributes

language
enum(string)

The programming language used by the preprocess script.

javascript
source
string

The source code for the preprocess script.

SourceEnvironmentSettings

#

Environment-specific settings for a source.

Attributes

created_at
string(date-time)

The timestamp of when these environment settings were created.

Event action mappings configured for this source in the environment.

action_parameters
object(any)

The action-specific parameters for the mapping.

action_type
enum(string)
Required

The action that is performed when this mapping matches a source event.

workflows_triggerusers_identifyusers_deleteobjects_setobjects_deleteobjects_subscribeobjects_unsubscribetenants_settenants_deleteaudiences_add_memberaudiences_remove_member
created_at
string(date-time)
Required

The timestamp of when the mapping was created.

event_type
string
Required

The decoded event type that triggers the action.

inactive_at
string(date-time)

The timestamp of when the mapping was deactivated.

is_deleted
boolean
Required

Whether the mapping has been deleted. When true, this indicates the trigger is present in the workflow's published version and may be active until the workflow is committed and published.

updated_at
string(date-time)
Required

The timestamp of when the mapping was last updated.

settings
object(any)

Source settings for this environment, including endpoint, verification behavior, and preprocess script.

endpoint
string

The public endpoint that receives source events for this environment.

enforce_idempotency
boolean
enforce_verification
boolean
event_type_path
string
handle_identifies
boolean
idempotency_key_path
string
preprocess_script

The resolved preprocess script for this source environment, if configured.

timestamp_path
string
updated_at
string(date-time)

The timestamp of when these environment settings were last updated.

SourceEvent

#

A known unique event received by a source.

Attributes

event
string

The decoded event name.

last_received_at
string(date-time)

The timestamp of when this event was last received.

SourceEventsResponse

#

A list of known unique source events.

Attributes

The known unique events for the requested source and environment.

event
string
Required

The decoded event name.

last_received_at
string(date-time)
Required

The timestamp of when this event was last received.

SourceEventActionMapping

#

An action mapping attached to a source event.

Attributes

action_parameters
object(any)

The action-specific parameters for the mapping.

action_type
enum(string)

The action that is performed when this mapping matches a source event.

workflows_triggerusers_identifyusers_deleteobjects_setobjects_deleteobjects_subscribeobjects_unsubscribetenants_settenants_deleteaudiences_add_memberaudiences_remove_member
created_at
string(date-time)

The timestamp of when the mapping was created.

event_type
string

The decoded event type that triggers the action.

inactive_at
string(date-time)

The timestamp of when the mapping was deactivated.

is_deleted
boolean

Whether the mapping has been deleted. When true, this indicates the trigger is present in the workflow's published version and may be active until the workflow is committed and published.

updated_at
string(date-time)

The timestamp of when the mapping was last updated.

SourceLog

#

A log entry for an event received by a source.

Attributes

The actions executed after receiving the source event. Only present when includes contains actions.

action_parameters
object(any)

The configured mapping parameters used to derive the action payload.

action_payload
object(any)

The parsed values generated from the mapping parameters for this action.

action_result
object(any)

The result returned by the action.

action_status
string

The status of the action.

action_type
string

The type of action that was executed.

id
string
Required

The action log ID.

inserted_at
string(date-time)

The timestamp of when the action log was created.

data
object(any)

The data payload parsed by the source.

event
string

The decoded source event name.

id
string

The source log ID.

inserted_at
string(date-time)

The timestamp of when the source log was created.

preprocess_output
object(any)

The output returned by the preprocess script.

source
string

Indicates the origin of the log; if the log is a product of a test event. This is typically null for regular source events received from the data source.

verification_status
string

The verification status for the received event.

SourceLogAction

#

An action executed after receiving a source event.

Attributes

action_parameters
object(any)

The configured mapping parameters used to derive the action payload.

action_payload
object(any)

The parsed values generated from the mapping parameters for this action.

action_result
object(any)

The result returned by the action.

action_status
string

The status of the action.

action_type
string

The type of action that was executed.

id
string

The action log ID.

inserted_at
string(date-time)

The timestamp of when the action log was created.

SourceLogsResponse

#

A paginated list of source logs. Include actions in the includes query parameter to return action details for each log.

Attributes

The source logs for the requested source and environment.

The actions executed after receiving the source event. Only present when includes contains actions.

action_parameters
object(any)

The configured mapping parameters used to derive the action payload.

action_payload
object(any)

The parsed values generated from the mapping parameters for this action.

action_result
object(any)

The result returned by the action.

action_status
string

The status of the action.

action_type
string

The type of action that was executed.

id
string
Required

The action log ID.

inserted_at
string(date-time)

The timestamp of when the action log was created.

data
object(any)

The data payload parsed by the source.

event
string
Required

The decoded source event name.

id
string
Required

The source log ID.

inserted_at
string(date-time)

The timestamp of when the source log was created.

preprocess_output
object(any)

The output returned by the preprocess script.

source
string

Indicates the origin of the log; if the log is a product of a test event. This is typically null for regular source events received from the data source.

verification_status
string

The verification status for the received event.

page_info

The information about a paginated result.

after
string

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

before
string

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

page_size
integer

The number of entries to fetch per-page.

SourceProviderResponse

#

A source provider available for creating sources.

Attributes

default_action_mappings
object[]

Default event action mappings for the provider. Only present when includes contains default_action_mappings.

action_parameters
object(any)
Required

Action-specific data paths and options.

action_type
enum(string)
Required

The action performed when the mapping matches a source event.

workflows_triggerusers_identifyusers_deleteobjects_setobjects_deleteobjects_subscribeobjects_unsubscribetenants_settenants_deleteaudiences_add_memberaudiences_remove_member
event_type
string
Required

Event type to match.

default_settings
object

Default source settings for this provider.

enforce_verification
boolean

Whether the source should enforce webhook verification.

event_type_path
string

Path to find the event type from the data.

idempotency_key_path
string

Path to find the idempotency key from the data.

preprocessing_script
object

Verification script source code. Only present when includes contains preprocessing_script.

timestamp_path
string

Path to find the timestamp from the data.

example_payloads
object(any)

Example payloads keyed by event type. Only present when includes contains example_payloads.

key
string

Provider key.

provider
object

Provider display metadata.

branding
object

Provider branding assets. Only present when includes contains branding.

categories
enum(string)[]

Provider categories for filtering and grouping.

BillingInfrastructureAnalyticsCRMEcommerceCommunicationsIdentity
description
string

Provider display description.

knock_tutorial_url
string

Knock tutorial URL for setting up the provider.

name
string

Provider display name.

webhook_config_deep_link
string

Provider webhook configuration URL.

webhook_docs_url
string

Provider webhook documentation URL.

website_url
string

Provider website URL.

static_fields
object(any)

JSON Schema fields needed to configure the source. Only present when includes contains static_fields.

version
string

Provider version.

SourceProvidersResponse

#

Source providers available for creating sources.

Attributes

entries
object[]

Source providers.

key
string
Required

Provider key.

provider
object
Required

Provider display metadata.

description
string
Required

Provider display description.

name
string
Required

Provider display name.

version
string
Required

Provider version.

SourceRehearseRequest

#

Request body for rehearsing a source event.

Attributes

payload
object(any)

An arbitrary payload to send through the source's parse, preprocess, and mapping pipeline.

SourceRehearseResponse

#

The result of a simulated source event rehearsal.

Attributes

action_logs_count
integer

The total number of action logs produced by the rehearsal.

errors
object[]

Errors returned while rehearsing the source event.

field
string
Required
message
string
Required
failed_action_logs_count
integer

The number of failed action logs produced by the rehearsal.

log_id
string

The ID of the source event log created by the rehearsal.

status
enum(string)

Whether the rehearsal completed without action errors.

okerror
successful_action_logs_count
integer

The number of successful action logs produced by the rehearsal.

SourceStatusResponse

#

Status information for a source in an environment.

Attributes

events_count
integer

The number of source events received in the last 30 days.

last_event_received
string

The timestamp of the most recently received source event.

mappings_count
integer

The total number of event action mappings for the source environment.

mappings_requiring_commit
object[]

Workflow trigger event action mappings that need a workflow commit before their changes are applied.

action_type
enum(string)
Required

The action that is performed when this mapping matches a source event.

workflows_trigger
event_type
string
Required

The decoded event type that triggers the action.

inactive_at
string(date-time)

The timestamp of when the mapping was deactivated.

is_deleted
boolean
Required

Whether the mapping is pending deletion.

resource_key
string
Required

The key of the workflow resource referenced by the mapping.

status
enum(string)
Required

Whether the mapping is pending deletion or update.

deletedupdated

SourcesResponse

#

Sources connected to the project.

Attributes

entries
object[]

Sources.

custom_image_url
string

Custom image URL for the source.

description
string

Source description.

key
string
Required

Source key.

name
string
Required

Source display name.

New chat