# Update environment

> Source: https://truto.one/docs/api-reference/admin/environments/update/

`PATCH /environment/{id}`

Resource: **Environments**

## Request body

- **`name`** _(string)_

## Response body

- **`id`** _(string)_
  The ID of the environment.
- **`name`** _(string)_
  The name of the environment.
- **`team_id`** _(string)_
  The ID of the team that owns this environment.
- **`created_at`** _(string)_
  The date and time when the environment was created.
- **`updated_at`** _(string)_
  The date and time when the environment was last updated.

## Code examples

### curl

```bash
curl -X PATCH 'https://api.truto.one/environment/{id}' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Staging"
}'
```

### JavaScript

```javascript
const body = {
  "name": "Staging"
};

const response = await fetch('https://api.truto.one/environment/{id}', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/environment/{id}"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "name": "Staging"
}

response = requests.patch(url, headers=headers, params=params, json=payload)
print(response.json())
```
