Getting Started
All requests are authenticated with an API key passed in the X-API-Key header. Keys are tier-scoped, rotatable, and can be optionally restricted to a list of source IPs.
The India Energy Atlas API uses a simple header-based authentication model. There is one credential — the API key — and it is carried in every request.
| Aspect | Details |
|---|---|
| Header | X-API-Key |
| Key format | iea_live_<random-32-char> |
| Storage | Only the SHA-256 hash is kept server-side. You see the secret once. |
| Tier binding | Tier is attached to the key record, not the key string. |
| Rotation | Instant revoke + regenerate from Settings. |
Use separate keys per environment
Keep dev, staging, and prod on different keys so you can revoke one without taking the others down. One-to-one key-per-machine also makes IP allow-listing tractable.
Pass the key in the X-API-Key header of every request. Do not put the key in the URL, query string, or body — those leak into logs and referrers.
export ATLAS_API_KEY="iea_live_YOUR_KEY"
curl -H "X-API-Key: ${ATLAS_API_KEY}" \
"https://api.energymap.in/developer/v1/ping"On Starter and above, you can scope a key to a comma-separated list of source IPv4 addresses or CIDR blocks. Requests from any other IP return 403 ip_not_allowed.
When to use it
Server-to-server keys (ETL, cron jobs, backends) have a fixed egress IP — pin them. For keys used from laptops, CI runners, or dynamic cloud IPs, leave the allow-list empty.
POST /api/developer/keys
Authorization: Bearer <clerk-jwt>
Content-Type: application/json
{
"name": "prod-etl",
"ip_allow_list": ["203.0.113.42", "203.0.113.64/29"]
}401 api_key_revoked. Revocation is permanent — you cannot un-revoke a key.expires_at. Expired keys return 401 api_key_expired..env files gitignored, secrets managers (Vault, Doppler, Secrets Manager), or CI secret stores.No browser-safe key
There is no "publishable" variant of the key. Every key has the full tier's quota — treat all keys as server-side secrets.