POST /v1/fetch
Per-field data fetch for one US coordinate, with full provenance.
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:
sourceandsource_url: the agency and a URL that fetches the same value again.fetched_atanddataset_vintage: when we read it, and which release of the dataset it came from.confidence:high,medium,loworunknown.- An explicit null: a field the source cannot answer comes back as
nullwith a reason, and the request still succeeds.
Try it
Authorizations
X-API-KeystringheaderrequiredYour API key, sent in the header.
Authorization: Bearer <key> also works. Get one free.Headers
X-Request-IDstringOptional. Echoed back on the response; otherwise we generate one.
Body
latnumberrequiredLatitude, WGS84 decimal degrees.
Required range:
18 <= x <= 72lngnumberrequiredLongitude, WGS84 decimal degrees.
Required range:
-180 <= x <= -65fieldsstring[]requiredField 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 elementsResponse
fieldsobjectOne 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_locationobjectThe coordinate the answer is for, with its
source.latnumberLatitude as requested.
lngnumberLongitude as requested.
fetched_atstringWhen 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.