Skip to content
KnockDevelopers
Analytics

Query an analytics table

Chat with a Developer
POST
/v1/analytics/tables/query

Returns rows, a count or a breakdown of your Accounts (table: accounts, one row per company domain) or Contacts (table: contacts, one row per person) table, filtered with the filters POST /v1/analytics/tables/describe lists.

limit: 0 returns only total. groupBy returns one count per value of a column, and splitBy splits each group by a second column. columns picks what each row carries. Filters AND together, values inside one filter OR together, and filters.filterGroups OR their groups. A list filter also takes { "matching": "<text>" }: every value containing the text.

Contacts rows hold personal data (names, emails, phone numbers, LinkedIn). A contact's contactId is what GET /v1/analytics/signals-history takes as actorId. Data refreshes every few hours.

Authorization

ApiKeyAuth
headerx-api-key<token>

Your Knock API key. Ask your Knock account team for one: a key with the Enrichment API role to enrich and route leads and find warm intros, the Viewer role to read chats, meetings, routing rules, FAQs, analytics, magic links, meeting routing rules, marketing cards and members, the Admin, Editor or AI Manager role to change FAQs, the Admin, Editor or Partner Contributor role to create marketing cards and wrap chat links, or the Admin role to set the working hours of your members.

Request Body

application/json
  1. body
table*enum<string>

accounts = companies; contacts = people

Show 2 valuesHide values
accountscontacts
filters?

Filter keys and values exactly as describe_table lists them

groupBy?string

A column to count the matching rows by, one count per value, in this one call (describe_table lists groupByColumns)

splitBy?string

With groupBy: a second, single-valued column to split each group by (describe_table lists splitByColumns)

groupLimit?integer

With groupBy: how many groups to return, largest first

Range1 <= value <= 100
Default25
columns?array<string>

Columns to return; the default set when omitted

orderBy?string

A column describe_table lists under orderByColumns

orderDirection?enum<string>
Show 2 valuesHide values
ASCDESC
limit?integer

0 returns only the total

Range0 <= value <= 100
Default25
offset?integer
Range0 <= value
Default0

Response Body

A page of rows, a count or groups.

application/json
  1. response
table*enum<string>
Show 2 valuesHide values
accountscontacts
total*number

Every row matching the filters, not just this page

columns*array<string>

The columns each row carries

rows*array<>
matched?

For each filter sent as { matching }: how many values it matched and was filtered by

groupCount?number

With groupBy: how many distinct groups exist

groups?array<>

With groupBy: the largest groups. A row of an array column counts in each of its values, so groups may sum past total

Example Request
curl -X POST 'https://app.knock-ai.com/v1/analytics/tables/query' \  -H 'x-api-key: <YOUR_API_KEY>' \  -H 'Content-Type: application/json' \  -d '{  "table": "accounts"}'
Example Response
{  "table": "accounts",  "total": 0,  "columns": [    "string"  ],  "rows": [    {}  ],  "matched": {    "property1": 0,    "property2": 0  },  "groupCount": 0,  "groups": [    {      "value": "string",      "count": 0,      "share": 0,      "splits": [        {          "value": "string",          "count": 0,          "share": 0        }      ]    }  ]}