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.
Harness APIs (1.0)
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.
For more information about how Harness works, visit the Harness Developer Hub.
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.
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.
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.
To generate an API token, complete the following steps:
- Go to the Harness Platform.
- On the left-hand navigation, click My Profile.
- 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 token you created in the Harness Platform in the x-api-key header. For example: x-api-key: YOUR_API_KEY_HERE
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.
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). |
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.
Error Code | Description |
---|---|
200 | OK |
201 | Created |
202 | Accepted |
204 | No Content |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
412 | Precondition Failed |
415 | Unsupported Media Type |
500 | Server Error |
To view our error response structures, go here.
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.
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.
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.
For example:
X-Total-Elements : 30
X-Page-Number : 0
X-Page-Size : 10
https://apidocs.harness.io/_mock/openapi-merged/
https://app.harness.io/
https://{vanity}/
- Mock server
https://apidocs.harness.io/_mock/openapi-merged/sto/api/v2/exemptions
- Harness host URL
https://app.harness.io/sto/api/v2/exemptions
- Vanity URL
https://app.harness.io/sto/api/v2/exemptions
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://apidocs.harness.io/_mock/openapi-merged/sto/api/v2/exemptions?accountId=abcdef1234567890ghijkl&page=4&pageSize=50&orgId=example_org&projectId=example_project' \
-H 'X-Api-Key: Officiis aspernatur sint sunt magni ad.'
OK response.
User ID the user who approved or rejected this exemptions
Consists of RBAC scopes for an user associated with this Exemption
States if the user can cancel the exemption
States whether the user can create or reopen the exemption
States if the user can re-approve the exemption for the exemption's scope
States whether the user can reject the exemption
The additional comment to include with the exemption
Unix timestamp at which the resource was created
Exemption's status at the Security Scan created time
Unix timestamp at which this Exemption will expire
Resource identifier
Issue ID associated with the Exemption
Unix timestamp at which the resource was most recently modified
Link to a related ticket
States how may occurrences are associated with the exemption, if not an issue level exemption
ID of the Harness Organization to which the exemption applies. Cannot be specified alongside "targetId".
Name of the organization associated with the exemption
ID of the Harness Pipeline to which the exemption applies. You must also specify "projectId" and "orgId". Cannot be specified alongside "targetId".
ID of the Harness Project to which the exemption applies. You must also specify "orgId". Cannot be specified alongside "targetId".
Name of the project associated with the exemption
Text describing why this Exemption is necessary
User ID of user who requested this exemptions
ID of the Harness Scan to determine all the occurrences for the scan-issue. You must also specify "projectId", "orgId" and "targetId". Cannot be specified alongside "pipelineId".
States the scope for the exemption
Search parameter to find filtered occurrences of the issue
Approval status of Exemption
ID of the Target to which the exemption applies. Cannot be specified alongside "projectId" or "pipelineId".
{ "pagination": { "link": "", "page": 4, "pageSize": 20, "totalItems": 230, "totalPages": 12 }, "results": [ { … }, { … }, { … } ] }
Harness Account ID
ID of the Harness Organization to which the exemption applies. Cannot be specified alongside "targetId".
States if the user wants to exempt future occurrences of the issue
Issue ID associated with the Exemption
ID of the Harness Pipeline to which the exemption applies. You must also specify "projectId" and "orgId". Cannot be specified alongside "targetId".
Text describing why this Exemption is necessary
User ID of user who requested this exemptions
ID of the Harness Scan to determine all the occurrences for the scan-issue. You must also specify "projectId", "orgId" and "targetId". Cannot be specified alongside "pipelineId".
Search parameter to find filtered occurrences of the issue
ID of the Target to which the exemption applies. Cannot be specified alongside "projectId" or "pipelineId".
- Mock server
https://apidocs.harness.io/_mock/openapi-merged/sto/api/v2/exemptions
- Harness host URL
https://app.harness.io/sto/api/v2/exemptions
- Vanity URL
https://app.harness.io/sto/api/v2/exemptions
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
'https://apidocs.harness.io/_mock/openapi-merged/sto/api/v2/exemptions?accountId=abcdef1234567890ghijkl&orgId=your_project&projectId=your_project' \
-H 'Content-Type: application/json' \
-H 'X-Api-Key: Consequatur omnis amet repellendus autem sit pariatur.' \
-d '{
"exemptFutureOccurrences": false,
"expiration": 1651578240,
"issueId": "abcdef1234567890ghijkl",
"link": "https://example.com/ABC-1234",
"occurrences": [
42,
666
],
"pendingChanges": {
"durationDays": 7
},
"pipelineId": "your_pipeline",
"reason": "Waiting on upstream bug fix",
"requesterId": "user111111111111111111",
"scanId": "abcdef1234567890ghijkl",
"search": "CWE-123,5",
"targetId": "abcdef1234567890ghijkl",
"type": "Other"
}'
{ "id": "abcdef1234567890ghijkl" }
- Mock server
https://apidocs.harness.io/_mock/openapi-merged/sto/api/v2/exemptions/{id}
- Harness host URL
https://app.harness.io/sto/api/v2/exemptions/{id}
- Vanity URL
https://app.harness.io/sto/api/v2/exemptions/{id}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://apidocs.harness.io/_mock/openapi-merged/sto/api/v2/exemptions/abcdef1234567890ghijkl?accountId=abcdef1234567890ghijkl&orgId=example_org&projectId=example_project&executionId=abcdef1234567890ghijkl&ignoreScope=true' \
-H 'X-Api-Key: Minus eum impedit totam aut qui dolorem.'
OK response.
User ID the user who approved or rejected this exemptions
Consists of RBAC scopes for an user associated with this Exemption
States whether the user can create or reopen the exemption
States if the user can re-approve the exemption for the exemption's scope
The additional comment to include with the exemption
Exemption's status at the Security Scan created time
Issue ID associated with the Exemption
Unix timestamp at which the resource was most recently modified
States how may occurrences are associated with the exemption, if not an issue level exemption
ID of the Harness Organization to which the exemption applies. Cannot be specified alongside "targetId".
ID of the Harness Pipeline to which the exemption applies. You must also specify "projectId" and "orgId". Cannot be specified alongside "targetId".
ID of the Harness Project to which the exemption applies. You must also specify "orgId". Cannot be specified alongside "targetId".
Text describing why this Exemption is necessary
User ID of user who requested this exemptions
ID of the Harness Scan to determine all the occurrences for the scan-issue. You must also specify "projectId", "orgId" and "targetId". Cannot be specified alongside "pipelineId".
States the scope for the exemption
Search parameter to find filtered occurrences of the issue
Approval status of Exemption
ID of the Target to which the exemption applies. Cannot be specified alongside "projectId" or "pipelineId".
{ "approverId": "user111111111111111111", "canApproveFor": [ "ACCOUNT", "ORG", "PROJECT", "PIPELINE" ], "canCancel": true, "canCreate": true, "canReApprove": true, "canReject": true, "comment": "This exemption was reviewed by the security team.", "created": 1651578240, "exemptionStatusAtScan": "Approved", "expiration": 1651578240, "id": "abcdef1234567890ghijkl", "isDeleted": true, "issueId": "abcdef1234567890ghijkl", "lastModified": 1651578240, "link": "https://example.com/ABC-1234", "numOccurrences": 10, "occurrences": [ 42, 666 ], "orgId": "your_project", "orgName": "Organization Name", "pendingChanges": { "durationDays": 7 }, "pipelineId": "your_pipeline", "projectId": "your_project", "projectName": "Project Name", "reason": "Waiting on upstream bug fix", "requesterId": "user111111111111111111", "scanId": "abcdef1234567890ghijkl", "scope": "PROJECT", "search": "CWE-123,5", "status": "Rejected", "targetId": "abcdef1234567890ghijkl", "type": "Other" }