The Harness Software Delivery Platform uses OpenAPI Specification v3.0. Harness constantly improves these APIs. Please be aware that some improvements could cause breaking changes.
The Harness API allows you to integrate and use all the services and modules we provide on the Harness Platform. If you use client-side SDKs, Harness functionality can be integrated with your client-side automation, helping you reduce manual efforts and deploy code faster.
The Harness API is a RESTful API that uses standard HTTP verbs. You can send requests in JSON, YAML, or form-data format. The format of the response matches the format of your request. You must send a single request at a time and ensure that you include your authentication key. For more information about this, go to Authentication.
Get started
Before you start integrating, get to know our API better by reading the following topics:
The methods you need to integrate with depend on the functionality you want to use. Work with your Harness Solutions Engineer to determine which methods you need.
Authentication
To authenticate with the Harness API, you need to:
Generate an API token on the Harness Platform.
Send the API token you generate in the x-api-key header in each request.
Generate an API token
To generate an API token, complete the following steps:
Click +API Key, enter a name for your key and then click Save.
Within the API Key tile, click +Token.
Enter a name for your token and click Generate Token. Important: Make sure to save your token securely. Harness does not store the API token for future reference, so make sure to save your token securely before you leave the page.
Send the API token in your requests
Send the token you created in the Harness Platform in the x-api-key header. For example: x-api-key: YOUR_API_KEY_HERE
Requests and Responses
The structure for each request and response is outlined in the API documentation. We have examples in JSON and YAML for every request and response. You can use our online editor to test the examples.
Common Parameters [Beta]
Field Name
Type
Default
Description
identifier
string
none
URL-friendly version of the name, used to identify a resource within it's scope and so needs to be unique within the scope.
name
string
none
Human-friendly name for the resource.
org
string
none
Limit to provided org identifiers.
project
string
none
Limit to provided project identifiers.
description
string
none
More information about the specific resource.
tags
map[string]string
none
List of labels applied to the resource.
order
string
desc
Order to use when sorting the specified fields. Type: enum(asc,desc).
sort
string
none
Fields on which to sort. Note: Specify the fields that you want to use for sorting. When doing so, consider the operational overhead of sorting fields.
limit
int
30
Pagination: Number of items to return.
page
int
1
Pagination page number strategy: Specify the page number within the paginated collection related to the number of items in each page.
created
int64
none
Unix timestamp that shows when the resource was created (in milliseconds).
updated
int64
none
Unix timestamp that shows when the resource was last edited (in milliseconds).
Status Codes
Harness uses conventional HTTP status codes to indicate the status of an API request. Generally, 2xx responses are reserved for success and 4xx status codes are reserved for failures. A 5xx response code indicates an error on the Harness server.
The current version of our Beta APIs is yet to be announced. The version number will use the date-header format and will be valid only for our Beta APIs.
Generation
All our beta APIs are versioned as a Generation, and this version is included in the path to every API resource. For example, v1 beta APIs begin with app.harness.io/v1/, where v1 is the API Generation.
The version number represents the core API and does not change frequently. The version number changes only if there is a significant departure from the basic underpinnings of the existing API. For example, when Harness performs a system-wide refactoring of core concepts or resources.
Pagination [Beta]
We use pagination to place limits on the number of responses associated with list endpoints. Pagination is achieved by the use of limit query parameters. The limit defaults to 30. Its maximum value is 100.
Following are the pagination headers supported in the response bodies of paginated APIs:
X-Total-Elements : Indicates the total number of entries in a paginated response.
X-Page-Number : Indicates the page number currently returned for a paginated response.
X-Page-Size : Indicates the number of entries per page for a paginated response.
Create and manage organizations in your account. You use organizations to group together related projects. For example, you can use an organization to group together projects within a business unit or division.
APIs for managing catalog Entities which represent the core components of your system. Entities can represent services, APIs, user groups, resources, and more. These endpoints allow you to create, retrieve, update, delete, and query entities across different scopes.
curl -i -X GET \ 'https://apidocs.harness.io/_mock/openapi-merged/pm/api/v1/evaluations/123?accountIdentifier=eBqAoNchMLKigC_qZ5EdC&orgIdentifier=test-org&projectIdentifier=test-project' \ -H 'x-api-key: Consequatur error eligendi voluptas blanditiis sed officia.'
Responses
OK response.
Bodyapplication/json
account_idstringrequired
The Harness account in which the evaluation was performed
Example: "XRQAjvT37acOiXx9PRaQMF"
actionstringrequired
The action that triggered evaluation
Example: "onrun"
createdinteger(int64)required
The time at which the evaluation was performed in Unix time millseconds
Example: 1636370209475
detailsArray of objects(EvaluationDetail)required
The detailed results of te evaluation
Example: [{"account_id":"eBqAoNchMLKigC_qZ5EdC","action":"onrun","created":1636669297674,"description":"Captures critical production policies","details":[{"deny_messages":["deployment stage 'example-stage' does not have a HarnessApproval step","deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"],"error":"policy.rego:25: rego_parse_error: non-terminated string m == \"test","output":"{\n \"deny\": [\n \"deployment stage 'deploy' does not have a HarnessApproval step\"\n ],\n \"stages_with_approval\": []\n}","policy":{"account_id":"eBqAoNchMLKigC_qZ5EdC","created":1636669297674,"git_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_connector_ref":".","git_default_branch":"main","git_default_branch_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_url":"","git_default_branch_update_error":{"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_updated":1636669297674,"git_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_file_url":"","git_path":".harness/policy.rego","git_repo":"github.com/org/repo,omitempty","identifier":"policy-1","name":"Pipeline Approval","org_id":"test-org","policy_set_count":3,"project_id":"test-project","rego":"","updated":1636669297674},"status":"error"},{"deny_messages":["deployment stage 'example-stage' does not have a HarnessApproval step","deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"],"error":"policy.rego:25: rego_parse_error: non-terminated string m == \"test","output":"{\n \"deny\": [\n \"deployment stage 'deploy' does not have a HarnessApproval step\"\n ],\n \"stages_with_approval\": []\n}","policy":{"account_id":"eBqAoNchMLKigC_qZ5EdC","created":1636669297674,"git_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_connector_ref":".","git_default_branch":"main","git_default_branch_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_url":"","git_default_branch_update_error":{"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_updated":1636669297674,"git_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_file_url":"","git_path":".harness/policy.rego","git_repo":"github.com/org/repo,omitempty","identifier":"policy-1","name":"Pipeline Approval","org_id":"test-org","policy_set_count":3,"project_id":"test-project","rego":"","updated":1636669297674},"status":"error"}],"enabled":true,"identifier":"policyset-1","name":"Production Policies","org_id":"test-org","project_id":"test-project","status":"error","type":"pipeline","updated":1636669297674},{"account_id":"eBqAoNchMLKigC_qZ5EdC","action":"onrun","created":1636669297674,"description":"Captures critical production policies","details":[{"deny_messages":["deployment stage 'example-stage' does not have a HarnessApproval step","deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"],"error":"policy.rego:25: rego_parse_error: non-terminated string m == \"test","output":"{\n \"deny\": [\n \"deployment stage 'deploy' does not have a HarnessApproval step\"\n ],\n \"stages_with_approval\": []\n}","policy":{"account_id":"eBqAoNchMLKigC_qZ5EdC","created":1636669297674,"git_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_connector_ref":".","git_default_branch":"main","git_default_branch_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_url":"","git_default_branch_update_error":{"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_updated":1636669297674,"git_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_file_url":"","git_path":".harness/policy.rego","git_repo":"github.com/org/repo,omitempty","identifier":"policy-1","name":"Pipeline Approval","org_id":"test-org","policy_set_count":3,"project_id":"test-project","rego":"","updated":1636669297674},"status":"error"},{"deny_messages":["deployment stage 'example-stage' does not have a HarnessApproval step","deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"],"error":"policy.rego:25: rego_parse_error: non-terminated string m == \"test","output":"{\n \"deny\": [\n \"deployment stage 'deploy' does not have a HarnessApproval step\"\n ],\n \"stages_with_approval\": []\n}","policy":{"account_id":"eBqAoNchMLKigC_qZ5EdC","created":1636669297674,"git_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_connector_ref":".","git_default_branch":"main","git_default_branch_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_url":"","git_default_branch_update_error":{"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_updated":1636669297674,"git_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_file_url":"","git_path":".harness/policy.rego","git_repo":"github.com/org/repo,omitempty","identifier":"policy-1","name":"Pipeline Approval","org_id":"test-org","policy_set_count":3,"project_id":"test-project","rego":"","updated":1636669297674},"status":"error"}],"enabled":true,"identifier":"policyset-1","name":"Production Policies","org_id":"test-org","project_id":"test-project","status":"error","type":"pipeline","updated":1636669297674},{"account_id":"eBqAoNchMLKigC_qZ5EdC","action":"onrun","created":1636669297674,"description":"Captures critical production policies","details":[{"deny_messages":["deployment stage 'example-stage' does not have a HarnessApproval step","deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"],"error":"policy.rego:25: rego_parse_error: non-terminated string m == \"test","output":"{\n \"deny\": [\n \"deployment stage 'deploy' does not have a HarnessApproval step\"\n ],\n \"stages_with_approval\": []\n}","policy":{"account_id":"eBqAoNchMLKigC_qZ5EdC","created":1636669297674,"git_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_connector_ref":".","git_default_branch":"main","git_default_branch_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_url":"","git_default_branch_update_error":{"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_updated":1636669297674,"git_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_file_url":"","git_path":".harness/policy.rego","git_repo":"github.com/org/repo,omitempty","identifier":"policy-1","name":"Pipeline Approval","org_id":"test-org","policy_set_count":3,"project_id":"test-project","rego":"","updated":1636669297674},"status":"error"},{"deny_messages":["deployment stage 'example-stage' does not have a HarnessApproval step","deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"],"error":"policy.rego:25: rego_parse_error: non-terminated string m == \"test","output":"{\n \"deny\": [\n \"deployment stage 'deploy' does not have a HarnessApproval step\"\n ],\n \"stages_with_approval\": []\n}","policy":{"account_id":"eBqAoNchMLKigC_qZ5EdC","created":1636669297674,"git_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_connector_ref":".","git_default_branch":"main","git_default_branch_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_url":"","git_default_branch_update_error":{"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_updated":1636669297674,"git_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_file_url":"","git_path":".harness/policy.rego","git_repo":"github.com/org/repo,omitempty","identifier":"policy-1","name":"Pipeline Approval","org_id":"test-org","policy_set_count":3,"project_id":"test-project","rego":"","updated":1636669297674},"status":"error"}],"enabled":true,"identifier":"policyset-1","name":"Production Policies","org_id":"test-org","project_id":"test-project","status":"error","type":"pipeline","updated":1636669297674}]
details[].​account_idstringrequired
Harness account ID associated with this policy set
Default ""
Example: "eBqAoNchMLKigC_qZ5EdC"
details[].​actionstringnon-emptyrequired
Action that triggers the policy set
Example: "onrun"
details[].​createdinteger(int64)required
Time the policy set was created
Example: 1636669297674
details[].​descriptionstring
Description of the policy set
Example: "Captures critical production policies"
details[].​detailsArray of objects(EvaluatedPolicy)required
Example: [{"deny_messages":["deployment stage 'example-stage' does not have a HarnessApproval step","deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"],"error":"policy.rego:25: rego_parse_error: non-terminated string m == \"test","output":"{\n \"deny\": [\n \"deployment stage 'deploy' does not have a HarnessApproval step\"\n ],\n \"stages_with_approval\": []\n}","policy":{"account_id":"eBqAoNchMLKigC_qZ5EdC","created":1636669297674,"git_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_connector_ref":".","git_default_branch":"main","git_default_branch_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_url":"","git_default_branch_update_error":{"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_updated":1636669297674,"git_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_file_url":"","git_path":".harness/policy.rego","git_repo":"github.com/org/repo,omitempty","identifier":"policy-1","name":"Pipeline Approval","org_id":"test-org","policy_set_count":3,"project_id":"test-project","rego":"","updated":1636669297674},"status":"error"},{"deny_messages":["deployment stage 'example-stage' does not have a HarnessApproval step","deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"],"error":"policy.rego:25: rego_parse_error: non-terminated string m == \"test","output":"{\n \"deny\": [\n \"deployment stage 'deploy' does not have a HarnessApproval step\"\n ],\n \"stages_with_approval\": []\n}","policy":{"account_id":"eBqAoNchMLKigC_qZ5EdC","created":1636669297674,"git_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_connector_ref":".","git_default_branch":"main","git_default_branch_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_url":"","git_default_branch_update_error":{"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_updated":1636669297674,"git_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_file_url":"","git_path":".harness/policy.rego","git_repo":"github.com/org/repo,omitempty","identifier":"policy-1","name":"Pipeline Approval","org_id":"test-org","policy_set_count":3,"project_id":"test-project","rego":"","updated":1636669297674},"status":"error"},{"deny_messages":["deployment stage 'example-stage' does not have a HarnessApproval step","deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"],"error":"policy.rego:25: rego_parse_error: non-terminated string m == \"test","output":"{\n \"deny\": [\n \"deployment stage 'deploy' does not have a HarnessApproval step\"\n ],\n \"stages_with_approval\": []\n}","policy":{"account_id":"eBqAoNchMLKigC_qZ5EdC","created":1636669297674,"git_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_connector_ref":".","git_default_branch":"main","git_default_branch_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_url":"","git_default_branch_update_error":{"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_updated":1636669297674,"git_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_file_url":"","git_path":".harness/policy.rego","git_repo":"github.com/org/repo,omitempty","identifier":"policy-1","name":"Pipeline Approval","org_id":"test-org","policy_set_count":3,"project_id":"test-project","rego":"","updated":1636669297674},"status":"error"}]
details[].​details[].​deny_messagesArray of stringsrequired
The values of any deny rego rules as returned by the rego engine
Example: ["deployment stage 'example-stage' does not have a HarnessApproval step","deployment stage 'example-stage' has step 'run-script' that is forbidden type 'ShellScript'"]
details[].​details[].​errorstringrequired
Any errors returned by the rego engine when this policy was evaluated
Example: "policy.rego:25: rego_parse_error: non-terminated string m == \"test"
Example: {"account_id":"eBqAoNchMLKigC_qZ5EdC","created":1636669297674,"git_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_connector_ref":".","git_default_branch":"main","git_default_branch_commit_sha":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_default_branch_file_url":"","git_default_branch_update_error":{"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_updated":1636669297674,"git_file_id":"1369b45c20fc685113adcfd1a08a914180ff3c0d","git_file_url":"","git_path":".harness/policy.rego","git_repo":"github.com/org/repo,omitempty","identifier":"policy-1","name":"Pipeline Approval","org_id":"test-org","policy_set_count":3,"project_id":"test-project","rego":"","updated":1636669297674}
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]."}