# policies#list

List all policies

Endpoint: GET /pm/api/v1/policies
Version: 1.0
Security: 

## Query parameters:

  - `accountIdentifier` (string)
    Harness account ID
    Example: "eBqAoNchMLKigC_qZ5EdC"

  - `orgIdentifier` (string)
    Harness organization ID
    Example: "test-org"

  - `projectIdentifier` (string)
    Harness project ID
    Example: "test-project"

  - `per_page` (integer)
    Number of results per page
    Example: 20

  - `page` (integer)
    Page number (starting from 0)
    Example: 4

  - `identifierFilter` (string)
    Comma separated List of Identifiers to filter on
    Example: "test-projectId1, test-projectId2"

  - `searchTerm` (string)
    Filter results by partial name match
    Example: "poli"

  - `sort` (string)
    Sort order for results
    Enum: "name,ASC", "name,DESC", "updated,ASC", "updated,DESC"

  - `excludeRegoFromResponse` (boolean)
    Set to true to exclude Rego content from the response
    Example: true

  - `includePolicySetCount` (boolean)
    Set to true to include the count of policy sets associated with each policy in the response

## Header parameters:

  - `x-api-key` (string)
    Harness PAT key used to perform authorization
    Example: "Quas odio quae porro vel cumque voluptatem."

## Response 200 fields (application/json):

  - `account_id` (string, required)
    Harness account ID associated with this policy
    Example: "eBqAoNchMLKigC_qZ5EdC"

  - `cache_response` (object)
    Cache metadata from GitX getFile RPC
    Example: {"cache_state":"STALE_CACHE","is_sync_enabled":true,"last_updated_at":1773917288158,"ttl_left":258234442}

  - `cache_response.cache_state` (string)
    Cache state (UNKNOWN_STATE, VALID_CACHE, STALE_CACHE)
    Example: "STALE_CACHE"

  - `cache_response.is_sync_enabled` (boolean)
    Whether sync is enabled for this resource
    Example: true

  - `cache_response.last_updated_at` (integer)
    Timestamp (millis) when cache was last updated
    Example: 1773917288158

  - `cache_response.ttl_left` (integer)
    Remaining time-to-live in milliseconds
    Example: 258234442

  - `created` (integer, required)
    Time the policy was created
    Example: 1636669297674

  - `git_commit_sha` (string)
    The commit sha of the commit that last effected the file
    Example: "1369b45c20fc685113adcfd1a08a914180ff3c0d"

  - `git_connector_ref` (string)
    The harness connector used for authenticating on the git provider
    Example: "."

  - `git_default_branch` (string)
    The default branch, the service pulls in changes from this branch for policy evaluation
    Example: "main"

  - `git_default_branch_commit_sha` (string)
    The commit sha of the commit that last effected the file in the default branch
    Example: "1369b45c20fc685113adcfd1a08a914180ff3c0d"

  - `git_default_branch_file_id` (string)
    The file id of the file in the default branch, may be empty for bitbucket files
    Example: "1369b45c20fc685113adcfd1a08a914180ff3c0d"

  - `git_default_branch_file_url` (string)
    The url of the file in the default branch

  - `git_default_branch_update_error` (object)
    Example: {"explanation":"File with given filepath [file.rego] already exists in Github, thus couldn't create a new file","hint":"Please check if there's already a file [file.rego] in Github repository [rego-demo] for the given filepath and branch [main].","message":"Please check if there's already a file [file.rego] in Github repository [rego-demo] for the given filepath and branch [main]."}

  - `git_default_branch_update_error.explanation` (string, required)
    the explanation of the error
    Example: "File with given filepath [file.rego] already exists in Github, thus couldn't create a new file"

  - `git_default_branch_update_error.hint` (string, required)
    the hint on how to resolve the error
    Example: "Please check if there's already a file [file.rego] in Github repository [rego-demo] for the given filepath and branch [main]."

  - `git_default_branch_update_error.message` (string, required)
    the message is a human-readable explanation specific to this occurrence of the problem
    Example: "Please check if there's already a file [file.rego] in Github repository [rego-demo] for the given filepath and branch [main]."

  - `git_default_branch_updated` (integer)
    The last time the service successfully pulled in changes from the default branch
    Example: 1636669297674

  - `git_file_id` (string)
    The file id of the file, may be empty for bitbucket files
    Example: "1369b45c20fc685113adcfd1a08a914180ff3c0d"

  - `git_file_url` (string)
    The url of the file on the fit provider

  - `git_path` (string)
    The path to the file in the git repo
    Example: ".harness/policy.rego"

  - `git_repo` (string)
    The git repo the policy resides in
    Example: "github.com/org/repo,omitempty"

  - `identifier` (string, required)
    identifier of the policy
    Example: "policy-1"

  - `name` (string, required)
    Name of the policy
    Example: "Pipeline Approval"

  - `org_id` (string, required)
    Harness organization ID associated with this policy
    Example: "test-org"

  - `parent_unique_id` (string)
    Parent unique identifier for the policy
    Example: "Omnis eos et animi."

  - `polciy_size_in_bytes` (integer)
    Size of the policy in bytes
    Example: 8393139872121218000

  - `policy_package_name` (string)
    Package name of the policy
    Example: "Quas rerum."

  - `policy_set_count` (integer)
    Count of policy sets associated with this policy
    Example: 3

  - `project_id` (string, required)
    Harness project ID associated with this policy
    Example: "test-project"

  - `rego` (string, required)
    Rego that defines the policy

  - `unique_id` (string)
    Unique identifier for the policy
    Example: "Laborum in vel ex eos amet velit."

  - `updated` (integer, required)
    Time the policy was last updated
    Example: 1636669297674

