---
title: "Search Commands Results"
method: POST
path: "/search/commandresults"
tags: ["Search"]
---

# Search Commands Results

`POST /search/commandresults`

## Request

- Base URL: `https://console.jumpcloud.com/api`
- URL: `https://console.jumpcloud.com/api/search/commandresults`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/jumpcloud/apis/jumpcloud-api/docs/search/commandresults/post.ts> (a function with typed inputs; its response is checked against the schema)

Return Command Results in multi-record format allowing for the passing of the `filter` parameter.

To support advanced filtering you can use the `filter` and `searchFilter` parameters that can only be passed in the body of POST /api/search/commandresults route. The `filter` parameter must be passed as Content-Type application/json.

The `filter` parameter is an object with a single property, either `and` or `or` with the value of the property being an array of query expressions.

This allows you to filter records using the logic of matching ALL or ANY records in the array of query expressions. If the `and` or `or` are not included the default behavior is to match ALL query expressions.


#### Sample Request

Exact search for a specific command result
```
curl -X POST https://console.jumpcloud.com/api/search/commandresults \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: {API_KEY}' \
  -d '{
  "filter" : "workflowInstanceId:$eq:62f3c599ec4e928499069c7f",
  "fields" : "name workflowId sudo"
}'
```

## Query parameters

- `fields` string
- `filter` string
- `limit` integer
- `skip` integer

## Headers

- `x-org-id` string

## Request body

- Search
  - `fields` string
  - `filter` object
  - `searchFilter` object

## Response `200`

OK

- Commandresultslist
  - `totalCount` integer: The total number of command results.
  - `results` object[]
    - `command` string: The command that was executed on the system, truncated to 10k characters.
    - `exitCode` integer: The stderr output from the command that ran.
    - `name` string: The name of the command.
    - `organization` string: Device organization ID for the command result.
    - `managedBy` 'enterprise' | 'organization': Command owner type stamped at dispatch (`enterprise` or `organization`).
    - `managedByLabel` string: Display label for Managed By (`Enterprise` or the device organization name).
    - `requestTime` string, date-time, nullable: The time (UTC) that the command was sent.
    - `responseTime` string, date-time, nullable: The time (UTC) that the command was completed.
    - `sudo` boolean: If the user had sudo rights.
    - `system` string: The display name of the system the command was executed on.
    - `systemId` string: The id of the system the command was executed on.
    - `user` string: The user the command ran as.
    - `workflowId` string: The id for the command that ran on the system.
    - `_id` string: The ID of the command result.
    - `response` object
      - `data` object
        - `exitCode` integer: The numeric exit code returned by the executed command.
        - `output` string: The successful command output, truncated to 40 characters.
      - `error` string: The error output from the command, truncated to 40 characters.

## Other responses

- `401`: Unauthorized

---

[API](https://skmtc.dev/jumpcloud/apis/jumpcloud-api.md) - [All operations](https://skmtc.dev/jumpcloud/apis/jumpcloud-api/llms.txt) - [OpenAPI document](https://skmtc.dev/jumpcloud/apis/jumpcloud-api/revisions/0762c7d17a26?raw)
