> ## Documentation Index
> Fetch the complete documentation index at: https://dench.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Compute chart-ready results (buckets / series / values) for the stored dashboard, a subset of its panels, or ad-hoc panel definitions — optionally scoped to a saved view, a period preset (with the previous interval as previousValue) and extra filters. Same query the strip renders from

> Compute chart-ready results (buckets / series / values) for the stored dashboard, a subset of its panels, or ad-hoc panel definitions — optionally scoped to a saved view, a period preset (with the previous interval as previousValue) and extra filters. Same query the strip renders from.



## OpenAPI

````yaml /api-reference/openapi.json post /crm/objects/{objectName}/analytics/compute
openapi: 3.1.0
info:
  title: Dench API
  version: 1.0.0
  description: >-
    Versioned Dench workspace API. The operation registry is shared with the
    Dench CLI parity layer, so every CLI command maps to an endpoint here.
servers:
  - url: https://www.dench.com/api/v1
security: []
tags:
  - name: agent-config
    description: Agent Config operations.
  - name: approvals
    description: Approvals operations.
  - name: apps
    description: Apps operations.
  - name: auth
    description: Auth operations.
  - name: billing
    description: Billing operations.
  - name: browser
    description: Browser operations.
  - name: campaigns
    description: Campaigns operations.
  - name: chat
    description: Chat operations.
  - name: crm
    description: Crm operations.
  - name: email
    description: Email operations.
  - name: files
    description: Files operations.
  - name: gateway
    description: Gateway operations.
  - name: lists
    description: Lists operations.
  - name: local
    description: Local operations.
  - name: meetings
    description: Meetings operations.
  - name: members
    description: Members operations.
  - name: memory
    description: Memory operations.
  - name: meta
    description: Meta operations.
  - name: notifications
    description: Notifications operations.
  - name: routines
    description: Routines operations.
  - name: workspace
    description: Workspace operations.
