Knock Tenants API
A tenant represents a top-level entity from your system, like a company, organization, account, or workspace.
A tenant represents a top-level entity from your system, like a company, organization, account, or workspace.
openapi: 3.0.0
info:
title: Knock Audiences Tenants API
version: '1.0'
description: An Audience is a segment of users.
servers:
- url: https://api.knock.app
variables: {}
security:
- BearerAuth: []
tags:
- description: A tenant represents a top-level entity from your system, like a company, organization, account, or workspace.
name: Tenants
paths:
/v1/tenants/{id}:
delete:
callbacks: {}
description: Delete a tenant and all associated data. This operation cannot be undone.
operationId: deleteTenant
parameters:
- description: The unique identifier for the tenant.
in: path
name: id
required: true
schema:
type: string
x-struct: null
x-validate: null
responses:
'204':
description: No Content
summary: Delete a tenant
tags:
- Tenants
x-ratelimit-tier: 2
get:
callbacks: {}
description: Get a tenant by ID.
operationId: getTenant
parameters:
- description: The unique identifier for the tenant.
in: path
name: id
required: true
schema:
type: string
x-struct: null
x-validate: null
- description: When true, merges environment-level default preferences into the tenant's `settings.preference_set` field before returning the response. Defaults to false.
in: query
name: resolve_full_preference_settings
required: false
schema:
type: boolean
x-struct: null
x-validate: null
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Tenant'
description: OK
summary: Get a tenant
tags:
- Tenants
x-ratelimit-tier: 4
put:
callbacks: {}
description: Sets a tenant within an environment, performing an upsert operation. Any existing properties will be merged with the incoming properties.
operationId: setTenant
parameters:
- description: The unique identifier for the tenant.
in: path
name: id
required: true
schema:
type: string
x-struct: null
x-validate: null
- description: When true, merges environment-level default preferences into the tenant's `settings.preference_set` field before returning the response. Defaults to false.
in: query
name: resolve_full_preference_settings
required: false
schema:
type: boolean
x-struct: null
x-validate: null
requestBody:
content:
application/json:
example:
name: Jurassic Park
settings:
branding:
icon_url: https://example.com/trex_silhouette_icon.png
logo_url: https://example.com/amber_fossil_logo.png
primary_color: '#DF1A22'
primary_color_contrast: '#FFDE00'
schema:
$ref: '#/components/schemas/SetTenantRequest'
description: Tenant
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/SetTenantResponse'
description: OK
summary: Set a tenant
tags:
- Tenants
x-ratelimit-tier: 3
/v1/tenants:
get:
callbacks: {}
description: List tenants for the current environment.
operationId: listTenants
parameters:
- description: Filter tenants by ID.
in: query
name: tenant_id
required: false
schema:
type: string
x-struct: null
x-validate: null
- description: Filter tenants by name.
in: query
name: name
required: false
schema:
type: string
x-struct: null
x-validate: null
- description: The cursor to fetch entries after.
in: query
name: after
required: false
schema:
type: string
x-struct: null
x-validate: null
- description: The cursor to fetch entries before.
in: query
name: before
required: false
schema:
type: string
x-struct: null
x-validate: null
- description: The number of items per page (defaults to 50).
in: query
name: page_size
required: false
schema:
type: integer
x-struct: null
x-validate: null
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ListTenantsResponse'
description: OK
summary: List tenants
tags:
- Tenants
x-ratelimit-tier: 4
/v1/tenants/bulk/delete:
post:
callbacks: {}
description: Delete up to 1,000 tenants at a time in a single operation. This operation cannot be undone.
operationId: bulkDeleteTenants
parameters:
- description: The IDs of the tenants to delete.
in: query
name: tenant_ids[]
required: true
schema:
items:
type: string
x-struct: null
x-validate: null
type: array
x-struct: null
x-validate: null
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BulkOperation'
description: OK
summary: Bulk delete tenants
tags:
- Tenants
x-ratelimit-tier: 1
/v1/tenants/bulk/set:
post:
callbacks: {}
description: Set or update up to 1,000 tenants in a single operation.
operationId: bulkSetTenants
parameters: []
requestBody:
content:
application/json:
example:
tenants:
- id: tenant_1
name: Acme Corp, Inc.
schema:
$ref: '#/components/schemas/BulkSetTenantsRequest'
description: Params
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BulkOperation'
description: OK
summary: Bulk set tenants
tags:
- Tenants
x-ratelimit-tier: 1
components:
schemas:
DiscordIncomingWebhookConnection:
description: Discord incoming webhook connection.
example:
incoming_webhook:
url: https://example.com/webhook
properties:
incoming_webhook:
description: Discord incoming webhook object.
properties:
url:
description: Incoming webhook URL.
example: https://example.com/webhook
type: string
x-struct: null
x-validate: null
required:
- url
type: object
x-struct: null
x-validate: null
required:
- incoming_webhook
title: DiscordIncomingWebhookConnection
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.DiscordChannelData.IncomingWebhookConnection
x-validate: null
TenantRequest:
additionalProperties: true
description: A tenant to be set in the system. You can supply any additional properties on the tenant object.
example:
id: tenant_123
name: ACME Corp, Inc.
settings:
branding:
icon_url: https://example.com/icon.png
logo_url: https://example.com/logo.png
primary_color: '#000000'
primary_color_contrast: '#FFFFFF'
properties:
channel_data:
description: The channel data for the tenant.
oneOf:
- nullable: true
x-struct: null
x-validate: null
- $ref: '#/components/schemas/InlineChannelDataRequest'
x-struct: null
x-validate: null
id:
description: The unique identifier for the tenant.
type: string
x-struct: null
x-validate: null
name:
description: An optional name for the tenant.
nullable: true
type: string
x-struct: null
x-validate: null
preferences:
description: The preferences for the tenant.
oneOf:
- nullable: true
x-struct: null
x-validate: null
- $ref: '#/components/schemas/InlinePreferenceSetRequest'
x-struct: null
x-validate: null
settings:
description: The settings for the tenant. Includes branding and preference set.
properties:
branding:
description: The branding for the tenant.
properties:
icon_url:
description: The icon URL for the tenant. Must point to a valid image with an image MIME type.
nullable: true
type: string
x-struct: null
x-validate: null
logo_url:
description: The logo URL for the tenant. Must point to a valid image with an image MIME type.
nullable: true
type: string
x-struct: null
x-validate: null
primary_color:
description: The primary color for the tenant, provided as a hex value.
nullable: true
type: string
x-struct: null
x-validate: null
primary_color_contrast:
description: The primary color contrast for the tenant, provided as a hex value.
nullable: true
type: string
x-struct: null
x-validate: null
type: object
x-struct: null
x-validate: null
preference_set:
description: The preference set for the tenant. Used to override the default preference set.
oneOf:
- nullable: true
x-struct: null
x-validate: null
- $ref: '#/components/schemas/PreferenceSetRequest'
x-struct: null
x-validate: null
type: object
x-struct: null
x-validate: null
required:
- id
title: TenantRequest
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.TenantRequest
x-validate: null
Tenant:
additionalProperties: true
description: A tenant entity.
example:
__typename: Tenant
id: tenant_jp123
name: Jurassic Park
settings:
branding:
icon_url: https://example.com/trex_silhouette_icon.png
logo_url: https://example.com/amber_fossil_logo.png
primary_color: '#DF1A22'
primary_color_contrast: '#FFDE00'
preference_set:
categories:
safety:
channel_types:
email: true
push: true
channel_types:
email: true
in_app_feed: true
push: true
id: default
workflows:
park_alert:
channel_types:
email: true
push: true
properties:
__typename:
description: The typename of the schema.
example: Tenant
type: string
x-struct: null
x-validate: null
id:
description: The unique identifier for the tenant.
nullable: false
type: string
x-struct: null
x-validate: null
name:
description: An optional name for the tenant.
nullable: true
type: string
x-struct: null
x-validate: null
settings:
description: The settings for the tenant. Includes branding and preference set.
nullable: true
properties:
branding:
description: The branding for the tenant.
nullable: true
properties:
icon_url:
description: The icon URL for the tenant. Must point to a valid image with an image MIME type.
example: https://example.com/trex_silhouette_icon.png
format: uri
nullable: true
type: string
x-struct: null
x-validate: null
logo_url:
description: The logo URL for the tenant. Must point to a valid image with an image MIME type.
example: https://example.com/amber_fossil_logo.png
format: uri
nullable: true
type: string
x-struct: null
x-validate: null
primary_color:
description: The primary color for the tenant, provided as a hex value.
example: '#DF1A22'
nullable: true
type: string
x-struct: null
x-validate: null
primary_color_contrast:
description: The primary color contrast for the tenant, provided as a hex value.
example: '#FFDE00'
nullable: true
type: string
x-struct: null
x-validate: null
type: object
x-struct: null
x-validate: null
preference_set:
anyOf:
- $ref: '#/components/schemas/PreferenceSet'
- nullable: true
x-struct: null
x-validate: null
description: The preference set for the tenant. Used to override the default preference set.
x-struct: null
x-validate: null
type: object
x-struct: null
x-validate: null
required:
- __typename
- id
title: Tenant
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.Tenant
x-validate: null
InlinePreferenceSetRequest:
additionalProperties:
$ref: '#/components/schemas/PreferenceSetRequest'
description: Inline set preferences for a recipient, where the key is the preference set id. Preferences that are set inline will be merged into any existing preferences rather than replacing them.
example:
default:
categories:
transactional:
channel_types:
email: false
channel_types:
email: true
title: InlinePreferenceSetRequest
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.InlinePreferenceSetRequest
x-validate: null
SetTenantResponse:
description: The response from setting a tenant.
example:
__typename: Tenant
created_at: '1993-05-24T08:30:00Z'
id: ingen_isla_nublar
name: Jurassic Park
settings:
branding:
icon_url: https://example.com/trex_silhouette_icon.png
logo_url: https://example.com/amber_fossil_logo.png
primary_color: '#DF1A22'
primary_color_contrast: '#FFDE00'
updated_at: '1993-06-11T15:45:00Z'
oneOf:
- $ref: '#/components/schemas/Tenant'
title: SetTenantResponse
x-struct: Elixir.SwitchboardWeb.V1.Specs.SetTenantResponse
x-validate: null
InlineTenantRequest:
description: An request to set a tenant inline.
example:
id: tenant_1
name: Acme Corp, Inc.
oneOf:
- description: The unique identifier for the tenant.
type: string
x-struct: null
x-validate: null
- $ref: '#/components/schemas/TenantRequest'
title: InlineTenantRequest
x-struct: Elixir.SwitchboardWeb.V1.Specs.InlineTenantRequest
x-validate: null
MsTeamsTokenConnection:
description: Microsoft Teams token connection.
example:
ms_teams_channel_id: 123e4567-e89b-12d3-a456-426614174000
ms_teams_team_id: 123e4567-e89b-12d3-a456-426614174000
ms_teams_tenant_id: null
ms_teams_user_id: null
properties:
ms_teams_channel_id:
description: Microsoft Teams channel ID.
format: uuid
nullable: true
type: string
x-struct: null
x-validate: null
ms_teams_team_id:
description: Microsoft Teams team ID.
format: uuid
nullable: true
type: string
x-struct: null
x-validate: null
ms_teams_tenant_id:
description: Microsoft Teams tenant ID.
format: uuid
nullable: true
type: string
x-struct: null
x-validate: null
ms_teams_user_id:
description: Microsoft Teams user ID.
format: uuid
nullable: true
type: string
x-struct: null
x-validate: null
title: MsTeamsTokenConnection
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.MsTeamsChannelData.TokenConnection
x-validate: null
PageInfo:
description: Pagination information for a list of resources.
example:
__typename: PageInfo
after: null
before: null
page_size: 25
properties:
__typename:
description: The typename of the schema.
example: PageInfo
type: string
x-struct: null
x-validate: null
after:
description: The cursor to fetch entries after.
nullable: true
type: string
x-struct: null
x-validate: null
before:
description: The cursor to fetch entries before.
nullable: true
type: string
x-struct: null
x-validate: null
page_size:
description: The number of items per page (defaults to 50).
type: integer
x-struct: null
x-validate: null
required:
- __typename
- page_size
title: PageInfo
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.PageInfo
x-validate: null
MsTeamsIncomingWebhookConnection:
description: Microsoft Teams incoming webhook connection.
example:
incoming_webhook:
url: https://example.com/webhook
properties:
incoming_webhook:
description: Microsoft Teams incoming webhook.
properties:
url:
description: Microsoft Teams incoming webhook URL.
example: https://example.com/webhook
type: string
x-struct: null
x-validate: null
required:
- url
type: object
x-struct: null
x-validate: null
required:
- incoming_webhook
title: MsTeamsIncomingWebhookConnection
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.MsTeamsChannelData.IncomingWebhookConnection
x-validate: null
OneSignalChannelDataPlayerIdsOnly:
description: OneSignal channel data.
example:
player_ids:
- 123e4567-e89b-12d3-a456-426614174000
properties:
player_ids:
description: A list of OneSignal player IDs.
example:
- 123e4567-e89b-12d3-a456-426614174000
items:
description: OneSignal player ID.
format: uuid
nullable: false
type: string
x-struct: null
x-validate: null
nullable: false
type: array
x-struct: null
x-validate: null
required:
- player_ids
title: OneSignalChannelDataPlayerIdsOnly
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.OneSignalChannelDataPlayerIdsOnly
x-validate: null
PreferenceSetWorkflowCategorySetting:
description: Workflow or category preferences within a preference set
example:
channel_types:
email: false
channels:
aef6e715-df82-4ab6-b61e-b743e249f7b6: true
oneOf:
- example: false
type: boolean
x-struct: null
x-validate: null
- description: The settings object for a workflow or category, where you can specify channel types or conditions.
example:
channel_types:
email: false
channels:
aef6e715-df82-4ab6-b61e-b743e249f7b6: true
conditions: null
properties:
channel_types:
anyOf:
- $ref: '#/components/schemas/PreferenceSetChannelTypes'
- nullable: true
x-struct: null
x-validate: null
description: An object where the key is the channel type and the values are the preference settings for that channel type.
x-struct: null
x-validate: null
channels:
anyOf:
- $ref: '#/components/schemas/PreferenceSetChannels'
- nullable: true
x-struct: null
x-validate: null
description: An object where the key is the channel ID and the values are the preference settings for that channel ID.
x-struct: null
x-validate: null
conditions:
description: A list of conditions to apply to a channel type.
items:
$ref: '#/components/schemas/Condition'
nullable: true
type: array
x-struct: null
x-validate: null
title: PreferenceSetWorkflowCategorySettingObject
type: object
x-struct: null
x-validate: null
title: PreferenceSetWorkflowCategorySetting
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.PreferenceSetWorkflowCategorySetting
x-validate: null
PreferenceSetChannelTypes:
description: Channel type preferences.
example:
email: true
sms:
conditions:
- argument: US
operator: equal_to
variable: recipient.country_code
properties:
chat:
description: Whether the channel type is enabled for the preference set.
oneOf:
- type: boolean
x-struct: null
x-validate: null
- $ref: '#/components/schemas/PreferenceSetChannelTypeSetting'
x-struct: null
x-validate: null
email:
description: Whether the channel type is enabled for the preference set.
oneOf:
- type: boolean
x-struct: null
x-validate: null
- $ref: '#/components/schemas/PreferenceSetChannelTypeSetting'
x-struct: null
x-validate: null
http:
description: Whether the channel type is enabled for the preference set.
oneOf:
- type: boolean
x-struct: null
x-validate: null
- $ref: '#/components/schemas/PreferenceSetChannelTypeSetting'
x-struct: null
x-validate: null
in_app_feed:
description: Whether the channel type is enabled for the preference set.
oneOf:
- type: boolean
x-struct: null
x-validate: null
- $ref: '#/components/schemas/PreferenceSetChannelTypeSetting'
x-struct: null
x-validate: null
push:
description: Whether the channel type is enabled for the preference set.
oneOf:
- type: boolean
x-struct: null
x-validate: null
- $ref: '#/components/schemas/PreferenceSetChannelTypeSetting'
x-struct: null
x-validate: null
sms:
description: Whether the channel type is enabled for the preference set.
oneOf:
- type: boolean
x-struct: null
x-validate: null
- $ref: '#/components/schemas/PreferenceSetChannelTypeSetting'
x-struct: null
x-validate: null
title: PreferenceSetChannelTypes
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.PreferenceSetChannelTypes
x-validate: null
PreferenceSetChannelTypeSetting:
description: A set of settings for a channel type. Currently, this can only be a list of conditions to apply.
example:
conditions:
- argument: US
operator: equal_to
variable: recipient.country_code
properties:
conditions:
description: A list of conditions to apply to a channel type.
items:
$ref: '#/components/schemas/Condition'
type: array
x-struct: null
x-validate: null
required:
- conditions
title: PreferenceSetChannelTypeSetting
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.PreferenceSetChannelTypes.PreferenceSetChannelTypeSetting
x-validate: null
PreferenceSetRequest:
description: A request to set a preference set for a recipient.
example:
__persistence_strategy__: merge
categories:
marketing: false
transactional:
channel_types:
email: false
channel_types:
email: true
channels:
2f641633-95d3-4555-9222-9f1eb7888a80:
conditions:
- argument: US
operator: equal_to
variable: recipient.country_code
aef6e715-df82-4ab6-b61e-b743e249f7b6: true
commercial_subscribed: true
workflows:
dinosaurs-loose:
channel_types:
email: false
properties:
__persistence_strategy__:
description: Controls how the preference set is persisted. 'replace' will completely replace the preference set, 'merge' will merge with existing preferences.
enum:
- merge
- replace
type: string
x-struct: null
x-validate: null
categories:
anyOf:
- additionalProperties:
$ref: '#/components/schemas/PreferenceSetWorkflowCategorySetting'
description: An object where the key is the category and the values are the preference settings for that category.
example:
marketing:
channel_types:
email: false
transactional: true
title: PreferenceSetRequestCategories
type: object
x-struct: null
x-validate: null
- nullable: true
x-struct: null
x-validate: null
description: An object where the key is the category and the values are the preference settings for that category.
x-struct: null
x-validate: null
channel_types:
anyOf:
- $ref: '#/components/schemas/PreferenceSetChannelTypes'
- nullable: true
x-struct: null
x-validate: null
description: An object where the key is the channel type and the values are the preference settings for that channel type.
x-struct: null
x-validate: null
channels:
anyOf:
- $ref: '#/components/schemas/PreferenceSetChannels'
- nullable: true
x-struct: null
x-validate: null
description: An object where the key is the channel ID and the values are the preference settings for that channel ID.
x-struct: null
x-validate: null
commercial_subscribed:
description: Whether the recipient is subscribed to commercial communications. When false, the recipient will not receive commercial workflow notifications.
nullable: true
type: boolean
x-struct: null
x-validate: null
workflows:
anyOf:
- additionalProperties:
$ref: '#/components/schemas/PreferenceSetWorkflowCategorySetting'
description: An object where the key is the workflow key and the values are the preference settings for that workflow.
example:
dinosaurs-loose:
channel_types:
email: false
sms: true
welcome-sequence: true
title: PreferenceSetRequestWorkflows
type: object
x-struct: null
x-validate: null
- nullable: true
x-struct: null
x-validate: null
description: An object where the key is the workflow key and the values are the preference settings for that workflow.
x-struct: null
x-validate: null
title: PreferenceSetRequest
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.PreferenceSetRequest
x-validate: null
AWSSNSPushChannelDataTargetARNsOnly:
description: AWS SNS push channel data.
example:
target_arns:
- arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3
properties:
target_arns:
description: A list of platform endpoint ARNs. See [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html).
example:
- arn:aws:sns:us-west-2:123456789012:endpoint/GCM/gcmpushapp/5e3e9847-3183-3f18-a7e8-671c3a57d4b3
items:
description: The ARN of a platform endpoint associated with a platform application and a device token. See [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html).
nullable: false
type: string
x-struct: null
x-validate: null
nullable: false
type: array
x-struct: null
x-validate: null
required:
- target_arns
title: AWSSNSPushChannelDataTargetARNsOnly
type: object
x-struct: Elixir.SwitchboardWeb.V1.Specs.AWSSNSPushChannelDataTargetARNsOnly
x-validate: null
SetTenantRequest:
additionalProperties: true
description: A tenant to be set in the system. You can supply any additional properties on the tenant object.
example:
name: Jurassic Park
settings:
branding:
icon_url: https://example.com/trex_silhouette_icon.png
logo_url: https://example.com/amber_fossil_logo.png
primary_color: '#DF1A22'
primary_color_contrast: '#FFDE00'
properties:
channel_data:
description: The channel data for the tenant.
oneOf:
- nullable: true
x-struct: null
x-validate: null
- $ref: '#/components/schemas/InlineChannelDataRequest'
x-struct: null
x-validate: null
name:
description: An optional name for the tenant.
nullable: true
type: string
x-struct: null
x-validate: null
settings:
description: The settings for the tenant. Includes branding and preference set.
properties:
branding:
description: The branding for the tenant.
properties:
icon_url:
description: The icon URL for the tenant. Must point to a valid image with an image MIME type.
nullable: true
type: string
x-struct: null
x-validate: null
logo_url:
description: The logo URL for the tenant. Must point to a valid image with an image MIME type.
nullable: true
type: string
x-struct: null
x-validate: null
primary_color:
description: The primary color for the tenant, provided as a hex value.
nullable: true
type: string
x-struct: null
x-validate: null
primary_color_contrast:
description: The primary color contrast for the tenant, provided as a hex value
# --- truncated at 32 KB (57 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/knock/refs/heads/main/openapi/knock-tenants-api-openapi.yml