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

# Dashboard Endpoints

> Manage dashboard configurations and layouts

## Dashboard Endpoints

Manage complete dashboard configurations with drag-and-drop layouts and component state.

## POST /dashboards

<Note>Creates a new dashboard with the specified configuration.</Note>

```python theme={null}
# Create a new dashboard
dashboard = client.dashboards.create_dashboard(
    name="Wind Farm Dashboard",
    components=["comp_123", "comp_456"],
    react_grid_layout_config={...},
    component_state={...}
)
```

<RequestExample>
  <RequestExample.Method>POST</RequestExample.Method>
  <RequestExample.URL>/dashboards</RequestExample.URL>

  <RequestExample.Body>
    ```json theme={null}
    {
      "name": "Wind Farm Dashboard",
      "components": ["comp_123", "comp_456"],
      "react_grid_layout_config": {
        "layout": [
          {
            "i": "comp_123",
            "x": 0,
            "y": 0,
            "w": 6,
            "h": 4
          },
          {
            "i": "comp_456", 
            "x": 6,
            "y": 0,
            "w": 6,
            "h": 4
          }
        ]
      },
      "component_state": {
        "comp_123": {
          "visible": true,
          "opacity": 0.8
        },
        "comp_456": {
          "visible": true,
          "opacity": 1.0
        }
      }
    }
    ```
  </RequestExample.Body>
</RequestExample>

<ResponseExample>
  <ResponseExample.StatusCode>201</ResponseExample.StatusCode>

  <ResponseExample.Body>
    ```json theme={null}
    {
      "id": "dashboard_789",
      "name": "Wind Farm Dashboard",
      "components": ["comp_123", "comp_456"],
      "react_grid_layout_config": {...},
      "component_state": {...},
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
    ```
  </ResponseExample.Body>
</ResponseExample>

## GET /dashboards

<Note>Retrieves all dashboards for the authenticated user.</Note>

```python theme={null}
# List all dashboards
dashboards = client.dashboards.list_dashboards()
```

<RequestExample>
  <RequestExample.Method>GET</RequestExample.Method>
  <RequestExample.URL>/dashboards</RequestExample.URL>
</RequestExample>

<ResponseExample>
  <ResponseExample.StatusCode>200</ResponseExample.StatusCode>

  <ResponseExample.Body>
    ```json theme={null}
    [
      {
        "id": "dashboard_123",
        "name": "Wind Farm Dashboard",
        "components": ["comp_123", "comp_456"],
        "react_grid_layout_config": {...},
        "component_state": {...},
        "created_at": "2024-01-01T00:00:00Z",
        "updated_at": "2024-01-01T00:00:00Z"
      },
      {
        "id": "dashboard_456",
        "name": "Solar Plant Dashboard",
        "components": ["comp_789"],
        "react_grid_layout_config": {...},
        "component_state": {...},
        "created_at": "2024-01-01T00:00:00Z",
        "updated_at": "2024-01-01T00:00:00Z"
      }
    ]
    ```
  </ResponseExample.Body>
</ResponseExample>

## GET /dashboards/{dashboard_id}

<Note>Retrieves a specific dashboard by ID.</Note>

```python theme={null}
# Get a specific dashboard by ID string
dashboard = client.dashboards.get_dashboard("dashboard_123")

# Or if you have a dashboard object
dashboard = client.dashboards.get_dashboard(dashboard.id)
```

<RequestExample>
  <RequestExample.Method>GET</RequestExample.Method>
  <RequestExample.URL>/dashboards/{dashboard_id}</RequestExample.URL>
</RequestExample>

<ResponseExample>
  <ResponseExample.StatusCode>200</ResponseExample.StatusCode>

  <ResponseExample.Body>
    ```json theme={null}
    {
      "id": "dashboard_123",
      "name": "Wind Farm Dashboard",
      "components": ["comp_123", "comp_456"],
      "react_grid_layout_config": {...},
      "component_state": {...},
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
    ```
  </ResponseExample.Body>
</ResponseExample>

## PUT /dashboards/{dashboard_id}

<Note>Updates the layout and component state of an existing dashboard.</Note>

```python theme={null}
# Update dashboard components by ID string
updated_dashboard = client.dashboards.update_dashboard(
    "dashboard_123",
    components=["comp_123", "comp_456"]
)

# Or if you have a dashboard object
updated_dashboard = client.dashboards.update_dashboard(
    dashboard.id,
    components=["comp_123", "comp_456"]
)
```

<RequestExample>
  <RequestExample.Method>PUT</RequestExample.Method>
  <RequestExample.URL>/dashboards/{dashboard_id}</RequestExample.URL>

  <RequestExample.Body>
    ```json theme={null}
    {
      "components": ["comp_123", "comp_456"]
    }
    ```
  </RequestExample.Body>
</RequestExample>

<ResponseExample>
  <ResponseExample.StatusCode>200</ResponseExample.StatusCode>

  <ResponseExample.Body>
    ```json theme={null}
    {
      "id": "dashboard_123",
      "name": "Wind Farm Dashboard",
      "components": ["comp_123", "comp_456"],
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T12:00:00Z"
    }
    ```
  </ResponseExample.Body>
</ResponseExample>

## DELETE /dashboards/{dashboard_id}

<Note>Permanently deletes a dashboard and all its associated data.</Note>

```python theme={null}
# Delete a dashboard by ID string
client.dashboards.delete_dashboard("dashboard_123")

# Or if you have a dashboard object
client.dashboards.delete_dashboard(dashboard.id)
```

<RequestExample>
  <RequestExample.Method>DELETE</RequestExample.Method>
  <RequestExample.URL>/dashboards/{dashboard_id}</RequestExample.URL>
</RequestExample>

<ResponseExample>
  <ResponseExample.StatusCode>204</ResponseExample.StatusCode>

  <ResponseExample.Body>
    ```json theme={null}
    {}
    ```
  </ResponseExample.Body>
</ResponseExample>
