> For the complete documentation index, see [llms.txt](https://docs.skyone.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.skyone.cloud/english/api-skyone-autosky/environment-api.md).

# Environment API

API calls for Environments operations.

{% hint style="info" %}
**Base path:** `/environments/`
{% endhint %}

***

## List Environments

Listing of all environments.

```http
GET /environments/
```

### Response

**Status:** `200 OK`

```json
[
  {
    "amb_uuid": "dd2f7c4e-8dee-4ecc-8033-21207945d55",
    "nome": "Environment 1",
    "in_maintenance": false,
    "maintenance_msg": "Under maintenance",
    "schedule_maintenance": false,
    "schedule_maintenance_start": "2020-12-11T03:10:14-03:00",
    "schedule_maintenance_end": "2020-12-12T07:35:15-03:00",
    "schedule_maintenance_msg": "Under maintenance",
    "terminate_sessions": false,
    "terminate_instances": false,
    "schedule_warning": false,
    "schedule_warning_start": "2020-12-24T00:00:00-03:00",
    "schedule_warning_end": "2020-12-25T00:00:00-03:00",
    "schedule_warning_msg": "Merry Christmas!",
    "display_warning_to_logged_users": false,
    "environment_state": "available",
    "preparation_server": {
      "instance_id": "ocid1.instance.oc1...",
      "name": "TEMPLATE_SERVER_NAME",
      "public_ip": "1.2.3.4",
      "private_ip": "4.3.2.1",
      "instance_state": "RUNNING",
      "stop_time": "2021/03/15 19:42:25"
    }
  }
]
```

### Environment Object Fields

| Field                             | Type        | Description                                                |
| --------------------------------- | ----------- | ---------------------------------------------------------- |
| `amb_uuid`                        | string      | Unique identifier of the environment                       |
| `nome`                            | string      | Name of the environment                                    |
| `in_maintenance`                  | boolean     | Whether it is under immediate maintenance                  |
| `maintenance_msg`                 | string      | Maintenance message                                        |
| `schedule_maintenance`            | boolean     | Whether it has an active scheduled maintenance             |
| `schedule_maintenance_start`      | string/null | Start date/time of the scheduled maintenance               |
| `schedule_maintenance_end`        | string/null | End date/time of the scheduled maintenance                 |
| `schedule_maintenance_msg`        | string      | Scheduled maintenance message                              |
| `terminate_sessions`              | boolean     | Whether it terminates sessions during maintenance          |
| `terminate_instances`             | boolean     | Whether it terminates instances during maintenance         |
| `schedule_warning`                | boolean     | Whether it has an active scheduled warning                 |
| `schedule_warning_start`          | string/null | Start date/time of the warning                             |
| `schedule_warning_end`            | string/null | End date/time of the warning                               |
| `schedule_warning_msg`            | string      | Warning message                                            |
| `display_warning_to_logged_users` | boolean     | Whether it displays the warning to already logged-in users |
| `environment_state`               | string      | Environment state (e.g. `available`)                       |
| `preparation_server`              | object/null | Preparation server data (can be `null`)                    |

***

## Get Environment Data

Gets data from an environment specified by its UUID.

```http
GET /environments/{amb_uuid}
```

### Path Parameters

| Parameter  | Required | Description      |
| ---------- | -------- | ---------------- |
| `amb_uuid` | Yes      | Environment UUID |

### Response

**Status:** `200 OK`

Returns the environment object with the same structure as the listing.

***

## Enable / Disable Immediate Maintenance

Enables or disables immediate maintenance across an entire environment.

```http
PATCH /environments/{amb_uuid}
```

### Path Parameters

| Parameter  | Required | Description      |
| ---------- | -------- | ---------------- |
| `amb_uuid` | Yes      | Environment UUID |

### Request Body

| Field             | Type    | Required | Description                                        |
| ----------------- | ------- | -------- | -------------------------------------------------- |
| `in_maintenance`  | boolean | Yes      | `true` to enable, `false` to disable               |
| `maintenance_msg` | string  | No       | Message presented to users during their next login |

### Response

**Status:** `200 OK`

Returns the updated environment object.

***

## Enable / Disable Scheduled Maintenance

Enables or disables scheduled maintenance across an entire environment.

It is mandatory to specify all fields below when `schedule_maintenance` for `true`.

```http
PATCH /environments/{amb_uuid}
```

### Path Parameters

| Parameters | Required | Description      |
| ---------- | -------- | ---------------- |
| `amb_uuid` | Yes      | Environment UUID |

### Request Body

| Field                        | Type    | Required    | Description                                              |
| ---------------------------- | ------- | ----------- | -------------------------------------------------------- |
| `schedule_maintenance`       | boolean | Yes         | Enables/disables scheduled maintenance                   |
| `schedule_maintenance_start` | string  | Conditional | Start date/time. Format: `2021-12-01T23:10:00.000-03:00` |
| `schedule_maintenance_end`   | string  | Conditional | End date/time                                            |
| `schedule_maintenance_msg`   | string  | Conditional | Message presented to users                               |
| `terminate_sessions`         | boolean | No          | Terminates active user sessions                          |
| `terminate_instances`        | boolean | No          | Terminates active instances                              |

### Response

**Status:** `200 OK`

Returns the updated environment object.

***

## Enable / Disable Scheduled Warnings

Enables or disables the scheduled display of warnings across an entire environment.

It is mandatory to specify all fields below when `schedule_warning` for `true`.

```http
PATCH /environments/{amb_uuid}
```

### Path Parameters

| Parameters | Required | Description      |
| ---------- | -------- | ---------------- |
| `amb_uuid` | Yes      | Environment UUID |

### Body da Requisição

| Field                             | Type    | Required    | Description                                 |
| --------------------------------- | ------- | ----------- | ------------------------------------------- |
| `schedule_warning`                | boolean | Yes         | Enables/disables scheduled warnings         |
| `schedule_warning_start`          | string  | Conditional | Start date/time                             |
| `schedule_warning_end`            | string  | Conditional | End date/time                               |
| `schedule_warning_msg`            | string  | Condicional | Warning message                             |
| `display_warning_to_logged_users` | boolean | Conditional | Displays warning to already logged-in users |

### Response

**Status:** `200 OK`

Returns the updated environment object.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.skyone.cloud/english/api-skyone-autosky/environment-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
