> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.vapi.ai/llms.txt.
> For full documentation content, see https://docs.vapi.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.vapi.ai/_mcp/server.

# Create Insight

POST https://api.vapi.ai/reporting/insight
Content-Type: application/json

Reference: https://docs.vapi.ai/api-reference/insight/insight-controller-create

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /reporting/insight:
    post:
      operationId: insight-controller-create
      summary: Create Insight
      tags:
        - subpackage_insight
      parameters:
        - name: Authorization
          in: header
          description: Retrieve your API Key from [Dashboard](dashboard.vapi.ai).
          required: true
          schema:
            type: string
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Insight_InsightController_create_Response_201
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Insight_InsightController_create_Request'
servers:
  - url: https://api.vapi.ai
components:
  schemas:
    InsightFormula:
      type: object
      properties:
        name:
          type: string
          description: |-
            This is the name of the formula.
            It will be used to label the formula in the insight board on the UI.
        formula:
          type: string
          description: >-
            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 +, -, *, /, %
      required:
        - formula
      title: InsightFormula
    BarInsightMetadata:
      type: object
      properties:
        xAxisLabel:
          type: string
        yAxisLabel:
          type: string
        yAxisMin:
          type: number
          format: double
        yAxisMax:
          type: number
          format: double
        name:
          type: string
      title: BarInsightMetadata
    InsightTimeRangeWithStepStep:
      type: string
      enum:
        - minute
        - hour
        - day
        - week
        - month
        - quarter
        - year
      description: |-
        This is the group by step for aggregation.

        If not provided, defaults to group by day.
      title: InsightTimeRangeWithStepStep
    InsightTimeRangeWithStepStart:
      type: object
      properties: {}
      description: |-
        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
      title: InsightTimeRangeWithStepStart
    InsightTimeRangeWithStepEnd:
      type: object
      properties: {}
      description: |-
        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
      title: InsightTimeRangeWithStepEnd
    InsightTimeRangeWithStep:
      type: object
      properties:
        step:
          $ref: '#/components/schemas/InsightTimeRangeWithStepStep'
          description: |-
            This is the group by step for aggregation.

            If not provided, defaults to group by day.
        start:
          $ref: '#/components/schemas/InsightTimeRangeWithStepStart'
          description: |-
            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:
          $ref: '#/components/schemas/InsightTimeRangeWithStepEnd'
          description: |-
            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:
          type: string
          description: |-
            This is the timezone you want to set for the query.

            If not provided, defaults to UTC.
      title: InsightTimeRangeWithStep
    ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingBarGroupBy:
      type: string
      enum:
        - assistantId
        - workflowId
        - squadId
        - phoneNumberId
        - type
        - endedReason
        - customerNumber
        - campaignId
        - artifact.structuredOutputs[OutputID]
      description: |-
        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.
      title: >-
        ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingBarGroupBy
    JsonQueryOnCallTableWithStringTypeColumnType:
      type: string
      enum:
        - vapiql-json
      description: This is the type of query. Only allowed type is "vapiql-json".
      title: JsonQueryOnCallTableWithStringTypeColumnType
    JsonQueryOnCallTableWithStringTypeColumnTable:
      type: string
      enum:
        - call
      description: This is the table that will be queried.
      title: JsonQueryOnCallTableWithStringTypeColumnTable
    FilterStringTypeColumnOnCallTableColumn:
      type: string
      enum:
        - assistantId
        - workflowId
        - squadId
        - phoneNumberId
        - type
        - customerNumber
        - status
        - endedReason
        - forwardedPhoneNumber
        - campaignId
      description: |-
        This is the column in the call table that will be filtered on.
        String Type columns are columns where the rows store data as a string.
        Must be a valid column for the selected table.
      title: FilterStringTypeColumnOnCallTableColumn
    FilterStringTypeColumnOnCallTableOperator:
      type: string
      enum:
        - '='
        - '!='
        - contains
        - not_contains
      description: >-
        This is the operator to use for the filter.

        For string type columns, the operator must be "=", "!=", "contains",
        "not contains"
      title: FilterStringTypeColumnOnCallTableOperator
    FilterStringTypeColumnOnCallTable:
      type: object
      properties:
        column:
          $ref: '#/components/schemas/FilterStringTypeColumnOnCallTableColumn'
          description: >-
            This is the column in the call table that will be filtered on.

            String Type columns are columns where the rows store data as a
            string.

            Must be a valid column for the selected table.
        operator:
          $ref: '#/components/schemas/FilterStringTypeColumnOnCallTableOperator'
          description: >-
            This is the operator to use for the filter.

            For string type columns, the operator must be "=", "!=", "contains",
            "not contains"
        value:
          type: string
          description: This is the value to filter on.
      required:
        - column
        - operator
        - value
      title: FilterStringTypeColumnOnCallTable
    FilterStringArrayTypeColumnOnCallTableColumn:
      type: string
      enum:
        - assistantId
        - workflowId
        - squadId
        - phoneNumberId
        - type
        - customerNumber
        - status
        - endedReason
        - forwardedPhoneNumber
        - campaignId
      description: >-
        This is the column in the call table that will be filtered on.

        String Array Type columns are the same as String Type columns, but
        provides the ability to filter on multiple values provided as an array.

        Must be a valid column for the selected table.
      title: FilterStringArrayTypeColumnOnCallTableColumn
    FilterStringArrayTypeColumnOnCallTableOperator:
      type: string
      enum:
        - in
        - not_in
        - is_empty
        - is_not_empty
      description: |-
        This is the operator to use for the filter.
        The operator must be `in` or `not_in`.
      title: FilterStringArrayTypeColumnOnCallTableOperator
    FilterStringArrayTypeColumnOnCallTable:
      type: object
      properties:
        column:
          $ref: '#/components/schemas/FilterStringArrayTypeColumnOnCallTableColumn'
          description: >-
            This is the column in the call table that will be filtered on.

            String Array Type columns are the same as String Type columns, but
            provides the ability to filter on multiple values provided as an
            array.

            Must be a valid column for the selected table.
        operator:
          $ref: '#/components/schemas/FilterStringArrayTypeColumnOnCallTableOperator'
          description: |-
            This is the operator to use for the filter.
            The operator must be `in` or `not_in`.
        value:
          type: array
          items:
            type: string
          description: These are the values to filter on.
      required:
        - column
        - operator
        - value
      title: FilterStringArrayTypeColumnOnCallTable
    FilterNumberTypeColumnOnCallTableColumn:
      type: string
      enum:
        - duration
        - cost
        - averageModelLatency
        - averageVoiceLatency
        - averageTranscriberLatency
        - averageTurnLatency
        - averageEndpointingLatency
      description: |-
        This is the column in the call table that will be filtered on.
        Number Type columns are columns where the rows store data as a number.
        Must be a valid column for the selected table.
      title: FilterNumberTypeColumnOnCallTableColumn
    FilterNumberTypeColumnOnCallTableOperator:
      type: string
      enum:
        - '='
        - '!='
        - '>'
        - <
        - '>='
        - <=
      description: |-
        This is the operator to use for the filter.
        For number type columns, the operator must be "=", ">", "<", ">=", "<="
      title: FilterNumberTypeColumnOnCallTableOperator
    FilterNumberTypeColumnOnCallTable:
      type: object
      properties:
        column:
          $ref: '#/components/schemas/FilterNumberTypeColumnOnCallTableColumn'
          description: >-
            This is the column in the call table that will be filtered on.

            Number Type columns are columns where the rows store data as a
            number.

            Must be a valid column for the selected table.
        operator:
          $ref: '#/components/schemas/FilterNumberTypeColumnOnCallTableOperator'
          description: >-
            This is the operator to use for the filter.

            For number type columns, the operator must be "=", ">", "<", ">=",
            "<="
        value:
          type: number
          format: double
          description: This is the value to filter on.
      required:
        - column
        - operator
        - value
      title: FilterNumberTypeColumnOnCallTable
    FilterNumberArrayTypeColumnOnCallTableColumn:
      type: string
      enum:
        - duration
        - cost
        - averageModelLatency
        - averageVoiceLatency
        - averageTranscriberLatency
        - averageTurnLatency
        - averageEndpointingLatency
      description: >-
        This is the column in the call table that will be filtered on.

        Number Array Type columns are the same as Number Type columns, but
        provides the ability to filter on multiple values provided as an array.

        Must be a valid column for the selected table.
      title: FilterNumberArrayTypeColumnOnCallTableColumn
    FilterNumberArrayTypeColumnOnCallTableOperator:
      type: string
      enum:
        - in
        - not_in
        - is_empty
        - is_not_empty
      description: |-
        This is the operator to use for the filter.
        The operator must be `in` or `not_in`.
      title: FilterNumberArrayTypeColumnOnCallTableOperator
    FilterNumberArrayTypeColumnOnCallTable:
      type: object
      properties:
        column:
          $ref: '#/components/schemas/FilterNumberArrayTypeColumnOnCallTableColumn'
          description: >-
            This is the column in the call table that will be filtered on.

            Number Array Type columns are the same as Number Type columns, but
            provides the ability to filter on multiple values provided as an
            array.

            Must be a valid column for the selected table.
        operator:
          $ref: '#/components/schemas/FilterNumberArrayTypeColumnOnCallTableOperator'
          description: |-
            This is the operator to use for the filter.
            The operator must be `in` or `not_in`.
        value:
          type: array
          items:
            type: number
            format: double
          description: This is the value to filter on.
      required:
        - column
        - operator
        - value
      title: FilterNumberArrayTypeColumnOnCallTable
    FilterDateTypeColumnOnCallTableColumn:
      type: string
      enum:
        - startedAt
        - endedAt
      description: |-
        This is the column in the call table that will be filtered on.
        Date Type columns are columns where the rows store data as a date.
        Must be a valid column for the selected table.
      title: FilterDateTypeColumnOnCallTableColumn
    FilterDateTypeColumnOnCallTableOperator:
      type: string
      enum:
        - '='
        - '!='
        - '>'
        - <
        - '>='
        - <=
      description: |-
        This is the operator to use for the filter.
        For date type columns, the operator must be "=", ">", "<", ">=", "<="
      title: FilterDateTypeColumnOnCallTableOperator
    FilterDateTypeColumnOnCallTable:
      type: object
      properties:
        column:
          $ref: '#/components/schemas/FilterDateTypeColumnOnCallTableColumn'
          description: |-
            This is the column in the call table that will be filtered on.
            Date Type columns are columns where the rows store data as a date.
            Must be a valid column for the selected table.
        operator:
          $ref: '#/components/schemas/FilterDateTypeColumnOnCallTableOperator'
          description: >-
            This is the operator to use for the filter.

            For date type columns, the operator must be "=", ">", "<", ">=",
            "<="
        value:
          type: string
          description: |-
            This is the value to filter on.
            Must be a valid ISO 8601 date-time string.
      required:
        - column
        - operator
        - value
      title: FilterDateTypeColumnOnCallTable
    FilterStructuredOutputColumnOnCallTableColumn:
      type: string
      enum:
        - artifact.structuredOutputs[OutputID]
      description: >-
        This is the column in the call table that will be filtered on.

        Structured Output Type columns are only to filter on
        artifact.structuredOutputs[OutputID] column.
      title: FilterStructuredOutputColumnOnCallTableColumn
    FilterStructuredOutputColumnOnCallTableOperator:
      type: string
      enum:
        - '='
        - '!='
        - '>'
        - <
        - '>='
        - <=
        - in
        - not_in
        - contains
        - not_contains
        - is_empty
        - is_not_empty
      description: >-
        This is the operator to use for the filter.

        The operator depends on the value type of the structured output.

        If the structured output is a string or boolean, the operator must be
        "=", "!="

        If the structured output is a number, the operator must be "=", ">",
        "<", ">=", "<="

        If the structured output is an array, the operator must be "in" or
        "not_in"
      title: FilterStructuredOutputColumnOnCallTableOperator
    FilterStructuredOutputColumnOnCallTableValue:
      type: object
      properties: {}
      description: |-
        This is the value to filter on.
        The value type depends on the structured output type being filtered.
      title: FilterStructuredOutputColumnOnCallTableValue
    FilterStructuredOutputColumnOnCallTable:
      type: object
      properties:
        column:
          $ref: '#/components/schemas/FilterStructuredOutputColumnOnCallTableColumn'
          description: >-
            This is the column in the call table that will be filtered on.

            Structured Output Type columns are only to filter on
            artifact.structuredOutputs[OutputID] column.
        operator:
          $ref: '#/components/schemas/FilterStructuredOutputColumnOnCallTableOperator'
          description: >-
            This is the operator to use for the filter.

            The operator depends on the value type of the structured output.

            If the structured output is a string or boolean, the operator must
            be "=", "!="

            If the structured output is a number, the operator must be "=", ">",
            "<", ">=", "<="

            If the structured output is an array, the operator must be "in" or
            "not_in"
        value:
          $ref: '#/components/schemas/FilterStructuredOutputColumnOnCallTableValue'
          description: |-
            This is the value to filter on.
            The value type depends on the structured output type being filtered.
      required:
        - column
        - operator
        - value
      title: FilterStructuredOutputColumnOnCallTable
    JsonQueryOnCallTableWithStringTypeColumnFiltersItems:
      oneOf:
        - $ref: '#/components/schemas/FilterStringTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterStringArrayTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterNumberTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterNumberArrayTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterDateTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterStructuredOutputColumnOnCallTable'
      title: JsonQueryOnCallTableWithStringTypeColumnFiltersItems
    JsonQueryOnCallTableWithStringTypeColumnColumn:
      type: string
      enum:
        - id
        - artifact.structuredOutputs[OutputID]
      description: |-
        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
      title: JsonQueryOnCallTableWithStringTypeColumnColumn
    JsonQueryOnCallTableWithStringTypeColumnOperation:
      type: string
      enum:
        - count
      description: |-
        This is the aggregation operation to perform on the column.
        When the column is a string type, the operation must be "count".
      title: JsonQueryOnCallTableWithStringTypeColumnOperation
    JSONQueryOnCallTableWithStringTypeColumn:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/JsonQueryOnCallTableWithStringTypeColumnType'
          description: This is the type of query. Only allowed type is "vapiql-json".
        table:
          $ref: '#/components/schemas/JsonQueryOnCallTableWithStringTypeColumnTable'
          description: This is the table that will be queried.
        filters:
          type: array
          items:
            $ref: >-
              #/components/schemas/JsonQueryOnCallTableWithStringTypeColumnFiltersItems
          description: >-
            This is the filters to apply to the insight.

            The discriminator automatically selects the correct filter type
            based on column and operator.
        column:
          $ref: '#/components/schemas/JsonQueryOnCallTableWithStringTypeColumnColumn'
          description: |-
            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:
          $ref: >-
            #/components/schemas/JsonQueryOnCallTableWithStringTypeColumnOperation
          description: |-
            This is the aggregation operation to perform on the column.
            When the column is a string type, the operation must be "count".
        name:
          type: string
          description: |-
            This is the name of the query.
            It will be used to label the query in the insight board on the UI.
      required:
        - type
        - table
        - column
        - operation
      title: JSONQueryOnCallTableWithStringTypeColumn
    JsonQueryOnCallTableWithNumberTypeColumnType:
      type: string
      enum:
        - vapiql-json
      description: This is the type of query. Only allowed type is "vapiql-json".
      title: JsonQueryOnCallTableWithNumberTypeColumnType
    JsonQueryOnCallTableWithNumberTypeColumnTable:
      type: string
      enum:
        - call
      description: This is the table that will be queried.
      title: JsonQueryOnCallTableWithNumberTypeColumnTable
    JsonQueryOnCallTableWithNumberTypeColumnFiltersItems:
      oneOf:
        - $ref: '#/components/schemas/FilterStringTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterStringArrayTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterNumberTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterNumberArrayTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterDateTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterStructuredOutputColumnOnCallTable'
      title: JsonQueryOnCallTableWithNumberTypeColumnFiltersItems
    JsonQueryOnCallTableWithNumberTypeColumnColumn:
      type: string
      enum:
        - cost
        - duration
        - averageModelLatency
        - averageVoiceLatency
        - averageTranscriberLatency
        - averageTurnLatency
        - averageEndpointingLatency
        - artifact.structuredOutputs[OutputID]
      description: |-
        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
      title: JsonQueryOnCallTableWithNumberTypeColumnColumn
    JsonQueryOnCallTableWithNumberTypeColumnOperation:
      type: string
      enum:
        - average
        - sum
        - min
        - max
      description: >-
        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
      title: JsonQueryOnCallTableWithNumberTypeColumnOperation
    JSONQueryOnCallTableWithNumberTypeColumn:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/JsonQueryOnCallTableWithNumberTypeColumnType'
          description: This is the type of query. Only allowed type is "vapiql-json".
        table:
          $ref: '#/components/schemas/JsonQueryOnCallTableWithNumberTypeColumnTable'
          description: This is the table that will be queried.
        filters:
          type: array
          items:
            $ref: >-
              #/components/schemas/JsonQueryOnCallTableWithNumberTypeColumnFiltersItems
          description: >-
            This is the filters to apply to the insight.

            The discriminator automatically selects the correct filter type
            based on column and operator.
        column:
          $ref: '#/components/schemas/JsonQueryOnCallTableWithNumberTypeColumnColumn'
          description: |-
            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:
          $ref: >-
            #/components/schemas/JsonQueryOnCallTableWithNumberTypeColumnOperation
          description: >-
            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:
          type: string
          description: |-
            This is the name of the query.
            It will be used to label the query in the insight board on the UI.
      required:
        - type
        - table
        - column
        - operation
      title: JSONQueryOnCallTableWithNumberTypeColumn
    JsonQueryOnCallTableWithStructuredOutputColumnType:
      type: string
      enum:
        - vapiql-json
      description: This is the type of query. Only allowed type is "vapiql-json".
      title: JsonQueryOnCallTableWithStructuredOutputColumnType
    JsonQueryOnCallTableWithStructuredOutputColumnTable:
      type: string
      enum:
        - call
      description: This is the table that will be queried.
      title: JsonQueryOnCallTableWithStructuredOutputColumnTable
    JsonQueryOnCallTableWithStructuredOutputColumnFiltersItems:
      oneOf:
        - $ref: '#/components/schemas/FilterStringTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterStringArrayTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterNumberTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterNumberArrayTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterDateTypeColumnOnCallTable'
        - $ref: '#/components/schemas/FilterStructuredOutputColumnOnCallTable'
      title: JsonQueryOnCallTableWithStructuredOutputColumnFiltersItems
    JsonQueryOnCallTableWithStructuredOutputColumnColumn:
      type: string
      enum:
        - artifact.structuredOutputs[OutputID]
      description: >-
        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.
      title: JsonQueryOnCallTableWithStructuredOutputColumnColumn
    JsonQueryOnCallTableWithStructuredOutputColumnOperation:
      type: string
      enum:
        - average
        - count
        - sum
        - min
        - max
      description: >-
        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".
      title: JsonQueryOnCallTableWithStructuredOutputColumnOperation
    JSONQueryOnCallTableWithStructuredOutputColumn:
      type: object
      properties:
        type:
          $ref: >-
            #/components/schemas/JsonQueryOnCallTableWithStructuredOutputColumnType
          description: This is the type of query. Only allowed type is "vapiql-json".
        table:
          $ref: >-
            #/components/schemas/JsonQueryOnCallTableWithStructuredOutputColumnTable
          description: This is the table that will be queried.
        filters:
          type: array
          items:
            $ref: >-
              #/components/schemas/JsonQueryOnCallTableWithStructuredOutputColumnFiltersItems
          description: >-
            This is the filters to apply to the insight.

            The discriminator automatically selects the correct filter type
            based on column and operator.
        column:
          $ref: >-
            #/components/schemas/JsonQueryOnCallTableWithStructuredOutputColumnColumn
          description: >-
            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:
          $ref: >-
            #/components/schemas/JsonQueryOnCallTableWithStructuredOutputColumnOperation
          description: >-
            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:
          type: string
          description: |-
            This is the name of the query.
            It will be used to label the query in the insight board on the UI.
      required:
        - type
        - table
        - column
        - operation
      title: JSONQueryOnCallTableWithStructuredOutputColumn
    JsonQueryOnEventsTableType:
      type: string
      enum:
        - vapiql-json
      description: This is the type of query. Only allowed type is "vapiql-json".
      title: JsonQueryOnEventsTableType
    JsonQueryOnEventsTableTable:
      type: string
      enum:
        - events
      description: |-
        This is the table that will be queried.
        Must be "events" for event-based insights.
      title: JsonQueryOnEventsTableTable
    JsonQueryOnEventsTableOn:
      type: string
      enum:
        - call.started
        - call.ended
        - call.inProgress
        - call.queued
        - call.transportConnected
        - call.transportDisconnected
        - call.transportReconnected
        - call.transferInitiated
        - call.transferCompleted
        - call.transferFailed
        - call.transferCancelled
        - call.handoffInitiated
        - call.handoffCompleted
        - call.handoffFailed
        - call.assistantSwapped
        - call.assistantStarted
        - call.customerJoined
        - call.customerLeft
        - call.controlReceived
        - call.listenStarted
        - call.recordingStarted
        - call.recordingPaused
        - call.recordingResumed
        - call.voicemailDetected
        - call.voicemailNotDetected
        - call.dtmfReceived
        - call.dtmfSent
        - call.amdDetected
        - call.hookTriggered
        - call.hookSucceeded
        - call.hookFailed
        - call.statusReceived
        - call.silenceTimeout
        - call.microphoneTimeout
        - call.maxDurationReached
        - assistant.voice.requestStarted
        - assistant.voice.requestSucceeded
        - assistant.voice.requestFailed
        - assistant.voice.connectionOpened
        - assistant.voice.connectionClosed
        - assistant.voice.firstAudioReceived
        - assistant.voice.audioChunkReceived
        - assistant.voice.generationSucceeded
        - assistant.voice.generationFailed
        - assistant.voice.textPushed
        - assistant.voice.reconnecting
        - assistant.voice.cleanup
        - assistant.voice.clearing
        - assistant.voice.voiceSwitched
        - assistant.model.requestStarted
        - assistant.model.requestSucceeded
        - assistant.model.requestFailed
        - assistant.model.requestAttemptStarted
        - assistant.model.requestAttemptSucceeded
        - assistant.model.requestAttemptFailed
        - assistant.model.connectionOpened
        - assistant.model.connectionClosed
        - assistant.model.firstTokenReceived
        - assistant.model.tokenReceived
        - assistant.model.responseSucceeded
        - assistant.model.responseFailed
        - assistant.model.toolCallsReceived
        - assistant.model.reconnecting
        - assistant.model.cleanup
        - assistant.model.clearing
        - assistant.tool.started
        - assistant.tool.completed
        - assistant.tool.failed
        - assistant.tool.delayedMessageSent
        - assistant.tool.timeout
        - assistant.tool.asyncCallbackReceived
        - assistant.transcriber.requestStarted
        - assistant.transcriber.requestSucceeded
        - assistant.transcriber.requestFailed
        - assistant.transcriber.connectionOpened
        - assistant.transcriber.connectionClosed
        - assistant.transcriber.partialTranscript
        - assistant.transcriber.finalTranscript
        - assistant.transcriber.keepAlive
        - assistant.transcriber.reconnecting
        - assistant.transcriber.cleanup
        - assistant.transcriber.clearing
        - assistant.transcriber.transcriptIgnored
        - assistant.transcriber.languageSwitched
        - assistant.analysis.structuredOutputGenerated
        - pipeline.turnStarted
        - pipeline.cleared
        - pipeline.botSpeechStarted
        - pipeline.botSpeechStopped
        - pipeline.userSpeechStarted
        - pipeline.userSpeechStopped
        - pipeline.endpointingTriggered
        - pipeline.firstMessageStarted
        - pipeline.firstMessageCompleted
      description: The event type to query
      title: JsonQueryOnEventsTableOn
    JsonQueryOnEventsTableOperation:
      type: string
      enum:
        - count
        - percentage
      description: |-
        This is the operation to perform on matching events.
        - "count": Returns the raw count of matching events
        - "percentage": Returns (count of matching events / total calls) * 100
      title: JsonQueryOnEventsTableOperation
    EventsTableStringConditionOperator:
      type: string
      enum:
        - '='
        - '!='
        - contains
        - notContains
      description: String comparison operator
      title: EventsTableStringConditionOperator
    EventsTableStringCondition:
      type: object
      properties:
        column:
          type: string
          description: The string field name from the event data
        operator:
          $ref: '#/components/schemas/EventsTableStringConditionOperator'
          description: String comparison operator
        value:
          type: string
          description: The string value to compare
      required:
        - column
        - operator
        - value
      title: EventsTableStringCondition
    EventsTableNumberConditionOperator:
      type: string
      enum:
        - '='
        - '!='
        - '>'
        - '>='
        - <
        - <=
      description: Number comparison operator
      title: EventsTableNumberConditionOperator
    EventsTableNumberCondition:
      type: object
      properties:
        column:
          type: string
          description: The number field name from the event data
        operator:
          $ref: '#/components/schemas/EventsTableNumberConditionOperator'
          description: Number comparison operator
        value:
          type: number
          format: double
          description: The number value to compare
      required:
        - column
        - operator
        - value
      title: EventsTableNumberCondition
    EventsTableBooleanConditionOperator:
      type: string
      enum:
        - '='
      description: Boolean comparison operator
      title: EventsTableBooleanConditionOperator
    EventsTableBooleanCondition:
      type: object
      properties:
        column:
          type: string
          description: The boolean field name from the event data
        operator:
          $ref: '#/components/schemas/EventsTableBooleanConditionOperator'
          description: Boolean comparison operator
        value:
          type: boolean
          description: The boolean value to compare
      required:
        - column
        - operator
        - value
      title: EventsTableBooleanCondition
    JsonQueryOnEventsTableFiltersItems:
      oneOf:
        - $ref: '#/components/schemas/EventsTableStringCondition'
        - $ref: '#/components/schemas/EventsTableNumberCondition'
        - $ref: '#/components/schemas/EventsTableBooleanCondition'
      title: JsonQueryOnEventsTableFiltersItems
    JSONQueryOnEventsTable:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/JsonQueryOnEventsTableType'
          description: This is the type of query. Only allowed type is "vapiql-json".
        table:
          $ref: '#/components/schemas/JsonQueryOnEventsTableTable'
          description: |-
            This is the table that will be queried.
            Must be "events" for event-based insights.
        'on':
          $ref: '#/components/schemas/JsonQueryOnEventsTableOn'
          description: The event type to query
        operation:
          $ref: '#/components/schemas/JsonQueryOnEventsTableOperation'
          description: >-
            This is the operation to perform on matching events.

            - "count": Returns the raw count of matching events

            - "percentage": Returns (count of matching events / total calls) *
            100
        filters:
          type: array
          items:
            $ref: '#/components/schemas/JsonQueryOnEventsTableFiltersItems'
          description: |-
            These are the filters to apply to the events query.
            Each filter filters on a field specific to the event type.
        name:
          type: string
          description: |-
            This is the name of the query.
            It will be used to label the query in the insight board on the UI.
      required:
        - type
        - table
        - 'on'
        - operation
      title: JSONQueryOnEventsTable
    ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingBarQueriesItems:
      oneOf:
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStringTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithNumberTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStructuredOutputColumn'
        - $ref: '#/components/schemas/JSONQueryOnEventsTable'
      title: >-
        ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingBarQueriesItems
    InsightTimeRangeStart:
      type: object
      properties: {}
      description: |-
        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
      title: InsightTimeRangeStart
    InsightTimeRangeEnd:
      type: object
      properties: {}
      description: |-
        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
      title: InsightTimeRangeEnd
    InsightTimeRange:
      type: object
      properties:
        start:
          $ref: '#/components/schemas/InsightTimeRangeStart'
          description: |-
            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:
          $ref: '#/components/schemas/InsightTimeRangeEnd'
          description: |-
            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:
          type: string
          description: |-
            This is the timezone you want to set for the query.

            If not provided, defaults to UTC.
      title: InsightTimeRange
    ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingPieGroupBy:
      type: string
      enum:
        - assistantId
        - workflowId
        - squadId
        - phoneNumberId
        - type
        - endedReason
        - customerNumber
        - campaignId
        - artifact.structuredOutputs[OutputID]
      description: |-
        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.
      title: >-
        ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingPieGroupBy
    ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingPieQueriesItems:
      oneOf:
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStringTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithNumberTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStructuredOutputColumn'
      title: >-
        ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingPieQueriesItems
    LineInsightMetadata:
      type: object
      properties:
        xAxisLabel:
          type: string
        yAxisLabel:
          type: string
        yAxisMin:
          type: number
          format: double
        yAxisMax:
          type: number
          format: double
        name:
          type: string
      title: LineInsightMetadata
    ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingLineGroupBy:
      type: string
      enum:
        - assistantId
        - workflowId
        - squadId
        - phoneNumberId
        - type
        - endedReason
        - customerNumber
        - campaignId
        - artifact.structuredOutputs[OutputID]
      description: |-
        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.
      title: >-
        ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingLineGroupBy
    ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingLineQueriesItems:
      oneOf:
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStringTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithNumberTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStructuredOutputColumn'
      title: >-
        ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingLineQueriesItems
    ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingTextFormula:
      type: object
      properties: {}
      description: >-
        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.
      title: >-
        ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingTextFormula
    ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingTextQueriesItems:
      oneOf:
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStringTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithNumberTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStructuredOutputColumn'
      title: >-
        ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingTextQueriesItems
    Insight_InsightController_create_Request:
      oneOf:
        - type: object
          properties:
            type:
              type: string
              enum:
                - bar
              description: 'Discriminator value: bar'
            name:
              type: string
              description: This is the name of the Insight.
            formulas:
              type: array
              items:
                $ref: '#/components/schemas/InsightFormula'
              description: >-
                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.
            metadata:
              $ref: '#/components/schemas/BarInsightMetadata'
              description: This is the metadata for the insight.
            timeRange:
              $ref: '#/components/schemas/InsightTimeRangeWithStep'
            groupBy:
              $ref: >-
                #/components/schemas/ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingBarGroupBy
              description: >-
                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:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingBarQueriesItems
              description: These are the queries to run to generate the insight.
          required:
            - type
            - queries
          description: bar variant
        - type: object
          properties:
            type:
              type: string
              enum:
                - pie
              description: 'Discriminator value: pie'
            name:
              type: string
              description: This is the name of the Insight.
            formulas:
              type: array
              items:
                $ref: '#/components/schemas/InsightFormula'
              description: >-
                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:
              $ref: '#/components/schemas/InsightTimeRange'
            groupBy:
              $ref: >-
                #/components/schemas/ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingPieGroupBy
              description: >-
                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:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingPieQueriesItems
              description: These are the queries to run to generate the insight.
          required:
            - type
            - queries
          description: pie variant
        - type: object
          properties:
            type:
              type: string
              enum:
                - line
              description: 'Discriminator value: line'
            name:
              type: string
              description: This is the name of the Insight.
            formulas:
              type: array
              items:
                $ref: '#/components/schemas/InsightFormula'
              description: >-
                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.
            metadata:
              $ref: '#/components/schemas/LineInsightMetadata'
              description: This is the metadata for the insight.
            timeRange:
              $ref: '#/components/schemas/InsightTimeRangeWithStep'
            groupBy:
              $ref: >-
                #/components/schemas/ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingLineGroupBy
              description: >-
                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:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingLineQueriesItems
              description: These are the queries to run to generate the insight.
          required:
            - type
            - queries
          description: line variant
        - type: object
          properties:
            type:
              type: string
              enum:
                - text
              description: 'Discriminator value: text'
            name:
              type: string
              description: This is the name of the Insight.
            formula:
              $ref: >-
                #/components/schemas/ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingTextFormula
              description: >-
                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:
              $ref: '#/components/schemas/InsightTimeRange'
            queries:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ReportingInsightPreviewPostRequestBodyContentApplicationJsonSchemaDiscriminatorMappingTextQueriesItems
              description: >-
                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
          required:
            - type
            - queries
          description: text variant
      discriminator:
        propertyName: type
      title: Insight_InsightController_create_Request
    ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingBarGroupBy:
      type: string
      enum:
        - assistantId
        - workflowId
        - squadId
        - phoneNumberId
        - type
        - endedReason
        - customerNumber
        - campaignId
        - artifact.structuredOutputs[OutputID]
      description: |-
        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.
      title: >-
        ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingBarGroupBy
    ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingBarQueriesItems:
      oneOf:
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStringTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithNumberTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStructuredOutputColumn'
        - $ref: '#/components/schemas/JSONQueryOnEventsTable'
      title: >-
        ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingBarQueriesItems
    ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingPieGroupBy:
      type: string
      enum:
        - assistantId
        - workflowId
        - squadId
        - phoneNumberId
        - type
        - endedReason
        - customerNumber
        - campaignId
        - artifact.structuredOutputs[OutputID]
      description: |-
        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.
      title: >-
        ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingPieGroupBy
    ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingPieQueriesItems:
      oneOf:
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStringTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithNumberTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStructuredOutputColumn'
      title: >-
        ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingPieQueriesItems
    ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingLineGroupBy:
      type: string
      enum:
        - assistantId
        - workflowId
        - squadId
        - phoneNumberId
        - type
        - endedReason
        - customerNumber
        - campaignId
        - artifact.structuredOutputs[OutputID]
      description: |-
        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.
      title: >-
        ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingLineGroupBy
    ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingLineQueriesItems:
      oneOf:
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStringTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithNumberTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStructuredOutputColumn'
      title: >-
        ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingLineQueriesItems
    ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingTextFormula:
      type: object
      properties: {}
      description: >-
        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.
      title: >-
        ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingTextFormula
    ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingTextQueriesItems:
      oneOf:
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStringTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithNumberTypeColumn'
        - $ref: '#/components/schemas/JSONQueryOnCallTableWithStructuredOutputColumn'
      title: >-
        ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingTextQueriesItems
    Insight_InsightController_create_Response_201:
      oneOf:
        - type: object
          properties:
            type:
              type: string
              enum:
                - bar
              description: 'Discriminator value: bar'
            name:
              type: string
              description: This is the name of the Insight.
            formulas:
              type: array
              items:
                $ref: '#/components/schemas/InsightFormula'
              description: >-
                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.
            metadata:
              $ref: '#/components/schemas/BarInsightMetadata'
              description: This is the metadata for the insight.
            timeRange:
              $ref: '#/components/schemas/InsightTimeRangeWithStep'
            groupBy:
              $ref: >-
                #/components/schemas/ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingBarGroupBy
              description: >-
                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:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingBarQueriesItems
              description: These are the queries to run to generate the insight.
            id:
              type: string
              description: This is the unique identifier for the Insight.
            orgId:
              type: string
              description: >-
                This is the unique identifier for the org that this Insight
                belongs to.
            createdAt:
              type: string
              format: date-time
              description: >-
                This is the ISO 8601 date-time string of when the Insight was
                created.
            updatedAt:
              type: string
              format: date-time
              description: >-
                This is the ISO 8601 date-time string of when the Insight was
                last updated.
          required:
            - type
            - queries
            - id
            - orgId
            - createdAt
            - updatedAt
          description: bar variant
        - type: object
          properties:
            type:
              type: string
              enum:
                - pie
              description: 'Discriminator value: pie'
            name:
              type: string
              description: This is the name of the Insight.
            formulas:
              type: array
              items:
                $ref: '#/components/schemas/InsightFormula'
              description: >-
                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:
              $ref: '#/components/schemas/InsightTimeRange'
            groupBy:
              $ref: >-
                #/components/schemas/ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingPieGroupBy
              description: >-
                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:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingPieQueriesItems
              description: These are the queries to run to generate the insight.
            id:
              type: string
              description: This is the unique identifier for the Insight.
            orgId:
              type: string
              description: >-
                This is the unique identifier for the org that this Insight
                belongs to.
            createdAt:
              type: string
              format: date-time
              description: >-
                This is the ISO 8601 date-time string of when the Insight was
                created.
            updatedAt:
              type: string
              format: date-time
              description: >-
                This is the ISO 8601 date-time string of when the Insight was
                last updated.
          required:
            - type
            - queries
            - id
            - orgId
            - createdAt
            - updatedAt
          description: pie variant
        - type: object
          properties:
            type:
              type: string
              enum:
                - line
              description: 'Discriminator value: line'
            name:
              type: string
              description: This is the name of the Insight.
            formulas:
              type: array
              items:
                $ref: '#/components/schemas/InsightFormula'
              description: >-
                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.
            metadata:
              $ref: '#/components/schemas/LineInsightMetadata'
              description: This is the metadata for the insight.
            timeRange:
              $ref: '#/components/schemas/InsightTimeRangeWithStep'
            groupBy:
              $ref: >-
                #/components/schemas/ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingLineGroupBy
              description: >-
                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:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingLineQueriesItems
              description: These are the queries to run to generate the insight.
            id:
              type: string
              description: This is the unique identifier for the Insight.
            orgId:
              type: string
              description: >-
                This is the unique identifier for the org that this Insight
                belongs to.
            createdAt:
              type: string
              format: date-time
              description: >-
                This is the ISO 8601 date-time string of when the Insight was
                created.
            updatedAt:
              type: string
              format: date-time
              description: >-
                This is the ISO 8601 date-time string of when the Insight was
                last updated.
          required:
            - type
            - queries
            - id
            - orgId
            - createdAt
            - updatedAt
          description: line variant
        - type: object
          properties:
            type:
              type: string
              enum:
                - text
              description: 'Discriminator value: text'
            name:
              type: string
              description: This is the name of the Insight.
            formula:
              $ref: >-
                #/components/schemas/ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingTextFormula
              description: >-
                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:
              $ref: '#/components/schemas/InsightTimeRange'
            queries:
              type: array
              items:
                $ref: >-
                  #/components/schemas/ReportingInsightIdPatchResponsesContentApplicationJsonSchemaDiscriminatorMappingTextQueriesItems
              description: >-
                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
            id:
              type: string
              description: This is the unique identifier for the Insight.
            orgId:
              type: string
              description: >-
                This is the unique identifier for the org that this Insight
                belongs to.
            createdAt:
              type: string
              format: date-time
              description: >-
                This is the ISO 8601 date-time string of when the Insight was
                created.
            updatedAt:
              type: string
              format: date-time
              description: >-
                This is the ISO 8601 date-time string of when the Insight was
                last updated.
          required:
            - type
            - queries
            - id
            - orgId
            - createdAt
            - updatedAt
          description: text variant
      discriminator:
        propertyName: type
      title: Insight_InsightController_create_Response_201
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: Retrieve your API Key from [Dashboard](dashboard.vapi.ai).

