> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gym.scale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Close Environment

> Terminate VM and clean up resources

Closes the desktop environment for a specific VM and releases all associated resources. The VM is terminated and cannot be used again.

## Request Body

<ParamField body="vm_id" type="string" required>
  VM identifier to close
</ParamField>

## Response

<ResponseField name="status" type="string">
  Result status (`success`)
</ResponseField>

<ResponseField name="message" type="string">
  Status message
</ResponseField>

<ResponseField name="vm_id" type="string">
  VM identifier that was closed
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "http://CONTROL_PLANE_IP:PORT/close" \
    -H "Content-Type: application/json" \
    -d '{
      "vm_id": "vm-abc123"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "status": "success",
    "message": "Desktop environment closed successfully",
    "vm_id": "vm-abc123"
  }
  ```

  ```json Error Response theme={null}
  {
    "error": "Desktop environment not found for VM: vm-abc123."
  }
  ```
</ResponseExample>
