# Unassign an environment from a machine

Source: https://www.jawsdeploy.net/rest-api/machines-environment-unassign | Section: Machines

Remove one environment from a machine, leaving its other assignments alone.

`DELETE /api/machine/environment`

Removes one environment from the machine, leaving its other environments in place. The machine itself is not deleted and keeps its registration, so it can be assigned again later.

The call is **idempotent**: removing an environment the machine was never assigned to succeeds and changes nothing, so a pipeline can unassign without checking first.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `machineId` | query | string | yes | ID of the machine, from [List machines](https://www.jawsdeploy.net/rest-api/machines-list). |
| `environmentId` | query | string | yes | ID of the environment to remove from the machine. |

## Errors

| Status | Meaning |
|---|---|
| 400 | Invalid `machineId`. A machine that belongs to another organization is reported the same way as one that does not exist. |
| 400 | Missing `environmentId`. |
| 401 | Missing or invalid Basic auth credentials, or the service account lacks permission to manage machines in this workspace. |

Example request:

```
DELETE /api/machine/environment?machineId=mch_web01&environmentId=env_prod HTTP/1.1
Authorization: Basic <base64(...)>
```

Example response:

```
{}
```

