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/gitops/api/v1/agents/{agentIdentifier}/repositories/{identifier}/refs
- Harness host URL
https://app.harness.io/gitops/api/v1/agents/{agentIdentifier}/repositories/{identifier}/refs
- Vanity URL
https://app.harness.io/gitops/api/v1/agents/{agentIdentifier}/repositories/{identifier}/refs
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://apidocs.harness.io/_mock/openapi-merged/gitops/api/v1/agents/{agentIdentifier}/repositories/{identifier}/refs?accountIdentifier=string&orgIdentifier=string&projectIdentifier=string&query.repo=string&query.forceRefresh=true&query.project=string' \
-H 'x-api-key: YOUR_API_KEY_HERE'
{ "branches": [ "string" ], "tags": [ "string" ] }
RepoURL is the URL to the repository (Git or Helm) that contains the application manifests.
Path is a directory path within the Git repository, and is only valid for applications sourced from Git.
TargetRevision defines the revision of the source to sync the application to. In case of Git, this can be commit, tag, or branch. If omitted, will equal to HEAD. In case of Helm, this is a semver tag for the Chart's version.
ValuesFiles is a list of Helm value files to use when generating a template.
ReleaseName is the Helm release name to use. If omitted it will use the application name.
Values specifies Helm values to be passed to helm template, typically defined as a block.
Version is the Helm version to use for templating (either "2" or "3").
PassCredentials pass credentials to all domains (Helm's --pass-credentials).
IgnoreMissingValueFiles prevents helm template from failing when valueFiles do not exist locally by not appending them to helm template --values.
SkipCrds skips custom resource definition installation step (Helm's --skip-crds).
Namespace is an optional namespace to template with. If left empty, defaults to the app's destination namespace.
KubeVersion specifies the Kubernetes API version to pass to Helm when templating manifests. By default, Argo CD uses the Kubernetes version of the target cluster.
APIVersions specifies the Kubernetes resource API versions to pass to Helm when templating manifests. By default, Argo CD uses the API versions of the target cluster. The format is [group/]version/kind.
SkipTests skips test manifest installation step (Helm's --skip-tests).
SkipSchemaValidation skips JSON schema validation (Helm's --skip-schema-validation).
NamePrefix is a prefix appended to resources for Kustomize apps.
NameSuffix is a suffix appended to resources for Kustomize apps.
Images is a list of Kustomize image override specifications.
Version controls which version of Kustomize to use for rendering manifests.
ForceCommonLabels specifies whether to force applying common labels to resources for Kustomize apps.
ForceCommonAnnotations specifies whether to force applying common annotations to resources for Kustomize apps.
Namespace sets the namespace that Kustomize adds to all resources.
Components specifies a list of kustomize components to add to the kustomization before building.
LabelWithoutSelector specifies whether to apply common labels to resource selectors or not.
KubeVersion specifies the Kubernetes API version to pass to Helm when templating manifests. By default, Argo CD uses the Kubernetes version of the target cluster.
APIVersions specifies the Kubernetes resource API versions to pass to Helm when templating manifests. By default, Argo CD uses the API versions of the target cluster. The format is [group/]version/kind.
Recurse specifies whether to scan a directory recursively for manifests.
Exclude contains a glob pattern to match paths against that should be explicitly excluded from being used during manifest generation.
Include contains a glob pattern to match paths against that should be explicitly included during manifest generation.
Chart is a Helm chart name, and must be specified for applications sourced from a Helm repo.
Ref is reference to another source within sources field. This field will not be used if used with a source
tag.
Name is used to refer to a source and is displayed in the UI. It is used in multi-source Applications.
- Mock server
https://apidocs.harness.io/_mock/openapi-merged/gitops/api/v1/agents/{agentIdentifier}/repositories_byurl/appdetails
- Harness host URL
https://app.harness.io/gitops/api/v1/agents/{agentIdentifier}/repositories_byurl/appdetails
- Vanity URL
https://app.harness.io/gitops/api/v1/agents/{agentIdentifier}/repositories_byurl/appdetails
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://apidocs.harness.io/_mock/openapi-merged/gitops/api/v1/agents/{agentIdentifier}/repositories_byurl/appdetails?accountIdentifier=string&orgIdentifier=string&projectIdentifier=string&identifier=string&query.source.repoURL=string&query.source.path=string&query.source.targetRevision=string&query.source.helm.valueFiles=string&query.source.helm.releaseName=string&query.source.helm.values=string&query.source.helm.version=string&query.source.helm.passCredentials=true&query.source.helm.ignoreMissingValueFiles=true&query.source.helm.skipCrds=true&query.source.helm.namespace=string&query.source.helm.kubeVersion=string&query.source.helm.apiVersions=string&query.source.helm.skipTests=true&query.source.helm.skipSchemaValidation=true&query.source.kustomize.namePrefix=string&query.source.kustomize.nameSuffix=string&query.source.kustomize.images=string&query.source.kustomize.version=string&query.source.kustomize.forceCommonLabels=true&query.source.kustomize.forceCommonAnnotations=true&query.source.kustomize.namespace=string&query.source.kustomize.components=string&query.source.kustomize.labelWithoutSelector=true&query.source.kustomize.kubeVersion=string&query.source.kustomize.apiVersions=string&query.source.ksonnet.environment=string&query.source.directory.recurse=true&query.source.directory.jsonnet.libs=string&query.source.directory.exclude=string&query.source.directory.include=string&query.source.plugin.name=string&query.source.chart=string&query.source.ref=string&query.source.name=string&query.appName=string&query.appProject=string&query.sourceIndex=0&query.versionId=0' \
-H 'x-api-key: YOUR_API_KEY_HERE'
{ "type": "string", "ksonnet": { "name": "string", "environments": { … }, "parameters": [ … ] }, "helm": { "name": "string", "valueFiles": [ … ], "parameters": [ … ], "values": "string", "fileParameters": [ … ] }, "kustomize": { "images": [ … ] }, "directory": {} }
- Mock server
https://apidocs.harness.io/_mock/openapi-merged/gitops/api/v1/agents/{agentIdentifier}/repositories_byurl/apps
- Harness host URL
https://app.harness.io/gitops/api/v1/agents/{agentIdentifier}/repositories_byurl/apps
- Vanity URL
https://app.harness.io/gitops/api/v1/agents/{agentIdentifier}/repositories_byurl/apps
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://apidocs.harness.io/_mock/openapi-merged/gitops/api/v1/agents/{agentIdentifier}/repositories_byurl/apps?accountIdentifier=string&orgIdentifier=string&projectIdentifier=string&identifier=string&query.repo=string&query.revision=string&query.appName=string&query.appProject=string' \
-H 'x-api-key: YOUR_API_KEY_HERE'
{ "items": [ { … } ] }