> ## 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.

# Preview which devices a filter matches

> Preview the devices a filter would match, without persisting anything. Build the filter from the /device-groups/filters-options catalog; an invalid filter is rejected with 400. Use this to confirm a target before creating a device group.

<span className="badge-read">Key: Read</span><span className="badge-company">Scope: Company</span>


## OpenAPI

````yaml https://api.getprimo.com/openapi.json post /devices/preview-filter
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:
  /devices/preview-filter:
    post:
      tags:
        - Devices
      summary: Preview which devices a filter matches
      description: >-
        Preview the devices a filter would match, without persisting anything.
        Build the filter from the /device-groups/filters-options catalog; an
        invalid filter is rejected with 400. Use this to confirm a target before
        creating a device group.
      operationId: previewDeviceFilter
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreviewDeviceFilterInput'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreviewDeviceFilter_Output'
components:
  schemas:
    PreviewDeviceFilterInput:
      type: object
      properties:
        target:
          description: >-
            Device filter. An object keyed by criterion `key` (from the
            /device-groups/filters-options catalog); each value is a clause {
            operationType: "INCLUDE" | "EXCLUDE", values: string[] } — never a
            bare array. Add top-level `matchAny: true` for OR across clauses.
            Example: { "platform": { "operationType": "INCLUDE", "values":
            ["MACOS"] } }.
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
      required:
        - target
    PreviewDeviceFilter_Output:
      type: object
      properties:
        total:
          type: number
          description: Total number of devices matched by the filter.
        devices:
          type: array
          description: The devices matched by the filter.
          items:
            type: object
            properties:
              id:
                description: Device ID
                type: string
              name:
                description: Device name (hostname), when known.
                anyOf:
                  - type: string
                  - type: 'null'
              serialNumber:
                description: Device serial number, when known.
                anyOf:
                  - type: string
                  - type: 'null'
            required:
              - id
              - name
              - serialNumber
            additionalProperties: false
      required:
        - total
        - devices
      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>`.

````