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

# Check a device group target before creating the group

> Validate a device group `target` without persisting anything: it reports whether the target is well-formed, whether every criterion is device-group-targetable (build it from `getDeviceGroupFiltersOptions`), and how many devices it currently matches — so a target that is valid but matches nothing is caught before the group exists. It returns counts and reasons, never device objects: to see WHICH devices match a filter, use `getDevices`.

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


## OpenAPI

````yaml https://api.getprimo.com/openapi.json post /device-groups/validate-target
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:
  /device-groups/validate-target:
    post:
      tags:
        - DeviceGroups
      summary: Check a device group target before creating the group
      description: >-
        Validate a device group `target` without persisting anything: it reports
        whether the target is well-formed, whether every criterion is
        device-group-targetable (build it from `getDeviceGroupFiltersOptions`),
        and how many devices it currently matches — so a target that is valid
        but matches nothing is caught before the group exists. It returns counts
        and reasons, never device objects: to see WHICH devices match a filter,
        use `getDevices`.
      operationId: validateDeviceGroupTarget
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidateDeviceGroupTargetInput'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateDeviceGroupTarget_Output'
components:
  schemas:
    ValidateDeviceGroupTargetInput:
      type: object
      properties:
        target:
          description: >-
            Device group target to validate. An object keyed by criterion `key`
            (from the /device-groups/filters-options catalog); each value is a
            clause { operationType: "INCLUDE" | "EXCLUDE", values: string[] }.
            Add top-level `matchAny: true` for OR across clauses.
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
      required:
        - target
    ValidateDeviceGroupTarget_Output:
      type: object
      properties:
        valid:
          type: boolean
          description: Whether the target can be used to create or update a device group.
        errors:
          type: array
          description: >-
            Why the target is invalid — malformed clauses, or criteria that are
            not device-group-targetable.
          items:
            type: string
        matchedCount:
          type: integer
          description: >-
            How many devices the target currently matches. 0 when the target is
            invalid.
          minimum: -9007199254740991
          maximum: 9007199254740991
      required:
        - valid
        - errors
        - matchedCount
      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>`.

````