---
title: Update the environment.
url: https://developers.wpengine.com/docs/headless-platform/reference/api/endpoints/operations/apps_updateenvironment/
image: https://developers.wpengine.com/og/docs/headless-platform/reference/api/endpoints/operations/apps_updateenvironment.png
---

# Update the environment.

PATCH

/v1/accounts/{account}/apps/{app}/environments/{environment}

Select code sample

```sh
curl --request PATCH \
  --url https://js.wpengineapi.com/v1/accounts/example/apps/example/environments/example \
  --header 'Authorization: Basic <credentials>' \
  --header 'Content-Type: application/json' \
  --data '{ "branch": "example", "displayName": "example", "domains": [ "example" ], "rootDirectory": "example", "shellVariables": [ { "key": "example", "value": "example" } ], "wpEnvironment": "example" }'
```

-

## Authorizations

- **[basicAuth](https://developers.wpengine.com/docs/headless-platform/reference/api/endpoints/#basicauth)**

## Parameters

### Path Parameters

**account**

required

string

Name of your WP Engine Headless Platform account

**app**

required

string

Name of your Headless Platform application

**environment**

required

string

ID of your environment

### Query Parameters

**validateOnly**

boolean

If set, validate the request (domains only) and preview the review, but do not actually post it.

## Request Body

Name of the environment to update.

(– The Environment’s `name` field is used to identify the Environment to be updated. Format: accounts/{account}/apps/{app}/environments/{environment} –)

Media typeapplication/json

*Name of the environment to update.*

(– The Environment’s `name` field is used to identify the Environment to be updated. Format: accounts/{account}/apps/{app}/environments/{environment} –)

object

**branch**

required

*Branch name*

The branch name from which the Environment is going to be built. In case of using .zip upload, the value should equal to `uploadable`

string

**build**

*Currently deployed build*

A Build describes steps taken to deploy (activate) the Environment. Format is: \`accounts/{account}/apps/{app}/builds/{build}

string

**createTime**

*Create time*

The timestamp when the environment was created.

string format: date-time

**displayName**

required

*Display name*

A name of the Environment used for display purposes

string

**domains**

*Domains list*

A list of domains associated with the Environment.

Array\<string>

**reconciling**

*Reconciling*

An Environment is marked as reconciling if its current state does not match the user’s requested intended state (as seen via GetEnvironmentSpec), and the system is working to reconcile them.

boolean

**rootDirectory**

*Root directory*

Root directory in which customer code is located.

string

**shellVariables**

*Shell Variable list*

A list of environment variables available in the environment’s container.

Array\<object>

*ShellVariable*

Environment variable represents a value available in the environment’s container under the specific key.

object

**key**

*Environment variable key. Must match regex: \`\[-.\_a-zA-Z]\[-.\_a-zA-Z0-9]\*\`. Must not match any of the following case-insensitive globs: WPE\_\*, ATLAS_METADATA\*, HEADLESS_METADATA\_\*, HOME, PORT, K\_\*, TMP, TMPDIR, TEMP*

string

**value**

Environment variable value.

string

**updateTime**

*Update time*

The timestamp when the environment was most recently updated. This value changes every time when user modifies this resource. It may also change when the service modifies the resource, but this is not currently guaranteed.

string format: date-time

**wpEnvironment**

required

*WordPress environment*

Name of the WordPress environment linked with this Environment. The Environment will have the same access visibility as wp_environment.

string

### Example generated

```json
{
  "branch": "example",
  "displayName": "example",
  "domains": [
    "example"
  ],
  "rootDirectory": "example",
  "shellVariables": [
    {
      "key": "example",
      "value": "example"
    }
  ],
  "wpEnvironment": "example"
}
```

## Responses

### 200

A successful response.

Media typeapplication/json

This resource represents a long-running operation that is the result of a network API call

object

**done**

Information if the operation is done or still in progress

boolean

**metadata**

Long running operation metadata

object

**@type**

A URL/resource name that uniquely identifies the type of the serialized protocol buffer message

string

**build**

Build name in the format of: accounts/{account}/apps/{app}/environments/{environment}/builds/{build}

string

**envID**

Environment ID

string

**name**

Operation name in the format of: accounts/{account}/apps/{app}/environments/{environment}/operations/{operation}

string

#### Example generated

```json
{
  "done": true,
  "metadata": {
    "@type": "example",
    "build": "example",
    "envID": "example"
  },
  "name": "example"
}
```

## Was this helpful?

Thanks for the feedback!

```json
{"@context":"https://schema.org","@graph":[{"@type":"WebSite","@id":"https://developers.wpengine.com/#website","name":"WP Engine Product Documentation","url":"https://developers.wpengine.com/","description":"Resources for developing, deploying, and scaling on WP Engine.","inLanguage":"en-US","keywords":["API documentation","product documentation","headless WordPress","managed WordPress hosting"],"publisher":{"@id":"https://wpengine.com/#organization"}}]}
```
