> [!CAUTION]
> **Caution:** This documentation covers Edge for Private Cloud 4.17.09, which is no longer supported. Google does not provide security patches, bug fixes, or technical support for this version. The current supported version is 4.54.00. See the [Edge for Private Cloud documentation](https://docs.apigee.com/private-cloud/latest/overview) for the current version, or [All versions](https://docs.apigee.com/private-cloud/versions) to compare releases.

*Edge for Private Cloud v. 4.17.09*

This section explains the removal of organizations, environments, and virtual hosts. Note that
the order of API calls is very important-- that means, for example, the step to remove an
organization can only be executed after you remove all associated environments in the
organization.

## Delete a Virtual Host

Before you can delete a virtual host from an environment, you must update any API proxies that
reference the virtual host to remove the reference. See [Virtual hosts](https://docs.apigee.com/api-platform/fundamentals/virtual-hosts) for more.

Use the following API to delete a virtual host:

```
curl -u <admin user>:<admin passwd> -X DELETE \
"http://<ms-ip>:8080/v1/organizations/<org-name>/environments/<env-name>/virtualhosts/{virtualhost_name}" 
```

## Delete an Environment

You can only delete an environment after you have:

1. Deleted all virtual hosts in the environment as described above.
2. Disassociated the environment from all Message Processors.
3. Cleaned up analytics.

### Disassociate an
Environment from Message Processor

Use the following API to remove an association of an environment with a Message Processor. If
you want to delete the environment, you must disassociate it from all Message Processors:

```
curl -H "Content-Type: application/x-www-form-urlencoded" \
-u <admin user>:<admin passwd> -X POST \
"http://<ms-ip>:8080/v1/organizations/<org-name>/environments/<env-name>/servers" \
-d "action=remove&uuid=<uuid>"
```

Where "\<uuid\>" is the
UUID of Message Processor.

> [!NOTE]
> **Note:** To retrieve the UUID of the Message Processor, run the following command:

```
> curl http://<mp-ip>:8082/v1/servers/self
```

Where "\<mp-ip\>" is the
IP address of the Message Processor.

### Cleanup analytics

Remove analytics information about the organization:

```
curl -u <admin user>:<admin passwd> -X DELETE \
http://<ms-IP>:8080/v1/analytics/groups/ax/<analytics_group>/scopes?org=<org-name>&env=<env-name>
```

where ***analytics_group*** defaults to analytics-001.

If you are unsure of the name of the analytics group, use the following command to display
it:

```
> apigee-adminapi.sh analytics groups list --admin adminEmail --pwd adminPword --host localhost
```

This command returns the analytics group name in the name field.

### Delete the environment

Use the following API to delete an environment:

```
curl -u <admin user>:<admin passwd> \
http://<ms-ip>:8080/v1/organizations/<org-name>/environments/<env-name> \
-X DELETE
```

## Delete an Organization

You can only delete an organization after you have:

1. Deleted all virtual hosts in all environments in the organization as described above.
2. Deleted all environments in the organization as described above.
3. Disassociated the organization from all pods.

### Disassociate an Organization from
Pod

Use the following API to delete disassociate an organization from a pod:

```
curl -H "Content-Type: application/x-www-form-urlencoded" \
-u <admin user>:<admin passwd> -X POST \
"http://<ms-ip>:8080/v1/organizations/<org-name>/pods" \
-d "action=remove&region=<region-name>&pod=<pod-name>"
```

> [!NOTE]
> **Note:** To find out what region and pods an organization is associated with, run the following command:

```
curl -u <admin user>:<admin passwd>  \
"http://<ms-ip>:8080/v1/organizations/<org-name>/pods"
```

### Delete the organization

Use the following API to delete an organization:

```
curl -u <admin user>:<admin passwd> -X DELETE \
"http://<ms-ip>:8080/v1/organizations/<org-name>" 
```