# List Job Compliance For Policy

Launch stage: GA

`GET /api/2.0/policies/jobs/list-compliance`

Returns the policy compliance status of all jobs that use a
 given policy. Jobs could be out of compliance if a cluster policy they
 use was updated after the job was last edited and its job
 clusters no longer comply with the updated policy.

API scopes: jobs

## Query parameters

- `policy_id` (string, optional)
  Canonical unique identifier for the cluster policy.
- `page_token` (string, optional)
  A page token that can be used to navigate to the next page or previous page as
   returned by `next_page_token` or `prev_page_token`.
- `page_size` (int32, optional)
  Use this field to specify the maximum number of results to be returned by the server.
   The server may further constrain the maximum number of results returned in a
   single page.
  Default: `20`
  Constraints: `[ 1 .. 100 ]`

## Returns

- `jobs` (array of object, optional)
  A list of jobs and their policy compliance statuses.
  - `job_id` (int64, optional)
    Canonical unique identifier for a job.
  - `is_compliant` (boolean, optional)
    Whether this job is in compliance with the latest version of its policy.
  - `violations` (object, optional)
    An object containing key-value mappings representing the first 200 policy
     validation errors.
     The keys indicate the path where the policy validation error is occurring.
     An identifier for the job cluster is prepended to the path.
     The values indicate an error message describing the policy validation error.
- `next_page_token` (string, optional)
  This field represents the pagination token to retrieve the next page of results.
   If this field is not in the response, it means no further results for the request.
- `prev_page_token` (string, optional)
  This field represents the pagination token to retrieve the previous page of results.
   If this field is not in the response, it means no further results for the request.

## Response

```json
{
  "jobs": [
    {
      "job_id": 0,
      "is_compliant": true,
      "violations": {
        "job_clusters[job_cluster_key].new_cluster.custom_tags.test_tag": "Validation failed for custom_tags.test_tag, the value cannot be present"
      }
    }
  ],
  "next_page_token": "string",
  "prev_page_token": "string"
}
```

