Docs
/
/

Audiences

An [Audience](/concepts/audiences) 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](/concepts/broadcasts).

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. Limited to 1,000 members per request.

tenant
string

The unique identifier for the tenant.

A user object. At minimum must contain an id property.

Returns

204 No Content

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

A URL for the avatar of the user.

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 unique identifier of the user.

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 unique identifier of the user.

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 (defaults to 50).

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.

A user object. At minimum must contain an id property.

Returns

204 No Content

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

A URL for the avatar of the user.

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 unique identifier of the user.

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 unique identifier of the user.

New chat