POST/organizations/{orgId}/queries
Runs a read-only query (select, filter, search, sort, group, page) on an organization source (Event,
CollaboratorRecord or CrewRecord) under the caller's access: only rows the caller can reach, and only fields their
field classes allow; CollaboratorRecord and CrewRecord are a 403 for a caller who can read none. Paths the caller
can't see, or that don't exist, are left out and listed in unavailableFields. Use for paged lists: send
includeTotals on the first page and pass nextCursor back as page.cursor for the next. Groups return headers
first: groupBys with no groupKey returns the top level's headers (key, label, count, aggregates), a partial
groupKey the next level's, and a full groupKey that group's rows, paged (header requests send no page).
includeTotals with no groupKey also returns whole-result aggregates and charts. Flags come back as booleans
on each row under their alias. timeZone (IANA) buckets date-time groups; date groups use UTC. For a calendar or
gantt send a window instead of a page (from, to, startPath, optional endPath and pointPaths, all date paths):
only rows whose dates overlap it come back. For a map send a viewport (west, south, east, north, path to a
location attribute): only rows whose point is inside it. Either returns up to 2,000 rows in sort order with
truncated true past that; a window or viewport path that is unknown, hidden from the caller, of the wrong kind
or through a related record is a 400. The orgId comes from Users_GetOrganizations; source names and paths from
Query_GetOrganizationQuerySources and Query_GetOrganizationQuerySourceSchema. Needs Organization basic access.
today (yyyy-MM-dd, the caller's local date) anchors relative dates such as Today; without it they resolve from the UTC date.
With storedPreview true (a table preview in an organization-drive Dynamic Docs doc, document filters allowed) it
returns the stored-run shape instead, the whole result in group order.
Path Parameters
| Field | Type | Required | Description |
|---|
| orgId | uuid | Required | |
Request Body
| Field | Type | Required | Description |
|---|
| source | string | Optional | |
| select | QuerySelect[] | Optional | |
| filter | QueryFilterGroup | Optional | |
| search | QuerySearch | Optional | |
| sorts | QuerySort[] | Optional | |
| groupBys | QueryGroupBy[] | Optional | |
| groupKey | QueryGroupKeyPart[] | Optional | |
| aggregates | QueryAggregate[] | Optional | |
| charts | QueryChart[] | Optional | |
| flags | QueryFlag[] | Optional | |
| hierarchy | QueryHierarchy | Optional | |
| page | QueryPage | Optional | |
| window | QueryWindow | Optional | |
| viewport | QueryViewport | Optional | |
| includeTotals | boolean | Optional | |
| includeAccess | boolean | Optional | |
| timeZone | string | Optional | |
| today | string | Optional | |
| storedPreview | boolean | Optional | |
| filters | object | Optional | |
QuerySelect
| Field | Type | Description |
|---|
| path | string| null | |
| alias | string| null | |
| label | string| null | |
| isLayoutField | boolean | |
| collectionMode | string| null | |
QueryFilterGroup
| Field | Type | Description |
|---|
| logic | string| null | |
| rules | QueryFilterRule[]| null | |
| groups | QueryFilterGroup[]| null | |
QuerySearch
| Field | Type | Description |
|---|
| text | string| null | |
| paths | string[]| null | |
QuerySort
| Field | Type | Description |
|---|
| path | string| null | |
| direction | string| null | |
QueryGroupBy
| Field | Type | Description |
|---|
| path | string| null | |
| dateBucket | string| null | |
QueryGroupKeyPart
| Field | Type | Description |
|---|
| path | string| null | |
| value | JsonElement| null | |
QueryAggregate
| Field | Type | Description |
|---|
| alias | string| null | |
| function | string| null | |
| path | string| null | |
QueryChart
| Field | Type | Description |
|---|
| alias | string| null | |
| path | string| null | |
| dateBucket | string| null | |
| stackPath | string| null | |
| aggregate | QueryAggregate| null | |
| ignoreRuleIds | string[]| null | |
QueryFlag
| Field | Type | Description |
|---|
| alias | string| null | |
| condition | QueryFilterGroup | |
QueryHierarchy
| Field | Type | Description |
|---|
| includeAncestors | boolean | |
| includeDescendants | boolean | |
| settingRuleIds | string[]| null | |
| parentId | uuid| null | |
QueryPage
| Field | Type | Description |
|---|
| size | integer | |
| cursor | string| null | |
QueryWindow
| Field | Type | Description |
|---|
| from | date-time | |
| to | date-time | |
| startPath | string| null | |
| endPath | string| null | |
| pointPaths | string[]| null | |
QueryViewport
| Field | Type | Description |
|---|
| west | number | |
| south | number | |
| east | number | |
| north | number | |
| path | string| null | |
QueryFilterRule
| Field | Type | Description |
|---|
| id | string| null | |
| path | string| null | |
| operator | string| null | |
| value | JsonElement| null | |
Response
| Field | Type | Description |
|---|
| rows | object[]| null | |
| groups | StoredQueryGroup[]| null | |
| columns | StoredQueryColumn[]| null | |
| truncated | boolean | |
| broken | boolean | |
| brokenReason | string| null | |
| brokenDetail | BrokenDetail | |
StoredQueryGroup
| Field | Type | Description |
|---|
| key | QueryGroupKeyPart[]| null | |
| labels | string[]| null | |
| count | integer | |
StoredQueryColumn
| Field | Type | Description |
|---|
| alias | string| null | |
| label | string| null | |
| kind | string| null | |
| options | StoredQueryColumnOption[]| null | |
BrokenDetail
| Field | Type | Description |
|---|
| path | string| null | |
| usage | string| null | |
| label | string| null | |
| v1Text | string| null | |
StoredQueryColumnOption
| Field | Type | Description |
|---|
| id | string| null | |
| label | string| null | |
| color | string| null | |
| icon | string| null | |