- Status: Active; contracts locked by
tests/test_api_contracts.py - Last updated: 2026-06-29
- Base URL (dev):
http://localhost:8000 - Base URL (prod): GCP Cloud Run custom domain (see ADR-0008)
- OpenAPI spec:
GET /openapi.json(auto-generated by FastAPI) - Interactive docs:
GET /docs(Swagger UI, dev only) - Total endpoints: 21
| Convention | Value |
|---|---|
| Content-Type | application/json |
| Timestamps | ISO-8601 UTC strings (e.g. "2024-02-08T00:00:00+00:00") |
| Coordinates | GeoJSON (lon, lat order; WGS-84) |
| Evidence classes | "measured" · "modeled" · "inferred" (INV-3) |
| Attribution | Responses with Open-Meteo data carry "_attribution": "Weather data by Open-Meteo.com (CC BY 4.0)" |
| Error body | {"detail": "<human-readable message>"} |
| Method | Path | Tag | Description |
|---|---|---|---|
| GET | /health |
meta | Liveness probe |
| GET | /ready |
meta | Readiness probe |
| GET | /status |
meta | Full system status + quotas |
| GET | /aois |
aois | List all configured AOIs |
| GET | /aois/{aoi_id} |
aois | Single AOI by ID |
| GET | /aois/{aoi_id}/observations |
observations | Observations for AOI (filterable) |
| GET | /aois/{aoi_id}/predictions |
predictions | Predictions with ForecastFrames |
| GET | /aois/{aoi_id}/impact |
impact | Impact assessments |
| GET | /aois/{aoi_id}/choke-points |
hydro | Hydrological choke points (D4) |
| GET | /aois/{aoi_id}/flood-risk |
hydro | FloodRisk predictions (D3/D4) |
| GET | /aois/{aoi_id}/acid-risk |
hydro | AcidDepositionRisk predictions (D3) |
| GET | /waterbodies |
waterbody | List water body target IDs |
| GET | /waterbody/{target_id}/observations |
waterbody | WQ observations for a water body |
| GET | /waterbody/{target_id}/forecasts |
waterbody | Skill-gate-filtered WQ forecasts |
| GET | /waterbody/{target_id}/raw_predictions |
waterbody | All WQ predictions (no gate) |
| GET | /waterbody/{target_id}/anomalies |
waterbody | Anomaly predictions for a water body |
| GET | /waterbody/{target_id}/report |
ai | Grounded NL situation report |
| GET | /anomaly/{prediction_id}/explanation |
ai | Grounded anomaly explanation |
| POST | /query |
ai | NL query (read-only, grounded) |
| GET | /openapi.json |
— | OpenAPI schema |
| GET | /docs |
— | Swagger UI (dev only) |
Liveness probe. Always returns 200 if the server process is running.
Response 200:
{
"status": "ok",
"version": "0.1.0"
}Readiness probe. Returns 200 only if the SQLite store is accessible. Returns 503 otherwise. Used by load balancers and orchestrators to determine when the instance is serving traffic.
Response 200:
{ "status": "ready" }Response 503:
{ "status": "not_ready", "reason": "store ping failed: ..." }Full system status: version, store health, last analysis run timestamp, quota consumption, and a per-domain run summary.
Response 200:
{
"version": "0.1.0",
"store_accessible": true,
"last_analysis_run_at": "2024-02-07T12:00:00+00:00",
"quota": {
"cdse_bytes_today": 124000000,
"cdse_daily_limit_gb": 1.0,
"cdse_remaining_bytes": 950000000
},
"domain_runs": [
{
"domain_id": "marine_oil",
"aoi_id": "tobago",
"last_run_at": "2024-02-07T12:00:00+00:00",
"last_run_status": "ok",
"scenes_fetched": 1,
"observations_created": 3,
"bytes_used": 124000000
}
],
"open_meteo_calls_today": 847
}List all configured Areas of Interest from config/aois/*.geojson.
Response 200:
{
"items": [
{
"id": "tobago",
"name": "Tobago AOI",
"geometry": { "type": "Polygon", "coordinates": [[...]] },
"domains": ["marine_oil", "inland_wq", "weather_hydro", "hydro_chokepoints"],
"active": true
}
],
"count": 1
}Return a single AOI by ID (slug).
Path params: aoi_id — AOI slug matching the filename in config/aois/
Response 200: AOISchema (same shape as items above)
Response 404:
{"detail": "AOI 'unknown' not found"}List Observations for an AOI. Observations are linked via their parent AnalysisRun.
Supports filtering by status and observation type.
Query params:
status(optional) —candidate|confirmed|dismissed|archivedobs_type(optional) —oil_slick|chlorophyll_a|turbidity|cdom|surface_temp|precip_series|discharge_series|so2_series|no2_series
Response 200:
{
"items": [
{
"id": "obs-001",
"analysis_run_id": "run-001",
"scene_id": "S1A_IW_GRDH_...",
"obs_type": "oil_slick",
"evidence_class": "measured",
"geometry": { "type": "Polygon", "coordinates": [[...]] },
"area_km2": 5.0,
"confidence": 0.85,
"status": "confirmed",
"created_at": "2024-02-07T12:00:00+00:00"
}
],
"count": 1
}INV-3 guarantee: evidence_class is always one of "measured", "modeled", "inferred".
Oil-slick observations from SAR: "measured". WQ optical proxies: "measured" (calibration-dependent).
Atmospheric derived series: "measured" (ERA5 historical) or "modeled" (forecast). Choke-point geometry: "inferred".
List Predictions for an AOI, with embedded ForecastFrames.
Carries _attribution required by the Open-Meteo CC BY 4.0 licence.
Response 200:
{
"items": [
{
"id": "pred-001",
"predictor_id": "oil_trajectory_v1",
"kind": "trajectory",
"evidence_class": "modeled",
"uncertainty": { "particle_spread_km": 18.0 },
"created_at": "2024-02-07T12:00:00+00:00",
"frames": [
{
"id": "frame-001",
"prediction_id": "pred-001",
"valid_at": "2024-02-08T00:00:00+00:00",
"footprint": { "type": "Polygon", "coordinates": [[...]] },
"particle_count": 1000,
"stats": { "mean_lon": -61.25, "mean_lat": 11.15, "spread_km": 12.3 }
}
]
}
],
"count": 1,
"_attribution": "Weather data by Open-Meteo.com (CC BY 4.0)"
}INV-9 guarantee: uncertainty is always present and non-empty.
Attribution: Preserve _attribution in any UI or downstream system displaying prediction data.
List ImpactAssessments for all predictions in an AOI. Each assessment links a Prediction to an ExposureLayer with an estimated time of arrival (ETA).
Response 200:
{
"items": [
{
"id": "ia-001",
"prediction_id": "pred-001",
"exposure_layer_id": "coast-tobago",
"valid_at": "2024-02-08T00:00:00+00:00",
"eta_hours": 24.0,
"metrics": { "coast_length_km": 12.5 }
}
],
"count": 1,
"_attribution": "Weather data by Open-Meteo.com (CC BY 4.0)"
}Return all hydrological choke points for an AOI, sorted by constriction_score descending.
Choke points are derived from DEM flow-accumulation analysis (D4 domain).
Response 200:
{
"items": [
{
"id": "cp-001",
"aoi_id": "tobago",
"location": { "type": "Point", "coordinates": [-61.35, 10.62] },
"upstream_area_km2": 45.3,
"constriction_score": 0.87,
"dem_source": "Copernicus DEM GLO-30",
"evidence_class": "inferred"
}
],
"count": 3
}INV-3 note: evidence_class is always "inferred" — choke points are derived from DEM
flow-accumulation modelling, not directly measured from orbit.
Return FloodRisk predictions for an AOI. The FloodRisk predictor combines precipitation forecast, GloFAS river discharge, and maximum choke-point constriction into a 0–1 risk score.
Response 200:
{
"items": [
{
"id": "pred-002",
"predictor_id": "FloodRisk",
"kind": "risk",
"evidence_class": "modeled",
"label": "modeled flood risk (not a measured flood)",
"risk_score": 0.71,
"risk_level": "high",
"acid_risk_index": null,
"uncertainty": { "risk_score": 0.71, "component_precip": 0.8, "component_discharge": 0.6, "component_constriction": 0.87 },
"created_at": "2024-02-07T12:00:00+00:00"
}
],
"count": 1
}Honesty label: label always reads "modeled flood risk (not a measured flood)". This is
not a deterministic flood inundation map — it is a probabilistic risk index.
Risk levels: low (< 0.35) · medium (0.35–0.55) · high (0.55–0.75) · extreme (≥ 0.75)
Return AcidDepositionRisk predictions for an AOI. The index combines SO₂ and NO₂ atmospheric concentrations with precipitation accumulation into a 0–10 scale.
Response 200:
{
"items": [
{
"id": "pred-003",
"predictor_id": "AcidDepositionRisk",
"kind": "risk",
"evidence_class": "modeled",
"label": "modeled acid-deposition risk index (0–10 scale) — NOT a pH measurement",
"risk_score": null,
"risk_level": null,
"acid_risk_index": 6.8,
"uncertainty": { "acid_risk_index": 6.8 },
"created_at": "2024-02-07T12:00:00+00:00"
}
],
"count": 1
}Honesty label: label always specifies this is not a pH measurement. The acid-deposition
risk index is an atmospheric-precursor indicator, not a water-body pH reading.
List all water body target IDs that have WQ observations in the store.
Response 200:
{
"target_ids": ["lake-nariva", "river-ortoire"],
"count": 2
}Return WQ Observations for a water body, optionally filtered by obs_type.
Use this endpoint to power trend charts (one call per observation type).
Query params:
obs_type(optional) —chlorophyll_a|turbidity|cdom|surface_temp
Response 200: ObservationListResponse (same shape as /aois/{id}/observations)
Return skill-gate-filtered forecast Predictions for a water body.
Only predictions from predictors with SkillReport(passed_gate=True) are returned.
Unvalidated predictors are excluded to protect UI trust (F-029 skill gate).
Response 200: PredictionListResponse (with _attribution)
Return all forecast Predictions for a water body, including unvalidated ones. Intended for internal review before a predictor passes the skill gate.
Response 200: PredictionListResponse (with _attribution)
Return anomaly Predictions linked to a water body's observations.
These are produced by the AnomalyDetector predictor (kind="anomaly").
Response 200: PredictionListResponse
All AI endpoints degrade to deterministic templates when ARGUS_AI_OFFLINE=true or
when the Anthropic API is unavailable. Every factual claim in AI output cites a record_id
from the store (INV-4). No AI endpoint ever originates an environmental value.
Generate a grounded NL situation report for a water body. The report text is grounded
in the last 30 days of observations and predictions from the store. Every factual sentence
cites a record ID in citations.
Response 200:
{
"text": "Lake Nariva shows elevated chlorophyll-a (obs-abc123) consistent with an algal bloom advisory. Turbidity has increased 40% over the 7-day baseline (obs-def456)...",
"citations": ["obs-abc123", "obs-def456"],
"model": "claude-3-5-sonnet-20241022",
"_attribution": "Weather data by Open-Meteo.com (CC BY 4.0)"
}Grounding guarantee (INV-4): Every factual environmental claim in text has a corresponding
record ID in citations. Ungrounded claims are a defect, not a warning.
Generate a grounded advisory explanation for an anomaly prediction. Returns a candidate hypothesis and recommended actions. This is advisory only — no automated action is taken.
Path params: prediction_id — ID of a Prediction with kind="anomaly"
Response 200:
{
"hypothesis": "The chlorophyll-a spike (obs-abc123) is consistent with thermal stratification enabling cyanobacteria growth. A similar pattern preceded the 2023 bloom event.",
"advisory": "Recommend in-situ sampling within 48 hours to confirm bloom species. Alert downstream intake operators.",
"confidence": "medium",
"citations": ["obs-abc123", "pred-xyz789"],
"model": "claude-3-5-sonnet-20241022",
"_attribution": "Weather data by Open-Meteo.com (CC BY 4.0)"
}Response 404: {"detail": "Prediction 'unknown' not found or has no anomaly records"}
Confidence labels: "low" · "medium" · "high" — always labeled, never implied.
Answer a natural-language question grounded in store records. The pipeline translates the question to a structured StoreQuery, executes it, then synthesizes a cited answer. Write-action questions are refused politely without an LLM call (read-only by design, OQ-E resolved).
Request body:
{ "question": "Which choke points have the highest constriction score?" }Response 200:
{
"answer": "The highest-scoring choke point is cp-001 at constriction_score=0.87, located at [-61.35, 10.62] (cp-001). Two additional choke points scored 0.61 (cp-002) and 0.45 (cp-003).",
"citations": ["cp-001", "cp-002", "cp-003"],
"model": "claude-3-5-sonnet-20241022",
"_attribution": "Weather data by Open-Meteo.com (CC BY 4.0)"
}Write-action refusal:
{
"answer": "I can only read from the platform store. Triggering domain runs or modifying data requires direct API calls or operator access.",
"citations": [],
"model": "fallback",
"_attribution": "Weather data by Open-Meteo.com (CC BY 4.0)"
}All schemas are defined in argus/api/schemas.py and serialized with Pydantic v2.
The contract for D1 endpoints is locked by tests/test_api_contracts.py.
| Schema | Used by |
|---|---|
HealthResponse |
/health |
ReadyResponse |
/ready |
StatusResponse |
/status |
AOISchema / AOIListResponse |
/aois, /aois/{id} |
ObservationSchema / ObservationListResponse |
/aois/{id}/observations, /waterbody/{id}/observations |
PredictionSchema / PredictionListResponse |
/aois/{id}/predictions, /waterbody/{id}/forecasts etc. |
ForecastFrameSchema |
Embedded in PredictionSchema.frames |
ImpactAssessmentSchema / ImpactListResponse |
/aois/{id}/impact |
ChokePointSchema / ChokePointListResponse |
/aois/{id}/choke-points |
RiskPredictionSchema / RiskPredictionListResponse |
/aois/{id}/flood-risk, /aois/{id}/acid-risk |
WaterbodyListResponse |
/waterbodies |
AIReportResponse |
/waterbody/{id}/report |
ExplanationResponse |
/anomaly/{id}/explanation |
QueryRequest / QueryResponse |
POST /query |
A change is breaking if it:
- Removes a required field from any response
- Changes the type of an existing field
- Removes or renames the
_attributionfield from any Open-Meteo-sourced response
Non-breaking (safe without version bump):
- Adding optional fields with defaults
- Adding new endpoints
- Adding new query parameters with defaults
{"detail": "<human-readable message>"}| Status | Meaning |
|---|---|
| 404 | Resource not found |
| 422 | Validation error (malformed request body or query param) |
| 503 | Store not accessible (readiness check only) |
| 500 | Unexpected server error |
Any client or UI that displays data from the following endpoints must show the Open-Meteo attribution string (CC BY 4.0 licence requirement):
GET /aois/{id}/predictionsGET /aois/{id}/impactGET /waterbody/{id}/forecastsGET /waterbody/{id}/raw_predictionsGET /waterbody/{id}/reportGET /anomaly/{id}/explanationPOST /query
Required text: "Weather data by Open-Meteo.com (CC BY 4.0)"
Licence: https://creativecommons.org/licenses/by/4.0/