Docs

Run Organization Query

POST /organizations/{orgId}/queries

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

FieldTypeRequiredDescription
orgIduuidRequired

Request Body

FieldTypeRequiredDescription
sourcestringOptional
selectQuerySelect[]Optional
filterQueryFilterGroupOptional
searchQuerySearchOptional
sortsQuerySort[]Optional
groupBysQueryGroupBy[]Optional
groupKeyQueryGroupKeyPart[]Optional
aggregatesQueryAggregate[]Optional
chartsQueryChart[]Optional
flagsQueryFlag[]Optional
hierarchyQueryHierarchyOptional
pageQueryPageOptional
windowQueryWindowOptional
viewportQueryViewportOptional
includeTotalsbooleanOptional
includeAccessbooleanOptional
timeZonestringOptional
todaystringOptional
storedPreviewbooleanOptional
filtersobjectOptional

QuerySelect

FieldTypeDescription
pathstring| null
aliasstring| null
labelstring| null
isLayoutFieldboolean
collectionModestring| null

QueryFilterGroup

FieldTypeDescription
logicstring| null
rulesQueryFilterRule[]| null
groupsQueryFilterGroup[]| null

QuerySearch

FieldTypeDescription
textstring| null
pathsstring[]| null

QuerySort

FieldTypeDescription
pathstring| null
directionstring| null

QueryGroupBy

FieldTypeDescription
pathstring| null
dateBucketstring| null

QueryGroupKeyPart

FieldTypeDescription
pathstring| null
valueJsonElement| null

QueryAggregate

FieldTypeDescription
aliasstring| null
functionstring| null
pathstring| null

QueryChart

FieldTypeDescription
aliasstring| null
pathstring| null
dateBucketstring| null
stackPathstring| null
aggregateQueryAggregate| null
ignoreRuleIdsstring[]| null

QueryFlag

FieldTypeDescription
aliasstring| null
conditionQueryFilterGroup

QueryHierarchy

FieldTypeDescription
includeAncestorsboolean
includeDescendantsboolean
settingRuleIdsstring[]| null
parentIduuid| null

QueryPage

FieldTypeDescription
sizeinteger
cursorstring| null

QueryWindow

FieldTypeDescription
fromdate-time
todate-time
startPathstring| null
endPathstring| null
pointPathsstring[]| null

QueryViewport

FieldTypeDescription
westnumber
southnumber
eastnumber
northnumber
pathstring| null

QueryFilterRule

FieldTypeDescription
idstring| null
pathstring| null
operatorstring| null
valueJsonElement| null

Response

FieldTypeDescription
rowsobject[]| null
groupsStoredQueryGroup[]| null
columnsStoredQueryColumn[]| null
truncatedboolean
brokenboolean
brokenReasonstring| null
brokenDetailBrokenDetail

StoredQueryGroup

FieldTypeDescription
keyQueryGroupKeyPart[]| null
labelsstring[]| null
countinteger

StoredQueryColumn

FieldTypeDescription
aliasstring| null
labelstring| null
kindstring| null
optionsStoredQueryColumnOption[]| null

BrokenDetail

FieldTypeDescription
pathstring| null
usagestring| null
labelstring| null
v1Textstring| null

StoredQueryColumnOption

FieldTypeDescription
idstring| null
labelstring| null
colorstring| null
iconstring| null