Get an API key
Get started

Authentication

Send your API key on every request that reads data.

Send the key

Use the X-API-Key header:

curl -s https://api.invariant-ai.com/v1/fetch \
  -H "X-API-Key: $INVARIANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lat": 39.0438, "lng": -77.4874, "fields": ["elevation"]}'

Authorization: Bearer <key> works too. Send one or the other; two different keys in one request return 400 auth_conflict.

Which routes need a key

Route Key
POST /v1/fetch Required
GET /v1/keys/me, DELETE /v1/keys/me Required
POST /v1/keys Not needed
GET /v1/meta/fields Not needed
GET /healthz, GET /readyz Not needed

Keep keys safe

  • Keys start with ief_. Treat them like passwords: keep them in environment variables or a secret manager, not in code or front-end bundles.
  • We never store a key, only its SHA-256 hash, so we cannot recover one. Create a new key instead.
  • Revoke a key you no longer need with DELETE /v1/keys/me. It stops working within a minute everywhere.

Auth errors

HTTP error Meaning
401 auth_missing No key on the request
401 auth_invalid Key not recognised, or revoked
400 auth_conflict Two different keys sent
503 auth_unavailable Key service briefly unavailable; retry