> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/api-reference/platform-apis/governance/policysets.md).

# Policysets

Create, edit and delete Governance policy sets

## GET /api/v1/policysets

> List all policy sets

```json
{"openapi":"3.0.3","info":{"title":"Governance Policy Management API","version":"1.2.0"},"tags":[{"name":"policysets","description":"Create, edit and delete Governance policy sets"}],"servers":[{"url":"https://app.harness.io/gateway/pm/"}],"security":[{"jwt_header_Authorization":["core_governancePolicySets_view"]},{"api_key_header_x-api-key":[]}],"components":{"securitySchemes":{"jwt_header_Authorization":{"type":"http","scheme":"bearer"},"api_key_header_x-api-key":{"type":"apiKey","description":"Harness PAT","name":"x-api-key","in":"header"}},"schemas":{"PolicySet":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy set","default":""},"action":{"type":"string","description":"Action that triggers the policy set","minLength":1},"created":{"type":"integer","description":"Time the policy set was created","format":"int64"},"description":{"type":"string","description":"Description of the policy set"},"enabled":{"type":"boolean","description":"Only enabled policy sets are evaluated when evaluating by type/action"},"entity_selector":{"type":"string","description":"A string enum value which determines which entities the policy set applies to during evaluation","enum":["all_entities_in_scope","all_entities_in_resource_groups"]},"identifier":{"type":"string","description":"Identifier of the policy set","minLength":1},"infra_params":{"$ref":"#/components/schemas/InfraParams"},"infra_type":{"type":"string","description":"Infrastructure type for executing policies on customer infrastructure","enum":["KubernetesDirect","VM"]},"name":{"type":"string","description":"Name of the policy set","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy set","default":""},"policies":{"type":"array","items":{"$ref":"#/components/schemas/LinkedPolicy"},"description":"Policies linked to this policy set"},"project_id":{"type":"string","description":"Harness project ID associated with this policy set","default":""},"resource_groups":{"type":"array","items":{"$ref":"#/components/schemas/ResourceGroup"},"description":"The groups of resources that this policy set should be applied to"},"type":{"type":"string","description":"Type of input suitable for the policy set","minLength":1},"updated":{"type":"integer","description":"Time the policy set was last updated","format":"int64"},"yaml_version":{"type":"string","description":"Harness yaml version associated with this policySet","default":"0","enum":["0","1"]}},"required":["identifier","name","action","type","enabled","created","updated","account_id","org_id","project_id","entity_selector"]},"InfraParams":{"type":"object","properties":{"annotations":{"type":"object","description":"Kubernetes annotations (for KubernetesDirect)","additionalProperties":{"type":"string"}},"connectorRef":{"type":"string","description":"Connector reference (for KubernetesDirect)"},"harnessImageConnectorRef":{"type":"string","description":"Harness image connector reference"},"initTimeout":{"type":"string","description":"Initialization timeout (for KubernetesDirect)"},"labels":{"type":"object","description":"Kubernetes labels (for KubernetesDirect)","additionalProperties":{"type":"string"}},"namespace":{"type":"string","description":"Kubernetes namespace (for KubernetesDirect)"},"nodeSelector":{"type":"object","description":"Kubernetes node selector (for KubernetesDirect)","additionalProperties":{"type":"string"}},"os":{"type":"string","description":"Operating system (for VM)"},"poolName":{"type":"string","description":"VM pool name (for VM)"},"resources":{"$ref":"#/components/schemas/ContainerResource"}},"description":"Infrastructure parameters for executing policies on customer infrastructure"},"ContainerResource":{"type":"object","properties":{"limits":{"$ref":"#/components/schemas/ResourceLimits"},"requests":{"$ref":"#/components/schemas/ResourceLimits"}},"description":"Container resource requests and limits"},"ResourceLimits":{"type":"object","properties":{"cpu":{"type":"string","description":"CPU quantity"},"memory":{"type":"string","description":"Memory quantity"}},"description":"CPU and memory quantities for container resources","required":["cpu","memory"]},"LinkedPolicy":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy","default":""},"created":{"type":"integer","description":"Time the policy was created","format":"int64"},"git_commit_sha":{"type":"string","description":"The commit sha of the commit that last effected the file"},"git_connector_ref":{"type":"string","description":"The harness connector used for authenticating on the git provider"},"git_file_id":{"type":"string","description":"The file id of the file, may be empty for bitbucket files"},"git_file_url":{"type":"string","description":"The url of the file on the fit provider"},"git_path":{"type":"string","description":"The path to the file in the git repo"},"git_repo":{"type":"string","description":"The git repo the policy resides in"},"identifier":{"type":"string","description":"identifier of the policy","minLength":1},"imported_policies":{"type":"array","items":{"$ref":"#/components/schemas/Policy"},"description":"Policies imported (via `import data.*`) by this policy's Rego, flattened across the whole import chain. These are compiler inputs only — they are loaded alongside this policy's Rego so imports resolve, and are never evaluated on their own."},"name":{"type":"string","description":"Name of the policy","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy","default":""},"parent_unique_id":{"type":"string","description":"Parent unique identifier for the policy"},"polciy_size_in_bytes":{"type":"integer","description":"Size of the policy in bytes","format":"int64"},"policy_package_name":{"type":"string","description":"Package name of the policy"},"project_id":{"type":"string","description":"Harness project ID associated with this policy","default":""},"rego":{"type":"string","description":"Rego that defines the policy","minLength":1},"severity":{"type":"string","description":"The severity of this policy in this context","enum":["warning","error"]},"unique_id":{"type":"string","description":"Unique identifier for the policy"},"updated":{"type":"integer","description":"Time the policy was last updated","format":"int64"}},"required":["account_id","org_id","project_id","identifier","name","severity","rego","created","updated"]},"Policy":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy","default":""},"cache_response":{"$ref":"#/components/schemas/CacheResponse"},"created":{"type":"integer","description":"Time the policy was created","format":"int64"},"git_commit_sha":{"type":"string","description":"The commit sha of the commit that last effected the file"},"git_connector_ref":{"type":"string","description":"The harness connector used for authenticating on the git provider"},"git_default_branch":{"type":"string","description":"The default branch, the service pulls in changes from this branch for policy evaluation"},"git_default_branch_commit_sha":{"type":"string","description":"The commit sha of the commit that last effected the file in the default branch"},"git_default_branch_file_id":{"type":"string","description":"The file id of the file in the default branch, may be empty for bitbucket files"},"git_default_branch_file_url":{"type":"string","description":"The url of the file in the default branch"},"git_default_branch_update_error":{"$ref":"#/components/schemas/GitErrorResult"},"git_default_branch_updated":{"type":"integer","description":"The last time the service successfully pulled in changes from the default branch","format":"int64"},"git_file_id":{"type":"string","description":"The file id of the file, may be empty for bitbucket files"},"git_file_url":{"type":"string","description":"The url of the file on the fit provider"},"git_path":{"type":"string","description":"The path to the file in the git repo"},"git_repo":{"type":"string","description":"The git repo the policy resides in"},"identifier":{"type":"string","description":"identifier of the policy","minLength":1},"name":{"type":"string","description":"Name of the policy","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy","default":""},"parent_unique_id":{"type":"string","description":"Parent unique identifier for the policy"},"polciy_size_in_bytes":{"type":"integer","description":"Size of the policy in bytes","format":"int64"},"policy_package_name":{"type":"string","description":"Package name of the policy"},"policy_set_count":{"type":"integer","description":"Count of policy sets associated with this policy","format":"int64"},"project_id":{"type":"string","description":"Harness project ID associated with this policy","default":""},"rego":{"type":"string","description":"Rego that defines the policy","minLength":1},"unique_id":{"type":"string","description":"Unique identifier for the policy"},"updated":{"type":"integer","description":"Time the policy was last updated","format":"int64"}},"required":["identifier","name","rego","created","updated","account_id","org_id","project_id"]},"CacheResponse":{"type":"object","properties":{"cache_state":{"type":"string","description":"Cache state (UNKNOWN_STATE, VALID_CACHE, STALE_CACHE)"},"is_sync_enabled":{"type":"boolean","description":"Whether sync is enabled for this resource"},"last_updated_at":{"type":"integer","description":"Timestamp (millis) when cache was last updated","format":"int64"},"ttl_left":{"type":"integer","description":"Remaining time-to-live in milliseconds","format":"int64"}},"description":"Cache metadata from GitX getFile RPC"},"GitErrorResult":{"type":"object","properties":{"explanation":{"type":"string","description":"the explanation of the error"},"hint":{"type":"string","description":"the hint on how to resolve the error"},"message":{"type":"string","description":"the message is a human-readable explanation specific to this occurrence of the problem"}},"required":["message","explanation","hint"]},"ResourceGroup":{"type":"object","properties":{"account_id":{"type":"string","description":"resource group account id"},"created":{"type":"integer","description":"resource group timestamp","format":"int64"},"identifier":{"type":"string","description":"resource group identifier"},"name":{"type":"string","description":"resource group name"},"org_id":{"type":"string","description":"resource group org id"},"project_id":{"type":"string","description":"resource group project identifier"}},"required":["account_id","org_id","project_id","identifier","name","created"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem."},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem."},"name":{"type":"string","description":"Name is the name of this class of errors."},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"required":["name","id","message","temporary","timeout","fault"]}}},"paths":{"/api/v1/policysets":{"get":{"tags":["policysets"],"description":"List all policy sets","operationId":"policysets#list","parameters":[{"name":"accountIdentifier","in":"query","description":"Harness account ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness account ID","default":""}},{"name":"orgIdentifier","in":"query","description":"Harness organization ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness organization ID","default":""}},{"name":"projectIdentifier","in":"query","description":"Harness project ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness project ID","default":""}},{"name":"per_page","in":"query","description":"Number of results per page","allowEmptyValue":true,"schema":{"type":"integer","description":"Number of results per page","default":50,"format":"int64","minimum":1,"maximum":100}},{"name":"page","in":"query","description":"Page number (starting from 0)","allowEmptyValue":true,"schema":{"type":"integer","description":"Page number (starting from 0)","default":0,"format":"int64","minimum":0}},{"name":"identifierFilter","in":"query","description":"Comma separated List of Identifiers to filter on","allowEmptyValue":true,"schema":{"type":"string","description":"Comma separated List of Identifiers to filter on","default":""}},{"name":"searchTerm","in":"query","description":"Filter results by partial name match","allowEmptyValue":true,"schema":{"type":"string","description":"Filter results by partial name match","default":""}},{"name":"sort","in":"query","description":"Sort order for results","allowEmptyValue":true,"schema":{"type":"string","description":"Sort order for results","default":"name,ASC","enum":["name,ASC","name,DESC","updated,ASC","updated,DESC"]}},{"name":"type","in":"query","description":"Filter results by type","allowEmptyValue":true,"schema":{"type":"string","description":"Filter results by type","minLength":1}},{"name":"types","in":"query","description":"Filter results by multiple types (comma-separated), e.g. pipeline,environment","allowEmptyValue":true,"schema":{"type":"string","description":"Filter results by multiple types (comma-separated), e.g. pipeline,environment","minLength":1}},{"name":"action","in":"query","description":"Filter results by action","allowEmptyValue":true,"schema":{"type":"string","description":"Filter results by action","minLength":1}},{"name":"yaml_version","in":"query","description":"Harness yaml version associated with this policySet","allowEmptyValue":true,"schema":{"type":"string","description":"Harness yaml version associated with this policySet","default":"0","enum":["0","1"]}},{"name":"x-api-key","in":"header","description":"Harness PAT key used to perform authorization","allowEmptyValue":true,"schema":{"type":"string","description":"Harness PAT key used to perform authorization"}}],"responses":{"200":{"description":"OK response.","headers":{"Link":{"description":"Link-based paging","schema":{"type":"string","description":"Link-based paging"}},"X-Page-Index":{"description":"Deprecated: Please use pageNumber / X-Page-Number instead. Same value as pageNumber; kept for legacy UI clients.","schema":{"type":"integer","description":"Deprecated: Please use pageNumber / X-Page-Number instead. Same value as pageNumber; kept for legacy UI clients.","format":"int64"}},"X-Page-Item-Count":{"description":"Number of results in this page","schema":{"type":"integer","description":"Number of results in this page","format":"int64"}},"X-Page-Number":{"description":"Current page number (0-based). Harness standard pagination header X-Page-Number.","schema":{"type":"integer","description":"Current page number (0-based). Harness standard pagination header X-Page-Number.","format":"int64"}},"X-Page-Size":{"description":"Requested page size. Harness standard pagination header X-Page-Size.","schema":{"type":"integer","description":"Requested page size. Harness standard pagination header X-Page-Size.","format":"int64"}},"X-Total-Elements":{"description":"Total number of results available. Harness standard pagination header X-Total-Elements.","schema":{"type":"integer","description":"Total number of results available. Harness standard pagination header X-Total-Elements.","format":"int64"}},"X-Total-Items":{"description":"Deprecated: Please use totalElements / X-Total-Elements instead. Same value as totalElements; kept for legacy UI clients.","schema":{"type":"integer","description":"Deprecated: Please use totalElements / X-Total-Elements instead. Same value as totalElements; kept for legacy UI clients.","format":"int64"}},"X-Total-Pages":{"description":"Total pages available","schema":{"type":"integer","description":"Total pages available","format":"int64"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PolicySet"}}}}},"400":{"description":"BadRequest: Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized: Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden: Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NotFound: Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"ScopeInfoError: Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"BadGateway: Bad Gateway response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## POST /api/v1/policysets

> Create a policy set

```json
{"openapi":"3.0.3","info":{"title":"Governance Policy Management API","version":"1.2.0"},"tags":[{"name":"policysets","description":"Create, edit and delete Governance policy sets"}],"servers":[{"url":"https://app.harness.io/gateway/pm/"}],"security":[{"jwt_header_Authorization":["core_governancePolicySets_create"]},{"api_key_header_x-api-key":[]}],"components":{"securitySchemes":{"jwt_header_Authorization":{"type":"http","scheme":"bearer"},"api_key_header_x-api-key":{"type":"apiKey","description":"Harness PAT","name":"x-api-key","in":"header"}},"schemas":{"CreateRequestBody2":{"type":"object","properties":{"action":{"type":"string","description":"Action that triggers the policy set","minLength":1},"description":{"type":"string","description":"Description of the policy set"},"enabled":{"type":"boolean","description":"Only enabled policy sets are evaluated when evaluating by type/action"},"identifier":{"type":"string","description":"Identifier for the policy set","minLength":1},"name":{"type":"string","description":"Name of the policy set","minLength":1},"type":{"type":"string","description":"Type of input suitable for the policy set","minLength":1},"yaml_version":{"type":"string","description":"Harness yaml version associated with this policySet","default":"0","enum":["0","1"]}},"required":["identifier","name","enabled","type","action","created","updated","account_id","org_id","project_id","entity_selector"]},"PolicySet":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy set","default":""},"action":{"type":"string","description":"Action that triggers the policy set","minLength":1},"created":{"type":"integer","description":"Time the policy set was created","format":"int64"},"description":{"type":"string","description":"Description of the policy set"},"enabled":{"type":"boolean","description":"Only enabled policy sets are evaluated when evaluating by type/action"},"entity_selector":{"type":"string","description":"A string enum value which determines which entities the policy set applies to during evaluation","enum":["all_entities_in_scope","all_entities_in_resource_groups"]},"identifier":{"type":"string","description":"Identifier of the policy set","minLength":1},"infra_params":{"$ref":"#/components/schemas/InfraParams"},"infra_type":{"type":"string","description":"Infrastructure type for executing policies on customer infrastructure","enum":["KubernetesDirect","VM"]},"name":{"type":"string","description":"Name of the policy set","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy set","default":""},"policies":{"type":"array","items":{"$ref":"#/components/schemas/LinkedPolicy"},"description":"Policies linked to this policy set"},"project_id":{"type":"string","description":"Harness project ID associated with this policy set","default":""},"resource_groups":{"type":"array","items":{"$ref":"#/components/schemas/ResourceGroup"},"description":"The groups of resources that this policy set should be applied to"},"type":{"type":"string","description":"Type of input suitable for the policy set","minLength":1},"updated":{"type":"integer","description":"Time the policy set was last updated","format":"int64"},"yaml_version":{"type":"string","description":"Harness yaml version associated with this policySet","default":"0","enum":["0","1"]}},"required":["identifier","name","action","type","enabled","created","updated","account_id","org_id","project_id","entity_selector"]},"InfraParams":{"type":"object","properties":{"annotations":{"type":"object","description":"Kubernetes annotations (for KubernetesDirect)","additionalProperties":{"type":"string"}},"connectorRef":{"type":"string","description":"Connector reference (for KubernetesDirect)"},"harnessImageConnectorRef":{"type":"string","description":"Harness image connector reference"},"initTimeout":{"type":"string","description":"Initialization timeout (for KubernetesDirect)"},"labels":{"type":"object","description":"Kubernetes labels (for KubernetesDirect)","additionalProperties":{"type":"string"}},"namespace":{"type":"string","description":"Kubernetes namespace (for KubernetesDirect)"},"nodeSelector":{"type":"object","description":"Kubernetes node selector (for KubernetesDirect)","additionalProperties":{"type":"string"}},"os":{"type":"string","description":"Operating system (for VM)"},"poolName":{"type":"string","description":"VM pool name (for VM)"},"resources":{"$ref":"#/components/schemas/ContainerResource"}},"description":"Infrastructure parameters for executing policies on customer infrastructure"},"ContainerResource":{"type":"object","properties":{"limits":{"$ref":"#/components/schemas/ResourceLimits"},"requests":{"$ref":"#/components/schemas/ResourceLimits"}},"description":"Container resource requests and limits"},"ResourceLimits":{"type":"object","properties":{"cpu":{"type":"string","description":"CPU quantity"},"memory":{"type":"string","description":"Memory quantity"}},"description":"CPU and memory quantities for container resources","required":["cpu","memory"]},"LinkedPolicy":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy","default":""},"created":{"type":"integer","description":"Time the policy was created","format":"int64"},"git_commit_sha":{"type":"string","description":"The commit sha of the commit that last effected the file"},"git_connector_ref":{"type":"string","description":"The harness connector used for authenticating on the git provider"},"git_file_id":{"type":"string","description":"The file id of the file, may be empty for bitbucket files"},"git_file_url":{"type":"string","description":"The url of the file on the fit provider"},"git_path":{"type":"string","description":"The path to the file in the git repo"},"git_repo":{"type":"string","description":"The git repo the policy resides in"},"identifier":{"type":"string","description":"identifier of the policy","minLength":1},"imported_policies":{"type":"array","items":{"$ref":"#/components/schemas/Policy"},"description":"Policies imported (via `import data.*`) by this policy's Rego, flattened across the whole import chain. These are compiler inputs only — they are loaded alongside this policy's Rego so imports resolve, and are never evaluated on their own."},"name":{"type":"string","description":"Name of the policy","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy","default":""},"parent_unique_id":{"type":"string","description":"Parent unique identifier for the policy"},"polciy_size_in_bytes":{"type":"integer","description":"Size of the policy in bytes","format":"int64"},"policy_package_name":{"type":"string","description":"Package name of the policy"},"project_id":{"type":"string","description":"Harness project ID associated with this policy","default":""},"rego":{"type":"string","description":"Rego that defines the policy","minLength":1},"severity":{"type":"string","description":"The severity of this policy in this context","enum":["warning","error"]},"unique_id":{"type":"string","description":"Unique identifier for the policy"},"updated":{"type":"integer","description":"Time the policy was last updated","format":"int64"}},"required":["account_id","org_id","project_id","identifier","name","severity","rego","created","updated"]},"Policy":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy","default":""},"cache_response":{"$ref":"#/components/schemas/CacheResponse"},"created":{"type":"integer","description":"Time the policy was created","format":"int64"},"git_commit_sha":{"type":"string","description":"The commit sha of the commit that last effected the file"},"git_connector_ref":{"type":"string","description":"The harness connector used for authenticating on the git provider"},"git_default_branch":{"type":"string","description":"The default branch, the service pulls in changes from this branch for policy evaluation"},"git_default_branch_commit_sha":{"type":"string","description":"The commit sha of the commit that last effected the file in the default branch"},"git_default_branch_file_id":{"type":"string","description":"The file id of the file in the default branch, may be empty for bitbucket files"},"git_default_branch_file_url":{"type":"string","description":"The url of the file in the default branch"},"git_default_branch_update_error":{"$ref":"#/components/schemas/GitErrorResult"},"git_default_branch_updated":{"type":"integer","description":"The last time the service successfully pulled in changes from the default branch","format":"int64"},"git_file_id":{"type":"string","description":"The file id of the file, may be empty for bitbucket files"},"git_file_url":{"type":"string","description":"The url of the file on the fit provider"},"git_path":{"type":"string","description":"The path to the file in the git repo"},"git_repo":{"type":"string","description":"The git repo the policy resides in"},"identifier":{"type":"string","description":"identifier of the policy","minLength":1},"name":{"type":"string","description":"Name of the policy","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy","default":""},"parent_unique_id":{"type":"string","description":"Parent unique identifier for the policy"},"polciy_size_in_bytes":{"type":"integer","description":"Size of the policy in bytes","format":"int64"},"policy_package_name":{"type":"string","description":"Package name of the policy"},"policy_set_count":{"type":"integer","description":"Count of policy sets associated with this policy","format":"int64"},"project_id":{"type":"string","description":"Harness project ID associated with this policy","default":""},"rego":{"type":"string","description":"Rego that defines the policy","minLength":1},"unique_id":{"type":"string","description":"Unique identifier for the policy"},"updated":{"type":"integer","description":"Time the policy was last updated","format":"int64"}},"required":["identifier","name","rego","created","updated","account_id","org_id","project_id"]},"CacheResponse":{"type":"object","properties":{"cache_state":{"type":"string","description":"Cache state (UNKNOWN_STATE, VALID_CACHE, STALE_CACHE)"},"is_sync_enabled":{"type":"boolean","description":"Whether sync is enabled for this resource"},"last_updated_at":{"type":"integer","description":"Timestamp (millis) when cache was last updated","format":"int64"},"ttl_left":{"type":"integer","description":"Remaining time-to-live in milliseconds","format":"int64"}},"description":"Cache metadata from GitX getFile RPC"},"GitErrorResult":{"type":"object","properties":{"explanation":{"type":"string","description":"the explanation of the error"},"hint":{"type":"string","description":"the hint on how to resolve the error"},"message":{"type":"string","description":"the message is a human-readable explanation specific to this occurrence of the problem"}},"required":["message","explanation","hint"]},"ResourceGroup":{"type":"object","properties":{"account_id":{"type":"string","description":"resource group account id"},"created":{"type":"integer","description":"resource group timestamp","format":"int64"},"identifier":{"type":"string","description":"resource group identifier"},"name":{"type":"string","description":"resource group name"},"org_id":{"type":"string","description":"resource group org id"},"project_id":{"type":"string","description":"resource group project identifier"}},"required":["account_id","org_id","project_id","identifier","name","created"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem."},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem."},"name":{"type":"string","description":"Name is the name of this class of errors."},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"required":["name","id","message","temporary","timeout","fault"]}}},"paths":{"/api/v1/policysets":{"post":{"tags":["policysets"],"description":"Create a policy set","operationId":"policysets#create","parameters":[{"name":"accountIdentifier","in":"query","description":"Harness account ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness account ID","default":""}},{"name":"orgIdentifier","in":"query","description":"Harness organization ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness organization ID","default":""}},{"name":"projectIdentifier","in":"query","description":"Harness project ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness project ID","default":""}},{"name":"x-api-key","in":"header","description":"Harness PAT key used to perform authorization","allowEmptyValue":true,"schema":{"type":"string","description":"Harness PAT key used to perform authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRequestBody2"}}}},"responses":{"201":{"description":"Created response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicySet"}}}},"400":{"description":"BadRequest: Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized: Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden: Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NotFound: Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"ScopeInfoError: Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"BadGateway: Bad Gateway response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## List all policy sets hierarchically

> List all policy sets hierarchically (includes policy sets from account, org, and project levels)

```json
{"openapi":"3.0.3","info":{"title":"Governance Policy Management API","version":"1.2.0"},"tags":[{"name":"policysets","description":"Create, edit and delete Governance policy sets"}],"servers":[{"url":"https://app.harness.io/gateway/pm/"}],"security":[{"jwt_header_Authorization":["core_governancePolicySets_view"]},{"api_key_header_x-api-key":[]}],"components":{"securitySchemes":{"jwt_header_Authorization":{"type":"http","scheme":"bearer"},"api_key_header_x-api-key":{"type":"apiKey","description":"Harness PAT","name":"x-api-key","in":"header"}},"schemas":{"PolicySet":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy set","default":""},"action":{"type":"string","description":"Action that triggers the policy set","minLength":1},"created":{"type":"integer","description":"Time the policy set was created","format":"int64"},"description":{"type":"string","description":"Description of the policy set"},"enabled":{"type":"boolean","description":"Only enabled policy sets are evaluated when evaluating by type/action"},"entity_selector":{"type":"string","description":"A string enum value which determines which entities the policy set applies to during evaluation","enum":["all_entities_in_scope","all_entities_in_resource_groups"]},"identifier":{"type":"string","description":"Identifier of the policy set","minLength":1},"infra_params":{"$ref":"#/components/schemas/InfraParams"},"infra_type":{"type":"string","description":"Infrastructure type for executing policies on customer infrastructure","enum":["KubernetesDirect","VM"]},"name":{"type":"string","description":"Name of the policy set","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy set","default":""},"policies":{"type":"array","items":{"$ref":"#/components/schemas/LinkedPolicy"},"description":"Policies linked to this policy set"},"project_id":{"type":"string","description":"Harness project ID associated with this policy set","default":""},"resource_groups":{"type":"array","items":{"$ref":"#/components/schemas/ResourceGroup"},"description":"The groups of resources that this policy set should be applied to"},"type":{"type":"string","description":"Type of input suitable for the policy set","minLength":1},"updated":{"type":"integer","description":"Time the policy set was last updated","format":"int64"},"yaml_version":{"type":"string","description":"Harness yaml version associated with this policySet","default":"0","enum":["0","1"]}},"required":["identifier","name","action","type","enabled","created","updated","account_id","org_id","project_id","entity_selector"]},"InfraParams":{"type":"object","properties":{"annotations":{"type":"object","description":"Kubernetes annotations (for KubernetesDirect)","additionalProperties":{"type":"string"}},"connectorRef":{"type":"string","description":"Connector reference (for KubernetesDirect)"},"harnessImageConnectorRef":{"type":"string","description":"Harness image connector reference"},"initTimeout":{"type":"string","description":"Initialization timeout (for KubernetesDirect)"},"labels":{"type":"object","description":"Kubernetes labels (for KubernetesDirect)","additionalProperties":{"type":"string"}},"namespace":{"type":"string","description":"Kubernetes namespace (for KubernetesDirect)"},"nodeSelector":{"type":"object","description":"Kubernetes node selector (for KubernetesDirect)","additionalProperties":{"type":"string"}},"os":{"type":"string","description":"Operating system (for VM)"},"poolName":{"type":"string","description":"VM pool name (for VM)"},"resources":{"$ref":"#/components/schemas/ContainerResource"}},"description":"Infrastructure parameters for executing policies on customer infrastructure"},"ContainerResource":{"type":"object","properties":{"limits":{"$ref":"#/components/schemas/ResourceLimits"},"requests":{"$ref":"#/components/schemas/ResourceLimits"}},"description":"Container resource requests and limits"},"ResourceLimits":{"type":"object","properties":{"cpu":{"type":"string","description":"CPU quantity"},"memory":{"type":"string","description":"Memory quantity"}},"description":"CPU and memory quantities for container resources","required":["cpu","memory"]},"LinkedPolicy":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy","default":""},"created":{"type":"integer","description":"Time the policy was created","format":"int64"},"git_commit_sha":{"type":"string","description":"The commit sha of the commit that last effected the file"},"git_connector_ref":{"type":"string","description":"The harness connector used for authenticating on the git provider"},"git_file_id":{"type":"string","description":"The file id of the file, may be empty for bitbucket files"},"git_file_url":{"type":"string","description":"The url of the file on the fit provider"},"git_path":{"type":"string","description":"The path to the file in the git repo"},"git_repo":{"type":"string","description":"The git repo the policy resides in"},"identifier":{"type":"string","description":"identifier of the policy","minLength":1},"imported_policies":{"type":"array","items":{"$ref":"#/components/schemas/Policy"},"description":"Policies imported (via `import data.*`) by this policy's Rego, flattened across the whole import chain. These are compiler inputs only — they are loaded alongside this policy's Rego so imports resolve, and are never evaluated on their own."},"name":{"type":"string","description":"Name of the policy","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy","default":""},"parent_unique_id":{"type":"string","description":"Parent unique identifier for the policy"},"polciy_size_in_bytes":{"type":"integer","description":"Size of the policy in bytes","format":"int64"},"policy_package_name":{"type":"string","description":"Package name of the policy"},"project_id":{"type":"string","description":"Harness project ID associated with this policy","default":""},"rego":{"type":"string","description":"Rego that defines the policy","minLength":1},"severity":{"type":"string","description":"The severity of this policy in this context","enum":["warning","error"]},"unique_id":{"type":"string","description":"Unique identifier for the policy"},"updated":{"type":"integer","description":"Time the policy was last updated","format":"int64"}},"required":["account_id","org_id","project_id","identifier","name","severity","rego","created","updated"]},"Policy":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy","default":""},"cache_response":{"$ref":"#/components/schemas/CacheResponse"},"created":{"type":"integer","description":"Time the policy was created","format":"int64"},"git_commit_sha":{"type":"string","description":"The commit sha of the commit that last effected the file"},"git_connector_ref":{"type":"string","description":"The harness connector used for authenticating on the git provider"},"git_default_branch":{"type":"string","description":"The default branch, the service pulls in changes from this branch for policy evaluation"},"git_default_branch_commit_sha":{"type":"string","description":"The commit sha of the commit that last effected the file in the default branch"},"git_default_branch_file_id":{"type":"string","description":"The file id of the file in the default branch, may be empty for bitbucket files"},"git_default_branch_file_url":{"type":"string","description":"The url of the file in the default branch"},"git_default_branch_update_error":{"$ref":"#/components/schemas/GitErrorResult"},"git_default_branch_updated":{"type":"integer","description":"The last time the service successfully pulled in changes from the default branch","format":"int64"},"git_file_id":{"type":"string","description":"The file id of the file, may be empty for bitbucket files"},"git_file_url":{"type":"string","description":"The url of the file on the fit provider"},"git_path":{"type":"string","description":"The path to the file in the git repo"},"git_repo":{"type":"string","description":"The git repo the policy resides in"},"identifier":{"type":"string","description":"identifier of the policy","minLength":1},"name":{"type":"string","description":"Name of the policy","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy","default":""},"parent_unique_id":{"type":"string","description":"Parent unique identifier for the policy"},"polciy_size_in_bytes":{"type":"integer","description":"Size of the policy in bytes","format":"int64"},"policy_package_name":{"type":"string","description":"Package name of the policy"},"policy_set_count":{"type":"integer","description":"Count of policy sets associated with this policy","format":"int64"},"project_id":{"type":"string","description":"Harness project ID associated with this policy","default":""},"rego":{"type":"string","description":"Rego that defines the policy","minLength":1},"unique_id":{"type":"string","description":"Unique identifier for the policy"},"updated":{"type":"integer","description":"Time the policy was last updated","format":"int64"}},"required":["identifier","name","rego","created","updated","account_id","org_id","project_id"]},"CacheResponse":{"type":"object","properties":{"cache_state":{"type":"string","description":"Cache state (UNKNOWN_STATE, VALID_CACHE, STALE_CACHE)"},"is_sync_enabled":{"type":"boolean","description":"Whether sync is enabled for this resource"},"last_updated_at":{"type":"integer","description":"Timestamp (millis) when cache was last updated","format":"int64"},"ttl_left":{"type":"integer","description":"Remaining time-to-live in milliseconds","format":"int64"}},"description":"Cache metadata from GitX getFile RPC"},"GitErrorResult":{"type":"object","properties":{"explanation":{"type":"string","description":"the explanation of the error"},"hint":{"type":"string","description":"the hint on how to resolve the error"},"message":{"type":"string","description":"the message is a human-readable explanation specific to this occurrence of the problem"}},"required":["message","explanation","hint"]},"ResourceGroup":{"type":"object","properties":{"account_id":{"type":"string","description":"resource group account id"},"created":{"type":"integer","description":"resource group timestamp","format":"int64"},"identifier":{"type":"string","description":"resource group identifier"},"name":{"type":"string","description":"resource group name"},"org_id":{"type":"string","description":"resource group org id"},"project_id":{"type":"string","description":"resource group project identifier"}},"required":["account_id","org_id","project_id","identifier","name","created"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem."},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem."},"name":{"type":"string","description":"Name is the name of this class of errors."},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"required":["name","id","message","temporary","timeout","fault"]}}},"paths":{"/api/v1/policysets/all":{"get":{"tags":["policysets"],"summary":"List all policy sets hierarchically","description":"List all policy sets hierarchically (includes policy sets from account, org, and project levels)","operationId":"policysets#listall","parameters":[{"name":"accountIdentifier","in":"query","description":"Harness account ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness account ID","default":""}},{"name":"orgIdentifier","in":"query","description":"Harness organization ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness organization ID","default":""}},{"name":"projectIdentifier","in":"query","description":"Harness project ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness project ID","default":""}},{"name":"per_page","in":"query","description":"Number of results per page","allowEmptyValue":true,"schema":{"type":"integer","description":"Number of results per page","default":50,"format":"int64","minimum":1,"maximum":100}},{"name":"page","in":"query","description":"Page number (starting from 0)","allowEmptyValue":true,"schema":{"type":"integer","description":"Page number (starting from 0)","default":0,"format":"int64","minimum":0}},{"name":"identifierFilter","in":"query","description":"Comma separated List of Identifiers to filter on","allowEmptyValue":true,"schema":{"type":"string","description":"Comma separated List of Identifiers to filter on","default":""}},{"name":"type","in":"query","description":"Filter results by type","allowEmptyValue":true,"schema":{"type":"string","description":"Filter results by type","minLength":1}},{"name":"action","in":"query","description":"Filter results by action","allowEmptyValue":true,"schema":{"type":"string","description":"Filter results by action","minLength":1}},{"name":"x-api-key","in":"header","description":"Harness PAT key used to perform authorization","allowEmptyValue":true,"schema":{"type":"string","description":"Harness PAT key used to perform authorization"}}],"responses":{"200":{"description":"OK response.","headers":{"Link":{"description":"Link-based paging","schema":{"type":"string","description":"Link-based paging"}},"X-Page-Index":{"description":"Deprecated: Please use pageNumber / X-Page-Number instead. Same value as pageNumber; kept for legacy UI clients.","schema":{"type":"integer","description":"Deprecated: Please use pageNumber / X-Page-Number instead. Same value as pageNumber; kept for legacy UI clients.","format":"int64"}},"X-Page-Item-Count":{"description":"Number of results in this page","schema":{"type":"integer","description":"Number of results in this page","format":"int64"}},"X-Page-Number":{"description":"Current page number (0-based). Harness standard pagination header X-Page-Number.","schema":{"type":"integer","description":"Current page number (0-based). Harness standard pagination header X-Page-Number.","format":"int64"}},"X-Page-Size":{"description":"Requested page size. Harness standard pagination header X-Page-Size.","schema":{"type":"integer","description":"Requested page size. Harness standard pagination header X-Page-Size.","format":"int64"}},"X-Total-Elements":{"description":"Total number of results available. Harness standard pagination header X-Total-Elements.","schema":{"type":"integer","description":"Total number of results available. Harness standard pagination header X-Total-Elements.","format":"int64"}},"X-Total-Items":{"description":"Deprecated: Please use totalElements / X-Total-Elements instead. Same value as totalElements; kept for legacy UI clients.","schema":{"type":"integer","description":"Deprecated: Please use totalElements / X-Total-Elements instead. Same value as totalElements; kept for legacy UI clients.","format":"int64"}},"X-Total-Pages":{"description":"Total pages available","schema":{"type":"integer","description":"Total pages available","format":"int64"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PolicySet"}}}}},"400":{"description":"BadRequest: Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized: Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden: Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NotFound: Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"ScopeInfoError: Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"BadGateway: Bad Gateway response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## GET /api/v1/policysets/{identifier}

> Find a policy set by identifier

```json
{"openapi":"3.0.3","info":{"title":"Governance Policy Management API","version":"1.2.0"},"tags":[{"name":"policysets","description":"Create, edit and delete Governance policy sets"}],"servers":[{"url":"https://app.harness.io/gateway/pm/"}],"security":[{"jwt_header_Authorization":["core_governancePolicySets_view"]},{"api_key_header_x-api-key":[]}],"components":{"securitySchemes":{"jwt_header_Authorization":{"type":"http","scheme":"bearer"},"api_key_header_x-api-key":{"type":"apiKey","description":"Harness PAT","name":"x-api-key","in":"header"}},"schemas":{"PolicySet":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy set","default":""},"action":{"type":"string","description":"Action that triggers the policy set","minLength":1},"created":{"type":"integer","description":"Time the policy set was created","format":"int64"},"description":{"type":"string","description":"Description of the policy set"},"enabled":{"type":"boolean","description":"Only enabled policy sets are evaluated when evaluating by type/action"},"entity_selector":{"type":"string","description":"A string enum value which determines which entities the policy set applies to during evaluation","enum":["all_entities_in_scope","all_entities_in_resource_groups"]},"identifier":{"type":"string","description":"Identifier of the policy set","minLength":1},"infra_params":{"$ref":"#/components/schemas/InfraParams"},"infra_type":{"type":"string","description":"Infrastructure type for executing policies on customer infrastructure","enum":["KubernetesDirect","VM"]},"name":{"type":"string","description":"Name of the policy set","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy set","default":""},"policies":{"type":"array","items":{"$ref":"#/components/schemas/LinkedPolicy"},"description":"Policies linked to this policy set"},"project_id":{"type":"string","description":"Harness project ID associated with this policy set","default":""},"resource_groups":{"type":"array","items":{"$ref":"#/components/schemas/ResourceGroup"},"description":"The groups of resources that this policy set should be applied to"},"type":{"type":"string","description":"Type of input suitable for the policy set","minLength":1},"updated":{"type":"integer","description":"Time the policy set was last updated","format":"int64"},"yaml_version":{"type":"string","description":"Harness yaml version associated with this policySet","default":"0","enum":["0","1"]}},"required":["identifier","name","action","type","enabled","created","updated","account_id","org_id","project_id","entity_selector"]},"InfraParams":{"type":"object","properties":{"annotations":{"type":"object","description":"Kubernetes annotations (for KubernetesDirect)","additionalProperties":{"type":"string"}},"connectorRef":{"type":"string","description":"Connector reference (for KubernetesDirect)"},"harnessImageConnectorRef":{"type":"string","description":"Harness image connector reference"},"initTimeout":{"type":"string","description":"Initialization timeout (for KubernetesDirect)"},"labels":{"type":"object","description":"Kubernetes labels (for KubernetesDirect)","additionalProperties":{"type":"string"}},"namespace":{"type":"string","description":"Kubernetes namespace (for KubernetesDirect)"},"nodeSelector":{"type":"object","description":"Kubernetes node selector (for KubernetesDirect)","additionalProperties":{"type":"string"}},"os":{"type":"string","description":"Operating system (for VM)"},"poolName":{"type":"string","description":"VM pool name (for VM)"},"resources":{"$ref":"#/components/schemas/ContainerResource"}},"description":"Infrastructure parameters for executing policies on customer infrastructure"},"ContainerResource":{"type":"object","properties":{"limits":{"$ref":"#/components/schemas/ResourceLimits"},"requests":{"$ref":"#/components/schemas/ResourceLimits"}},"description":"Container resource requests and limits"},"ResourceLimits":{"type":"object","properties":{"cpu":{"type":"string","description":"CPU quantity"},"memory":{"type":"string","description":"Memory quantity"}},"description":"CPU and memory quantities for container resources","required":["cpu","memory"]},"LinkedPolicy":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy","default":""},"created":{"type":"integer","description":"Time the policy was created","format":"int64"},"git_commit_sha":{"type":"string","description":"The commit sha of the commit that last effected the file"},"git_connector_ref":{"type":"string","description":"The harness connector used for authenticating on the git provider"},"git_file_id":{"type":"string","description":"The file id of the file, may be empty for bitbucket files"},"git_file_url":{"type":"string","description":"The url of the file on the fit provider"},"git_path":{"type":"string","description":"The path to the file in the git repo"},"git_repo":{"type":"string","description":"The git repo the policy resides in"},"identifier":{"type":"string","description":"identifier of the policy","minLength":1},"imported_policies":{"type":"array","items":{"$ref":"#/components/schemas/Policy"},"description":"Policies imported (via `import data.*`) by this policy's Rego, flattened across the whole import chain. These are compiler inputs only — they are loaded alongside this policy's Rego so imports resolve, and are never evaluated on their own."},"name":{"type":"string","description":"Name of the policy","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy","default":""},"parent_unique_id":{"type":"string","description":"Parent unique identifier for the policy"},"polciy_size_in_bytes":{"type":"integer","description":"Size of the policy in bytes","format":"int64"},"policy_package_name":{"type":"string","description":"Package name of the policy"},"project_id":{"type":"string","description":"Harness project ID associated with this policy","default":""},"rego":{"type":"string","description":"Rego that defines the policy","minLength":1},"severity":{"type":"string","description":"The severity of this policy in this context","enum":["warning","error"]},"unique_id":{"type":"string","description":"Unique identifier for the policy"},"updated":{"type":"integer","description":"Time the policy was last updated","format":"int64"}},"required":["account_id","org_id","project_id","identifier","name","severity","rego","created","updated"]},"Policy":{"type":"object","properties":{"account_id":{"type":"string","description":"Harness account ID associated with this policy","default":""},"cache_response":{"$ref":"#/components/schemas/CacheResponse"},"created":{"type":"integer","description":"Time the policy was created","format":"int64"},"git_commit_sha":{"type":"string","description":"The commit sha of the commit that last effected the file"},"git_connector_ref":{"type":"string","description":"The harness connector used for authenticating on the git provider"},"git_default_branch":{"type":"string","description":"The default branch, the service pulls in changes from this branch for policy evaluation"},"git_default_branch_commit_sha":{"type":"string","description":"The commit sha of the commit that last effected the file in the default branch"},"git_default_branch_file_id":{"type":"string","description":"The file id of the file in the default branch, may be empty for bitbucket files"},"git_default_branch_file_url":{"type":"string","description":"The url of the file in the default branch"},"git_default_branch_update_error":{"$ref":"#/components/schemas/GitErrorResult"},"git_default_branch_updated":{"type":"integer","description":"The last time the service successfully pulled in changes from the default branch","format":"int64"},"git_file_id":{"type":"string","description":"The file id of the file, may be empty for bitbucket files"},"git_file_url":{"type":"string","description":"The url of the file on the fit provider"},"git_path":{"type":"string","description":"The path to the file in the git repo"},"git_repo":{"type":"string","description":"The git repo the policy resides in"},"identifier":{"type":"string","description":"identifier of the policy","minLength":1},"name":{"type":"string","description":"Name of the policy","minLength":1},"org_id":{"type":"string","description":"Harness organization ID associated with this policy","default":""},"parent_unique_id":{"type":"string","description":"Parent unique identifier for the policy"},"polciy_size_in_bytes":{"type":"integer","description":"Size of the policy in bytes","format":"int64"},"policy_package_name":{"type":"string","description":"Package name of the policy"},"policy_set_count":{"type":"integer","description":"Count of policy sets associated with this policy","format":"int64"},"project_id":{"type":"string","description":"Harness project ID associated with this policy","default":""},"rego":{"type":"string","description":"Rego that defines the policy","minLength":1},"unique_id":{"type":"string","description":"Unique identifier for the policy"},"updated":{"type":"integer","description":"Time the policy was last updated","format":"int64"}},"required":["identifier","name","rego","created","updated","account_id","org_id","project_id"]},"CacheResponse":{"type":"object","properties":{"cache_state":{"type":"string","description":"Cache state (UNKNOWN_STATE, VALID_CACHE, STALE_CACHE)"},"is_sync_enabled":{"type":"boolean","description":"Whether sync is enabled for this resource"},"last_updated_at":{"type":"integer","description":"Timestamp (millis) when cache was last updated","format":"int64"},"ttl_left":{"type":"integer","description":"Remaining time-to-live in milliseconds","format":"int64"}},"description":"Cache metadata from GitX getFile RPC"},"GitErrorResult":{"type":"object","properties":{"explanation":{"type":"string","description":"the explanation of the error"},"hint":{"type":"string","description":"the hint on how to resolve the error"},"message":{"type":"string","description":"the message is a human-readable explanation specific to this occurrence of the problem"}},"required":["message","explanation","hint"]},"ResourceGroup":{"type":"object","properties":{"account_id":{"type":"string","description":"resource group account id"},"created":{"type":"integer","description":"resource group timestamp","format":"int64"},"identifier":{"type":"string","description":"resource group identifier"},"name":{"type":"string","description":"resource group name"},"org_id":{"type":"string","description":"resource group org id"},"project_id":{"type":"string","description":"resource group project identifier"}},"required":["account_id","org_id","project_id","identifier","name","created"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem."},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem."},"name":{"type":"string","description":"Name is the name of this class of errors."},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"required":["name","id","message","temporary","timeout","fault"]}}},"paths":{"/api/v1/policysets/{identifier}":{"get":{"tags":["policysets"],"description":"Find a policy set by identifier","operationId":"policysets#find","parameters":[{"name":"accountIdentifier","in":"query","description":"Harness account ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness account ID","default":""}},{"name":"orgIdentifier","in":"query","description":"Harness organization ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness organization ID","default":""}},{"name":"projectIdentifier","in":"query","description":"Harness project ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness project ID","default":""}},{"name":"identifier","in":"path","description":"Identifier of the policy set to retrieve","required":true,"schema":{"type":"string","description":"Identifier of the policy set to retrieve","minLength":1}},{"name":"x-api-key","in":"header","description":"Harness PAT key used to perform authorization","allowEmptyValue":true,"schema":{"type":"string","description":"Harness PAT key used to perform authorization"}}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicySet"}}}},"400":{"description":"BadRequest: Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized: Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden: Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NotFound: Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"ScopeInfoError: Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"BadGateway: Bad Gateway response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## DELETE /api/v1/policysets/{identifier}

> Delete a policy set by identifier

```json
{"openapi":"3.0.3","info":{"title":"Governance Policy Management API","version":"1.2.0"},"tags":[{"name":"policysets","description":"Create, edit and delete Governance policy sets"}],"servers":[{"url":"https://app.harness.io/gateway/pm/"}],"security":[{"jwt_header_Authorization":["core_governancePolicySets_delete"]},{"api_key_header_x-api-key":[]}],"components":{"securitySchemes":{"jwt_header_Authorization":{"type":"http","scheme":"bearer"},"api_key_header_x-api-key":{"type":"apiKey","description":"Harness PAT","name":"x-api-key","in":"header"}},"schemas":{"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem."},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem."},"name":{"type":"string","description":"Name is the name of this class of errors."},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"required":["name","id","message","temporary","timeout","fault"]}}},"paths":{"/api/v1/policysets/{identifier}":{"delete":{"tags":["policysets"],"description":"Delete a policy set by identifier","operationId":"policysets#delete","parameters":[{"name":"accountIdentifier","in":"query","description":"Harness account ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness account ID","default":""}},{"name":"orgIdentifier","in":"query","description":"Harness organization ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness organization ID","default":""}},{"name":"projectIdentifier","in":"query","description":"Harness project ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness project ID","default":""}},{"name":"identifier","in":"path","description":"Identifier of the policy set","required":true,"schema":{"type":"string","description":"Identifier of the policy set","minLength":1}},{"name":"x-api-key","in":"header","description":"Harness PAT key used to perform authorization","allowEmptyValue":true,"schema":{"type":"string","description":"Harness PAT key used to perform authorization"}}],"responses":{"204":{"description":"No Content response."},"400":{"description":"BadRequest: Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized: Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden: Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NotFound: Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"ScopeInfoError: Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"BadGateway: Bad Gateway response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## PATCH /api/v1/policysets/{identifier}

> Update a policy set by identifier

```json
{"openapi":"3.0.3","info":{"title":"Governance Policy Management API","version":"1.2.0"},"tags":[{"name":"policysets","description":"Create, edit and delete Governance policy sets"}],"servers":[{"url":"https://app.harness.io/gateway/pm/"}],"security":[{"jwt_header_Authorization":["core_governancePolicySets_edit"]},{"api_key_header_x-api-key":[]}],"components":{"securitySchemes":{"jwt_header_Authorization":{"type":"http","scheme":"bearer"},"api_key_header_x-api-key":{"type":"apiKey","description":"Harness PAT","name":"x-api-key","in":"header"}},"schemas":{"UpdateRequestBody2":{"type":"object","properties":{"action":{"type":"string","description":"Action that triggers the policy set","minLength":1},"description":{"type":"string","description":"Description of the policy set"},"enabled":{"type":"boolean","description":"Only enabled policy sets are evaluated when evaluating by type/action"},"entity_selector":{"type":"string","description":"A string enum value which determines which entities the policy set applies to during evaluation. This feature is not available for all accounts, Contact support if you wish to have it enabled.","enum":["all_entities_in_scope","all_entities_in_resource_groups"]},"infra_params":{"$ref":"#/components/schemas/InfraParams"},"infra_type":{"type":"string","description":"Infrastructure type for executing policies on customer infrastructure. Use empty string or null to clear infrastructure configuration."},"name":{"type":"string","description":"Name of the policy set"},"policies":{"type":"array","items":{"$ref":"#/components/schemas/Linkedpolicyidentifier"},"description":"Policies linked to this policy set"},"resource_groups":{"type":"array","items":{"$ref":"#/components/schemas/ResourceGroupIdentifier"},"description":"Resource groups that contain the resources that this policy set should be evaluated for. Resource groups are not supported for flag or custom policy sets. This feature is not available for all accounts, Contact support if you wish to have it enabled."},"type":{"type":"string","description":"Type of input suitable for the policy set"}}},"InfraParams":{"type":"object","properties":{"annotations":{"type":"object","description":"Kubernetes annotations (for KubernetesDirect)","additionalProperties":{"type":"string"}},"connectorRef":{"type":"string","description":"Connector reference (for KubernetesDirect)"},"harnessImageConnectorRef":{"type":"string","description":"Harness image connector reference"},"initTimeout":{"type":"string","description":"Initialization timeout (for KubernetesDirect)"},"labels":{"type":"object","description":"Kubernetes labels (for KubernetesDirect)","additionalProperties":{"type":"string"}},"namespace":{"type":"string","description":"Kubernetes namespace (for KubernetesDirect)"},"nodeSelector":{"type":"object","description":"Kubernetes node selector (for KubernetesDirect)","additionalProperties":{"type":"string"}},"os":{"type":"string","description":"Operating system (for VM)"},"poolName":{"type":"string","description":"VM pool name (for VM)"},"resources":{"$ref":"#/components/schemas/ContainerResource"}},"description":"Infrastructure parameters for executing policies on customer infrastructure"},"ContainerResource":{"type":"object","properties":{"limits":{"$ref":"#/components/schemas/ResourceLimits"},"requests":{"$ref":"#/components/schemas/ResourceLimits"}},"description":"Container resource requests and limits"},"ResourceLimits":{"type":"object","properties":{"cpu":{"type":"string","description":"CPU quantity"},"memory":{"type":"string","description":"Memory quantity"}},"description":"CPU and memory quantities for container resources","required":["cpu","memory"]},"Linkedpolicyidentifier":{"type":"object","properties":{"identifier":{"type":"string","description":"identifier of the policy with account. or org. prefix if needed","minLength":1},"severity":{"type":"string","description":"The severity of this policy in this context","enum":["warning","error"]}},"required":["identifier","severity"]},"ResourceGroupIdentifier":{"type":"object","properties":{"account_id":{"type":"string","description":"resource group account id"},"identifier":{"type":"string","description":"resource group identifier"},"org_id":{"type":"string","description":"resource group org id"},"project_id":{"type":"string","description":"resource group project identifier"}},"required":["account_id","org_id","project_id","identifier"]},"Error":{"type":"object","properties":{"fault":{"type":"boolean","description":"Is the error a server-side fault?"},"id":{"type":"string","description":"ID is a unique identifier for this particular occurrence of the problem."},"message":{"type":"string","description":"Message is a human-readable explanation specific to this occurrence of the problem."},"name":{"type":"string","description":"Name is the name of this class of errors."},"temporary":{"type":"boolean","description":"Is the error temporary?"},"timeout":{"type":"boolean","description":"Is the error a timeout?"}},"required":["name","id","message","temporary","timeout","fault"]}}},"paths":{"/api/v1/policysets/{identifier}":{"patch":{"tags":["policysets"],"description":"Update a policy set by identifier","operationId":"policysets#update","parameters":[{"name":"accountIdentifier","in":"query","description":"Harness account ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness account ID","default":""}},{"name":"orgIdentifier","in":"query","description":"Harness organization ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness organization ID","default":""}},{"name":"projectIdentifier","in":"query","description":"Harness project ID","allowEmptyValue":true,"schema":{"type":"string","description":"Harness project ID","default":""}},{"name":"identifier","in":"path","description":"Identifier of the policy set","required":true,"schema":{"type":"string","description":"Identifier of the policy set"}},{"name":"x-api-key","in":"header","description":"Harness PAT key used to perform authorization","allowEmptyValue":true,"schema":{"type":"string","description":"Harness PAT key used to perform authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRequestBody2"}}}},"responses":{"204":{"description":"No Content response."},"400":{"description":"BadRequest: Bad Request response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized: Unauthorized response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden: Forbidden response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NotFound: Not Found response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"ScopeInfoError: Internal Server Error response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"BadGateway: Bad Gateway response.","content":{"application/vnd.goa.error":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```
