# HIFLD webapp - agent index > This site exposes a **public JSON API** for geospatial dataset metadata (collections, datasets, files, sources). Prefer **OpenAPI** and JSON over scraping HTML; the UI is a client-rendered SPA. ## Read this first (avoid 404 loops) 1. **[GET /api](/api)** - Bootstrap JSON: `links` to OpenAPI, `llms.txt`, collections, and short `hints` on URL shape. 2. **[GET /api/openapi](/api/openapi)** - OpenAPI 3.1: every path, query param, and problem response shape. 3. **[GET /.well-known/mcp/server-card.json](/.well-known/mcp/server-card.json)** - JSON MCP Server Card for Streamable HTTP discovery. 4. **[GET /.well-known/ai-catalog.json](/.well-known/ai-catalog.json)** - JSON Agent Resource Discovery catalog (ARD) for scanners. 5. **[POST /mcp](/mcp)** - same-origin Streamable HTTP MCP proxy (`GET` is not the handshake method). 6. **[GET /api/collections](/api/collections)** and **GET /api/collections/{slug}** return authored **STAC Catalog** documents. The catalog API is not a STAC Item Search or OGC API-Features item service: there are no `/items`, `/features`, `/download`, or `/map` JSON routes under `/api` dataset paths. The separate OGC feature server is at **[/features/collections](/features/collections)**. Dataset paths use **string slugs**, not numeric IDs in collection-scoped URLs. 7. The **JSON API remains read-only**. On supported browsers, this first-party webapp may expose contextual WebMCP tools that read catalog/query data and modify only the **current browser workspace**; they never write catalog data. ## Standard STAC clients **GET /stac** is the STAC API landing page. It advertises STAC API Core and STAC API Collections 1.0.0. **GET /stac/collections** pages through version-level STAC Collections, and **GET /stac/collections/{collectionId}** opens one. The Collection ID is the full version path, for example `hifld/hospitals-3/hospitals-3/v1.0.0`; clients may percent-encode its slashes. The service description is **GET /stac/api**. Follow `next` links to page through all Collections. **GET /api/collections** remains the root of the static STAC catalog tree; it is not the STAC API Collections listing. `/stac` does not advertise STAC Item Search, STAC API Features, or Collection Search. `/features` serves OGC data features, not STAC Items. Use the custom `/api` dataset listing below for text search and tag filters. ## Search and pagination **GET /api/collections/{slug}/datasets** is the collection-scoped route that lists datasets with text search and paging. **GET /api/datasets** provides the same paginated shape aggregated across all collections. **GET /api/collections/{slug}** returns the collection's raw STAC Catalog instead. Supported query parameters on these listing routes: - `search` or `query` - relevance-ranked full-text search; all words must match token prefixes, with title/slug and tags weighted above description (do not use `q=` on made-up paths like `.../items`) - `tag_filters` - use **[GET /api/collections/{slug}/datasets/tags](/api/collections/hifld/datasets/tags)** to discover values - `limit`, `offset` - pagination (`limit` defaults to 50 when omitted) - `omit` - e.g. `omit=description` to shrink rows - `include_urls` - `true` / `false` Example (replace host with your origin): ``` GET /api/collections/hifld/datasets?search=wastewater&limit=25&omit=description ``` Then open one dataset by collection and dataset slug: ``` GET /api/collections/{collectionSlug}/datasets/{datasetSlug} ``` Then selected-version file metadata (slug from the dataset Catalog child links): ``` GET /api/collections/{collectionSlug}/datasets/{datasetSlug}/files/{fileSlug} ``` The file response is a raw STAC Collection with assets. Omit `version` for the latest version; assets are keyed by `{format}-{hash}`, and `hifld:*` asset fields preserve query-source identities. Schema columns are in `table:columns`. The metadata and schema paths are exact aliases of those raw STAC documents: ``` GET /api/collections/{collectionSlug}/datasets/{datasetSlug}/files/{fileSlug}/schema GET /api/collections/{collectionSlug}/datasets/{datasetSlug}/metadata GET /api/collections/{collectionSlug}/datasets/{datasetSlug}/files/{fileSlug}/metadata ``` The file metadata and schema aliases accept the same optional `version` and otherwise select the latest version. They do not return a separate database envelope or paginated schema view model. Published STAC documents use absolute links and asset URLs, so clients can follow them directly from API responses. The response `Content-Location` identifies the canonical storage document. Older or offline catalogs may retain relative links; open their canonical URL before traversing them. Unknown paths under `/api` return **404** with **application/problem+json** and a `links` object pointing back to `/api`, OpenAPI, and this file. ## Machine-readable contract - [OpenAPI 3.1 document](/api/openapi): full schema including extended Problem bodies (`instance`, `links`). ## Contextual WebMCP tools (supported browsers only) Use a **collection-first** workflow: list collections, select a collection, search its datasets, then inspect a dataset and file. Do not use WebMCP to invent catalog URLs or submit catalog writes. The contextual surface has exactly these 19 tools; schemas remain in the browser tool registry, not this index. - Catalog: `list_collections`, `get_collection`, `search_datasets`, `get_dataset`, `get_dataset_file`, `get_dataset_file_schema`. - Version comparison: `compare_file_versions`. - Map workspace: `get_map_state`, `add_dataset_layer`, `remove_map_layer`, `set_layer_visibility`, `set_layer_style`, `reorder_map_layers`, `set_map_camera`, `set_basemap`, `get_map_selection`, `clear_map_selection`. Map styles accept `color_property` and `color_mode` (`numeric` or `categorical`). Text/boolean fields default to categories; numeric fields default to graduated colors but can be treated as category codes. Size fields remain numeric-only. `tableau10` and `set3` provide qualitative palettes alongside the existing ramps. Category legends use dictionary and loaded-feature values, not a complete data inventory; at most 32 values receive named entries, with Other values and No data fallbacks. Colors stay stable while panning. Added layers choose an unused palette or the least-used palette after exhaustion; existing manual styles are preserved. - Bounded queries: `run_dataset_query`, `set_result_page`. The current standard `document.modelContext` surface is preferred. Native Chrome preview/scanner builds may expose `navigator.modelContext` as a fallback; this is native compatibility, not a polyfill. Unsupported browsers register no WebMCP tools and the ordinary webapp remains unchanged. Scanner acceptance checks the MCP Server Card and ARD responses as JSON, then probes same-origin `/mcp`. ARD supports cross-origin JSON discovery with CORS; MCP calls remain same-origin. The card advertises same-origin `/mcp` unless the server-only `DATASET_MCP_PUBLIC_ENDPOINT` overrides the public endpoint. The proxy's internal `DATASET_MCP_QUERY_API_URL` is never exposed. ## Bounded query resources These same-origin webapp routes are for the contextual query workflow; they do not make the JSON catalog writable. - `POST /api/queries` creates a bounded server-side GeoParquet query from catalog source identities and returns a non-secret opaque `query_id`. - `POST /api/queries/{query_id}/pages` re-executes one page. Send the signed token only in `X-HIFLD-Query-Token`; never put it in a URL. The `query_id` in the path must match that token. `offset` is non-negative and `page_size` is bounded from 1 through 1,000. - Query failures use stable `application/problem+json` / structured problem codes rather than DuckDB, SQL, object-path, credential, or token details. - MVT is loaded directly from the public dataset-mcp URL returned with the query, such as `GET /api/queries/{query_id}/tiles/{z}/{x}/{y}.mvt`; it also uses `X-HIFLD-Query-Token`. There is no webapp tile proxy. ## Collections - [STAC API landing page](/stac): Core and Collections discovery for standard clients. - [STAC API Collections listing](/stac/collections): paginated version-level STAC Collections. - [Root catalog](/api/collections): raw STAC Catalog with child links to collection catalogs. - [Collection catalog](/api/collections/{slug}): raw STAC Catalog for one collection. - [Collection datasets](/api/collections/{slug}/datasets): custom paginated wrapper `{datasets,total,limit,offset,links}` whose `datasets` entries are raw STAC Catalogs. It is not a STAC Item Search FeatureCollection. - [Tag facets](/api/collections/{slug}/datasets/tags): values for building `tag_filters`. - [OGC API Features](/features/collections): spatial collections and feature items, separate from the STAC metadata API. ## Global dataset views - [Dataset list](/api/datasets): the same custom paginated STAC-Catalog wrapper aggregated across collections; supports `search`/`query`, `tag_filters`, `limit`, and `offset`. - [Dataset stats](/api/datasets/stats): aggregate counters. - [Dataset by identity](/api/datasets/{id}): raw dataset STAC Catalog for a URL-encoded `collection/dataset` identity. Numeric legacy IDs are invalid. ## Files and downloads - File metadata and assets: `/api/collections/{collectionSlug}/datasets/{datasetSlug}/files/{fileSlug}` is the selected-version raw STAC Collection. Omit `version` for latest. - Schema alias: `/api/collections/{collectionSlug}/datasets/{datasetSlug}/files/{fileSlug}/schema` returns that same raw Collection; read `table:columns`. ## Bulk analysis For statewide filters or heavy analytics, **download GeoParquet (or other formats) from file metadata source URLs** and use **DuckDB**, **GeoPandas**, or similar locally. The HTTP API is for discovery and metadata, not a spatial database. ## Upstream - Catalog metadata routes read the published Portolan STAC catalog with its SQLite index. ZIP downloads redirect to published object-storage assets. This file describes routes on **this** origin only.