paths:
  /crm/objects/{objectName}/analytics/compute:
    post:
      tags:
        - crm
      summary: >-
        Compute chart-ready results (buckets / series / values) for the stored
        dashboard, a subset of its panels, or ad-hoc panel definitions —
        optionally scoped to a saved view, a period preset (with the previous
        interval as previousValue) and extra filters. Same query the strip
        renders from
      description: >-
        Compute chart-ready results (buckets / series / values) for the stored
        dashboard, a subset of its panels, or ad-hoc panel definitions —
        optionally scoped to a saved view, a period preset (with the previous
        interval as previousValue) and extra filters. Same query the strip
        renders from.
      operationId: crm_analytics_compute
      parameters:
        - name: objectName
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                viewName:
                  description: >-
                    Compute the saved view's own dashboard instead of the
                    object's (ignored when the view inherits).
                  type: string
                panelIds:
                  description: Only these stored panels.
                  type: array
                  items:
                    type: string
                panels:
                  description: >-
                    Ad-hoc panel definitions to compute instead of the stored
                    dashboard (nothing is persisted). id/title/metric/sortOrder
                    are filled in when omitted.
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        description: >-
                          Stable id (template panels use
                          `tpl:<template>:<slug>`).
                      title:
                        type: string
                      type:
                        type: string
                        enum:
                          - stat
                          - bar
                          - line
                          - area
                          - donut
                          - funnel
                          - leaderboard
                          - forecast
                          - map
                      metric:
                        type: string
                        enum:
                          - count
                          - sum
                          - avg
                          - min
                          - max
                      metricField:
                        description: Numeric field for sum/avg/min/max. Ignored for count.
                        type: string
                      groupBy:
                        description: >-
                          Bucketing field (enum/user/relation/boolean/text, or
                          $location). On a time-series panel it splits the
                          series into one line per value.
                        type: string
                      dateField:
                        description: >-
                          Date field for line/area/forecast bucketing (or
                          $createdAt).
                        type: string
                      dateBucket:
                        type: string
                        enum:
                          - day
                          - week
                          - month
                          - quarter
                      filters:
                        description: >-
                          Panel-scoped FilterGroup, same shape as saved-view
                          filters.
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                      size:
                        description: Deprecated; ignored for layout. Use `span`.
                        type: string
                        enum:
                          - sm
                          - md
                          - lg
                      span:
                        description: >-
                          Card width on the 6-track dashboard grid: 2 = a third,
                          3 = half, 4 = two thirds, 6 = full row. Defaults:
                          funnel 4; map and leaderboard 2; bar/donut grouped by
                          a user field 2, by anything else 4; trends 3.
                        anyOf:
                          - type: number
                            const: 2
                          - type: number
                            const: 3
                          - type: number
                            const: 4
                          - type: number
                            const: 6
                      hidden:
                        description: >-
                          Hide from the strip above the table; still shown in
                          the full analytics view.
                        type: boolean
                      sortOrder:
                        type: number
                      derived:
                        description: >-
                          Role-driven derived metric; when set the panel
                          computes from fieldRoles instead of metric/groupBy.
                        type: string
                        enum:
                          - conversion_rate
                          - win_rate
                          - won_amount
                          - lost_amount
                          - open_pipeline
                          - pipeline_forecast
                          - mrr
                          - arr
                    required:
                      - type
                    additionalProperties: false
                    description: >-
                      One ad-hoc panel. `id`, `title`, `metric` (default count)
                      and `sortOrder` (default: position) are optional.
                period:
                  type: string
                  enum:
                    - all
                    - this_week
                    - this_month
                    - last_month
                    - this_quarter
                    - last_quarter
                    - this_year
                  description: >-
                    Period preset. Scopes every panel by a date_preset on the
                    object's closeDate role (else $createdAt) and fills
                    previousValue from the previous calendar interval. "all" =
                    no scope.
                extraFilters:
                  description: >-
                    FilterGroup applied to every panel (e.g. the view's rules).
                    Forces the bounded scan path.
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties: {}
                compareFilters:
                  description: >-
                    FilterGroup for the comparison window; every panel's value
                    over it comes back as previousValue. Derived automatically
                    from `period`.
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties: {}
                fieldRolesOverride:
                  description: Preview an unsaved role mapping.
                  type: object
                  properties:
                    amount:
                      description: >-
                        Numeric field holding the deal value ("Amount") — the
                        "Value field" in the setup sheet.
                      type: string
                    stage:
                      description: >-
                        Enum field driving the pipeline ("Stage" / "Status") —
                        the "Progress field".
                      type: string
                    wonValues:
                      description: '`stage` options that count as won (closed, successful).'
                      type: array
                      items:
                        type: string
                    lostValues:
                      description: '`stage` options that count as lost (closed, gone).'
                      type: array
                      items:
                        type: string
                    convertedValues:
                      description: >-
                        `stage` options that count as converted (a lead reached
                        "Qualified").
                      type: array
                      items:
                        type: string
                    closeDate:
                      description: >-
                        Date field for time bucketing, forecasts and the period
                        pill (falls back to $createdAt).
                      type: string
                    owner:
                      description: >-
                        User field naming who owns each record ("Owner").
                        Rankings on it default to a narrow card and draw member
                        faces.
                      type: string
                    location:
                      description: >-
                        Place-name field maps plot. May be a relation path like
                        "Account.HQ Location" (one hop through a relation).
                      type: string
                    recurrence:
                      description: >-
                        How a won amount recurs: annual treats Amount as ARR,
                        monthly as MRR, one_time disables MRR/ARR panels.
                      type: string
                      enum:
                        - monthly
                        - annual
                        - one_time
                    stageProbabilities:
                      description: >-
                        Chance of closing per OPEN stage, 0..1, for the weighted
                        forecast. Unlisted stages are spaced evenly; won = 1,
                        lost = 0.
                      type: object
                      propertyNames:
                        type: string
                      additionalProperties:
                        type: number
                  additionalProperties: false
                drillFilters:
                  description: >-
                    Click-to-filter chips, same as the strip: each scopes every
                    panel EXCEPT those whose dimensions include `dimension`.
                  type: array
                  items:
                    type: object
                    properties:
                      dimension:
                        type: string
                        description: >-
                          Dimension the click came from (`field:<name>` or
                          `time:<field>`). Panels bucketing on it keep their
                          full picture.
                      filter:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                        description: FilterGroup selecting the clicked bucket.
                    required:
                      - dimension
                      - filter
                    additionalProperties: false
            example:
              period: this_month
              panels:
                - id: adhoc:leads-by-source
                  title: New leads by source
                  type: donut
                  metric: count
                  groupBy: Source
                  sortOrder: 0
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  objectName:
                    type: string
                  truncated:
                    type: boolean
                    description: >-
                      True when the table exceeded the 5,000-row scan and
                      numbers are approximate.
                  scannedRows:
                    type: number
                  locationRole:
                    type: string
                  panels:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        unit:
                          type: string
                          enum:
                            - number
                            - currency
                            - percent
                        value:
                          type: number
                        secondaryValue:
                          type: number
                        previousValue:
                          description: >-
                            The same value over the comparison window (period /
                            compareFilters).
                          type: number
                        buckets:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              label:
                                type: string
                              count:
                                type: number
                              value:
                                type: number
                              color:
                                type: string
                              amount:
                                description: >-
                                  Funnel only: sum of the amount role over the
                                  rows in this stage.
                                type: number
                            required:
                              - key
                              - label
                              - count
                              - value
                            additionalProperties: false
                        series:
                          type: array
                          items:
                            type: object
                            properties:
                              bucket:
                                type: string
                              label:
                                type: string
                              value:
                                type: number
                              count:
                                type: number
                              projected:
                                type: boolean
                            required:
                              - bucket
                              - label
                              - value
                              - count
                            additionalProperties: false
                        seriesGroups:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              label:
                                type: string
                              color:
                                type: string
                              series:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    bucket:
                                      type: string
                                    label:
                                      type: string
                                    value:
                                      type: number
                                    count:
                                      type: number
                                    projected:
                                      type: boolean
                                  required:
                                    - bucket
                                    - label
                                    - value
                                    - count
                                  additionalProperties: false
                            required:
                              - key
                              - label
                              - series
                            additionalProperties: false
                        error:
                          type: string
                      required:
                        - id
                        - unit
                      additionalProperties: false
                required:
                  - objectName
                  - truncated
                  - scannedRows
                  - panels
                additionalProperties: false
              example:
                objectName: lead
                truncated: false
                scannedRows: 42
                panels:
                  - id: adhoc:leads-by-source
                    unit: number
                    value: 42
                    previousValue: 31
                    buckets:
                      - key: Website
                        label: Website
                        count: 25
                        value: 25
                      - key: Referral
                        label: Referral
                        count: 17
                        value: 17
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - DenchApiKey: []
        - AgentSession: []
components:
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Unauthorized:
      description: Missing or invalid authentication
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    NotFound:
      description: Operation or resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    InternalError:
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  schemas:
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
            - code
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
            details: {}
  securitySchemes:
    DenchApiKey:
      type: http
      scheme: bearer
      bearerFormat: DENCH_API_KEY
      description: >-
        Workspace-scoped Dench API key from workspace settings. This is the same
        key used by DENCH_API_KEY in sandboxes.
    AgentSession:
      type: http
      scheme: bearer
      bearerFormat: dch_agent_*
      description: >-
        Agent session token created by `dench signin`. Gateway-backed routes
        exchange this token for the workspace gateway key.

````