## Response 400 fields (application/json):

  - `fault` (boolean, required)
    Is the error a server-side fault?
    Example: true

  - `id` (string, required)
    ID is a unique identifier for this particular occurrence of the problem.
    Example: "123abc"

  - `message` (string, required)
    Message is a human-readable explanation specific to this occurrence of the problem.
    Example: "parameter 'p' must be an integer"

  - `name` (string, required)
    Name is the name of this class of errors.
    Example: "bad_request"

  - `temporary` (boolean, required)
    Is the error temporary?
    Example: true

  - `timeout` (boolean, required)
    Is the error a timeout?

## Response 409 fields (application/json):

  - `message` (string, required)
    Human-readable warning message
    Example: "Eius explicabo laborum aut aut qui."

  - `referenced_by` (array, required)
    Policy sets that reference this policy
    Example: [{"account_id":"Blanditiis est at.","identifier":"Impedit quia quas eum vitae deleniti.","name":"Quisquam voluptas voluptas.","org_id":"Quam accusantium numquam ipsum molestias exercitationem.","project_id":"Itaque necessitatibus aut dolor tempora ullam esse."},{"account_id":"Blanditiis est at.","identifier":"Impedit quia quas eum vitae deleniti.","name":"Quisquam voluptas voluptas.","org_id":"Quam accusantium numquam ipsum molestias exercitationem.","project_id":"Itaque necessitatibus aut dolor tempora ullam esse."},{"account_id":"Blanditiis est at.","identifier":"Impedit quia quas eum vitae deleniti.","name":"Quisquam voluptas voluptas.","org_id":"Quam accusantium numquam ipsum molestias exercitationem.","project_id":"Itaque necessitatibus aut dolor tempora ullam esse."}]

  - `referenced_by.account_id` (string, required)
    Harness account ID
    Example: "Vitae non eos vel et."

  - `referenced_by.identifier` (string, required)
    Identifier of the referencing policy set
    Example: "Assumenda et blanditiis autem."

  - `referenced_by.name` (string, required)
    Name of the referencing policy set
    Example: "Qui nostrum laboriosam odit repellendus iste nihil."

  - `referenced_by.org_id` (string)
    Harness organization ID
    Example: "Quam excepturi."

  - `referenced_by.project_id` (string)
    Harness project ID
    Example: "Voluptate assumenda."


