---
title: "POST /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults"
method: POST
path: "/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults"
---

# POST /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults

`POST /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults`

Queries policy states for the resources under the subscription.

## Path parameters

- `policyStatesResource` 'default' | 'latest', required
- `subscriptionId` string, required

## Query parameters

- `api-version` string, required
- `$top` integer
- `$orderby` string
- `$select` string
- `$from` string, date-time
- `$to` string, date-time
- `$filter` string
- `$apply` string
- `$skiptoken` string

## Response `200`

Query results.

- PolicyStatesQueryResults — Query results.
  - `@odata.context` string — OData context string; used by OData clients to resolve type information based on metadata.
  - `@odata.count` integer — OData entity count; represents the number of policy state records returned.
  - `@odata.nextLink` string — Odata next link; URL to get the next set of results.
  - `value` PolicyState[] — Query results.
    - `@odata.id` string — OData entity ID; always set to null since policy state records do not have an entity ID.
    - `@odata.context` string — OData context string; used by OData clients to resolve type information based on metadata.
    - `timestamp` string, date-time — Timestamp for the policy state record.
    - `resourceId` string — Resource ID.
    - `policyAssignmentId` string — Policy assignment ID.
    - `policyDefinitionId` string — Policy definition ID.
    - `effectiveParameters` string — Effective parameters for the policy assignment.
    - `isCompliant` boolean — Flag which states whether the resource is compliant against the policy assignment it was evaluated against.
    - `subscriptionId` string — Subscription ID.
    - `resourceType` string — Resource type.
    - `resourceLocation` string — Resource location.
    - `resourceGroup` string — Resource group name.
    - `resourceTags` string — List of resource tags.
    - `policyAssignmentName` string — Policy assignment name.
    - `policyAssignmentOwner` string — Policy assignment owner.
    - `policyAssignmentParameters` string — Policy assignment parameters.
    - `policyAssignmentScope` string — Policy assignment scope.
    - `policyDefinitionName` string — Policy definition name.
    - `policyDefinitionAction` string — Policy definition action, i.e. effect.
    - `policyDefinitionCategory` string — Policy definition category.
    - `policySetDefinitionId` string — Policy set definition ID, if the policy assignment is for a policy set.
    - `policySetDefinitionName` string — Policy set definition name, if the policy assignment is for a policy set.
    - `policySetDefinitionOwner` string — Policy set definition owner, if the policy assignment is for a policy set.
    - `policySetDefinitionCategory` string — Policy set definition category, if the policy assignment is for a policy set.
    - `policySetDefinitionParameters` string — Policy set definition parameters, if the policy assignment is for a policy set.
    - `managementGroupIds` string — Comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under.
    - `policyDefinitionReferenceId` string — Reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set.
    - `complianceState` string — Compliance state of the resource.
    - `policyEvaluationDetails` PolicyEvaluationDetails — Policy evaluation details.
      - `evaluatedExpressions` ExpressionEvaluationDetails[] — Details of the evaluated expressions.
        - `result` string — Evaluation result.
        - `expression` string — Expression evaluated.
        - `path` string — Property path if the expression is a field or an alias.
        - `expressionValue` object — Value of the expression.
        - `targetValue` object — Target value to be compared with the expression value.
        - `operator` string — Operator to compare the expression value and the target value.
      - `ifNotExistsDetails` IfNotExistsEvaluationDetails — Evaluation details of IfNotExists effect.
        - `resourceId` string — ID of the last evaluated resource for IfNotExists effect.
        - `totalResources` integer — Total number of resources to which the existence condition is applicable.

## Other responses

- `default` — Error response describing why the operation failed.

---

[API](https://skmtc.net/azure/apis/policystatesclient.md) · [All operations](https://skmtc.net/azure/apis/policystatesclient/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/azure/policystatesclient/revisions/b38ff3b427a5/schema)
