---
title: "Query entries"
method: POST
path: "/crm/query"
tags: ["crm"]
---

# Query entries

`POST /crm/query`

## Request

- Base URL: `https://www.dench.com/api/v1`
- URL: `https://www.dench.com/api/v1/crm/query`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Query CRM entries.

## Request body

- object
  - `withReferences` boolean: Include bounded navigation references. Array reads return {data, references, referenceCoverage}; existing result envelopes keep their fields.
  - `objectName` string, required
  - `dsl` object: Query DSL. Bare equality only; use dslJson for $-operators.
    - `filter` object
    - `select` string[]
    - `sort` string: e.g. -Score,Name (- = desc).
    - `limit` integer
    - `timeZone` string: IANA zone date filters mean (day bounds, date-times without an offset, $datePreset). UTC when unset.
  - `dslJson` string: JSON string of the DSL when filters use operators like $gt/$in/$contains/$and/$or. Date fields and the system timestamps created_at/updated_at also accept $datePreset ("today", "yesterday", "this_week", "last_week", "this_month", "last_month", "this_quarter", "last_quarter", "this_year", "last_year"), and $inLast/$inNext rolling windows (a day count like 7, or {"amount":2,"unit":"weeks"} with unit days|weeks|months|quarters|years). On a date field, $gt/$gte/$lt/$lte take a day ("2026-11-03"), an ISO date-time with its offset or epoch ms; a top-level "timeZone" (IANA) says which zone a day bound means. A filter naming a field the object does not have is an error. Example: {"filter":{"updated_at":{"$datePreset":"this_month"}}}.
  - `assignedTo` string: Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view.
  - `assigneeField` string: Which `user` field "assigned" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field.

## Response `200`

Successful response

- union: Entry rows. With dsl.select the rows are flat {_id, ...selectedFields} objects instead.
  - object[]
  - object
    - `data` object[], required
    - `references` union[], required
      - union
        - object
          - `kind` 'crm-entry', required
          - `objectName` string, required
          - `entryId` string, required
          - `label` string, required
          - `href` string, required
          - `url` string
          - `imageUrl` string
          - `objectIcon` string
        - object
          - `kind` 'crm-object', required
          - `objectName` string, required
          - `label` string, required
          - `href` string, required
          - `url` string
          - `imageUrl` string
          - `objectIcon` string
        - object
          - `kind` 'campaign', required
          - `sequenceId` string, required
          - `label` string, required
          - `href` string, required
          - `url` string
          - `imageUrl` string
          - `objectIcon` string
    - `referenceCoverage` object, required
      - `returned` integer, required
      - `available` integer, required
      - `truncated` boolean, required

## Other responses

- `400`: Invalid request
- `401`: Missing or invalid authentication
- `404`: Operation or resource not found
- `500`: Server error

---

[API](https://skmtc.dev/dench/apis/dench-api.md) - [All operations](https://skmtc.dev/dench/apis/dench-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dench/apis/dench-api/revisions/4a145b38f19c?raw)
