# Delete Environment

Remove an environment nothing uses any more.

`DELETE https://connect.mindcloud.co/v2/environments/:environmentId`

Permissions: `environment:edit`.

## Parameters

### Path

- `environmentId` (string, required): The environment's id, from List Environments.

### Headers

- `X-Company-Id` (string): Optional. The id of the organization to act in. Leave it out to act in the API key's own organization. A key can also act in its child organizations, and, with "Use this key across all of your organizations" on, in every organization its creator can open in the app. List them with GET /v2/companies. Every response's X-Company-Id header names the organization it acted in. See [Organizations](https://mindcloud.co/docs/api/rest/introduction/organizations).

## Example request

```bash
curl --request DELETE \
  --url 'https://connect.mindcloud.co/v2/environments/Ev4kR8mTq2Lx' \
  --header 'Authorization: Bearer $MINDCLOUD_API_TOKEN'
```

## Response fields

- `id` (string): The id of the resource that was deleted.

## Example response

```json
{
  "success": true,
  "data": {
    "id": "Ev4kR8mTq2Lx"
  }
}
```

## Errors

- 409 In use: `CONFLICT` / `ENVIRONMENT_IN_USE` "This environment is used by 2 workflows. Remove it from those workflows before deleting it."
