> ## 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.

# Dataset Endpoints

> Store and manage energy data with static and live datasets

## Dataset Endpoints

Store and manage your energy data with support for static datasets, live data feeds, and both time series and geospatial data types.

## POST /datasets/timeseries-static

<Note>Creates a static time series dataset with pre-loaded data.</Note>

```python theme={null}
# Create a static time series dataset
dataset = client.datasets.create_timeseries_static(
    name="Wind Farm Production Data",
    data=[...],
    description="Historical wind farm production data"
)
```

<RequestExample>
  <RequestExample.Method>POST</RequestExample.Method>
  <RequestExample.URL>/datasets/timeseries-static</RequestExample.URL>

  <RequestExample.Body>
    ```json theme={null}
    {
      "name": "Wind Farm Production Data",
      "data": [
        {
          "timestamp": "2024-01-01T00:00:00Z",
          "production_mw": 45.2,
          "capacity_factor": 0.75
        }
      ],
      "description": "Historical wind farm production data"
    }
    ```
  </RequestExample.Body>
</RequestExample>

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

  <ResponseExample.Body>
    ```json theme={null}
    {
      "id": "dataset_123",
      "name": "Wind Farm Production Data",
      "type": "timeseries-static",
      "data": [...],
      "description": "Historical wind farm production data",
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
    ```
  </ResponseExample.Body>
</ResponseExample>

## POST /datasets/timeseries-live

<Note>
  Creates a live time series dataset that fetches data from external APIs.
</Note>

```python theme={null}
# Create a live time series dataset
dataset = client.datasets.create_timeseries_live(
    name="Live Wind Data",
    url="https://api.windfarm.com/data",
    params={...},
    data_format="json",
    aliases={...}
)
```

<RequestExample>
  <RequestExample.Method>POST</RequestExample.Method>
  <RequestExample.URL>/datasets/timeseries-live</RequestExample.URL>

  <RequestExample.Body>
    ```json theme={null}
    {
      "name": "Live Wind Data",
      "url": "https://api.windfarm.com/data",
      "params": {
        "api_key": "your_api_key",
        "location": "north_sea"
      },
      "data_format": "json",
      "aliases": {
        "timestamp": "time",
        "wind_speed": "speed"
      }
    }
    ```
  </RequestExample.Body>
</RequestExample>

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

  <ResponseExample.Body>
    ```json theme={null}
    {
      "id": "dataset_456",
      "name": "Live Wind Data",
      "type": "timeseries-live",
      "url": "https://api.windfarm.com/data",
      "params": {...},
      "data_format": "json",
      "aliases": {...},
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
    ```
  </ResponseExample.Body>
</ResponseExample>

## POST /datasets/geospatial-static

<Note>
  Creates a static geospatial dataset with point, line, or polygon data.
</Note>

```python theme={null}
# Create a static geospatial dataset
dataset = client.datasets.create_geospatial_static(
    name="Wind Turbine Locations",
    data=[...],
    coordinate_system="EPSG:4326",
    geometry_type="Point"
)
```

<RequestExample>
  <RequestExample.Method>POST</RequestExample.Method>
  <RequestExample.URL>/datasets/geospatial-static</RequestExample.URL>

  <RequestExample.Body>
    ```json theme={null}
    {
      "name": "Wind Turbine Locations",
      "data": [
        {
          "geometry": {
            "type": "Point",
            "coordinates": [3.5, 55.2]
          },
          "properties": {
            "name": "Turbine 1",
            "capacity_mw": 3.6
          }
        }
      ],
      "coordinate_system": "EPSG:4326",
      "geometry_type": "Point"
    }
    ```
  </RequestExample.Body>
</RequestExample>

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

  <ResponseExample.Body>
    ```json theme={null}
    {
      "id": "dataset_789",
      "name": "Wind Turbine Locations",
      "type": "geospatial-static",
      "data": [...],
      "coordinate_system": "EPSG:4326",
      "geometry_type": "Point",
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
    ```
  </ResponseExample.Body>
</ResponseExample>

## GET /datasets

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

```python theme={null}
# List all datasets
datasets = client.datasets.list_datasets()
```

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

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

  <ResponseExample.Body>
    ```json theme={null}
    [
      {
        "id": "dataset_123",
        "name": "Wind Farm Production Data",
        "type": "timeseries-static",
        "data": [...],
        "description": "Historical wind farm production data",
        "created_at": "2024-01-01T00:00:00Z",
        "updated_at": "2024-01-01T00:00:00Z"
      },
      {
        "id": "dataset_456",
        "name": "Live Wind Data",
        "type": "timeseries-live",
        "url": "https://api.windfarm.com/data",
        "params": {...},
        "created_at": "2024-01-01T00:00:00Z",
        "updated_at": "2024-01-01T00:00:00Z"
      }
    ]
    ```
  </ResponseExample.Body>
