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/activeRate Limits
API rate limits depend on your tier. Headers X-RateLimit-Remaining and X-RateLimit-Reset are included in every response.
Error Codes
Standard HTTP status codes are returned alongside a JSON payload containing a detailed message.
FPI & Risk
/PublicHealth check. Returns API status, version, last model run timestamp, and active alert count.
curl http://127.0.0.1:8000//v1/riskPublicGet FPI score for a specific lat/lon coordinate. Uses nearest 0.1° grid cell.
| Name | Type | Description |
|---|---|---|
| lat | float | Latitude (−90 to 90) |
| lon | float | Longitude (−180 to 180) |
| hours_ahead | int | Forecast horizon: 0, 24, or 48 hours |
curl "http://127.0.0.1:8000/v1/risk?lat=11.58&lon=76.08&hours_ahead=24"/v1/districts/{state_code}PublicAll districts in a state with current FPI summary. Filter by min_fpi.
| Name | Type | Description |
|---|---|---|
| state_code | str | Two-letter state code (e.g., KL, UK, SK) |
| min_fpi | float | Minimum FPI score filter (0.0–1.0) |
Alerts
/v1/alerts/activePublicGet all currently active alerts. Filter by tier, state, or minimum FPI score.
| Name | Type | Description |
|---|---|---|
| min_fpi | float | Minimum FPI threshold |
| tier | str | WATCH | WARNING | EMERGENCY |
| state | str | Two-letter state code |
/v1/alerts/{alert_id}PublicFull detail for a specific alert including signal breakdown.
GeoJSON & CAP
/v1/geojson/fpiPublicGeoJSON FeatureCollection of FPI scores for MapLibre heatmap rendering. Supports bbox viewport filtering.
| Name | Type | Description |
|---|---|---|
| state | str | Filter by state code |
| min_fpi | float | Minimum FPI |
| bbox | str | minLon,minLat,maxLon,maxLat viewport filter |
/v1/cap/feedPublicCAP v1.2 XML alert feed. Compatible with NDMA Sachet app and all CAP consumers.
| Name | Type | Description |
|---|---|---|
| state | str | Filter by state |
| min_fpi | float | Default 0.65 (WARNING threshold) |
curl "http://127.0.0.1:8000/v1/cap/feed?state=KL&min_fpi=0.65"Reports & Audit
/v1/districts/{district_code}/report.pdfPublicOfficial NDMA-style PDF report for a district. Includes FPI table, signal breakdown, and recommended actions.
/v1/historical/{date}/{district_code}PublicHistorical FPI time-series for a district on a given date. Supports GeoJSON output.
| Name | Type | Description |
|---|---|---|
| date | str | YYYY-MM-DD |
| district_code | str | District code (e.g., WYD) |
| format | str | json | geojson |
/v1/retrospectivePublicRetrospective validation summary for all 6 historical India landslide events.
Contacts & Webhooks
/v1/contacts/registerAPI KeyRegister for WhatsApp alert delivery. Supports DDMA officers, Aapda Mitra volunteers, and Gram Pradhans.
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"}'/v1/webhooks/whatsappSignedWhatsApp webhook receiver. Handles delivery receipts and "NO EVENT" false alarm feedback from field officers.
/ws/livePublicWebSocket endpoint for live FPI updates on the dashboard. Sends init state on connect, then pushes on each model run.
// JavaScript
const ws = new WebSocket("wss://api.slopesense.in/ws/live");
ws.onmessage = (e) => console.log(JSON.parse(e.data));