---
title: "Update Insight"
method: PATCH
path: "/reporting/insight/{id}"
tags: ["Insight"]
---

# Update Insight

`PATCH /reporting/insight/{id}`

## Path parameters

- `id` string, required

## Request body

- union
  - UpdateBarInsightFromCallTableDTO
    - `name` string — This is the name of the Insight.
    - `type` 'bar' — This is the type of the Insight. It is required to be `bar` to create a bar insight.
    - `formulas` InsightFormula[] — Formulas are mathematical expressions applied on the data returned by the queries to transform them before being used to create the insight. The formulas needs to be a valid mathematical expression, supported by MathJS - https://mathjs.org/docs/expressions/syntax.html A formula is created by using the query names as the variable. The formulas must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. For example, if you have 2 queries, 'Was Booking Made' and 'Average Call Duration', you can create a formula like this: ``` {{['Query 1']}} / {{['Query 2']}} * 100 ``` ``` ({{[Query 1]}} * 10) + {{[Query 2]}} ``` This will take the You can also use the query names as the variable in the formula.
      - `name` string — This is the name of the formula. It will be used to label the formula in the insight board on the UI.
      - `formula` string, required — This is the formula to calculate the insight from the queries. The formula needs to be a valid mathematical expression. The formula must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. Any MathJS formula is allowed - https://mathjs.org/docs/expressions/syntax.html Common valid math operations are +, -, *, /, %
    - `metadata` BarInsightMetadata
      - `xAxisLabel` string
      - `yAxisLabel` string
      - `yAxisMin` number
      - `yAxisMax` number
      - `name` string
    - `timeRange` InsightTimeRangeWithStep
      - `step` 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year' — This is the group by step for aggregation. If not provided, defaults to group by day.
      - `start` object — This is the start date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to the 7 days ago. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `end` object — This is the end date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to now. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `timezone` string — This is the timezone you want to set for the query. If not provided, defaults to UTC.
    - `groupBy` 'assistantId' | 'workflowId' | 'squadId' | 'phoneNumberId' | 'type' | 'endedReason' | 'campaignId' | 'artifact.structuredOutputs[OutputID]' — This is the group by column for the insight when table is `call`. These are the columns to group the results by. All results are grouped by the time range step by default.
    - `queries` union[] — These are the queries to run to generate the insight.
      - union
        - JSONQueryOnCallTableWithStringTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'id' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. String Type columns are columns where the rows store String data
          - `operation` 'count', required — This is the aggregation operation to perform on the column. When the column is a string type, the operation must be "count".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithNumberTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'cost' | 'duration' | 'averageModelLatency' | 'averageVoiceLatency' | 'averageTranscriberLatency' | 'averageTurnLatency' | 'averageEndpointingLatency' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. Number Type columns are columns where the rows store Number data
          - `operation` 'average' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a number type, the operation must be one of the following: - average - sum - min - max
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithStructuredOutputColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the call table. Structured Output Type columns are only to query on artifact.structuredOutputs[OutputID] column.
          - `operation` 'average' | 'count' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a structured output type, the operation depends on the value of the structured output. If the structured output is a string or boolean, the operation must be "count". If the structured output is a number, the operation can be "average", "sum", "min", or "max".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
  - UpdatePieInsightFromCallTableDTO
    - `name` string — This is the name of the Insight.
    - `type` 'pie' — This is the type of the Insight. It is required to be `pie` to create a pie insight.
    - `formulas` InsightFormula[] — Formulas are mathematical expressions applied on the data returned by the queries to transform them before being used to create the insight. The formulas needs to be a valid mathematical expression, supported by MathJS - https://mathjs.org/docs/expressions/syntax.html A formula is created by using the query names as the variable. The formulas must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. For example, if you have 2 queries, 'Was Booking Made' and 'Average Call Duration', you can create a formula like this: ``` {{['Query 1']}} / {{['Query 2']}} * 100 ``` ``` ({{[Query 1]}} * 10) + {{[Query 2]}} ``` This will take the You can also use the query names as the variable in the formula.
      - `name` string — This is the name of the formula. It will be used to label the formula in the insight board on the UI.
      - `formula` string, required — This is the formula to calculate the insight from the queries. The formula needs to be a valid mathematical expression. The formula must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. Any MathJS formula is allowed - https://mathjs.org/docs/expressions/syntax.html Common valid math operations are +, -, *, /, %
    - `timeRange` InsightTimeRange
      - `start` object — This is the start date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to the 7 days ago. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `end` object — This is the end date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to now. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `timezone` string — This is the timezone you want to set for the query. If not provided, defaults to UTC.
    - `groupBy` 'assistantId' | 'workflowId' | 'squadId' | 'phoneNumberId' | 'type' | 'endedReason' | 'campaignId' | 'artifact.structuredOutputs[OutputID]' — This is the group by column for the insight when table is `call`. These are the columns to group the results by. All results are grouped by the time range step by default.
    - `queries` union[] — These are the queries to run to generate the insight.
      - union
        - JSONQueryOnCallTableWithStringTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'id' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. String Type columns are columns where the rows store String data
          - `operation` 'count', required — This is the aggregation operation to perform on the column. When the column is a string type, the operation must be "count".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithNumberTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'cost' | 'duration' | 'averageModelLatency' | 'averageVoiceLatency' | 'averageTranscriberLatency' | 'averageTurnLatency' | 'averageEndpointingLatency' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. Number Type columns are columns where the rows store Number data
          - `operation` 'average' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a number type, the operation must be one of the following: - average - sum - min - max
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithStructuredOutputColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the call table. Structured Output Type columns are only to query on artifact.structuredOutputs[OutputID] column.
          - `operation` 'average' | 'count' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a structured output type, the operation depends on the value of the structured output. If the structured output is a string or boolean, the operation must be "count". If the structured output is a number, the operation can be "average", "sum", "min", or "max".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
  - UpdateLineInsightFromCallTableDTO
    - `name` string — This is the name of the Insight.
    - `type` 'line' — This is the type of the Insight. It is required to be `line` to create a line insight.
    - `formulas` InsightFormula[] — Formulas are mathematical expressions applied on the data returned by the queries to transform them before being used to create the insight. The formulas needs to be a valid mathematical expression, supported by MathJS - https://mathjs.org/docs/expressions/syntax.html A formula is created by using the query names as the variable. The formulas must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. For example, if you have 2 queries, 'Was Booking Made' and 'Average Call Duration', you can create a formula like this: ``` {{['Query 1']}} / {{['Query 2']}} * 100 ``` ``` ({{[Query 1]}} * 10) + {{[Query 2]}} ``` This will take the You can also use the query names as the variable in the formula.
      - `name` string — This is the name of the formula. It will be used to label the formula in the insight board on the UI.
      - `formula` string, required — This is the formula to calculate the insight from the queries. The formula needs to be a valid mathematical expression. The formula must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. Any MathJS formula is allowed - https://mathjs.org/docs/expressions/syntax.html Common valid math operations are +, -, *, /, %
    - `metadata` LineInsightMetadata
      - `xAxisLabel` string
      - `yAxisLabel` string
      - `yAxisMin` number
      - `yAxisMax` number
      - `name` string
    - `timeRange` InsightTimeRangeWithStep
      - `step` 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year' — This is the group by step for aggregation. If not provided, defaults to group by day.
      - `start` object — This is the start date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to the 7 days ago. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `end` object — This is the end date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to now. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `timezone` string — This is the timezone you want to set for the query. If not provided, defaults to UTC.
    - `groupBy` 'assistantId' | 'workflowId' | 'squadId' | 'phoneNumberId' | 'type' | 'endedReason' | 'campaignId' | 'artifact.structuredOutputs[OutputID]' — This is the group by column for the insight when table is `call`. These are the columns to group the results by. All results are grouped by the time range step by default.
    - `queries` union[] — These are the queries to run to generate the insight.
      - union
        - JSONQueryOnCallTableWithStringTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'id' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. String Type columns are columns where the rows store String data
          - `operation` 'count', required — This is the aggregation operation to perform on the column. When the column is a string type, the operation must be "count".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithNumberTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'cost' | 'duration' | 'averageModelLatency' | 'averageVoiceLatency' | 'averageTranscriberLatency' | 'averageTurnLatency' | 'averageEndpointingLatency' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. Number Type columns are columns where the rows store Number data
          - `operation` 'average' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a number type, the operation must be one of the following: - average - sum - min - max
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithStructuredOutputColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the call table. Structured Output Type columns are only to query on artifact.structuredOutputs[OutputID] column.
          - `operation` 'average' | 'count' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a structured output type, the operation depends on the value of the structured output. If the structured output is a string or boolean, the operation must be "count". If the structured output is a number, the operation can be "average", "sum", "min", or "max".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
  - UpdateTextInsightFromCallTableDTO
    - `name` string — This is the name of the Insight.
    - `type` 'text' — This is the type of the Insight. It is required to be `text` to create a text insight.
    - `formula` object — Formulas are mathematical expressions applied on the data returned by the queries to transform them before being used to create the insight. The formulas needs to be a valid mathematical expression, supported by MathJS - https://mathjs.org/docs/expressions/syntax.html A formula is created by using the query names as the variable. The formulas must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. For example, if you have 2 queries, 'Was Booking Made' and 'Average Call Duration', you can create a formula like this: ``` {{['Query 1']}} / {{['Query 2']}} * 100 ``` ``` ({{[Query 1]}} * 10) + {{[Query 2]}} ``` This will take the You can also use the query names as the variable in the formula.
    - `timeRange` InsightTimeRange
      - `start` object — This is the start date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to the 7 days ago. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `end` object — This is the end date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to now. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `timezone` string — This is the timezone you want to set for the query. If not provided, defaults to UTC.
    - `queries` union[] — These are the queries to run to generate the insight. For Text Insights, we only allow a single query, or require a formula if multiple queries are provided
      - union
        - JSONQueryOnCallTableWithStringTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'id' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. String Type columns are columns where the rows store String data
          - `operation` 'count', required — This is the aggregation operation to perform on the column. When the column is a string type, the operation must be "count".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithNumberTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'cost' | 'duration' | 'averageModelLatency' | 'averageVoiceLatency' | 'averageTranscriberLatency' | 'averageTurnLatency' | 'averageEndpointingLatency' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. Number Type columns are columns where the rows store Number data
          - `operation` 'average' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a number type, the operation must be one of the following: - average - sum - min - max
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithStructuredOutputColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the call table. Structured Output Type columns are only to query on artifact.structuredOutputs[OutputID] column.
          - `operation` 'average' | 'count' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a structured output type, the operation depends on the value of the structured output. If the structured output is a string or boolean, the operation must be "count". If the structured output is a number, the operation can be "average", "sum", "min", or "max".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.

