Skip to main content

Jump to: | Table of Contents |

Downloads PyPI version STAC

stac-fastapi multi-tenant virtual catalogs extension

STAC FastAPI extension for multi-tenant, recursive catalog hierarchies.

This package adds a dedicated /catalogs registry and scoped catalog routes so a single STAC API deployment can serve multiple logical catalog trees. It is designed for use cases where one API needs tenant-style isolation, curated views, provider-specific trees, or thematic navigation across shared datasets.

The extension supports poly-hierarchy (multi-parenting), where a collection or catalog can be linked under multiple catalog paths without duplicating data. It also supports contextual navigation for scoped routes, preserving UI breadcrumb behavior while still exposing alternative parents through related links.

Implementation status

Project Status Notes
stac-fastapi-elasticsearch-opensearch (SFEOS) Implemented Active integration target for this extension
stac-fastapi-pgstac Partially implemented Catalogs and transaction endpoints implemented; scoped search (AsyncCatalogsSearchClient) not yet implemented
stac-fastapi-mongo Not implemented yet Planned

Last verified: 2026-09-17

Table of contents

Specification reference

This implementation is aligned with the Multi-Tenant Catalogs extension work in StacLabs:

Notable concepts adopted here include:

  • Recursive /catalogs endpoint structure
  • Optional transaction management plane
  • Safety-first unlink semantics (organizational operations are non-destructive)
  • Runtime link generation for parent/child/related relationships

Conformance class guidance

When enabling this extension in your deployment, advertise conformance classes according to your enabled capabilities:

Operational guidance:

  • Read-only/public APIs should not expose POST/PUT/DELETE catalog endpoints and should not advertise the transaction conformance class.
  • If transactions are enabled, expose and document the management endpoints and include the transaction conformance class in conformance responses.
  • Important: To preserve the poly-hierarchy DAG structure, updates to collections SHOULD be performed through scoped routes (/catalogs/{catalogId}/collections/{collectionId}) rather than the core STAC route (/collections/{collectionId}). The core route is flat and does not maintain parent-child relationships, so updates through that route may not properly preserve the hierarchical context.

Multi-Tenant Security

For multi-tenant deployments where you want to prevent information leakage about other tenants, use the hide_alternate_parents flag:

CatalogsExtension(
    client=catalogs_client,
    hide_alternate_parents=True,  # Disables rel="related" links to alternative parents
)

When hide_alternate_parents=True, the API will only advertise the single contextual parent through rel="parent" and will not expose alternative parents via rel="related" links. This prevents clients from discovering the names and structure of other tenants in the system.

Supported projects

This extension is designed for STAC FastAPI deployment applications and is currently supported in:

Planned (not yet implemented):

It can also be integrated into custom STAC FastAPI deployments that implement the AsyncBaseCatalogsClient contract.

What this package provides

  • Three STAC FastAPI extension classes:
    • CatalogsExtension: Read-only discovery endpoints for catalogs
    • CatalogsTransactionExtension: Write operations (POST, PUT, DELETE) for catalog management
    • CatalogsSearchExtension: Scoped search endpoints bounded to a catalog's descendant tree
  • Request/response models for catalogs, children, and search APIs
  • Abstract client contracts: AsyncBaseCatalogsClient and AsyncCatalogsSearchClient

This package wires routes and validation into your API. Your deployment app is responsible for providing a concrete client implementation backed by your database/search stack.

Install

pip install stac-fastapi-catalogs-extension

Integrate in a STAC FastAPI deployment

In your deployment app.py (for example in stac-fastapi-elasticsearch-opensearch), instantiate StacApi with CatalogsExtension and optionally CatalogsTransactionExtension and/or CatalogsSearchExtension, passing an implementation of AsyncBaseCatalogsClient.

Read-only deployment (discovery only)

from stac_fastapi.api.app import StacApi
from stac_fastapi.types.config import ApiSettings

from stac_fastapi_catalogs_extension import (
    CatalogsExtension,
    CATALOGS_CORE_CONFORMANCE,
)
from my_project.catalogs_client import CatalogsClient
from my_project.core_client import CoreClient


settings = ApiSettings()

core_client = CoreClient(...)
catalogs_client = CatalogsClient(...)

api = StacApi(
    settings=settings,
    client=core_client,
    extensions=[
        CatalogsExtension(
            client=catalogs_client,
            conformance_classes=list(CATALOGS_CORE_CONFORMANCE),
            settings=settings.model_dump(),
        )
    ],
)