</ResponseExample>

## GET /datasets/{dataset_id}

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

```python theme={null}
# Get a specific dataset by ID string
dataset = client.datasets.get_dataset("dataset_123")

# Or if you have a dataset object
dataset = client.datasets.get_dataset(dataset.id)
```

<RequestExample>
  <RequestExample.Method>GET</RequestExample.Method>
  <RequestExample.URL>/datasets/{dataset_id}</RequestExample.URL>
</RequestExample>

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

  <ResponseExample.Body>
    ```json theme={null}
    {
      "id": "dataset_123",
      "name": "Wind Farm Production Data",
      "type": "timeseries-static",
      "data": [...],
      "description": "Historical wind farm production data",
      "metadata": {...},
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
    ```
  </ResponseExample.Body>
</ResponseExample>

## GET /datasets/{dataset_id}/data

<Note>
  Retrieves dataset data with optional time filtering for live datasets.
</Note>

```python theme={null}
# Get dataset data with time filtering by ID string
data = client.datasets.get_dataset_data(
    "dataset_456",
    start="2024-01-01T00:00:00Z",
    end="2024-01-02T00:00:00Z"
)

# Or if you have a dataset object
data = client.datasets.get_dataset_data(
    dataset.id,
    start="2024-01-01T00:00:00Z",
    end="2024-01-02T00:00:00Z"
)
```

<RequestExample>
  <RequestExample.Method>GET</RequestExample.Method>

  <RequestExample.URL>
    /datasets/{dataset_id}
    /data?start=2024-01-01T00:00:00Z\&end=2024-01-02T00:00:00Z
  </RequestExample.URL>
</RequestExample>

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

  <ResponseExample.Body>
    ```json theme={null}
    {
      "dataset_id": "dataset_456",
      "data": [...],
      "metadata": {
        "total_records": 2,
        "time_range": {
          "start": "2024-01-01T00:00:00Z",
          "end": "2024-01-02T00:00:00Z"
        }
      }
    }
    ```
  </ResponseExample.Body>
</ResponseExample>

## PUT /datasets/{dataset_id}

<Note>Updates a dataset's basic properties (name, description, metadata).</Note>

```python theme={null}
# Update a dataset by ID string
updated_dataset = client.datasets.update_dataset(
    "dataset_123",
    name="Updated Wind Farm Production Data",
    description="Updated historical wind farm production data",
    metadata={...}
)

# Or if you have a dataset object
updated_dataset = client.datasets.update_dataset(
    dataset.id,
    name="Updated Wind Farm Production Data",
    description="Updated historical wind farm production data",
    metadata={...}
)
```

<RequestExample>
  <RequestExample.Method>PUT</RequestExample.Method>
  <RequestExample.URL>/datasets/{dataset_id}</RequestExample.URL>

  <RequestExample.Body>
    ```json theme={null}
    {
      "name": "Updated Wind Farm Production Data",
      "description": "Updated historical wind farm production data",
      "metadata": {
        "location": "North Sea Wind Farm",
        "capacity_mw": 60,
        "last_updated": "2024-01-15"
      }
    }
    ```
  </RequestExample.Body>
</RequestExample>

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

  <ResponseExample.Body>
    ```json theme={null}
    {
      "id": "dataset_123",
      "name": "Updated Wind Farm Production Data",
      "type": "timeseries-static",
      "data": [...],
      "description": "Updated historical wind farm production data",
      "metadata": {...},
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-15T12:00:00Z"
    }
    ```
  </ResponseExample.Body>
</ResponseExample>

## DELETE /datasets/{dataset_id}

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

```python theme={null}
# Delete a dataset by ID string
client.datasets.delete_dataset("dataset_123")

# Or if you have a dataset object
client.datasets.delete_dataset(dataset.id)
```

<RequestExample>
  <RequestExample.Method>DELETE</RequestExample.Method>
  <RequestExample.URL>/datasets/{dataset_id}</RequestExample.URL>
</RequestExample>

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

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

## Dataset Types

### Time Series Datasets

* `timeseries-static` - Pre-loaded historical data
* `timeseries-live` - Real-time data from external APIs

### Geospatial Datasets

* `geospatial-static` - Point, line, or polygon data

### Required Fields

#### Time Series Data

* **Required**: `timestamp` field (ISO 8601 format)
* **Optional**: Any additional numeric or string fields

#### Geospatial Data

* **Geometry**: GeoJSON format (Point, LineString, Polygon)
* **Properties**: Additional metadata for each feature
* **Coordinate System**: EPSG:4326 (WGS84) by default

#### Live Dataset Configuration

* **Data Formats**: JSON, CSV, XML
* **Authentication**: Bearer Token, API Key, Basic Auth
* **Time Filtering**: `start`, `end` parameters (ISO 8601 format)
