> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getprimo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Read the rows the devices stored for a saved query

> Return, paginated by host name, the rows each device last answered to a saved query that runs on an interval: the device (`id`, `name`, `serialNumber`), when it sent them (`lastFetchedAt`) and the row's `values`, one per column of the query's SQL. Use this to export or answer questions about what the devices report, such as every browser extension installed. Nothing runs on the devices: each one refreshes its rows at the query's interval. Narrow with `deviceIds` or `search`. To find the `queryId`, use `getQueries`. For the software Primo deploys to a device, use `getDeviceSoftware` instead.

Fleet keeps a limited number of rows per query across every device: `rowLimit` (1,000 unless Primo raised it), or the number of hosts when that is higher. Once a query reaches it, Fleet drops the rows of the next devices and `clipped` becomes true. A device that answers more than 1,000 rows to one query stores none of them and keeps its previous rows, without setting `clipped`. `scheduled` is false, with no rows, for a query that runs on no interval or whose data Fleet discards.

Key: ReadScope: Company


## OpenAPI

````yaml https://api.getprimo.com/openapi.json get /queries/{queryId}/results
openapi: 3.1.1
info:
  title: Public API - BETA
  description: Read docs on https://docs.getprimo.com/
  version: '1.0'
  contact: {}
servers:
  - url: https://api.getprimo.com
security:
  - apikey: []
tags: []
paths:
  /queries/{queryId}/results:
    get:
      tags:
        - Queries
      summary: Read the rows the devices stored for a saved query
      description: >-
        Return, paginated by host name, the rows each device last answered to a
        saved query that runs on an interval: the device (`id`, `name`,
        `serialNumber`), when it sent them (`lastFetchedAt`) and the row's
        `values`, one per column of the query's SQL. Use this to export or
        answer questions about what the devices report, such as every browser
        extension installed. Nothing runs on the devices: each one refreshes its
        rows at the query's interval. Narrow with `deviceIds` or `search`. To
        find the `queryId`, use `getQueries`. For the software Primo deploys to
        a device, use `getDeviceSoftware` instead.


        Fleet keeps a limited number of rows per query across every device:
        `rowLimit` (1,000 unless Primo raised it), or the number of hosts when
        that is higher. Once a query reaches it, Fleet drops the rows of the
        next devices and `clipped` becomes true. A device that answers more than
        1,000 rows to one query stores none of them and keeps its previous rows,
        without setting `clipped`. `scheduled` is false, with no rows, for a
        query that runs on no interval or whose data Fleet discards.
      operationId: getStoredQueryResults
      parameters:
        - name: queryId
          required: true
          in: path
          schema:
            type: string
        - name: search
          required: false
          in: query
          description: >-
            Only the rows whose host name or one of whose values contains this
            text
          schema:
            type: string
        - name: deviceIds
          required: false
          in: query
          description: >-
            Only the rows of these devices: a comma-separated list of at most 50
            device ids
          schema:
            type: string
        - name: page
          required: false
          in: query
          description: Page number
          schema:
            type: number
        - name: perPage
          required: false
          in: query
          description: Number of items per page (max 100)
          schema:
            type: number
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetStoredQueryResults_Output'
components:
  schemas:
    GetStoredQueryResults_Output:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              device:
                description: >-
                  The Primo device whose Fleet host stored the row; null when no
                  device carries that host.
                anyOf:
                  - type: object
                    properties:
                      id:
                        type: string
                      name:
                        anyOf:
                          - type: string
                          - type: 'null'
                      serialNumber:
                        anyOf:
                          - type: string
                          - type: 'null'
                    required:
                      - id
                      - name
                      - serialNumber
                    additionalProperties: false
                  - type: 'null'
              hostName:
                description: The host name the device reported to Fleet.
                type: string
              lastFetchedAt:
                description: When the device sent the row.
                anyOf:
                  - type: string
                  - type: 'null'
              values:
                description: >-
                  The row: each column of the query's SQL with its value, as a
                  string.
                type: object
                propertyNames:
                  type: string
                additionalProperties:
                  type: string
            required:
              - device
              - hostName
              - lastFetchedAt
              - values
            additionalProperties: false
        pagination:
          type: object
          properties:
            totalElements:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            totalPages:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            page:
              type: integer
              minimum: 1
              maximum: 9007199254740991
            perPage:
              type: integer
              minimum: 1
              maximum: 100
          required:
            - totalElements
            - totalPages
            - page
            - perPage
          additionalProperties: false
        scheduled:
          type: boolean
          description: >-
            False when the query runs on no interval or Fleet discards its data:
            it never stores rows.
        clipped:
          type: boolean
          description: >-
            True when Fleet dropped the rows of a device because the query
            reached its row limit: some devices are missing. A device that
            answers more than 1,000 rows stores none and does not set it.
        rowLimit:
          type: number
          description: >-
            The row limit set for one query across every device. Fleet raises it
            to the number of hosts when that is higher.
      required:
        - data
        - pagination
        - scheduled
        - clipped
        - rowLimit
      additionalProperties: false
  securitySchemes:
    apikey:
      scheme: bearer
      bearerFormat: API key
      type: http
      description: >-
        Use your Primo API key in the Authorization header as `Bearer
        <API_KEY>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.