Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Environments

Manage workspace-scoped deployment environments (name, production flag, lifecycle state).

List Environments

get
/v4/environments

Returns a paginated list of Environments in the specified project workspace. Defaults to active environments (status defaults to [ACTIVE]).

Authorizations
x-api-keystringRequired

Harness Service Account Token (SAT) or Personal Access Token (PAT). Generate tokens in Harness under Account Settings → Access Management.

Query parameters
account_idstring · max: 128Required

Harness account identifier. Required on all endpoints.

Example: {{accountId}}Pattern: ^[-_A-Za-z0-9]+$
organization_identifierstring · max: 128Required

Harness organization identifier.

Example: defaultPattern: ^[-_A-Za-z0-9]+$
project_identifierstring · max: 128Required

Harness project identifier.

Example: my_projectPattern: ^[-_A-Za-z0-9]+$
limitinteger · min: 1 · max: 100Optional

Number of items to return per page. Defaults to 100, maximum 100.

Default: 100Example: 100
offsetintegerOptional

Number of items to skip before the first returned result. Defaults to 0.

Default: 0Example: 0
Responses
200

OK — paginated list of environments returned.

application/json

Paginated list of Environments matching the query.

limitintegerRequired

The page size used for this response.

Example: 100
offsetintegerRequired

The number of items skipped before the first result.

Example: 0
totalCountintegerRequired

Total number of environments matching the query.

Example: 5
get/v4/environments
GET /fme/api/v4/environments?account_id={{accountId}}&organization_identifier=default&project_identifier=my_project HTTP/1.1
Host: app.harness.io
x-api-key: YOUR_API_KEY
Accept: */*
{
  "data": [
    {
      "id": "ad2eb8f0-9c3a-11ed-873c-e234abaad319",
      "name": "Production",
      "isProduction": true,
      "createdAt": "2025-06-01T12:00:00Z",
      "status": "ACTIVE"
    }
  ],
  "limit": 100,
  "offset": 0,
  "totalCount": 5
}

Create an Environment

post
/v4/environments

Creates a new Environment in the specified project workspace. The environment name must be unique within the project.

Authorizations
x-api-keystringRequired

Harness Service Account Token (SAT) or Personal Access Token (PAT). Generate tokens in Harness under Account Settings → Access Management.

Query parameters
account_idstring · max: 128Required

Harness account identifier. Required on all endpoints.

Example: {{accountId}}Pattern: ^[-_A-Za-z0-9]+$
organization_identifierstring · max: 128Required

Harness organization identifier.

Example: defaultPattern: ^[-_A-Za-z0-9]+$
project_identifierstring · max: 128Required

Harness project identifier.

Example: my_projectPattern: ^[-_A-Za-z0-9]+$
Body

Request body for creating a new Environment.

namestringRequired

Unique environment name within the project.

Example: Production
isProductionbooleanOptional

true when this environment represents production traffic. Defaults to false when omitted.

Default: falseExample: true
Responses
201

Created — the environment was successfully created.

application/json

Mutation response (create, update): entity plus OPA governance.

post/v4/environments
POST /fme/api/v4/environments?account_id={{accountId}}&organization_identifier=default&project_identifier=my_project HTTP/1.1
Host: app.harness.io
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 41

{
  "name": "Production",
  "isProduction": true
}
{
  "entity": {
    "id": "ad2eb8f0-9c3a-11ed-873c-e234abaad319",
    "name": "Production",
    "isProduction": true,
    "createdAt": "2025-06-01T12:00:00Z",
    "status": "ACTIVE"
  },
  "governance": {
    "status": "PASS",
    "details": []
  }
}

Get an Environment

get
/v4/environments/{environment-id}

Returns a single Environment by its system-assigned identifier. Unlike list, this endpoint returns the environment regardless of lifecycle status (ACTIVE or ARCHIVED).

Authorizations
x-api-keystringRequired

Harness Service Account Token (SAT) or Personal Access Token (PAT). Generate tokens in Harness under Account Settings → Access Management.

Path parameters
environment-idstring · uuid · max: 128Required

The system-assigned identifier of the environment. Environment names are free-form (may contain spaces) and are not accepted as a path parameter.

Example: ad2eb8f0-9c3a-11ed-873c-e234abaad319Pattern: ^[-_A-Za-z0-9]+$
Query parameters
account_idstring · max: 128Required

Harness account identifier. Required on all endpoints.

Example: {{accountId}}Pattern: ^[-_A-Za-z0-9]+$
organization_identifierstring · max: 128Required

Harness organization identifier.

Example: defaultPattern: ^[-_A-Za-z0-9]+$
project_identifierstring · max: 128Required

Harness project identifier.

Example: my_projectPattern: ^[-_A-Za-z0-9]+$
Responses
200

OK — environment returned.

application/json

A workspace-scoped Environment entity.

idstring · uuidRequired

Unique system-assigned identifier for the environment.

Example: ad2eb8f0-9c3a-11ed-873c-e234abaad319
namestringRequired

Unique environment name within the project. Updatable via PATCH. Use the system-assigned id as the path parameter in subsequent requests — this field is informational only.

Example: Production
isProductionbooleanRequired

true when this environment represents production traffic. Defaults to false when omitted at creation time.

Example: true
createdAtstring · date-timeRequired

ISO-8601 timestamp when the environment was created.

Example: 2025-06-01T12:00:00Z
statusstring · enumRequired

Lifecycle status of the environment.

  • ACTIVE — environment is live.
  • ARCHIVED — environment is no longer active (soft-deleted).
Example: ACTIVEPossible values:
get/v4/environments/{environment-id}
GET /fme/api/v4/environments/{environment-id}?account_id={{accountId}}&organization_identifier=default&project_identifier=my_project HTTP/1.1
Host: app.harness.io
x-api-key: YOUR_API_KEY
Accept: */*
{
  "id": "ad2eb8f0-9c3a-11ed-873c-e234abaad319",
  "name": "Production",
  "isProduction": true,
  "createdAt": "2025-06-01T12:00:00Z",
  "status": "ACTIVE"
}