```

## SDK Code Examples

```python
from vapi import Vapi, JsonQueryOnCallTableWithStringTypeColumn
from vapi.insight import InsightControllerCreateRequest_Bar

client = Vapi(
    token="YOUR_TOKEN_HERE",
)

client.insight.insight_controller_create(
    request=InsightControllerCreateRequest_Bar(
        queries=[
            JsonQueryOnCallTableWithStringTypeColumn(
                type="vapiql-json",
                table="call",
                column="id",
                operation="count",
            )
        ],
    ),
)

```

```go
package example

import (
    context "context"

    serversdkgo "github.com/VapiAI/server-sdk-go"
    client "github.com/VapiAI/server-sdk-go/client"
    option "github.com/VapiAI/server-sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithToken(
            "YOUR_TOKEN_HERE",
        ),
    )
    request := &serversdkgo.InsightControllerCreateRequest{
        Bar: &serversdkgo.CreateBarInsightFromCallTableDto{
            Queries: []*serversdkgo.CreateBarInsightFromCallTableDtoQueriesItem{
                &serversdkgo.CreateBarInsightFromCallTableDtoQueriesItem{
                    JsonQueryOnCallTableWithStringTypeColumn: &serversdkgo.JsonQueryOnCallTableWithStringTypeColumn{
                        Type: serversdkgo.JsonQueryOnCallTableWithStringTypeColumnTypeVapiqlJson,
                        Table: serversdkgo.JsonQueryOnCallTableWithStringTypeColumnTableCall,
                        Column: serversdkgo.JsonQueryOnCallTableWithStringTypeColumnColumnId,
                        Operation: serversdkgo.JsonQueryOnCallTableWithStringTypeColumnOperationCount,
                    },
                },
            },
        },
    }
    client.Insight.InsightControllerCreate(
        context.TODO(),
        request,
    )
}

```