## Response `200`

- union
  - BarInsight
    - `name` string — This is the name of the Insight.
    - `type` 'bar', required — This is the type of the Insight. It is required to be `bar` to create a bar insight.
    - `formulas` InsightFormula[] — Formulas are mathematical expressions applied on the data returned by the queries to transform them before being used to create the insight. The formulas needs to be a valid mathematical expression, supported by MathJS - https://mathjs.org/docs/expressions/syntax.html A formula is created by using the query names as the variable. The formulas must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. For example, if you have 2 queries, 'Was Booking Made' and 'Average Call Duration', you can create a formula like this: ``` {{['Query 1']}} / {{['Query 2']}} * 100 ``` ``` ({{[Query 1]}} * 10) + {{[Query 2]}} ``` This will take the You can also use the query names as the variable in the formula.
      - `name` string — This is the name of the formula. It will be used to label the formula in the insight board on the UI.
      - `formula` string, required — This is the formula to calculate the insight from the queries. The formula needs to be a valid mathematical expression. The formula must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. Any MathJS formula is allowed - https://mathjs.org/docs/expressions/syntax.html Common valid math operations are +, -, *, /, %
    - `metadata` BarInsightMetadata
      - `xAxisLabel` string
      - `yAxisLabel` string
      - `yAxisMin` number
      - `yAxisMax` number
      - `name` string
    - `timeRange` InsightTimeRangeWithStep
      - `step` 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year' — This is the group by step for aggregation. If not provided, defaults to group by day.
      - `start` object — This is the start date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to the 7 days ago. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `end` object — This is the end date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to now. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `timezone` string — This is the timezone you want to set for the query. If not provided, defaults to UTC.
    - `groupBy` 'assistantId' | 'workflowId' | 'squadId' | 'phoneNumberId' | 'type' | 'endedReason' | 'campaignId' | 'artifact.structuredOutputs[OutputID]' — This is the group by column for the insight when table is `call`. These are the columns to group the results by. All results are grouped by the time range step by default.
    - `queries` union[], required — These are the queries to run to generate the insight.
      - union
        - JSONQueryOnCallTableWithStringTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'id' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. String Type columns are columns where the rows store String data
          - `operation` 'count', required — This is the aggregation operation to perform on the column. When the column is a string type, the operation must be "count".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithNumberTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'cost' | 'duration' | 'averageModelLatency' | 'averageVoiceLatency' | 'averageTranscriberLatency' | 'averageTurnLatency' | 'averageEndpointingLatency' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. Number Type columns are columns where the rows store Number data
          - `operation` 'average' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a number type, the operation must be one of the following: - average - sum - min - max
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithStructuredOutputColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the call table. Structured Output Type columns are only to query on artifact.structuredOutputs[OutputID] column.
          - `operation` 'average' | 'count' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a structured output type, the operation depends on the value of the structured output. If the structured output is a string or boolean, the operation must be "count". If the structured output is a number, the operation can be "average", "sum", "min", or "max".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
    - `id` string, required — This is the unique identifier for the Insight.
    - `orgId` string, required — This is the unique identifier for the org that this Insight belongs to.
    - `createdAt` string, date-time, required — This is the ISO 8601 date-time string of when the Insight was created.
    - `updatedAt` string, date-time, required — This is the ISO 8601 date-time string of when the Insight was last updated.
  - PieInsight
    - `name` string — This is the name of the Insight.
    - `type` 'pie', required — This is the type of the Insight. It is required to be `pie` to create a pie insight.
    - `formulas` InsightFormula[] — Formulas are mathematical expressions applied on the data returned by the queries to transform them before being used to create the insight. The formulas needs to be a valid mathematical expression, supported by MathJS - https://mathjs.org/docs/expressions/syntax.html A formula is created by using the query names as the variable. The formulas must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. For example, if you have 2 queries, 'Was Booking Made' and 'Average Call Duration', you can create a formula like this: ``` {{['Query 1']}} / {{['Query 2']}} * 100 ``` ``` ({{[Query 1]}} * 10) + {{[Query 2]}} ``` This will take the You can also use the query names as the variable in the formula.
      - `name` string — This is the name of the formula. It will be used to label the formula in the insight board on the UI.
      - `formula` string, required — This is the formula to calculate the insight from the queries. The formula needs to be a valid mathematical expression. The formula must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. Any MathJS formula is allowed - https://mathjs.org/docs/expressions/syntax.html Common valid math operations are +, -, *, /, %
    - `timeRange` InsightTimeRange
      - `start` object — This is the start date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to the 7 days ago. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `end` object — This is the end date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to now. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `timezone` string — This is the timezone you want to set for the query. If not provided, defaults to UTC.
    - `groupBy` 'assistantId' | 'workflowId' | 'squadId' | 'phoneNumberId' | 'type' | 'endedReason' | 'campaignId' | 'artifact.structuredOutputs[OutputID]' — This is the group by column for the insight when table is `call`. These are the columns to group the results by. All results are grouped by the time range step by default.
    - `queries` union[], required — These are the queries to run to generate the insight.
      - union
        - JSONQueryOnCallTableWithStringTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'id' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. String Type columns are columns where the rows store String data
          - `operation` 'count', required — This is the aggregation operation to perform on the column. When the column is a string type, the operation must be "count".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithNumberTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'cost' | 'duration' | 'averageModelLatency' | 'averageVoiceLatency' | 'averageTranscriberLatency' | 'averageTurnLatency' | 'averageEndpointingLatency' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. Number Type columns are columns where the rows store Number data
          - `operation` 'average' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a number type, the operation must be one of the following: - average - sum - min - max
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithStructuredOutputColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the call table. Structured Output Type columns are only to query on artifact.structuredOutputs[OutputID] column.
          - `operation` 'average' | 'count' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a structured output type, the operation depends on the value of the structured output. If the structured output is a string or boolean, the operation must be "count". If the structured output is a number, the operation can be "average", "sum", "min", or "max".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
    - `id` string, required — This is the unique identifier for the Insight.
    - `orgId` string, required — This is the unique identifier for the org that this Insight belongs to.
    - `createdAt` string, date-time, required — This is the ISO 8601 date-time string of when the Insight was created.
    - `updatedAt` string, date-time, required — This is the ISO 8601 date-time string of when the Insight was last updated.
  - LineInsight
    - `name` string — This is the name of the Insight.
    - `type` 'line', required — This is the type of the Insight. It is required to be `line` to create a line insight.
    - `formulas` InsightFormula[] — Formulas are mathematical expressions applied on the data returned by the queries to transform them before being used to create the insight. The formulas needs to be a valid mathematical expression, supported by MathJS - https://mathjs.org/docs/expressions/syntax.html A formula is created by using the query names as the variable. The formulas must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. For example, if you have 2 queries, 'Was Booking Made' and 'Average Call Duration', you can create a formula like this: ``` {{['Query 1']}} / {{['Query 2']}} * 100 ``` ``` ({{[Query 1]}} * 10) + {{[Query 2]}} ``` This will take the You can also use the query names as the variable in the formula.
      - `name` string — This is the name of the formula. It will be used to label the formula in the insight board on the UI.
      - `formula` string, required — This is the formula to calculate the insight from the queries. The formula needs to be a valid mathematical expression. The formula must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. Any MathJS formula is allowed - https://mathjs.org/docs/expressions/syntax.html Common valid math operations are +, -, *, /, %
    - `metadata` LineInsightMetadata
      - `xAxisLabel` string
      - `yAxisLabel` string
      - `yAxisMin` number
      - `yAxisMax` number
      - `name` string
    - `timeRange` InsightTimeRangeWithStep
      - `step` 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year' — This is the group by step for aggregation. If not provided, defaults to group by day.
      - `start` object — This is the start date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to the 7 days ago. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `end` object — This is the end date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to now. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `timezone` string — This is the timezone you want to set for the query. If not provided, defaults to UTC.
    - `groupBy` 'assistantId' | 'workflowId' | 'squadId' | 'phoneNumberId' | 'type' | 'endedReason' | 'campaignId' | 'artifact.structuredOutputs[OutputID]' — This is the group by column for the insight when table is `call`. These are the columns to group the results by. All results are grouped by the time range step by default.
    - `queries` union[], required — These are the queries to run to generate the insight.
      - union
        - JSONQueryOnCallTableWithStringTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'id' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. String Type columns are columns where the rows store String data
          - `operation` 'count', required — This is the aggregation operation to perform on the column. When the column is a string type, the operation must be "count".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithNumberTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'cost' | 'duration' | 'averageModelLatency' | 'averageVoiceLatency' | 'averageTranscriberLatency' | 'averageTurnLatency' | 'averageEndpointingLatency' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. Number Type columns are columns where the rows store Number data
          - `operation` 'average' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a number type, the operation must be one of the following: - average - sum - min - max
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithStructuredOutputColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the call table. Structured Output Type columns are only to query on artifact.structuredOutputs[OutputID] column.
          - `operation` 'average' | 'count' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a structured output type, the operation depends on the value of the structured output. If the structured output is a string or boolean, the operation must be "count". If the structured output is a number, the operation can be "average", "sum", "min", or "max".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
    - `id` string, required — This is the unique identifier for the Insight.
    - `orgId` string, required — This is the unique identifier for the org that this Insight belongs to.
    - `createdAt` string, date-time, required — This is the ISO 8601 date-time string of when the Insight was created.
    - `updatedAt` string, date-time, required — This is the ISO 8601 date-time string of when the Insight was last updated.
  - TextInsight
    - `name` string — This is the name of the Insight.
    - `type` 'text', required — This is the type of the Insight. It is required to be `text` to create a text insight.
    - `formula` object — Formulas are mathematical expressions applied on the data returned by the queries to transform them before being used to create the insight. The formulas needs to be a valid mathematical expression, supported by MathJS - https://mathjs.org/docs/expressions/syntax.html A formula is created by using the query names as the variable. The formulas must contain at least one query name in the LiquidJS format {{query_name}} or {{['query name']}} which will be substituted with the query result. For example, if you have 2 queries, 'Was Booking Made' and 'Average Call Duration', you can create a formula like this: ``` {{['Query 1']}} / {{['Query 2']}} * 100 ``` ``` ({{[Query 1]}} * 10) + {{[Query 2]}} ``` This will take the You can also use the query names as the variable in the formula.
    - `timeRange` InsightTimeRange
      - `start` object — This is the start date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to the 7 days ago. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `end` object — This is the end date for the time range. Should be a valid ISO 8601 date-time string or relative time string. If not provided, defaults to now. Relative time strings of the format "-{number}{unit}" are allowed. Valid units are: - d: days - h: hours - w: weeks - m: months - y: years
      - `timezone` string — This is the timezone you want to set for the query. If not provided, defaults to UTC.
    - `queries` union[], required — These are the queries to run to generate the insight. For Text Insights, we only allow a single query, or require a formula if multiple queries are provided
      - union
        - JSONQueryOnCallTableWithStringTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'id' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. String Type columns are columns where the rows store String data
          - `operation` 'count', required — This is the aggregation operation to perform on the column. When the column is a string type, the operation must be "count".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithNumberTypeColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'cost' | 'duration' | 'averageModelLatency' | 'averageVoiceLatency' | 'averageTranscriberLatency' | 'averageTurnLatency' | 'averageEndpointingLatency' | 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the selected table. Available columns depend on the selected table. Number Type columns are columns where the rows store Number data
          - `operation` 'average' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a number type, the operation must be one of the following: - average - sum - min - max
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
        - JSONQueryOnCallTableWithStructuredOutputColumn
          - `type` 'vapiql-json', required — This is the type of query. Only allowed type is "vapiql-json".
          - `table` 'call', required — This is the table that will be queried.
          - `filters` union[] — This is the filters to apply to the insight. The discriminator automatically selects the correct filter type based on column and operator.
            - union
              - …
          - `column` 'artifact.structuredOutputs[OutputID]', required — This is the column that will be queried in the call table. Structured Output Type columns are only to query on artifact.structuredOutputs[OutputID] column.
          - `operation` 'average' | 'count' | 'sum' | 'min' | 'max', required — This is the aggregation operation to perform on the column. When the column is a structured output type, the operation depends on the value of the structured output. If the structured output is a string or boolean, the operation must be "count". If the structured output is a number, the operation can be "average", "sum", "min", or "max".
          - `name` string — This is the name of the query. It will be used to label the query in the insight board on the UI.
    - `id` string, required — This is the unique identifier for the Insight.
    - `orgId` string, required — This is the unique identifier for the org that this Insight belongs to.
    - `createdAt` string, date-time, required — This is the ISO 8601 date-time string of when the Insight was created.
    - `updatedAt` string, date-time, required — This is the ISO 8601 date-time string of when the Insight was last updated.

## Changes

> 35 revisions in range; 6 could not be searched.

- **2025-11-03** `d052da8b4f6e` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/vapiai/apis/vapi-api/changes/reporting/insight/:id/patch.md)

---

[API](https://skmtc.dev/vapiai/apis/vapi-api.md) · [All operations](https://skmtc.dev/vapiai/apis/vapi-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/vapiai/vapi-api/revisions/45678bc2c663/schema)
