### Get Dataset Updates (JavaScript) Source: https://docs.gridstatus.io/developers/api-reference/dataset-updates This JavaScript example shows how to use the fetch API to get dataset updates from the GridStatus API. It includes setting the API key via a header. ```JavaScript fetch('https://api.gridstatus.io/v1/dataset-updates/{dataset_id}', { method: 'GET', headers: { 'x-api-key': 'YOUR_API_KEY' } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Get API Info Response (JSON) Source: https://docs.gridstatus.io/developers/api-reference/api-info Example of a successful JSON response containing the API name and version. ```json { "name": "Grid Status API", "version": "1.3.0" } ``` -------------------------------- ### List Datasets via cURL Source: https://docs.gridstatus.io/developers/api-reference/dataset-metadata This example demonstrates how to use cURL to fetch a list of datasets from the Gridstatus.io API. It shows a basic GET request to the specified endpoint. ```cURL curl -X GET "https://api.gridstatus.io/v1/datasets" -H "accept: */*" ``` -------------------------------- ### Get Dataset Updates (Python) Source: https://docs.gridstatus.io/developers/api-reference/dataset-updates This Python example uses the 'requests' library to retrieve dataset updates from the GridStatus API. It demonstrates how to pass the API key in the headers. ```Python import requests url = "https://api.gridstatus.io/v1/dataset-updates/{dataset_id}" headers = { "x-api-key": "YOUR_API_KEY" } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") ``` -------------------------------- ### Install gridstatusio Python Package Source: https://docs.gridstatus.io/developers/getting-started/python-client Installs the gridstatusio Python client library using pip. It is recommended to use a virtual environment. ```Bash pip install gridstatusio ``` -------------------------------- ### API Info Response Example Source: https://docs.gridstatus.io/developers/api-reference An example of a successful JSON response from the Grid Status API, containing the API's name and version. ```json { "name": "Grid Status API", "version": "1.3.0" } ``` -------------------------------- ### Offset Pagination URL Example Source: https://docs.gridstatus.io/developers/concepts/pagination An example of how to construct a request URL for offset-based pagination, specifying the desired page number and page size. ```http ?page=2&page_size=100 ``` -------------------------------- ### Get Daily Peak Report (JavaScript) Source: https://docs.gridstatus.io/developers/api-reference/reports Demonstrates fetching a daily peak report using JavaScript's fetch API. This example includes setting the API key in the headers and specifying the date and ISO. ```JavaScript async function getDailyPeakReport(iso, date, apiKey) { const url = `https://api.gridstatus.io/v1/reports/daily_peak/${iso}?date=${date}`; const headers = { 'x-api-key': apiKey }; try { const response = await fetch(url, { method: 'GET', headers: headers }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); return data; } catch (error) { console.error('Error fetching daily peak report:', error); return null; } } // Example usage: // const iso = 'PJM'; // const date = '2025-05-16'; // const apiKey = 'YOUR_API_KEY'; // getDailyPeakReport(iso, date, apiKey).then(data => console.log(data)); ``` -------------------------------- ### Get API Info (cURL) Source: https://docs.gridstatus.io/developers/api-reference Retrieves general information about the Grid Status API, including its name and version. This example shows how to make the request using cURL. ```bash GET /v1/ HTTP/1.1 Host: api.gridstatus.io Accept: */* ``` -------------------------------- ### Get API Info (JavaScript) Source: https://docs.gridstatus.io/developers/api-reference Retrieves general information about the Grid Status API, including its name and version. This example shows how to make the request using JavaScript's fetch API. ```javascript fetch('https://api.gridstatus.io/v1/') .then(response => response.json()) .then(data => console.log(data)); ``` -------------------------------- ### Get API Info (JavaScript) Source: https://docs.gridstatus.io/developers/api-reference/api-info Demonstrates how to fetch API information using JavaScript. ```javascript fetch('https://api.gridstatus.io/v1/') .then(response => response.json()) .then(data => console.log(data)); ``` -------------------------------- ### Example Successful Query Response Source: https://docs.gridstatus.io/developers/api-reference/query-data This is an example of a successful response when querying a dataset. It includes a status code, the queried data, and metadata about the pagination and dataset. ```JSON { "status_code": 200, "data": [ { "interval_start_local": "2018-04-10T00:00:00-07:00", "interval_start_utc": "2018-04-10T07:00:00+00:00", "interval_end_local": "2018-04-10T00:05:00-07:00", "interval_end_utc": "2018-04-10T07:05:00+00:00", "load": 22459 }, { "interval_start_local": "2018-04-10T00:05:00-07:00", "interval_start_utc": "2018-04-10T07:05:00+00:00", "interval_end_local": "2018-04-10T00:10:00-07:00", "interval_end_utc": "2018-04-10T07:10:00+00:00", "load": 22371 }, { "interval_start_local": "2018-04-10T00:10:00-07:00", "interval_start_utc": "2018-04-10T07:10:00+00:00", "interval_end_local": "2018-04-10T00:15:00-07:00", "interval_end_utc": "2018-04-10T07:15:00+00:00", "load": 22330 } ], "meta": { "page": 1, "limit": 1000, "page_size": 100000, "hasNextPage": false }, "dataset_metadata": { "id": "caiso_load", "name": "CAISO Load", "time_index_column": "interval_start_utc", "all_columns": [ { "name": "interval_start_local", "type": "TIMESTAMP", "is_datetime": true, "is_numeric": false }, { "name": "interval_start_utc", "type": "TIMESTAMP", "is_datetime": true, "is_numeric": false } ] } } ``` -------------------------------- ### Get API Info (Python) Source: https://docs.gridstatus.io/developers/api-reference Retrieves general information about the Grid Status API, including its name and version. This example shows how to make the request using Python's requests library. ```python import requests response = requests.get('https://api.gridstatus.io/v1/') data = response.json() print(data) ``` -------------------------------- ### Successful JSON Response Example Source: https://docs.gridstatus.io/developers/api-reference/query-data An example of a successful JSON response when querying a dataset. It includes the status code, the queried data, pagination metadata, and dataset-specific metadata. ```json { "status_code": 200, "data": [ { "interval_start_local": "2018-04-10T00:00:00-07:00", "interval_start_utc": "2018-04-10T07:00:00+00:00", "interval_end_local": "2018-04-10T00:05:00-07:00", "interval_end_utc": "2018-04-10T07:05:00+00:00", "load": 22459 }, { "interval_start_local": "2018-04-10T00:05:00-07:00", "interval_start_utc": "2018-04-10T07:05:00+00:00", "interval_end_local": "2018-04-10T00:10:00-07:00", "interval_end_utc": "2018-04-10T07:10:00+00:00", "load": 22371 }, { "interval_start_local": "2018-04-10T00:10:00-07:00", "interval_start_utc": "2018-04-10T07:10:00+00:00", "interval_end_local": "2018-04-10T00:15:00-07:00", "interval_end_utc": "2018-04-10T07:15:00+00:00", "load": 22330 } ], "meta": { "page": 1, "limit": 1000, "page_size": 100000, "hasNextPage": false }, "dataset_metadata": { "id": "caiso_load", "name": "CAISO Load", "time_index_column": "interval_start_utc", "all_columns": [ { "name": "interval_start_local", "type": "TIMESTAMP", "is_datetime": true, "is_numeric": false }, { "name": "interval_start_utc", "type": "TIMESTAMP", "is_datetime": true, "is_numeric": false }, { "name": "interval_end_local", "type": "TIMESTAMP", "is_datetime": true, "is_numeric": false }, { "name": "interval_end_utc", "type": "TIMESTAMP", "is_datetime": true, "is_numeric": false }, { "name": "load", "type": "INTEGER", "is_datetime": false, "is_numeric": true } ] } } ``` -------------------------------- ### Get Daily Peak Report (cURL) Source: https://docs.gridstatus.io/developers/api-reference/reports Example of how to retrieve a daily peak report using cURL. Replace '{iso}' with the desired ISO and ensure your API key is included. ```cURL curl -X GET "https://api.gridstatus.io/v1/reports/daily_peak/{iso}?date=YYYY-MM-DD" -H "x-api-key: YOUR_API_KEY" ``` -------------------------------- ### Grid Status Prebuilt Components Source: https://docs.gridstatus.io/analytics/dashboards Details the prebuilt components available in Grid Status for simplifying dashboard setup. Includes options like Saved Chart, Most Recent Value, Historical Profile Graph, Embed Webpage, and prebuilt components by ISOs. ```Markdown ## Prebuilt Components To simplify setting up your own dashboard, a selection of prebuilt elements are available. These components can be customized by ISO and graph type. **Saved Chart** : View a list of charts created and add, or remove, them to your dashboard. **Most Recent Value:** Select the dataset and data series. To add to dashboard, set the unit and delta for observed value. **Historical Profile Graph** : These graphs are also located on _Live Dashboards_ _****_ on the _Trends and Profiles_ __ tab. Customize the graph by selecting the dataset, series, and setting the number of days included in your profile graph. To add granularity, you can add lines for the mean, maximum, and minimum. To view specific historical data, you can highlight data for today, yesterday, or all days. **Embed Webpage** : Embed other webpages. Note that not every webpage works since it depends on the originating site's permissions. You can view an example by visiting our Winter Hazards, Outlook, and Operations dashboard. **Prebuilt by ISOs:** Select _+ Add_ → _Prebuilt by ISOs_ from the upper right corner. From the menu, you can choose: * LMP * Fuel Mix * Load * Renewables * ISO's Graph Type (ie. Zonal Load, Outages, Curtailment) These graphs are the same ones that appear on the ISO Live pages from the Grid Status home page. **Prebuilt Components:** Select _+ Add_ → _Prebuilt Components_ from the upper right corner. From the menu, you can choose: * ISO Latest Status * ERCOT 4CP Table: an ERCOT-specific table that lists estimated, real-time 4CP intervals and includes other relevant data series such as storage load due to charging * Nodal Price Map: Filter by market and select type of data, map criteria, and style. ``` -------------------------------- ### Market Data Records Source: https://docs.gridstatus.io/developers/api-reference/reports This snippet shows an array of JSON objects, each representing market data for a specific location and time interval. It includes interval start and end times, location details, and financial/energy metrics like LMP, energy, congestion, and loss. ```json [ { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "PSEG", "location_type": "ZONE", "lmp": 87.408946, "energy": 155.76, "congestion": -71.727043, "loss": 3.375989 }, { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "RECO", "location_type": "ZONE", "lmp": 84.78116, "energy": 155.76, "congestion": -74.6739, "loss": 3.69506 }, { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "WESTERN HUB", "location_type": "HUB", "lmp": 144.9218, "energy": 155.76, "congestion": -15.622671, "loss": 4.784471 }, { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "WEST INT HUB", "location_type": "HUB", "lmp": 147.074394, "energy": 155.76, "congestion": -7.775049, "loss": -0.910557 } ] ``` -------------------------------- ### List Datasets via HTTP Source: https://docs.gridstatus.io/developers/api-reference/dataset-metadata This snippet shows how to make an HTTP GET request to the Gridstatus.io API to retrieve a list of available datasets. It includes the necessary host and accept headers. ```HTTP GET /v1/datasets HTTP/1.1 Host: api.gridstatus.io Accept: */* ``` -------------------------------- ### Authenticate API Request with Query Parameter Source: https://docs.gridstatus.io/developers/getting-started This snippet shows how to authenticate an API request by appending your API key as the 'api_key' query parameter. Replace 'YOUR_API_KEY' with your actual key. ```bash curl "https://api.gridstatus.io/v1/datasets?api_key=YOUR_API_KEY" ``` -------------------------------- ### Display Electricity Market Data Source: https://docs.gridstatus.io/developers/api-reference/reports This snippet shows a structured JSON-like format for electricity market data. It includes details such as interval start and end times, location identifiers, location types, and key market price components like LMP (Locational Marginal Price), energy, congestion, and loss. ```json { "interval_start_market": "2025-05-16T16:00:00", "interval_end_market": "2025-05-16T16:00:00", "location": "DOM", "location_type": "ZONE", "lmp": 486.712458, "energy": 137.01, "congestion": 341.984566, "loss": 7.717892 } ``` ```json { "interval_start_market": "2025-05-16T19:00:00", "interval_end_market": "2025-05-16T20:00:00", "location": "DOMINION HUB", "location_type": "HUB", "lmp": 191.920648, "energy": 108.56, "congestion": 80.191854, "loss": 3.168794 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "DPL", "location_type": "ZONE", "lmp": 112.420637, "energy": 155.76, "congestion": -52.112548, "loss": 8.773185 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "DUQ", "location_type": "ZONE", "lmp": 83.736817, "energy": 155.76, "congestion": -70.621802, "loss": -1.401381 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "EASTERN HUB", "location_type": "HUB", "lmp": 114.075813, "energy": 155.76, "congestion": -50.283271, "loss": 8.599084 } ``` ```json { "interval_start_market": "2025-05-16T19:00:00", "interval_end_market": "2025-05-16T20:00:00", "location": "EKPC", "location_type": "ZONE", "lmp": 88.626441, "energy": 108.56, "congestion": -14.0673, "loss": -5.866259 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "JCPL", "location_type": "ZONE", "lmp": 88.978929, "energy": 155.76, "congestion": -69.921157, "loss": 3.140086 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "METED", "location_type": "ZONE", "lmp": 115.99368, "energy": 155.76, "congestion": -43.41339, "loss": 3.64707 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "MID-ATL/APS", "location_type": "ZONE", "lmp": 209.16278, "energy": 155.76, "congestion": 42.553516, "loss": 10.849265 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "NEW JERSEY HUB", "location_type": "HUB", "lmp": 89.631444, "energy": 155.76, "congestion": -69.848054, "loss": 3.719498 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "N ILLINOIS HUB", "location_type": "HUB", "lmp": 64.797684, "energy": 155.76, "congestion": -78.77356, "loss": -12.188756 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "OHIO HUB", "location_type": "HUB", "lmp": 92.687787, "energy": 155.76, "congestion": -57.230401, "loss": -5.841812 } ``` ```json { "interval_start_market": "2025-05-16T19:00:00", "interval_end_market": "2025-05-16T20:00:00", "location": "OVEC", "location_type": "ZONE", "lmp": 88.5, "energy": 108.56, "congestion": -15.33, "loss": -4.73 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "PECO", "location_type": "ZONE", "lmp": 95.395634, "energy": 155.76, "congestion": -64.371292, "loss": 4.006926 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "PENELEC", "location_type": "ZONE", "lmp": 80.674772, "energy": 155.76, "congestion": -78.416136, "loss": 3.330908 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "PEPCO", "location_type": "ZONE", "lmp": 262.645429, "energy": 155.76, "congestion": 95.992709, "loss": 10.89272 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "PJM-RTO", "location_type": "ZONE", "lmp": 144.182684, "energy": 155.76, "congestion": -14.599713, "loss": 3.022396 } ``` ```json { "interval_start_market": "2025-05-16T17:00:00", "interval_end_market": "2025-05-16T18:00:00", "location": "PPL", "location_type": "ZONE", "lmp": 86.842633, "energy": 155.76, "congestion": -69.501223, "loss": 0.583856 } ``` -------------------------------- ### Get Daily Peak Report (HTTP) Source: https://docs.gridstatus.io/developers/api-reference/reports This snippet shows the HTTP request structure for fetching a daily peak report from the GridStatus API. It includes the GET method, host, and accept headers. ```HTTP GET /v1/reports/daily_peak/{iso} HTTP/1.1 Host: api.gridstatus.io Accept: */* ``` -------------------------------- ### Authenticate API Request with Header Source: https://docs.gridstatus.io/developers/getting-started This snippet demonstrates how to authenticate an API request by including your API key in the 'x-api-key' header. Replace 'YOUR_API_KEY' with your actual key. ```bash curl -H "x-api-key: YOUR_API_KEY" https://api.gridstatus.io/v1/datasets ```