Environments
Manage workspace-scoped deployment environments (name, production flag, lifecycle state).
Returns a paginated list of Environments in the specified project workspace. Defaults to active environments (status defaults to [ACTIVE]).
Harness Service Account Token (SAT) or Personal Access Token (PAT). Generate tokens in Harness under Account Settings → Access Management.
Harness account identifier. Required on all endpoints.
{{accountId}}Pattern: ^[-_A-Za-z0-9]+$Harness organization identifier.
defaultPattern: ^[-_A-Za-z0-9]+$Harness project identifier.
my_projectPattern: ^[-_A-Za-z0-9]+$Number of items to return per page. Defaults to 100, maximum 100.
100Example: 100Number of items to skip before the first returned result. Defaults to 0.
0Example: 0OK — paginated list of environments returned.
Paginated list of Environments matching the query.
The page size used for this response.
100The number of items skipped before the first result.
0Total number of environments matching the query.
5Bad Request — validation errors or invalid state transition.
Unauthorized — the request is missing a valid API key, or the key has expired.
Forbidden — the caller is authenticated but not permitted to perform this operation.
Returned when the API can deny the operation without leaking whether a resource exists,
such as create, or write operations where the caller can already read the resource. When
returning 403 would reveal resource existence, the API returns 404 instead.
Environment-scoped mutations that require approval also return 403.
Too Many Requests — the caller has exceeded the rate limit for this endpoint.
Internal Server Error — an unexpected error occurred while processing the request.
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
}Creates a new Environment in the specified project workspace. The environment name must be unique within the project.
Harness Service Account Token (SAT) or Personal Access Token (PAT). Generate tokens in Harness under Account Settings → Access Management.
Harness account identifier. Required on all endpoints.
{{accountId}}Pattern: ^[-_A-Za-z0-9]+$Harness organization identifier.
defaultPattern: ^[-_A-Za-z0-9]+$Harness project identifier.
my_projectPattern: ^[-_A-Za-z0-9]+$Request body for creating a new Environment.
Unique environment name within the project.
Productiontrue when this environment represents production traffic. Defaults to false when
omitted.
falseExample: trueCreated — the environment was successfully created.
Mutation response (create, update): entity plus OPA governance.
Bad Request — validation errors or invalid state transition.
Unauthorized — the request is missing a valid API key, or the key has expired.
Forbidden — the caller is authenticated but not permitted to perform this operation.
Returned when the API can deny the operation without leaking whether a resource exists,
such as create, or write operations where the caller can already read the resource. When
returning 403 would reveal resource existence, the API returns 404 instead.
Environment-scoped mutations that require approval also return 403.
Conflict — a resource with this identifier already exists, the operation conflicts with an
open change request, or the resource cannot be deleted/archived while dependents still
exist. Discriminate with errorType: resourceAlreadyExists, pendingChangeConflict, or
hasDependents. For hasDependents, detail is the archiver message when one is
available; otherwise Resource has active dependents.
Unprocessable Content — OPA governance policy evaluation returned ERROR (governanceError).
Each failing policy is listed in the errors array.
Too Many Requests — the caller has exceeded the rate limit for this endpoint.
Internal Server Error — an unexpected error occurred while processing the request.
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": []
}
}Returns a single Environment by its system-assigned identifier. Unlike list, this endpoint returns the environment regardless of lifecycle status (ACTIVE or ARCHIVED).
Harness Service Account Token (SAT) or Personal Access Token (PAT). Generate tokens in Harness under Account Settings → Access Management.
The system-assigned identifier of the environment. Environment names are free-form (may contain spaces) and are not accepted as a path parameter.
ad2eb8f0-9c3a-11ed-873c-e234abaad319Pattern: ^[-_A-Za-z0-9]+$Harness account identifier. Required on all endpoints.
{{accountId}}Pattern: ^[-_A-Za-z0-9]+$Harness organization identifier.
defaultPattern: ^[-_A-Za-z0-9]+$Harness project identifier.
my_projectPattern: ^[-_A-Za-z0-9]+$OK — environment returned.
A workspace-scoped Environment entity.
Unique system-assigned identifier for the environment.
ad2eb8f0-9c3a-11ed-873c-e234abaad319Unique 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.
Productiontrue when this environment represents production traffic. Defaults to false when
omitted at creation time.
trueISO-8601 timestamp when the environment was created.
2025-06-01T12:00:00ZLifecycle status of the environment.
ACTIVE— environment is live.ARCHIVED— environment is no longer active (soft-deleted).
ACTIVEPossible values: Bad Request — validation errors or invalid state transition.
Unauthorized — the request is missing a valid API key, or the key has expired.
Not Found — the requested resource does not exist. Also returned when the caller lacks access to the resource (to avoid leaking resource existence).
Too Many Requests — the caller has exceeded the rate limit for this endpoint.
Internal Server Error — an unexpected error occurred while processing the request.
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"
}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).
Harness Service Account Token (SAT) or Personal Access Token (PAT). Generate tokens in Harness under Account Settings → Access Management.
The system-assigned identifier of the environment. Environment names are free-form (may contain spaces) and are not accepted as a path parameter.
ad2eb8f0-9c3a-11ed-873c-e234abaad319Pattern: ^[-_A-Za-z0-9]+$Harness account identifier. Required on all endpoints.
{{accountId}}Pattern: ^[-_A-Za-z0-9]+$Harness organization identifier.
defaultPattern: ^[-_A-Za-z0-9]+$Harness project identifier.
my_projectPattern: ^[-_A-Za-z0-9]+$OK — environment deleted. Returns the governance result.
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.
Bad Request — validation errors or invalid state transition.
Unauthorized — the request is missing a valid API key, or the key has expired.
Forbidden — the caller is authenticated but not permitted to perform this operation.
Returned when the API can deny the operation without leaking whether a resource exists,
such as create, or write operations where the caller can already read the resource. When
returning 403 would reveal resource existence, the API returns 404 instead.
Environment-scoped mutations that require approval also return 403.
Not Found — the requested resource does not exist. Also returned when the caller lacks access to the resource (to avoid leaking resource existence).
Conflict — a resource with this identifier already exists, the operation conflicts with an
open change request, or the resource cannot be deleted/archived while dependents still
exist. Discriminate with errorType: resourceAlreadyExists, pendingChangeConflict, or
hasDependents. For hasDependents, detail is the archiver message when one is
available; otherwise Resource has active dependents.
Unprocessable Content — OPA governance policy evaluation returned ERROR (governanceError).
Each failing policy is listed in the errors array.
Too Many Requests — the caller has exceeded the rate limit for this endpoint.
Internal Server Error — an unexpected error occurred while processing the request.
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": []
}
}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.
Harness Service Account Token (SAT) or Personal Access Token (PAT). Generate tokens in Harness under Account Settings → Access Management.
The system-assigned identifier of the environment. Environment names are free-form (may contain spaces) and are not accepted as a path parameter.
ad2eb8f0-9c3a-11ed-873c-e234abaad319Pattern: ^[-_A-Za-z0-9]+$Harness account identifier. Required on all endpoints.
{{accountId}}Pattern: ^[-_A-Za-z0-9]+$Harness organization identifier.
defaultPattern: ^[-_A-Za-z0-9]+$Harness project identifier.
my_projectPattern: ^[-_A-Za-z0-9]+$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.
Updated environment name.
Production-USUpdated production flag.
trueOK — environment updated.
Mutation response (create, update): entity plus OPA governance.
Bad Request — validation errors or invalid state transition.
Unauthorized — the request is missing a valid API key, or the key has expired.
Forbidden — the caller is authenticated but not permitted to perform this operation.
Returned when the API can deny the operation without leaking whether a resource exists,
such as create, or write operations where the caller can already read the resource. When
returning 403 would reveal resource existence, the API returns 404 instead.
Environment-scoped mutations that require approval also return 403.
Not Found — the requested resource does not exist. Also returned when the caller lacks access to the resource (to avoid leaking resource existence).
Conflict — a resource with this identifier already exists, the operation conflicts with an
open change request, or the resource cannot be deleted/archived while dependents still
exist. Discriminate with errorType: resourceAlreadyExists, pendingChangeConflict, or
hasDependents. For hasDependents, detail is the archiver message when one is
available; otherwise Resource has active dependents.
Unprocessable Content — OPA governance policy evaluation returned ERROR (governanceError).
Each failing policy is listed in the errors array.
Too Many Requests — the caller has exceeded the rate limit for this endpoint.
Internal Server Error — an unexpected error occurred while processing the request.
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?