app = api.app

With transaction support (read and write)

from stac_fastapi.api.app import StacApi
from stac_fastapi.types.config import ApiSettings

from stac_fastapi_catalogs_extension import (
    CatalogsExtension,
    CatalogsTransactionExtension,
)
from my_project.catalogs_client import CatalogsClient
from my_project.core_client import CoreClient


settings = ApiSettings()

core_client = CoreClient(...)
catalogs_client = CatalogsClient(...)

api = StacApi(
    settings=settings,
    client=core_client,
    extensions=[
        CatalogsExtension(
            client=catalogs_client,
            settings=settings.model_dump(),
        ),
        CatalogsTransactionExtension(
            client=catalogs_client,
            settings=settings.model_dump(),
        ),
    ],
)

app = api.app

The transaction conformance class is automatically registered when CatalogsTransactionExtension is included.

With scoped search support

from stac_fastapi.api.app import StacApi
from stac_fastapi.types.config import ApiSettings
from stac_fastapi.types.search import BaseSearchGetRequest, BaseSearchPostRequest

from stac_fastapi_catalogs_extension import (
    CatalogsExtension,
    CatalogsSearchExtension,
    CATALOGS_SEARCH_CONFORMANCE,
)
from my_project.catalogs_client import CatalogsClient
from my_project.core_client import CoreClient


settings = ApiSettings()

core_client = CoreClient(...)
catalogs_client = CatalogsClient(...)

# In a real deployment, these models are generated dynamically by 
# your search extensions (e.g., FilterExtension, SortExtension).
# We pass them to CatalogsSearchExtension so scoped searches inherit them!
get_request_model = BaseSearchGetRequest
post_request_model = BaseSearchPostRequest

api = StacApi(
    settings=settings,
    client=core_client,
    extensions=[
        CatalogsExtension(
            client=catalogs_client,
            settings=settings.model_dump(),
        ),
        CatalogsSearchExtension(
            client=catalogs_client,
            search_get_request_model=get_request_model,
            search_post_request_model=post_request_model,
            conformance_classes=list(CATALOGS_SEARCH_CONFORMANCE),
            settings=settings.model_dump(),
        ),
    ],
)

app = api.app

The search conformance classes are automatically registered when CatalogsSearchExtension is included. This enables scoped search via:

  • GET /catalogs/{catalog_id}/search - Query parameter-based search
  • POST /catalogs/{catalog_id}/search - JSON body-based search

Both endpoints perform recursive tree traversal to search only items in collections linked to the specified catalog and its descendants.

Key architectural benefit: By injecting the dynamic core search request models, the scoped search endpoints automatically inherit any features added to the global /search endpoint (CQL2 filtering, sorting, field projection, etc.), ensuring scoped searches are always feature-complete!

Inheriting Core Search Extensions (Filter, Sort, Fields)

If your core STAC API utilizes extensions that modify the global /search endpoint (such as the FilterExtension for CQL2, SortExtension, or FieldsExtension), the scoped search endpoints can automatically inherit these exact same capabilities.

By passing the dynamically generated request models from your core API setup into the CatalogsSearchExtension, you guarantee that multi-tenant users have access to the same advanced querying features inside their sub-catalogs:

# Generate models using your core stac-fastapi extensions
get_request_model = create_get_request_model(core_extensions)
post_request_model = create_post_request_model(core_extensions)

CatalogsSearchExtension(
    search_get_request_model=get_request_model,
    search_post_request_model=post_request_model,
    # ...
)

This makes it crystal clear that the scoped search isn't a "second-class citizen" endpoint—it is functionally identical to the main search!

Customizing listing request models

Each listing route on CatalogsExtension takes its request model from an attribute, defaulting to the model the route used before:

Route Attribute Default
GET /catalogs catalogs_get_request_model CatalogsGetRequest
GET /catalogs/{catalog_id}/collections catalog_collections_get_request_model CatalogCollectionsRequest
GET /catalogs/{catalog_id}/collections/{collection_id}/items catalog_collection_items_get_request_model CatalogCollectionItemsRequest
GET /catalogs/{catalog_id}/catalogs sub_catalogs_get_request_model SubCatalogsRequest
GET /catalogs/{catalog_id}/children catalog_children_get_request_model CatalogChildrenRequest

