v1

latestOpenAPI 3.1.02026-07-2466150275.0 KB
Projects

Aggregate Projects

Aggregate projects with GROUP BY operations.

Allows grouping by name, city, country, site_code, and other fields with aggregation functions like COUNT, SUM, AVG, MIN, MAX. Uses the same base filters and company scoping as the search endpoint for consistent behavior.

post/v1/project/aggregate

Request body

querystring nullable

Keywords should be space separated and are ANDed together, so all keywords must be present but they can be present in any of the fields specified above.

skipinteger nullable

Number of records to skip before returning records

limitinteger nullable

Number of records to return

sort_direction'asc' | 'desc'

Direction to sort the sort_column - ascending or descending.

date_startstring date-time nullable

If sorting on updated_at or created_at, and date_cut_off is provided, return only records that were created or updated (whichever is being sorted on) between date_start and date_cut_off

date_cut_offstring date-time nullable

If sorting on updated_at or created_at, return only records that were created or updated (whichever is being sorted on) between the initial value (determined by sort order) and the cutoff date.

For example, sorting on created_at ascending with a date_cut_off will return all records from the oldest creation date to the cutoff date. By comparison, sorting on created_at descending with a date_cut_off will return all records from the most recent creation date to the cutoff date.

sort_columnstring nullable

Column to sort aggregation results by (must be in group_by or an aggregation alias)

external_idsstring nullable

Return sites with a matching external identifier. Should be a comma-separated list.

is_archivedboolean nullable

Filter based on the project's archived status. Defaults to False, which returns records that have not been archived

citystring nullable

Filter by project city.

countrystring nullable

Filter by project country.

is_privateboolean nullable

Filter by private/public status.

prime_idinteger nullable

Filter by prime contractor company ID.

user_idinteger nullable

Return sites that the user with this ID is assigned to.

group_bystring[] required

Column names to group by

date_filter_column'created_at' | 'updated_at'

Column to apply date_start/date_cut_off filters on (created_at or updated_at)

Example request

{
  "aggregations": [
    {
      "alias": "total_projects",
      "column": "id",
      "operator": "count"
    }
  ],
  "date_filter_column": "updated_at",
  "group_by": [
    "city",
    "country"
  ],
  "is_archived": false,
  "limit": 50,
  "query": "warehouse",
  "skip": 0,
  "sort_column": "total_projects",
  "sort_direction": "desc"
}

Response

Successful Response

errorboolean

A boolean error indicator.

messagestring nullable

Optional message.

Example response

{
  "data": {
    "data": [
      {
        "city": "Toronto",
        "country": "Canada",
        "total_projects": 15
      },
      {
        "city": "Vancouver",
        "country": "Canada",
        "total_projects": 8
      },
      {
        "city": "New York",
        "country": "USA",
        "total_projects": 12
      }
    ],
    "metadata": {
      "aggregations": [
        {
          "alias": "total_projects",
          "column": "id",
          "operator": "count"
        }
      ],
      "group_by_columns": [
        "city",
        "country"
      ]
    },
    "total_groups": 3
  }
}