# Responses and provenance

> Every field carries its source. Here is how to read each part of a response.

Source: https://docs.invariant-ai.com/responses

## Response shape

```json
{
  "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"
  }
}
```

## Field object

| Key | Type | Meaning |
| --- | --- | --- |
| `value` | number, string, boolean or null | The answer. `null` when `status` is not `ok`. |
| `unit` | string | Unit of `value`, for example `meters`. |
| `status` | `ok`, `absent`, `failed` | See below. |
| `source` | string | Stable label of the source that answered, for example `USGS_3DEP_COG`. |
| `source_url` | string | A URL that re-fetches this value from the agency. |
| `confidence` | `high`, `medium`, `low`, `unknown` | How much to trust the value; the rule is per field. |
| `fetched_at` | timestamp | When the source answered. Unchanged when served from cache. |
| `dataset_vintage` | string or null | Which edition, resolution or acquisition the value came from. |
| `ttl_seconds` | integer | How long the value is reasonable to reuse. |
| `cached` | boolean | `true` when served from our cache. |
| `notes` | string or null | Context such as the vertical datum, or why a value is missing. |

## Status

| `status` | `value` | What happened | What to do |
| --- | --- | --- | --- |
| `ok` | present | The source answered. | Use it. |
| `absent` | `null` | The source says it has no data at this point. | Treat as a real "no data here". It is safe to cache. |
| `failed` | `null` | The source could not answer: timeout, outage or a bad response. | The field is also in `partial_failures`. Retry if `retryable` is `true`. Do not cache it. |

> Never cache a failed field. A failed null means "we could not find out", not "there is nothing here". Retry it later.

## partial\_failures

One entry per failed field, so you can retry only what failed:

```json
"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
  }
]
```

The request itself still returns `200`; the other fields are unaffected.

### When a source is down

If a source fails with a retryable error three times in a row, the API stops calling it for 60 seconds. During that time its fields return `failed` straight away, with `retryable: true` and an error that says the source is being skipped. This means you don't wait out a timeout on every request while a provider is down. After 60 seconds one request tries the source again, and if it answers, normal service resumes.

`GET /readyz` lists any skipped sources in `open_circuit_breakers`.