Override one to add query parameters to a route. For the catalog collections route the multi-tenant-catalogs specification treats the STAC API Collection Search parameters (bbox, datetime, fields, sortby, q, filter/filter-lang/filter-crs) as an optional capability bound through the https://api.stacspec.org/v1.0.0/multi-tenant-catalogs#collection-search marker class. The marker is a binding only: each parameter group applies solely while the corresponding upstream collection-search conformance class is also advertised (e.g. collection-search for bbox/datetime, collection-search#sort for sortby, collection-search#filter for the filter parameters). The upstream base class MUST be advertised whenever any group is bound — it also makes limit required and presumes the OGC API Common simple-query class (#filter likewise presumes a CQL2 class) — and advertising the upstream classes presumes the deployment also serves GET /collections under Collection Search. Deployments that support these parameters MUST apply them strictly to the catalog's directly linked collections (the route is not recursive into descendant catalogs). Compose them onto the default model with create_request_model:

from stac_fastapi.api.models import create_request_model

from stac_fastapi_catalogs_extension import (
    CatalogCollectionsRequest,
    CatalogsExtension,
)

catalog_collections_model = create_request_model(
    model_name="CatalogCollectionsGetRequest",
    base_model=CatalogCollectionsRequest,
    extensions=[fields_extension, sort_extension, filter_extension, free_text_extension],
    # mixin supplying the Collection Search Basics (bbox, datetime, limit)
    mixins=[collection_search_basics_model],
    request_type="GET",
)

CatalogsExtension(
    client=catalogs_client,
    catalog_collections_get_request_model=catalog_collections_model,
)

collection_search_basics_model can be any request model supplying bbox, datetime, and limit query parameters — for example stac-fastapi's BaseCollectionSearchGetRequest where the deployment provides it, or an equivalent model defined in your app. FastAPI binds and validates the parameters, and they reach your client method through **kwargs. Passing the same extension list to StacApi gives GET /collections and GET /catalogs/{catalog_id}/collections matching parameters. Deployments that do not want these parameters keep the default CatalogCollectionsRequest (or compose a smaller extension list) and then MUST NOT advertise the multi-tenant-catalogs#collection-search marker class — upstream collection-search classes may still be advertised at the root for GET /collections, and limit/token remain plain pagination primitives of the route either way; the marker alone binds no parameters. When binding the Collection Search Basics (bbox, datetime, limit), register the bundled constant:

from stac_fastapi_catalogs_extension import (
    CATALOGS_COLLECTION_SEARCH_CONFORMANCE,
    CATALOGS_CORE_CONFORMANCE,
    CatalogsExtension,
)

CatalogsExtension(
    client=catalogs_client,
    catalog_collections_get_request_model=catalog_collections_model,
    conformance_classes=[*CATALOGS_CORE_CONFORMANCE, *CATALOGS_COLLECTION_SEARCH_CONFORMANCE],
)