Delete an Environment

delete
/v4/environments/{environment-id}

Soft-deletes an Environment by transitioning it to ARCHIVED. The environment remains retrievable via GET by id and via LIST when status includes ARCHIVED. Returns the OPA governance result for the operation. Deleting an environment that is already ARCHIVED returns 404. Deleting an environment that has active dependents returns 409 (hasDependents).

Authorizations
x-api-keystringRequired

Harness Service Account Token (SAT) or Personal Access Token (PAT). Generate tokens in Harness under Account Settings → Access Management.

Path parameters
environment-idstring · uuid · max: 128Required

The system-assigned identifier of the environment. Environment names are free-form (may contain spaces) and are not accepted as a path parameter.

Example: ad2eb8f0-9c3a-11ed-873c-e234abaad319Pattern: ^[-_A-Za-z0-9]+$
Query parameters
account_idstring · max: 128Required

Harness account identifier. Required on all endpoints.

Example: {{accountId}}Pattern: ^[-_A-Za-z0-9]+$
organization_identifierstring · max: 128Required

Harness organization identifier.

Example: defaultPattern: ^[-_A-Za-z0-9]+$
project_identifierstring · max: 128Required

Harness project identifier.

Example: my_projectPattern: ^[-_A-Za-z0-9]+$
Responses
200

OK — environment deleted. Returns the governance result.

application/json

Response envelope for delete operations. Contains only the OPA governance result — no entity is returned. Shared by all FME resources so delete responses are consistent.

delete/v4/environments/{environment-id}
DELETE /fme/api/v4/environments/{environment-id}?account_id={{accountId}}&organization_identifier=default&project_identifier=my_project HTTP/1.1
Host: app.harness.io
x-api-key: YOUR_API_KEY
Accept: */*
{
  "governance": {
    "status": "PASS",
    "details": []
  }
}

Update an Environment (partial)

patch
/v4/environments/{environment-id}

Partially updates an Environment using JSON Merge Patch semantics (RFC 7396). Only fields present in the request body are modified; omitted fields are left unchanged. Sending null for name or isProduction is rejected with 400.

Only ACTIVE environments can be updated. Patching an archived environment returns 404. Renaming to a name already used in the project returns 409.

Updatable fields: name, isProduction.

Authorizations
x-api-keystringRequired

Harness Service Account Token (SAT) or Personal Access Token (PAT). Generate tokens in Harness under Account Settings → Access Management.

Path parameters
environment-idstring · uuid · max: 128Required

The system-assigned identifier of the environment. Environment names are free-form (may contain spaces) and are not accepted as a path parameter.

Example: ad2eb8f0-9c3a-11ed-873c-e234abaad319Pattern: ^[-_A-Za-z0-9]+$
Query parameters
account_idstring · max: 128Required

Harness account identifier. Required on all endpoints.

Example: {{accountId}}Pattern: ^[-_A-Za-z0-9]+$
organization_identifierstring · max: 128Required

Harness organization identifier.

Example: defaultPattern: ^[-_A-Za-z0-9]+$
project_identifierstring · max: 128Required

Harness project identifier.

Example: my_projectPattern: ^[-_A-Za-z0-9]+$
Body

JSON Merge Patch body (RFC 7396). All fields are optional. Omit a field to leave it unchanged. Sending null for name or isProduction, or a blank name, is rejected with 400.

namestringOptional

Updated environment name.

Example: Production-US
isProductionbooleanOptional

Updated production flag.

Example: true
Responses
200

OK — environment updated.

application/json

Mutation response (create, update): entity plus OPA governance.

patch/v4/environments/{environment-id}
PATCH /fme/api/v4/environments/{environment-id}?account_id={{accountId}}&organization_identifier=default&project_identifier=my_project HTTP/1.1
Host: app.harness.io
x-api-key: YOUR_API_KEY
Content-Type: application/merge-patch+json
Accept: */*
Content-Length: 44

{
  "name": "Production-US",
  "isProduction": true
}
{
  "entity": {
    "id": "ad2eb8f0-9c3a-11ed-873c-e234abaad319",
    "name": "Production",
    "isProduction": true,
    "createdAt": "2025-06-01T12:00:00Z",
    "status": "ACTIVE"
  },
  "governance": {
    "status": "PASS",
    "details": []
  }
}

Last updated

Was this helpful?