Get an API key
Fetch

POST /v1/fetch

Per-field data fetch for one US coordinate, with full provenance.

POST/v1/fetch

Fetch returns the public fields you ask for at one US coordinate. Each value comes with its source.

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"]}'
{
  "lat": 39.0438,
  "lng": -77.4874,
  "fetched_at": "2026-11-22T03:26:14.083456Z",
  "fields": {
    "elevation": {
      "value": 89.63117218,
      "unit": "meters",
      "status": "ok",
      "source": "USGS_3DEP_COG",
      "source_url": "https://prd-tnm.s3.amazonaws.com/StagedProducts/Elevation/13/TIFF/current/n40w078/USGS_13_n40w078.tif",
      "confidence": "medium",
      "fetched_at": "2026-11-22T03:26:14.082945Z",
      "dataset_vintage": "USGS 3DEP 1/3 arc-second seamless DEM, current edition; tile n40w078; nominal resolution 10 m",
      "ttl_seconds": 86400,
      "cached": false,
      "notes": "metres; vertical datum NAVD88"
    }
  },
  "partial_failures": [],
  "resolved_location": {
    "lat": 39.0438,
    "lng": -77.4874,
    "source": "coordinate"
  }
}

Every value carries:

  • source and source_url: the agency and a URL that fetches the same value again.
  • fetched_at and dataset_vintage: when we read it, and which release of the dataset it came from.
  • confidence: high, medium, low or unknown.
  • An explicit null: a field the source cannot answer comes back as null with a reason, and the request still succeeds.

Try it

Live request
Response
Send a request to see the live response here.

Authorizations

X-API-Keystringheaderrequired
Your API key, sent in the header. Authorization: Bearer <key> also works. Get one free.

Headers

X-Request-IDstring
Optional. Echoed back on the response; otherwise we generate one.

Body

application/json
latnumberrequired
Latitude, WGS84 decimal degrees.
Required range: 18 <= x <= 72
lngnumberrequired
Longitude, WGS84 decimal degrees.
Required range: -180 <= x <= -65
fieldsstring[]required
Field names from GET /v1/meta/fields. Duplicates are ignored. Unknown keys in the body are rejected with 400 invalid_request.
Required array length: 1 - 50 elements

Response

200 · application/json
fieldsobject
One object per requested field, in request order: value, unit, status, source, source_url, confidence, fetched_at, dataset_vintage, cached. Explained in Responses.
partial_failuresobject[]
Fields whose source could not answer, each with field, source, error and retryable. A failed source still returns 200.
resolved_locationobject
The coordinate the answer is for, with its source.
latnumber
Latitude as requested.
lngnumber
Longitude as requested.
fetched_atstring
When this response was assembled, ISO 8601 UTC.

A failed source

{
  "fields": {
    "elevation": {
      "value": null,
      "status": "failed",
      "source": "USGS_EPQS",
      "confidence": "unknown",
      "notes": "USGS_3DEP_COG: 3DEP tile read failed: TimeoutError; USGS_EPQS: EPQS timed out after 20 s"
    }
  },
  "partial_failures": [
    {
      "field": "elevation",
      "source": "USGS_EPQS",
      "error": "USGS_3DEP_COG: 3DEP tile read failed: TimeoutError; USGS_EPQS: EPQS timed out after 20 s",
      "retryable": true
    }
  ]
}

Errors

HTTP error When
400 invalid_request Malformed body
400 coord_out_of_bounds Outside the US envelope
400 fields_unknown Unknown field name
401 auth_missing / auth_invalid No key, or key not recognised

Full list on Errors.