CATALOGS_COLLECTION_SEARCH_CONFORMANCE bundles the marker class with the upstream collection-search base class and the simple-query class it presumes. Deployments binding further parameter groups advertise the corresponding upstream classes (e.g. collection-search#sort, collection-search#filter plus a CQL2 class) alongside it. Binding #filter or #sortables also requires the scoped listing's links to carry a queryables/sortables link (application/schema+json) pointing at a corresponding endpoint — the spec recommends /catalogs/{catalog_id}/collection-queryables and /catalogs/{catalog_id}/collection-sortables; the extension does not generate these links, so the deployment must supply them. Advertising the conformance classes for a composed model is the deployment's responsibility, as it already is on StacApi.

Backend client requirements

Your CatalogsClient should subclass AsyncBaseCatalogsClient and implement the required async methods, including:

  • get_catalogs
  • get_catalog
  • create_catalog
  • update_catalog
  • delete_catalog
  • get_catalog_collections
  • create_catalog_collection
  • get_catalog_collection
  • update_catalog_collection
  • unlink_catalog_collection
  • get_catalog_collection_items
  • get_catalog_collection_item
  • get_sub_catalogs
  • create_sub_catalog
  • unlink_sub_catalog
  • get_catalog_children
  • get_catalog_conformance
  • get_catalog_queryables

Note: create_catalog_collection and create_sub_catalog default to 201 Created. When linking an existing resource (an ObjectUri payload), return a Response with status 200 OK, as the specification requires; the extension has no persistence and cannot tell the two cases apart itself.

Note: per STAC API - Children v1.0.0, the get_catalog_children response links array MUST include root, parent, and self link relations, and each entity in children MUST include a self link to its canonical location. The Children response model validates these requirements and will raise an error if they are missing.

If you are supporting Scoped Search, your client must also subclass AsyncCatalogsSearchClient and implement:

  • get_all_descendant_collections
  • catalog_search_get
  • catalog_search_post

Notes for common deployment repos

stac-fastapi-elasticsearch-opensearch style deployment

  • Build a catalogs client that reads/writes catalog links and hierarchy metadata from your OpenSearch/Elasticsearch index strategy.
  • Reuse your existing core client for global /collections and /search routes.
  • Add CatalogsExtension to the extensions list in app.py as shown above.

stac-fastapi-pgstac style deployment

  • Build a catalogs client that maps these methods to SQL functions or pgstac tables/views that represent catalog hierarchy and scoped membership.
  • Keep link generation contextual for scoped routes (/catalogs/{id}/collections/{collection_id}) so UI breadcrumb navigation stays correct.
  • Add CatalogsExtension to the extensions list in app.py as shown above.

Endpoints added by this extension

CatalogsExtension (read-only discovery)

  • GET /catalogs
  • GET /catalogs/{catalog_id}
  • GET /catalogs/{catalog_id}/collections
  • GET /catalogs/{catalog_id}/collections/{collection_id}
  • GET /catalogs/{catalog_id}/collections/{collection_id}/items
  • GET /catalogs/{catalog_id}/collections/{collection_id}/items/{item_id}
  • GET /catalogs/{catalog_id}/catalogs
  • GET /catalogs/{catalog_id}/children
  • GET /catalogs/{catalog_id}/conformance
  • GET /catalogs/{catalog_id}/queryables

CatalogsTransactionExtension (write operations)

When CatalogsTransactionExtension is enabled, the following additional endpoints are available for catalog and collection management:

  • POST /catalogs
  • PUT /catalogs/{catalog_id}
  • DELETE /catalogs/{catalog_id}
  • POST /catalogs/{catalog_id}/collections
  • PUT /catalogs/{catalog_id}/collections/{collection_id}
  • DELETE /catalogs/{catalog_id}/collections/{collection_id}
  • POST /catalogs/{catalog_id}/catalogs
  • DELETE /catalogs/{catalog_id}/catalogs/{sub_catalog_id}

When CatalogsSearchExtension is enabled, the following additional endpoints are available for searching items within a catalog's descendant tree:

  • GET /catalogs/{catalog_id}/search
  • POST /catalogs/{catalog_id}/search

These endpoints perform recursive tree traversal to search only items in collections linked to the specified catalog and its descendants. They automatically inherit any features from the global /search endpoint (CQL2 filtering, sorting, field projection, etc.).

Metadata

Release files for stac-fastapi-catalogs-extension 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stac-fastapi-catalogs-extension 1.1.0
File Size Uploaded Provenance Actions
stac_fastapi_catalogs_extension-1.1.0.tar.gz 30.9 kB Without provenance Details for stac_fastapi_catalogs_extension-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stac-fastapi-catalogs-extension 1.1.0
File Interpreter ABI Platform Actions
stac_fastapi_catalogs_extension-1.1.0-py3-none-any.whl Python 3 none any Details for stac_fastapi_catalogs_extension-1.1.0-py3-none-any.whl

Total release size: 50.7 kB

Release files / stac_fastapi_catalogs_extension-1.1.0.tar.gz

Download URL stac_fastapi_catalogs_extension-1.1.0.tar.gz
Size 30.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4afb2f55bee78f489abb0d5cd3143a47a2a198f60eb4c9a937d593d3bee8288f
BLAKE2b-256 checksum
How to use checksums
21171b26804ed465f279b493d37b4545f00aecc324f79868420aa07b04b65384
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / stac_fastapi_catalogs_extension-1.1.0-py3-none-any.whl

Download URL stac_fastapi_catalogs_extension-1.1.0-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f095bcfa71f66f8593e18f55854c160a81eef15884067c09d7e3dc68cc330920
BLAKE2b-256 checksum
How to use checksums
064554073b2f830260db10912f15f37c9da4de4761405d4b7052af4981bb0567
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for stac-fastapi-catalogs-extension 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page