Getting data for a specific area can be done in multiple ways:
- Use the
zone
parameter - Use coordinates with
lon
andlat
parameters - Use a look-up by data center, with the
dataCenterProvider
anddataCenterRegion
parameters
Find the zone-key by calling /v3/zones
with your auth-token as header and you can see details about the zones you have access to
Find available data centers by calling /v3/data-centers
In cases where it's undesireable to send latitude and longitude with each request, it's possible to use the /v3/zone
endpoint to locate the zone that corresponds with a set of coordinates ahead of time. If it is not possible to send coordinates to Electricity Maps' servers (e.g. for privacy reasons), we have built a script that can map coordinates to zones fully offline: https://github.com/electricitymaps/zone-finder
Auto fallback: If no zone is detected (or we don't have data for that area), the API will attempt to use your current location based on IP of the caller. This can be actively disabled by setting the disableCallerLookup
query parameter to true