SlopeSense API Documentation

Explore model-generated landslide risk scores and CAP-format feeds. Check data provenance: sample outputs are not live warnings or official government alerts.

Get API Key

Authentication

Public endpoint limits depend on the deployment. Check response headers for the active limit. API keys use the public tier. Research and paid tiers are not available. Send keys using an X-API-Key header.

curl -H "X-API-Key: your_key" https://slopesense-olive.vercel.app/api/v1/alerts/active

Rate Limits

Rate-limit response headers describe the active deployment. Headers X-RateLimit-Remaining and X-RateLimit-Reset are included in every response.

Public
Deployment-dependent
No key required
Research (planned)
Not available
No active research tier
Paid (planned)
Not available
No paid plan offered

Error Codes

Standard HTTP status codes are returned alongside a JSON payload containing a detailed message.

400Bad Request (e.g. invalid coordinates)
401Unauthorized (missing or invalid API Key)
429Too Many Requests (Rate limit exceeded)

FPI & Risk

GET/Public

Health check. Returns API status, version, last model run timestamp, and active alert count.

Example
curl /api/
GET/v1/riskPublic

Get FPI score for a specific lat/lon coordinate. Uses nearest 0.1° grid cell.

Parameters
NameTypeDescription
latfloatLatitude (−90 to 90)
lonfloatLongitude (−180 to 180)
hours_aheadintForecast horizon: 0, 24, or 48 hours
Example
curl "/api/v1/risk?lat=11.58&lon=76.08&hours_ahead=24"
GET/v1/districts/{state_code}Public

All districts in a state with current FPI summary. Filter by min_fpi.

Parameters
NameTypeDescription
state_codestrTwo-letter state code (e.g., KL, UK, SK)
min_fpifloatMinimum FPI score filter (0.0–1.0)

Source observations

GET/v1/source-observationsPublic

Latest stored weather-model snapshot per representative point, with source, fetch time and stale flag. Open-Meteo model values, not measurements, not risk scores, not warnings.

GET/v1/source-observations/{point_code}/historyPublic

Stored snapshots for one point, newest first, as fetched. No interpolation.

Parameters
NameTypeDescription
hoursintWindow in hours, 1-168 (default 48)

Alerts

GET/v1/alerts/activePublic

Get all currently active alerts. Filter by tier, state, or minimum FPI score.

Parameters
NameTypeDescription
min_fpifloatMinimum FPI threshold
tierstrWATCH | WARNING | EMERGENCY
statestrTwo-letter state code
GET/v1/alerts/{alert_id}Public

Full detail for a specific alert including signal breakdown.

GeoJSON & CAP

GET/v1/geojson/fpiPublic

GeoJSON FeatureCollection of FPI scores for MapLibre heatmap rendering. Supports bbox viewport filtering.

Parameters
NameTypeDescription
statestrFilter by state code
min_fpifloatMinimum FPI
bboxstrminLon,minLat,maxLon,maxLat viewport filter
GET/v1/cap/feedPublic

CAP v1.2 XML alert feed. Compatible with NDMA Sachet app and all CAP consumers.

Parameters
NameTypeDescription
statestrFilter by state
min_fpifloatDefault 0.65 (WARNING threshold)
Example
curl "/api/v1/cap/feed?state=KL&min_fpi=0.65"

Reports & Audit

GET/v1/districts/{district_code}/report.pdfPublic

Official NDMA-style PDF report for a district. Includes FPI table, signal breakdown, and recommended actions.

GET/v1/historical/{date}/{district_code}Public

Historical FPI time-series for a district on a given date. Supports GeoJSON output.

Parameters
NameTypeDescription
datestrYYYY-MM-DD
district_codestrDistrict code (e.g., WYD)
formatstrjson | geojson
GET/v1/retrospectivePublic

Retrospective validation summary for all 6 historical India landslide events.

Contacts & Webhooks

POST/v1/contacts/registerAPI Key

Register for WhatsApp alert delivery. Supports DDMA officers, Aapda Mitra volunteers, and Gram Pradhans.

Example
curl -X POST /api/v1/contacts/register \ -H "Content-Type: application/json" \ -d '{"name":"Test","role":"district_collector","whatsapp_number":"+919876543210","state_code":"KL","language":"ml","min_tier":"WARNING"}'
POST/v1/webhooks/whatsappSigned

WhatsApp webhook receiver. Handles delivery receipts and "NO EVENT" false alarm feedback from field officers.

WS/ws/livePublic

WebSocket endpoint for live FPI updates on the dashboard. Sends init state on connect, then pushes on each model run.

Example
// JavaScript const ws = new WebSocket("wss://YOUR-API-HOST/ws/live"); ws.onmessage = (e) => console.log(JSON.parse(e.data));

Interactive Swagger UI