SlopeSense API Documentation

Integrate real-time landslide risk intelligence, historical data, and CAP-compliant alerts into your own systems.

Get API Key

Authentication

Public endpoints are rate-limited to 100 requests/hour per IP. Research and paid tiers require an X-API-Key header.

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

Rate Limits

API rate limits depend on your tier. Headers X-RateLimit-Remaining and X-RateLimit-Reset are included in every response.

Public
100/hour
No key required
Research
1,000/hour
X-API-Key required
Paid
10,000/hour
X-API-Key required

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 http://127.0.0.1:8000/
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 "http://127.0.0.1:8000/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)

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 "http://127.0.0.1:8000/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 http://127.0.0.1:8000/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://api.slopesense.in/ws/live"); ws.onmessage = (e) => console.log(JSON.parse(e.data));

Interactive Swagger UI