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.
- Enable ephemeral TTL for a workspace
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, read our documentation or 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-keyheader 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- Harness host URLhttps://app.harness.io/iacm/api/orgs/{org}/projects/{project}/workspaces/{workspace}/ephemeral-config
- Vanity URLhttps://app.harness.io/iacm/api/orgs/{org}/projects/{project}/workspaces/{workspace}/ephemeral-config
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://app.harness.io/iacm/api/orgs/0/projects/v/workspaces/Explicabo voluptas./ephemeral-config?provisioner=Ea+beatae+saepe+ullam.' \
-H 'Harness-Account: s' \
-H 'x-api-key: YOUR_API_KEY_HERE'OK response.
Configured delete delay unit (hours or days)
Configured delete delay value (when delete_workspace is true)
Configured delete date (YYYY-MM-DD) when schedule uses a specific date
Configured destroy date (YYYY-MM-DD) when schedule uses a specific date
Origin of the configuration: 'workspace', 'project', or 'disabled'
Configured destroy delay unit (hours or days)
{ "delete_at": "Quo quam.", "delete_delay_unit": "minutes", "delete_delay_value": 745689784981673000, "delete_on_date": "Sint possimus enim dolor eos.", "delete_workspace": true, "destroy_at": "Doloremque ullam voluptate ut eum quo.", "destroy_on_date": "Necessitatibus et dolores quia iusto architecto.", "enabled": false, "pipeline_id": "Voluptatum eius nisi quis.", "provisioner": "Qui esse.", "source": "workspace", "trigger_id": "Unde eligendi distinctio praesentium dolor velit.", "ttl_unit": "hours", "ttl_value": 2859195119978020400 }
Request
Configures time-to-live settings to automatically destroy infrastructure and optionally delete the workspace.
Delete workspace after N hours or days from now
Specific date to delete workspace (ISO 8601 format, e.g. 2026-09-02)
Whether to delete the workspace record after infrastructure is destroyed
Unit for destroy delay
Destroy infrastructure after N hours or days from now
Specific date to destroy infrastructure (ISO 8601 format, e.g. 2026-08-24)
Pipeline to run for destroying infrastructure
- Harness host URLhttps://app.harness.io/iacm/api/orgs/{org}/projects/{project}/workspaces/{workspace}/ephemeral-config
- Vanity URLhttps://app.harness.io/iacm/api/orgs/{org}/projects/{project}/workspaces/{workspace}/ephemeral-config
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X PUT \
'https://app.harness.io/iacm/api/orgs/t/projects/f/workspaces/Adipisci magnam./ephemeral-config' \
-H 'Content-Type: application/json' \
-H 'Harness-Account: 6b' \
-H 'x-api-key: YOUR_API_KEY_HERE' \
-d '{
"delete_delay_unit": "minutes",
"delete_delay_value": 6276623458463452000,
"delete_on_date": "Eum cum asperiores.",
"delete_workspace": false,
"destroy_delay_unit": "seconds",
"destroy_delay_value": 4820616969058833000,
"destroy_on_date": "Aut sit exercitationem laboriosam qui enim.",
"pipeline_id": "Vero et est quia tempore temporibus voluptas.",
"provisioner": "Voluptatem quos."
}'{ "delete_at": "Similique quam rerum sed voluptatem est.", "destroy_at": "Quis illo a accusantium.", "status": "Eaque ea nulla velit animi fuga molestias." }
The type of event that occurred
- Harness host URLhttps://app.harness.io/iacm/api/orgs/{org}/projects/{project}/workspaces/{workspace}/events
- Vanity URLhttps://app.harness.io/iacm/api/orgs/{org}/projects/{project}/workspaces/{workspace}/events
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
https://app.harness.io/iacm/api/orgs/r/projects/hc/workspaces/foj/events \
-H 'Content-Type: application/json' \
-H 'Harness-Account: xyk' \
-H 'x-api-key: YOUR_API_KEY_HERE' \
-d '{
"data": {
"Non facilis doloribus dolorem quas suscipit.": "Non animi quod ab.",
"Ratione optio quia tenetur aut quisquam unde.": "Eveniet non."
},
"event_type": "active",
"metadata": {
"PlannedChangesCount": 4470257074936995300,
"activity_status": "success",
"activity_type": "import",
"cost_breakdown_uuid": "Recusandae molestiae dolorem praesentium repudiandae et.",
"cost_currency": "Perferendis voluptas.",
"cost_diff_total_monthly": "Neque vitae quia.",
"cost_diff_uuid": "Dolor cupiditate dolor laboriosam labore facilis ea.",
"cost_past_total_monthly": "Aut odio.",
"cost_total_monthly": "Ut aliquam neque inventore sapiente repudiandae.",
"cost_total_monthly_percentage_change": "Fuga sunt enim nostrum.",
"data_length": 3417327374429683700,
"drift_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"enable_solutions_factory": false,
"git_branch": "Esse rem dicta facilis libero.",
"git_commit_message": "Consequatur blanditiis eos.",
"git_commit_sha": "Assumenda a minus.",
"git_repo": "Sit rem.",
"modules_uuid": "Quasi qui consequuntur a ut.",
"output_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"pipeline": "Hic rerum fugit voluptatem vel quae cumque.",
"pipeline_execution_id": "Doloremque vitae nihil.",
"pipeline_execution_number": "Amet molestiae et facere est.",
"pipeline_name": "Harum totam exercitationem soluta.",
"pipeline_stage_id": "Qui qui odit ut.",
"plan_uuid": "Excepturi error sit at.",
"providers_uuid": "Enim sapiente dolores consequatur cupiditate aut.",
"provisioner": "Accusantium qui voluptas.",
"provisioner_version": "Cupiditate ut vel temporibus deleniti.",
"resource_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"rollback_reason": "Iusto qui earum aut.",
"rollback_source_id": "Ut qui eos et eligendi eaque.",
"stacks": [
{
"assets_uuid": "Consequatur sunt enim eum magni qui.",
"drift_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"drift_uuid": "Placeat dolores maxime impedit.",
"error_message": "Magnam accusamus iste enim.",
"manifest_uuid": "Mollitia alias optio repellendus quibusdam modi.",
"resource_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"stack_name": "Quibusdam itaque autem.",
"stack_outputs": {
"Dolores et officiis esse voluptates maiores.": "Doloribus praesentium facere libero.",
"Molestiae nihil id corrupti voluptatem.": "Consequuntur eius.",
"Suscipit consequatur adipisci optio et error.": "Repudiandae temporibus atque magni."
},
"stack_path": "Harum et sit voluptatibus quasi rerum.",
"status": "success",
"template_uuid": "Aliquam dolore neque et illum.",
"tree_uuid": "Ut accusamus delectus sed quod dolorum."
},
{
"assets_uuid": "Consequatur sunt enim eum magni qui.",
"drift_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"drift_uuid": "Placeat dolores maxime impedit.",
"error_message": "Magnam accusamus iste enim.",
"manifest_uuid": "Mollitia alias optio repellendus quibusdam modi.",
"resource_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"stack_name": "Quibusdam itaque autem.",
"stack_outputs": {
"Dolores et officiis esse voluptates maiores.": "Doloribus praesentium facere libero.",
"Molestiae nihil id corrupti voluptatem.": "Consequuntur eius.",
"Suscipit consequatur adipisci optio et error.": "Repudiandae temporibus atque magni."
},
"stack_path": "Harum et sit voluptatibus quasi rerum.",
"status": "success",
"template_uuid": "Aliquam dolore neque et illum.",
"tree_uuid": "Ut accusamus delectus sed quod dolorum."
},
{
"assets_uuid": "Consequatur sunt enim eum magni qui.",
"drift_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"drift_uuid": "Placeat dolores maxime impedit.",
"error_message": "Magnam accusamus iste enim.",
"manifest_uuid": "Mollitia alias optio repellendus quibusdam modi.",
"resource_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"stack_name": "Quibusdam itaque autem.",
"stack_outputs": {
"Dolores et officiis esse voluptates maiores.": "Doloribus praesentium facere libero.",
"Molestiae nihil id corrupti voluptatem.": "Consequuntur eius.",
"Suscipit consequatur adipisci optio et error.": "Repudiandae temporibus atque magni."
},
"stack_path": "Harum et sit voluptatibus quasi rerum.",
"status": "success",
"template_uuid": "Aliquam dolore neque et illum.",
"tree_uuid": "Ut accusamus delectus sed quod dolorum."
}
],
"state_checksum": "Veniam quod itaque placeat.",
"state_uuid": "Rerum qui unde ullam.",
"terragrunt_details": [
{
"cost_breakdown_uuid": "Natus sit sint quo delectus.",
"cost_currency": "Ut non voluptas accusamus est.",
"cost_diff_total_monthly": "Magnam cum dolorum aperiam modi odio qui.",
"cost_diff_uuid": "Omnis maxime id sint pariatur rerum.",
"cost_past_total_monthly": "Dolor nisi.",
"cost_total_monthly": "Voluptate incidunt laudantium est.",
"cost_total_monthly_percentage_change": "Quia aperiam minus.",
"drift_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"output_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"path_id": "Doloremque qui.",
"resource_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"state_file_link": "Consequuntur aut minus inventore.",
"status": "Eveniet aliquid et qui."
},
{
"cost_breakdown_uuid": "Natus sit sint quo delectus.",
"cost_currency": "Ut non voluptas accusamus est.",
"cost_diff_total_monthly": "Magnam cum dolorum aperiam modi odio qui.",
"cost_diff_uuid": "Omnis maxime id sint pariatur rerum.",
"cost_past_total_monthly": "Dolor nisi.",
"cost_total_monthly": "Voluptate incidunt laudantium est.",
"cost_total_monthly_percentage_change": "Quia aperiam minus.",
"drift_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"output_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"path_id": "Doloremque qui.",
"resource_counts": {
"added": 8549097531984075000,
"changed": 6127065919816137000,
"deleted": 1648344243941422000,
"imported": 5611324336299605000,
"removed": 4982668176335011000,
"unchanged": 7762818230949140000
},
"state_file_link": "Consequuntur aut minus inventore.",
"status": "Eveniet aliquid et qui."
}
],
"trigger": {
"Non sed voluptatem.": "Occaecati ea cumque delectus nesciunt."
}
},
"pipeline_execution_id": "Error at omnis iste aliquid et aspernatur.",
"pipeline_stage_id": "Officia id."
}'