Geolocation
The different ways to tell the API which area you want data for.
Getting data for a specific area can be done in multiple ways:
1. Use the zone parameter
Find the zone-key by calling
/v4/zones with your auth-token as header and you can see details about the zones you have access to.
2. Use coordinates with lon and lat parameters
In cases where it's undesirable to send latitude and longitude with each request, it's possible to use the
/v4/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.