*This page
applies to **Apigee** , but not to **Apigee hybrid**.*


*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*
![](https://fonts.gstatic.com/s/i/googlematerialicons/help/v13/gm_grey-24dp/1x/gm_help_gm_grey_24dp.png)

Apigee's Pay-as-you-go pricing attributes are based in part upon the
[environment types](https://docs.cloud.google.com/apigee/docs/api-platform/reference/pay-as-you-go-environment-types.md.txt)
you attach to your [Apigee instance](https://docs.cloud.google.com/apigee/docs/api-platform/fundamentals/environments-working-with.md.txt#environments-and-instances). You can choose to add [Base,](https://docs.cloud.google.com/apigee/docs/api-platform/reference/pay-as-you-go-environment-types.md.txt#base-env) [Intermediate](https://docs.cloud.google.com/apigee/docs/api-platform/reference/pay-as-you-go-environment-types.md.txt#int-env),
or [Comprehensive](https://docs.cloud.google.com/apigee/docs/api-platform/reference/pay-as-you-go-environment-types.md.txt#comp-env)
environments to your Pay-as-you-go organization at any time, tailoring a pricing scheme based
on your feature and capacity needs. This topic explains how to upgrade or downgrade the *type* of an *existing* environment
to add or remove feature capabilities and manage your Apigee Pay-as-you-go billing and resource usage.

## Required roles and permissions


To get the permissions that
you need to update a Pay-as-you-go environment type,

ask your administrator to grant you the
following IAM roles on the project:

- Apigee Organization Admin (`apigee.organization.admin`)
- Apigee Environment Admin (`apigee.environment.admin`)


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


You might also be able to get
the required permissions through [custom
roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles) or other [predefined
roles](https://docs.cloud.google.com/iam/docs/roles-overview#predefined).

## Update your environment type

You can update the type of an existing Pay-as-you-go environment using the Apigee UI in the Google Cloud console
or using the API, as described in the following sections.

### Apigee in Cloud console

To update the type of an existing Pay-as-you-go environment using the Apigee UI in the Google Cloud console:

1. Open the **Apigee** page in the console.

   [Go to Apigee](https://cloud.google.com/console/apigee)
2. Select the project with the Pay-as-you-go organization and environments you want to update.
3. Select **Management \> Environments** to open the **Environments** list page.
4. In the row for the environment you want to edit, click **Actions** and select **Edit**.
5. In the **Edit environment** dialog, choose an option under **Select environment type**.
6. Click **Update** to save your changes.
7. To confirm the change in environment type, refresh the **Environments** list page.

### Apigee API

To update the type of an existing Pay-as-you-go environment using the Apigee API,
use the following command:

```
curl "https://apigee.googleapis.com/v1/organizations/ORG_NAME/environments/ENV_NAME?updateMask=type" \
          -H "Authorization: Bearer $token" \
          -X PATCH \
          -H 'Content-Type: application/json' \
          -d '{"type":"ENV_TYPE"}'
        
```

Where:

- <var translate="no">ORG_NAME</var> is the name of your Apigee Pay-as-you-go organization.
- <var translate="no">ENV_NAME</var> is the name of the Apigee environment to update.
- <var translate="no">ENV_TYPE</var> is the updated environment type. Options are `BASE`, `INTERMEDIATE`, or `COMPREHENSIVE`.

For example, to upgrade a *Base* environment named `test-env` to *Comprehensive*,
use the following command:

```
curl "https://apigee.googleapis.com/v1/organizations/my-org/environments/test-env?updateMask=type" \
          -H "Authorization: Bearer $token" \
          -X PATCH \
          -H 'Content-Type: application/json' \
          -d '{"type":"COMPREHENSIVE"}'
        
```

After the operation completes, use the following command to confirm the change in environment type:

```
curl "https://apigee.googleapis.com/v1/organizations/ORG_NAME/environments/ENV_NAME" -H "Authorization: Bearer $token"
```

This command returns the [environment
resource object](https://docs.cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments#resource:-environment), which includes the selected environment type.

## Error reference

When upgrading or downgrading environment type, the operation will fail if the existing environment
contains resources that are incompatible with the newly selected environment type. For more information
on available features and limitations by environment type, see [Comparison of environment types](https://docs.cloud.google.com/apigee/docs/api-platform/reference/pay-as-you-go-environment-types.md.txt#compare-env-table).

If the operation fails, you will see an error with the following format:

```
  {
    "error": {
      "code": "FAILED_PRECONDITION",
      "message": "environment type update invalid: ...<detailed message here >... :failed precondition",
      "status": "FAILED_PRECONDITION"
      }
  }
```

The following table summarizes possible error messages and potential steps you can take to resolve the issue
and upgrade or downgrade the environment type:

| **Failure condition** | **Error message** | **Steps to resolve** |
|---|---|---|
| Maximum number of environments per organization exceeded | `cannot transfer active environments to INTERMEDIATE, will exceed limit` `cannot transfer active environments to BASE, will exceed limit` | [Delete one or more environments](https://docs.cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments/delete.md.txt) from your organization. |
| Extensible proxy deployed in the environment | `existing environment has an extensible API` | [Undeploy the extensible proxy](https://docs.cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.apis.revisions.deployments/undeploy.md.txt) from the environment. |
| Shared flow deployed in the environment | `existing environment has a shared flow` | [Undeploy the shared flow](https://docs.cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.sharedflows.revisions.deployments/undeploy.md.txt) from the environment. |
| Maximum number of proxy deployment units per environment per region | `pdu count, 50, cannot exceed 20` `pdu count, 425, cannot exceed 50` | Undeploy and delete [shared flows](https://docs.cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.sharedflows.revisions/delete.md.txt) or [proxies](https://docs.cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.apis/delete.md.txt) from the environment. |
| Add-ons enabled in the environment | `Existing environment has an addon enabled` | [Disable the add-ons](https://docs.cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.addonsConfig/setAddonEnablement.md.txt) in the environment. |
| Multi-region support enabled in the environment | `instance attachment count, 2, cannot exceed 1 for BASE environment` `instance attachment count, 2, cannot exceed 1 for INTERMEDIATE environment` | [Delete the second instance attachment](https://docs.cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.instances.attachments/delete.md.txt) for the environment. |