# executions

Executions Service handles the API for workflow executions.

At this time it is a read-only API with no ability to directly create or edit
executions. Instead these are triggered from the Workspaces Service.

## List executions

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions](https://apidocs.harness.io/executions/executions_list-executions.md): List all executions.

## Create execution

 - [POST /iacm/api/orgs/{org}/projects/{project}/executions](https://apidocs.harness.io/executions/executions_create-execution.md): Create a new execution.

## Show execution

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/{pipeline_stage_id}](https://apidocs.harness.io/executions/executions_show-execution.md): Show an individual execution.

## Update execution

 - [POST /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/{pipeline_stage_id}/audit-event](https://apidocs.harness.io/executions/executions_modify-execution.md): Modify an individual execution by adding audit data.

## Upload resource change page

 - [POST /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/{pipeline_stage_id}/resource-changes/{category}/{page}](https://apidocs.harness.io/executions/executions_upload-resource-change-page.md): Upload a single sharded resource-change page file for an execution stage.

Resource-change data is split into categories (planned_changes, drift_changes,
resources, etc.) and each category is sharded into zero-based pages. The request
body is the raw page file (application/octet-stream) and is currently discarded.

The planned_changes and drift_changes categories are uploaded twice: once as pages
of the whole category, and once as pages of a single change type, identified by the
change parameter. Rows in both categories are expected pre-sorted by change-type
priority (deleted, replaced, added, changed, unchanged, removed, imported).

The body is a JSON array whose element shape depends on {category}:

  planned_changes | unchanged | drift_changes  ->  ChangedResource[]
  resources | data_sources                     ->  Resource[]
  outputs                                       ->  Output[]

Example body (category=planned_changes):
json
[
  {
    "provider": "AWS",
    "type": "aws_s3_bucket",
    "name": "app_bucket",
    "module": "root",
    "change": "added",
    "change_count": 1,
    "drift": false,
    "changes": {
      "bucket": { "change": "added", "old": "", "new": "my-bucket" }
    }
  }
]


Example body (category=resources):
json
[
  {
    "provider": "AWS",
    "type": "aws_instance",
    "name": "app_server",
    "module": "root",
    "mode": "resource",
    "path_id": "namespace",
    "resource_id": "i-0abc123",
    "attributes": { "instance_type": "t2.micro" },
    "drift_status": "unchanged",
    "drift_attributes": {},
    "sensitive_attributes": []
  }
]

## Get resource change indexed page

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/{pipeline_stage_id}/resource-changes/{category}/indexed-page](https://apidocs.harness.io/executions/executions_get-resource-change-indexed-page.md): Get one page of indexed resource-change rows together with badge totals and selection-aware filter counts.

Badge totals, facets, rows, total items, and pagination are read in one repeatable-read transaction over one committed plan/applied generation pair, so a commit that lands during the request cannot mix those values.

Badge totals are fixed for the pair. The resources badge counts managed resources only. Facets and rows keep the category semantics of list-resource-change-rows and get-resource-change-filter-counts, including data sources inside the resources category.

A 404 means the stage has no fresh indexed snapshot. Callers fall through to the sharded page files and then the legacy list.

## List resource change rows

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/{pipeline_stage_id}/resource-changes/{category}/rows](https://apidocs.harness.io/executions/executions_list-resource-change-rows.md): List one page of resource-change rows for an execution stage.

Served entirely from the indexed snapshot: every column the response carries is a scalar, so a
list request reads no attribute data. Attribute documents are fetched one row at a time from
get-resource-change-detail.

Pages are numbered and randomly addressable, because the table's page picker lets a caller jump
straight to page 5 rather than walking there. Unfiltered, a page is a bare ordinal range over an
index — ordinals are dense within a category — so page 40 costs what page 1 costs. Once a filter
or search is applied ordinals stop being contiguous and the page has to be counted into, but by
then the result set has narrowed to the point where there is little to count past.

Rows come back in stored order: change-type priority (deleted, added, changed, unchanged, removed,
imported) then name. There is no sort parameter, because the columns filter rather than sort — the
ordering is fixed at write time and identical for every caller.

Only committed snapshots are visible. A stage whose upload never completed, or that predates
indexing, is a 404 and the caller should fall back to list-resource-changes.

## Get resource change detail

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/{pipeline_stage_id}/resource-changes/{category}/rows/{ordinal}](https://apidocs.harness.io/executions/executions_get-resource-change-detail.md): Get one row's attribute document.

The row is addressed by category and ordinal, taken from a list-resource-change-rows response, not
by resource address. A resource can appear both as drifted and as planned, so an address can match
more than one row and an address-keyed panel would open an arbitrary one.

Only the bytes belonging to this row's attribute document are read, so the cost of a detail request
is independent of how large the plan or the stored snapshot is.

A 404 means the row is not retrievable — an unknown ordinal, an uncommitted snapshot, or a snapshot
whose attribute data has passed its retention window while the row survives. It is not an error
worth retrying.

## Get resource change detail by address

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/{pipeline_stage_id}/resource-changes/by-address/{resource_address}](https://apidocs.harness.io/executions/executions_get-resource-change-detail-by-address.md): Get every attribute document matching a Terraform resource address.

This is the address-keyed counterpart to get-resource-change-detail. Consumers that hold a
Terraform address — the dependency graph, risk map, future agents — can fetch the matching
attribute documents without first discovering an ordinal via list-resource-change-rows, and
without knowing which category the address lives in.

Omit category to search every category. The same address can appear as a planned change and as
drift, or as a planned change and as a provisioned resource; every match is returned and the
caller chooses. Pass category to restrict to one bucket. Pass change to restrict planned_changes
and drift_changes rows to one change type — for example the added half of a replace.

Only the bytes belonging to each matching row's attribute document are read, so the cost of a
detail request is independent of how large the plan or the stored snapshot is.

A 404 means no row is retrievable — an unknown address, an uncommitted snapshot, or a snapshot
whose attribute data has passed its retention window while the row survives. It is not an error
worth retrying.

## Commit resource changes

 - [POST /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/{pipeline_stage_id}/resource-changes/counts](https://apidocs.harness.io/executions/executions_commit-resource-changes.md): Upload the counts.json commit marker for an execution stage's resource changes.

Sent after all category pages have been uploaded to signal the upload is
complete; the body is the counts.json object (application/octet-stream) and is
currently discarded. It carries the badge totals the UI needs without scanning
the paged files.

Example body:
json
{
  "PlannedTotal": 42,
  "PlannedByChangeType": { "added": 10, "changed": 8, "deleted": 2, "unchanged": 22 },
  "Drift": 3,
  "Resources": 120,
  "DataSources": 15,
  "Outputs": 6
}

## Get resource change filter counts

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/{pipeline_stage_id}/resource-changes/filter-counts](https://apidocs.harness.io/executions/executions_get-resource-change-filter-counts.md): Get the count beside every filter option, across every dimension, in one request.

Unlike get-resource-change-counts, which returns fixed whole-snapshot badge totals, these counts are
selection-aware: each one answers how many rows the list would hold if the caller also picked that
option, so they move as the caller filters. Both endpoints stay — badges read the totals, the filter
panel reads these.

Every dimension is counted with the other dimensions' filters applied but not its own. That is what
lets a caller widen a selection: were they all counted under one shared predicate, selecting a
single provider would make every other provider read zero.

The category filter accepts more than one value here even though the list endpoint takes a single
category in its path, so a caller can scope the counts to the categories its tab shows.

Only committed snapshots are visible; an unindexed or incomplete stage is a 404.

## Begin resource change upload

 - [POST /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/{pipeline_stage_id}/resource-changes/uploads](https://apidocs.harness.io/executions/executions_begin-resource-change-upload.md): Begin an immutable resource-change upload generation for an execution stage.

## List cost changes

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/cost-changes](https://apidocs.harness.io/executions/executions_list-cost-changes.md): List cost changes from the latest plan and last applied state for the current execution.

## List cost changes for all stages

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/cost-changes-all-stages](https://apidocs.harness.io/executions/executions_list-cost-changes-all-stages.md): List cost changes for all stages from the latest plan and last applied state for the current execution.

Pass pipeline_stage_id to narrow the result to a single stage. A matrix run has one
stage per workspace, so a caller that is already looking at one of them - the approval
step, for instance - should name it rather than filter the whole collection itself.

## List cost changes for all stages by modules

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/cost-changes-all-stages-by-modules](https://apidocs.harness.io/executions/executions_list-cost-changes-all-stages-by-modules.md): List cost changes per module (stack path) for all stages for the current execution.

Pass pipeline_stage_id to narrow the result to a single stage, as with cost-changes-all-stages.

## Get dependency graph

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/dependency-graph](https://apidocs.harness.io/executions/executions_get-dependency-graph.md): Get dependency graph for an execution

## List resource changes

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/resource-changes](https://apidocs.harness.io/executions/executions_list-resource-changes.md): List resource changes from the latest plan and state for this execution.

## List resource changes for all stages

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/resource-changes-all-stages](https://apidocs.harness.io/executions/executions_list-resource-changes-all-stages.md): List resource changes for all stages from the latest plan and state for this execution.

## Get resource change counts

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/resource-changes/counts](https://apidocs.harness.io/executions/executions_get-resource-change-counts.md): Get resource-change badge totals for a sharded execution.

## Get resource change page

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/resource-changes/pages/{category}](https://apidocs.harness.io/executions/executions_get-resource-change-page.md): Get one fixed-size page of resource-changes for a given category.

Rows in the planned_changes and drift_changes categories are ordered by change-type
priority (deleted, replaced, added, changed, unchanged, removed, imported), so page 1 holds
the most actionable rows and a client need not sort what it receives. Those two
categories also accept the change parameter, which pages over a single change type
with its own totals rather than filtering the rows a page happens to hold.

## Get risk assessment

 - [GET /iacm/api/orgs/{org}/projects/{project}/executions/{pipeline_execution_id}/risk-assessment](https://apidocs.harness.io/executions/executions_get-risk-assessment.md): Get risk assessment for an execution

