GIE API in Python: build a storage dataset you can audit
By OilPriceAPI · Published November 7, 2026
Getting JSON into Python is the easy part. The useful output is a table whose gas days, units, and quality status survive into your analysis. This workflow calls GIE's direct AGSI API with a GIE key. It does not describe an OilPriceAPI response or require an OilPriceAPI key.
The downloadable loader follows the EU aggregate request and pagination pattern in GIE's version 007 manual. That manual is dated 2022; check current GIE account and operational guidance before scheduling production pulls. The loader archives every raw page, rejects duplicate gas days and malformed numbers, then writes a CSV and quality report.
Download and try the loader
Create an API account through GIE AGSI. Keep GIE_API_KEY in your local environment or secret manager, never a shared notebook or browser script. Install requests, then run a small historical range.
python -m pip install requests
python gie_storage.py --start 2025-01-01 --end 2025-01-07 --output eu-storageThe dates are query inputs, not a completeness claim. Inspect eu-storage/report.json for missing days, unconfirmed observations, and missing inventory before using the CSV.
Understand the request boundary
GET https://agsi.gie.eu/api?type=eu&from=YYYY-MM-DD&to=YYYY-MM-DD&page=1&size=300
x-key: your GIE keyThe loader follows last_page, waits between pages, and applies bounded retries for rate limits and server errors. Authentication errors stop the run. It supports only the EU aggregate; changing a label to “Germany” would not change the source query or prevent double counting.
Keep the CSV auditable
These columns are this tutorial's normalized interchange format, not vendor API field names. Keep the raw response pages alongside them to investigate transformation mistakes and later source revisions.
| Column | Meaning |
|---|---|
gas_day | The source gas day, not the download date |
inventory_twh | Stored energy in TWh; a missing value stays blank |
capacity_twh | Reported working gas volume in TWh |
fill_pct | Filling percentage points; 60 means 60% |
status | Source quality code, including estimated or unconfirmed |
retrieved_at_utc | When this run retrieved the response |
An empty inventory cell does not mean zero gas in storage. The loader leaves missing numeric values blank and rejects malformed nonempty numbers. A chart with missing days should show a gap or warning rather than silently carrying the last value forward.
Calculate changes without mixing units
A fictional increase from 60 to 60.4 TWh is 0.4 TWh, or 400 GWh. If it spans two days, the daily path is unknown. This optional pandas calculation leaves nonconsecutive changes blank:
import pandas as pd
storage = pd.read_csv("eu-storage/storage.csv", parse_dates=["gas_day"])
storage = storage.sort_values("gas_day")
consecutive = storage["gas_day"].diff().dt.days.eq(1)
storage["daily_inventory_change_gwh"] = (
storage["inventory_twh"].diff().mul(1000).where(consecutive)
)Inventory change is not the same as GIE's reported gross injection and withdrawal fields. Plot gas day on the horizontal axis, inventory TWh on one chart, and filling percentage separately.
Reproduce and qualify the result
Store retrieval time and raw pages. Keep revised pulls separately. Credit GIE AGSI in reports and retain relevant notices. When joining storage with prices, preserve each dataset's observation and publication time: equal calendar dates do not prove the data was available simultaneously. The storage versus TTF guide demonstrates a publication-time join.
For a separate TTF price leg, inspect the Dutch TTF API guide. For OilPriceAPI storage access, start with the German storage page and verify the dataset and entitlement; GIE credentials do not work against another service.