People

Count people

POST
https://api.searchsoftware.nl/v4/records/people/count

Counts people records in the shared records index, optionally grouped by one attribute. Requires people:read.

Takes the same query and filters as the search route and returns numbers, never records. limit, offset, sort and objects are refused as unknown fields (400).

group_by names one attribute that GET /v4/records/{plural_slug}/attributes marks groupable: enum, select and boolean attributes, workflow phase, user references such as assigned_to, and the sources and types tokens. The answer then has groups (one per value with records, sorted by count), none_count (records without a value) and overlapping (true for multivalue attributes, where one record can be in several groups). Each group's value works as an eq (or, for multivalue attributes, contains_exact) filter on the search route.

An attribute with more than 50 values returns 422 GROUP_BY_TOO_MANY_VALUES; any other attribute returns 422 GROUP_BY_NOT_SUPPORTED. A grouped count runs one index query per value and has a 10-second budget: over it, 503 COUNT_TIMEOUT.

approximate is true for OAuth tokens of non-manager users: hidden and access-level-protected records are excluded in the index, so the count can lag recent permission changes.

Request example:

{"filters":[{"op":"and","clauses":[{"field":"status","op":"eq","value":"normal"}]}],"group_by":"assigned_to"}

Response example (data):

{"count":42,"approximate":false,"groups":[{"value":"Ab12","label":"Anna de Boer","count":30},{"value":"Cd34","label":"Bob","count":9}],"none_count":3,"overlapping":false}

Body

application/json
querystring

Search query, default *. The same as on the search route.

The same filters as on the search route.

Show child attributes
opstringandornotrequired

How the clauses combine: and, or, or not (NOT of the AND of its clauses). Groups are ANDed together. An unknown op drops the whole group.

Example
and

One or more clauses. A group whose clauses are all dropped is ignored.

Show child attributes
fieldstringrequired

Attribute name as returned in the record's attributes (custom fields by slug). No meta. prefix. Clauses on type are ignored.

Example
status
opstringeqnot_eqgtgteltltebetweenexistsnot_existscontainscontains_exactrequired

Clause operator. Unknown operators are ignored (the clause is dropped), not rejected.

Example
eq
valueany

String, integer, or a two-element [low, high] array for between. Omit for exists / not_exists. Timestamps are full RFC 3339 values.

Example
normal
group_bystring

One attribute marked groupable in the attributes route.

Example
assigned_to
Show child attributes
placestring

A city name, resolved from this workspace's own located addresses (the average of their coordinates). 422 PLACE_NOT_FOUND when none is located there; pass lat and lng instead. 503 PLACE_LOOKUP_FAILED when the lookup itself fails (retry, or pass lat and lng).

Example
Amsterdam
latnumber<float>

Latitude, with lng, in place of place.

Example
52.37
lngnumber<float>

Longitude, with lat.

Example
4.9
radius_kmnumber<float>required

1 to 500 kilometres.

Example
40
document_querystring

The same as on the search route. Not with group_by (422 DOCUMENT_QUERY_WITH_GROUP_BY).

Example
AutoCAD

Response

Record count

Response fields application/json
statusstringrequired
Example
ok
dataRecordCountDatarequired
Show child attributes
countinteger<int32>required
Example
42
approximatebooleanrequired

True when visibility is filtered for the caller and the number may lag recent permission changes.

Example
false

Only with group_by. Values with no records are left out.

Show child attributes
valuestringrequired

The attribute value, as a filter takes it. A boolean for boolean attributes.

Example
Ab12
labelstringrequired
Example
Anna de Boer
countinteger<int32>required
Example
30
none_countinteger<int32>

Only with group_by: records without a value.

Example
3
overlappingboolean

Only with group_by: true for multivalue attributes, where group counts can add up to more than count.

Example
false
document_matches_truncatedboolean

Only with document_query, and only when true: the count covers the first 200 matching records only.

Example
true
400Bad RequestErrorResponse

Invalid request body

Response fields application/json
statusstringerrorrequired
Example
error
errorErrorBodyrequired
Show child attributes
codestringrequired

Stable machine-readable error code.

status_codeinteger<int32>required

HTTP status code for this response.

messagestringrequired

Human-readable error message.

Example
{
  "status": "error",
  "error": {
    "code": "INVALID_BODY",
    "status_code": 400,
    "message": "Invalid request body"
  }
}
401UnauthorizedErrorResponse

Invalid API key

Response fields application/json
statusstringerrorrequired
Example
error
errorErrorBodyrequired
Show child attributes
codestringrequired

Stable machine-readable error code.

status_codeinteger<int32>required

HTTP status code for this response.

messagestringrequired

Human-readable error message.

Example
{
  "status": "error",
  "error": {
    "code": "INVALID_API_KEY",
    "status_code": 401,
    "message": "Invalid API key"
  }
}
403ForbiddenErrorResponse

Insufficient scope

Response fields application/json
statusstringerrorrequired
Example
error
errorErrorBodyrequired
Show child attributes
codestringrequired

Stable machine-readable error code.

status_codeinteger<int32>required

HTTP status code for this response.

messagestringrequired

Human-readable error message.

Example
{
  "status": "error",
  "error": {
    "code": "FORBIDDEN",
    "status_code": 403,
    "message": "Insufficient scope"
  }
}
422Unprocessable EntityErrorResponse

Validation error

Response fields application/json
statusstringerrorrequired
Example
error
errorErrorBodyrequired
Show child attributes
codestringrequired

Stable machine-readable error code.

status_codeinteger<int32>required

HTTP status code for this response.

messagestringrequired

Human-readable error message.

Example
{
  "status": "error",
  "error": {
    "code": "VALIDATION_FAILED",
    "status_code": 422,
    "message": "Validation failed"
  }
}
500Internal Server ErrorErrorResponse

Internal server error

Response fields application/json
statusstringerrorrequired
Example
error
errorErrorBodyrequired
Show child attributes
codestringrequired

Stable machine-readable error code.

status_codeinteger<int32>required

HTTP status code for this response.

messagestringrequired

Human-readable error message.

Example
{
  "status": "error",
  "error": {
    "code": "INTERNAL_ERROR",
    "status_code": 500,
    "message": "Internal server error"
  }
}
503Service UnavailableErrorResponse

Counting took too long

Response fields application/json
statusstringerrorrequired
Example
error
errorErrorBodyrequired
Show child attributes
codestringrequired

Stable machine-readable error code.

status_codeinteger<int32>required

HTTP status code for this response.

messagestringrequired

Human-readable error message.

Authorization

bearer_authhttp (bearer) in header

API key or OAuth access token in Authorization header

Scopes: people:read

oauth2_authoauth2

OAuth authorization code flow with mandatory S256 PKCE.

Scopes: people:read

apikey_authapiKey in query

API key in query string

Scopes: people:read