Overview#
The Search Query API lets clients query JumpCloud data (users, devices, groups, and related objects) using a structured JSON filter DSL. Callers can:
- Select fields to return
- Apply nested filters (
AND/ORand comparison operators) - Join related objects by selecting fields from multiple objects in one request
- Sort and paginate results
- Optionally aggregate data (for example
COUNT)
Use Search Query when you need filtered, join-aware, report-style data.
Do not use it for free-text / keyword search across many fields at once.
Authentication and headers#
| Header | Required | Description |
|---|---|---|
x-api-key |
Yes | JumpCloud API key |
x-org-id |
Yes | Organization ID (from console settings) |
Content-Type |
Yes | application/json |
Base path: /api/v2/search/query
Request shape (quick reference)#
| Property | Type | Description |
|---|---|---|
fields.include |
string[] | Fields to return, always as <object>.<field> (for example user.email) |
fields.exclude |
string[] | Optional fields to exclude |
filters |
object[] | Filter tree. Leaf filters need operation, field, and usually value. Nested AND/OR use a child filters array |
sort |
object[] | Sort by field and order (ASC or DESC) |
limit |
integer | Max rows to return (legacy; still widely used) |
pagination.page_size |
integer | Preferred page size when using pagination |
pagination.offset |
integer | Zero-based offset into the result set |
aggregations |
object[] | Optional aggregates such as COUNT, AVG, MAX, MIN, SUM, COUNT_UNIQUE |
request_cache |
boolean | Optional; when true, cache the full result set for later paginated reads |
cache_token |
string | Optional; token from a previous cached query |
Field naming rule: Always use <objectName>.<fieldName> (case-insensitive; stored/compared as lowercase).
Discover fields: Call GET /api/v2/search/query/schema (or schema for a single object) before building queries.
Example 1 — Simple user search (filter + sort + limit)#
Goal: Return a small set of users whose email starts with a given prefix.
curl -X POST "https://console.jumpcloud.com/api/v2/search/query" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-org-id: YOUR_ORG_ID" \
-d '{
"fields": {
"include": [
"user.id",
"user.email",
"user.username"
]
},
"filters": [
{
"operation": "STARTS_WITH",
"field": "user.email",
"value": "admin"
}
],
"sort": [
{
"field": "user.email",
"order": "ASC"
}
],
"limit": 10
}'
Request body only#
{
"fields": {
"include": ["user.id", "user.email", "user.username"]
},
"filters": [
{
"operation": "STARTS_WITH",
"field": "user.email",
"value": "admin"
}
],
"sort": [
{
"field": "user.email",
"order": "ASC"
}
],
"limit": 10
}
What this demonstrates#
- Field selection with
fields.include - Case-insensitive string filter (
STARTS_WITH) - Ascending sort
- Row cap via
limit
Sample response shape#
{
"results": [
{
"fields": {
"user.id": "64f1a2b3c4d5e6f7a8b9c0d1",
"user.email": "admin.jane@example.com",
"user.username": "jane.admin"
}
}
],
"totalCount": 1
}
Note: Exact response envelope field names may vary by gateway/version.
Example 2 — Join related objects + nested OR filter#
Goal: List users with their user-group memberships, and keep rows where the user is activated or the group name contains "admins".
Selecting fields from more than one object in a single request causes Search to join those related objects automatically (when the join is valid in schema metadata).
curl -X POST "https://console.jumpcloud.com/api/v2/search/query" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-org-id: YOUR_ORG_ID" \
-d '{
"fields": {
"include": [
"user.id",
"user.username",
"user.email",
"user_group.id",
"user_group.name"
]
},
"filters": [
{
"operation": "OR",
"filters": [
{
"operation": "EQUALS",
"field": "user.user_state",
"value": "ACTIVATED"
},
{
"operation": "CONTAINS",
"field": "user_group.name",
"value": "admins"
}
]
}
],
"sort": [
{
"field": "user.username",
"order": "ASC"
}
],
"limit": 25
}'
Request body only#
{
"fields": {
"include": [
"user.id",
"user.username",
"user.email",
"user_group.id",
"user_group.name"
]
},
"filters": [
{
"operation": "OR",
"filters": [
{
"operation": "EQUALS",
"field": "user.user_state",
"value": "ACTIVATED"
},
{
"operation": "CONTAINS",
"field": "user_group.name",
"value": "admins"
}
]
}
],
"sort": [
{
"field": "user.username",
"order": "ASC"
}
],
"limit": 25
}
What this demonstrates#
- Multi-object field selection → implicit join (
user+user_group) - Nested boolean filter tree (
ORwith child filters) - Mixing filter operators (
EQUALS,CONTAINS)
Example 3 — Device inventory join + aggregation + pagination#
Goal: Build a device inventory-style query that:
- Joins device core fields with system/disk detail fields
- Filters to macOS devices that contacted JumpCloud recently
- Counts matching devices (
COUNT) - Returns the first page of results with explicit pagination
curl -X POST "https://console.jumpcloud.com/api/v2/search/query" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-org-id: YOUR_ORG_ID" \
-d '{
"fields": {
"include": [
"device.display_name",
"device.hostname",
"device.os",
"device.os_version",
"device.last_contact",
"device.serial_number",
"device_system_detail.memory",
"device_system_detail.cpu_brand",
"device_disk_detail.disk_size",
"device_disk_detail.storage_available"
]
},
"filters": [
{
"operation": "AND",
"filters": [
{
"operation": "EQUALS",
"field": "device.os",
"value": "Mac OS X"
},
{
"operation": "GREATER_THAN_OR_EQUALS",
"field": "device.last_contact",
"value": "2026-01-01T00:00:00Z"
}
]
}
],
"aggregations": [
{
"field": ["device.display_name"],
"function": "COUNT",
"name": "device_count"
}
],
"sort": [
{
"field": "device.display_name",
"order": "ASC"
}
],
"pagination": {
"page_size": 50,
"offset": 0
},
"request_cache": true
}'
Request body only#
{
"fields": {
"include": [
"device.display_name",
"device.hostname",
"device.os",
"device.os_version",
"device.last_contact",
"device.serial_number",
"device_system_detail.memory",
"device_system_detail.cpu_brand",
"device_disk_detail.disk_size",
"device_disk_detail.storage_available"
]
},
"filters": [
{
"operation": "AND",
"filters": [
{
"operation": "EQUALS",
"field": "device.os",
"value": "Mac OS X"
},
{
"operation": "GREATER_THAN_OR_EQUALS",
"field": "device.last_contact",
"value": "2026-01-01T00:00:00Z"
}
]
}
],
"aggregations": [
{
"field": ["device.display_name"],
"function": "COUNT",
"name": "device_count"
}
],
"sort": [
{
"field": "device.display_name",
"order": "ASC"
}
],
"pagination": {
"page_size": 50,
"offset": 0
},
"request_cache": true
}
What this demonstrates#
- Device inventory-style multi-object join (
device,device_system_detail,device_disk_detail) - Nested
ANDfilter combining string and datetime comparisons - Aggregation (
COUNT) with a named result field (device_count) - Pagination via
pagination.page_size/pagination.offset - Optional result caching (
request_cache: true) for follow-up page requests
Pagination follow-up (page 2)#
After the first response returns a cache token (when caching is enabled), subsequent pages can reuse it:
{
"cache_token": "TOKEN_FROM_PREVIOUS_RESPONSE",
"pagination": {
"page_size": 50,
"offset": 50
}
}
Confirm the exact response field that carries the cache token against current OpenAPI before publishing.
Common filter operations (subset)#
| Operation | Typical use |
|---|---|
EQUALS / NOT_EQUALS |
Exact match (case-insensitive for strings) |
STARTS_WITH / ENDS_WITH / CONTAINS |
String pattern matching (case-insensitive) |
IN / NOT_IN |
Match against a list of values |
GREATER_THAN / LESS_THAN / *_OR_EQUALS |
Numbers and datetimes |
IS_NULL |
Null check; value is boolean (true = is null) |
IS_EMPTY |
Null or empty string; string fields only; value is boolean |
AND / OR |
Nest child filters in filters[] |
Datetime values should be ISO-8601 strings in UTC (no offset), for example "2026-01-01T00:00:00Z".
Case-sensitive variants also exist (for example EQUALS_CASE_SENSITIVE, CONTAINS_CASE_SENSITIVE) and apply only to string fields.
Aggregation functions#
| Function | Description |
|---|---|
COUNT |
Count rows / values |
COUNT_UNIQUE |
Count distinct values |
AVG |
Average |
MAX |
Maximum |
MIN |
Minimum |
SUM |
Sum |
Each aggregation needs:
function— one of the values abovefield— array of<object>.<field>paths to aggregatename— alias returned in the response
Related endpoints (optional callouts)#
| Method | Path | Purpose |
|---|---|---|
GET |
/api/v2/search/query/schema |
List searchable objects, fields, join targets, and capabilities |
GET |
/api/v2/search/query/schema/{object_name} |
Schema for a single object |
POST |
/api/v2/search/query |
Run a structured search query (this document) |