Public APIs¶
This page is a one-stop path if you simply want to access and use CoRE Stack public data:
1. Generate An API Key¶
For public dataset access:
- Register or sign in at dashboard.core-stack.org
- Generate an API key from the dashboard
- Send it as the
X-API-Keyheader onpublic_apiroutes
Register or sign in at dashboard.core-stack.org
If you need place names before you use the public routes, start with GeoAdmin (NoAuth) APIs.
2. Inspect The Public Surface¶
Two direct tools are useful here:
- Swagger: better for trying requests quickly.
- ReDoc: better for reading grouped routes and schema details carefully.
3. Public API Endpoints¶
This is the practical pattern for moving from discovery to analysis with the public data APIs.
| Route | What it does | Source |
|---|---|---|
GET /api/v1/get_admin_details_by_latlon/ |
state, district, tehsil for a coordinate | get_admin_details_by_lat_lon() |
GET /api/v1/get_mwsid_by_latlon/ |
MWS identifier for a coordinate | get_mws_by_lat_lon() |
GET /api/v1/get_tehsil_data/ |
tehsil JSON derived from stats spreadsheets | generate_tehsil_data() |
GET /api/v1/get_mws_data/ |
MWS time-series data | get_mws_data() |
GET /api/v1/get_mws_kyl_indicators/ |
KYL indicator subset for one MWS | get_mws_json_by_kyl_indicator() |
GET /api/v1/get_generated_layer_urls/ |
generated vector or raster layer URLs | get_generated_layer_urls() |
GET /api/v1/get_mws_report/ |
report URL for one MWS | get_mws_report_urls() |
GET /api/v1/get_active_locations/ |
activated location inventory | get_active_locations() |
GET /api/v1/get_mws_geometries/ |
MWS geometries via GeoServer | get_mws_geometries() |
GET /api/v1/get_village_geometries/ |
village geometries via GeoServer | get_village_geometries() |
4. Recommended API Workflow¶
Discover a real place¶
Use either:
- GeoAdmin (NoAuth) APIs if you need state or district names
Reveal a quick location-finding route
Start with your state: Once you find your state (eg: 29), start with: Using the district code in your state, follow with: That lets you copy the exact district and block names before you try the computation route locally.GET /api/v1/get_active_locations/if you want only places currently active in the public surface
Inventory the published layers¶
Call GET /api/v1/get_generated_layer_urls/ and inspect:
dataset_namelayer_typelayer_urlstyle_urlgee_asset_path
The output url provides several ways to download and utilise the data:
- direct download
- QGIS loading
- GeoServer-backed clients
- Earth Engine-oriented follow-up work
Fetch stable geometries¶
Use:
GET /api/v1/get_mws_geometries/GET /api/v1/get_village_geometries/
The main practical join key to watch for is uid on micro-watershed-aligned outputs.
Fetch analytical tables¶
Use:
GET /api/v1/get_tehsil_data/for tehsil-wide analytical tables keyed by watershed identifiersGET /api/v1/get_mws_data/for one watershed time seriesGET /api/v1/get_mws_kyl_indicators/for a compact watershed snapshotGET /api/v1/get_mws_report/for report handoff URLs
Join by uid¶
That is the central reuse pattern:
geometries = fetch_mws_geometries(...)
tehsil_data = fetch_tehsil_data(...)
metric_table = build_metric_table(tehsil_data)
joined_geojson = join_metrics_to_geojson(geometries, metric_table)
In other words:
- choose a stable geometry layer
- choose an analytical table
- join through the watershed identifier
- visualize, rank, or export
5. Installer Helper And Smoke Test¶
The backend repo now ships a standard-library helper at installation/public_api_client.py.
It is useful when you want one of these:
- a minimal public API smoke test
- active-location inspection
- fuzzy name resolution against the active hierarchy
- bulk download of tehsil, village, MWS, and layer payloads
The current installer can run the same surface automatically during public_api_check if PUBLIC_API_X_API_KEY is configured in nrm_app/.env.
Common commands:
# Minimal smoke test
python installation/public_api_client.py smoke-test
# Resolve misspelled names using the active hierarchy
python installation/public_api_client.py resolve \
--state bihar \
--district jamu \
--tehsil jami
# Download everything for one tehsil
python installation/public_api_client.py download \
--state assam \
--district cachar \
--tehsil lakhipur
# Resolve the containing tehsil from a point first
python installation/public_api_client.py download \
--latitude 24.79 \
--longitude 92.79
Important runtime details:
- it is standard-library only, so it does not depend on
corestackenv - it can read credentials from
--api-key, environment variables, or an optional env file - broad state or district downloads expand across activated tehsils and write aggregated metadata as well as per-tehsil output folders
If you are debugging public API access during local setup, this helper is usually faster than composing many raw curl calls by hand.