> 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/evaluate.md).

# Evaluate

Perform evaluations

## POST /api/v1/evaluate

> Evaluate arbitrary rego

```json
{"openapi":"3.0.3","info":{"title":"Governance Policy Management API","version":"1.2.0"},"tags":[{"name":"evaluate","description":"Perform evaluations"}],"servers":[{"url":"https://app.harness.io/gateway/pm/"}],"security":[{"jwt_header_Authorization":[]},{"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":{"EvaluateRequestBody":{"type":"object","properties":{"input":{"description":"Input to evaluate"},"rego":{"type":"string","description":"Arbitrary rego to be evaluated","minLength":1}},"required":["rego","input"]},"EvaluatedPolicy":{"type":"object","properties":{"deny_messages":{"type":"array","items":{"type":"string"},"description":"The values of any `deny` rego rules as returned by the rego engine"},"error":{"type":"string","description":"Any errors returned by the rego engine when this policy was evaluated"},"output":{"description":"The output returned by the rego engine when this policy was evaluated"},"policy":{"$ref":"#/components/schemas/Policy"},"policy_severity":{"type":"string","description":"The severity of the policy that was selected while creating the policyset","enum":["Warn & Continue","Error & Exit"]},"status":{"type":"string","description":"The overall status for this individual policy indicating whether it passed","enum":["error","warning","pass","pending"]}},"required":["status","policy","output","deny_messages","error"]},"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"]},"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/evaluate":{"post":{"tags":["evaluate"],"description":"Evaluate arbitrary rego","operationId":"evaluate#evaluate","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/EvaluateRequestBody"}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvaluatedPolicy"}}}},"400":{"description":"LargePayload: 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"}}}}}}}}}
```
