Scan Filtering using Labels
Focus
Focus
Prisma AIRS

Scan Filtering using Labels

Table of Contents


Scan Filtering using Labels

The ListScans API includes a labels_query parameter that enables scan filtering based on labels.

Using ListScans API with labels_query

The ListScans API includes a labels_query parameter that enables scan filtering based on labels. This parameter supports AND/OR logic with grouping functionality.
The labels_query syntax combines label filters with logical operators.
Label Filters
A label filter follows the format key:value_type where:
  • key:value—Match exact key-value pair (for example, env:prod).
  • key:*—Match any value for the specified key (for example, env:*)
Operators
Valid operators are:
  • AND—Logical AND operation (for example, env:prod AND team:guardian).
  • OR—Logical OR operation (for example, env:prod OR env:staging).
  • ( )—Single-level grouping for precedence (for example, (env:prod OR env:staging) AND team:platform).
    Nested subqueries are not supported (for example, ((env:prod OR env:dev) AND team:ml) OR region:us-west).
Using CLI
model-security list-scans \ --labels-query "(env:production OR env:staging) AND (team:ml-platform OR team:security)"
Using Python SDK
from model_security_client.api import ModelSecurityAPIClient client = ModelSecurityAPIClient(base_url="https://api.sase.paloaltonetworks.com/aims") # List scans that have a label key 'env' with value 'production' or 'staging' and have a label key 'team' with value 'ml-platform' or 'security' scans = client.list_scans( labels_query="(env:production OR env:staging) AND (team:ml-platform OR team:security)" ) for scan in scans.scans: print(f"Scan {scan.uuid}: {scan.model_uri}") print(f" Labels: {scan.labels}") print(f" Outcome: {scan.eval_outcome}")