> ## Documentation Index
> Fetch the complete documentation index at: https://docs.credibledata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List all available environments

> Retrieves a list of all environments currently hosted on this Malloy Publisher server.
Each environment contains metadata about its packages, connections, and configuration.
This endpoint is typically used to discover available environments and their basic information.




## OpenAPI

````yaml /dataplane-public-api-doc.yaml get /environments
openapi: 3.1.0
info:
  title: Malloy Publisher - Semantic Model Serving API
  description: >
    The Malloy Publisher - Semantic Model Serving API provides comprehensive
    access to Malloy packages and their associated resources.

    A Malloy package is a directory containing Malloy models (.malloy files),
    Malloy notebooks (.malloynb files), and embedded databases

    (.parquet files) with a malloy-publisher.json manifest at the package's root
    directory.


    ## Key Features


    - **Environment Management**: Create and manage environments with their
    associated packages and connections

    - **Package Lifecycle**: Full CRUD operations for Malloy packages and their
    versions

    - **Model & Notebook Access**: Retrieve and execute Malloy models and
    notebooks

    - **Connection Management**: Secure database connection configuration and
    testing

    - **Query Execution**: Execute queries against models and retrieve results

    - **Watch Mode**: Real-time file watching for development workflows


    ## Resource Hierarchy


    The API follows a hierarchical resource structure:

    ```

    Environments

    ├── Connections

    └── Packages
        ├── Models
        ├── Notebooks
        └── Databases
    ```


    For examples, see the Malloy samples packages
    (https://github.com/malloydata/malloy-samples) repository.
  version: v0
servers:
  - url: https://{organization}.data.credibledata.com/api/v0/
    description: Production API server
    variables:
      organization:
        default: demo
        description: Your organization subdomain
security:
  - bearerAuth: []
tags:
  - name: publisher
    description: Publisher status and health check operations
  - name: environments
    description: >-
      Environment lifecycle management including creation, configuration, and
      deletion of data modeling environments
  - name: connections
    description: >-
      Database connection management for secure data source configuration and
      access
  - name: packages
    description: >-
      Package management for Malloy data models, including versioning and
      distribution
  - name: models
    description: Malloy model access and compilation operations
  - name: notebooks
    description: Malloy notebook access and execution operations
  - name: pages
    description: Static HTML pages (in-package data apps)
  - name: databases
    description: Embedded database management and access
  - name: watch-mode
    description: Real-time file watching for development workflows
  - name: materializations
    description: Package-level materializations for persisting Malloy sources
paths:
  /environments:
    get:
      tags:
        - environments
      summary: List all available environments
      description: >
        Retrieves a list of all environments currently hosted on this Malloy
        Publisher server.

        Each environment contains metadata about its packages, connections, and
        configuration.

        This endpoint is typically used to discover available environments and
        their basic information.
      operationId: list-environments
      responses:
        '200':
          description: A list of all available environments
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Environment'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    Environment:
      type: object
      description: >-
        Represents a Malloy environment containing packages, connections, and
        other resources
      properties:
        resource:
          type: string
          description: Resource path to the environment
        name:
          type: string
          description: Environment name
        readme:
          type: string
          description: Environment README content
        location:
          type: string
          description: >-
            Environment location, can be an absolute path or URI (e.g. github,
            s3, gcs, etc.)
        connections:
          type: array
          description: List of database connections configured for this environment
          items:
            $ref: '#/components/schemas/Connection'
        packages:
          type: array
          description: List of Malloy packages in this environment
          items:
            $ref: '#/components/schemas/Package'
    Connection:
      type: object
      description: Database connection configuration and metadata
      properties:
        resource:
          type: string
          description: Resource path to the connection
        name:
          type: string
          description: Name of the connection
        type:
          type: string
          description: Type of database connection
          enum:
            - postgres
            - bigquery
            - snowflake
            - trino
            - databricks
            - mysql
            - duckdb
            - motherduck
            - ducklake
            - publisher
        fingerprint:
          type: string
          description: >
            Optional, opaque, stable fingerprint of this connection's data
            identity. It is a hash of the configuration that determines *which
            data* the connection reaches (its data-locating settings), and
            deliberately excludes credentials and other secret values, so it
            stays constant across credential rotation and changes only when the
            connection is pointed at different data. When present, it is used as
            this connection's contribution to content-addressed build
            identifiers so that builds re-address only when the underlying data
            identity actually changes; consumers should treat it as an opaque
            token and use the supplied value verbatim rather than deriving their
            own. This field is optional — when omitted, a connection identity is
            derived locally instead.
        attributes:
          $ref: '#/components/schemas/ConnectionAttributes'
        proxy:
          $ref: '#/components/schemas/ConnectionProxy'
        postgresConnection:
          $ref: '#/components/schemas/PostgresConnection'
        bigqueryConnection:
          $ref: '#/components/schemas/BigqueryConnection'
        snowflakeConnection:
          $ref: '#/components/schemas/SnowflakeConnection'
        trinoConnection:
          $ref: '#/components/schemas/TrinoConnection'
        databricksConnection:
          $ref: '#/components/schemas/DatabricksConnection'
        mysqlConnection:
          $ref: '#/components/schemas/MysqlConnection'
        duckdbConnection:
          $ref: '#/components/schemas/DuckdbConnection'
        motherduckConnection:
          $ref: '#/components/schemas/MotherDuckConnection'
        ducklakeConnection:
          $ref: '#/components/schemas/DucklakeConnection'
        publisherConnection:
          $ref: '#/components/schemas/PublisherConnection'
    Package:
      type: object
      description: >-
        Represents a Malloy package containing models, notebooks, and embedded
        databases
      properties:
        resource:
          type: string
          description: Resource path to the package
        name:
          type: string
          description: Package name
        description:
          type: string
          description: Package description
        location:
          type: string
          description: >-
            Package location, can be an absolute path or URI (e.g. github, s3,
            gcs, etc.)
        explores:
          type: array
          items:
            type: string
          description: >-
            Optional opt-in for curated discovery. When present, only these
            model file paths (relative to the package root) are listed via
            `listModels()`, and within-file discovery is filtered to each
            model's `export {}` closure. When absent or empty, every model is
            listed with its full source set (backward-compatible). Every other
            .malloy file still compiles for import/join resolution but is hidden
            from listings once `explores` is declared. Notebooks are always
            listed regardless of this field.
        exploresWarnings:
          type: array
          readOnly: true
          items:
            type: string
          description: >-
            Actionable messages for declared explores that do not resolve to a
            real model in this package (e.g. a misspelled path, or a notebook
            listed as an explore). Server-computed and read-only: it is ignored
            on create/update requests and only ever returned in responses.
            Present only when there are such problems. Loading is fail-safe —
            the unresolved entry simply lists nothing rather than exposing
            everything — so this is the signal that a package is misconfigured;
            publishing such a package is rejected.
        warnings:
          type: array
          readOnly: true
          description: >-
            Non-fatal render-tag findings collected when the package loaded: a
            render annotation (e.g. `# big_value` or `# currency`) misconfigured
            for the field it sits on, so it renders as "[object Object]" or an
            inline error at query time but does not stop the model compiling or
            the package loading. Server-computed and read-only: ignored on
            create/update requests and only returned in responses. Present only
            when there are such findings.
          items:
            type: object
            properties:
              model:
                type: string
                description: Package-relative path of the model the finding is on.
              target:
                type: string
                description: >-
                  The query or view the finding sits on, e.g. `by_carrier` or
                  `flights -> by_carrier`.
              message:
                type: string
                description: The render validator's description of the problem.
              severity:
                type: string
                enum:
                  - error
                  - warn
                description: >-
                  Finding severity. Currently only `error`-severity render
                  findings are surfaced here; lower-severity findings remain on
                  the query-time `renderLogs` surface.
        queryableSources:
          type: string
          enum:
            - declared
            - all
          description: >-
            Controls whether the discovery surface is also a query boundary.
            `"declared"` (the default) makes queryable == discoverable: when
            `explores` is declared, only `explores` model files — and within
            them only the `export {}` closure — are valid top-level query
            targets; every other source still compiles, imports, joins, and
            extends but is not directly queryable (denied with 404). `"all"`
            decouples them: `explores`/`export {}` gate discovery only and every
            compiled source stays directly queryable. When `explores` is absent
            there is no curated surface, so both modes are equivalent
            (everything queryable). Invalid values fall back to `"declared"`.
            Identity-based access is a separate concern — see `#(authorize)`.
        manifestLocation:
          type:
            - string
            - 'null'
          description: >
            URI (gs:// or s3://) of the externally-computed manifest for this
            package.

            On (re)load the publisher reads it and binds persist references

            (sourceEntityId -> physicalTableName). Null = serve live.
        scope:
          type: string
          enum:
            - version
            - package
          description: >-
            Package-level materialization scope mode, declared at the
            malloy-publisher.json manifest root. Governs the lifetime/ownership
            of every persisted source and dimension index in the package, and
            replaces the removed per-source/per-dimension `sharing` annotation:
              - `version`: materializations are owned by (scoped to) the package
                version; no cross-version reuse. Cadence is a single
                package-level `materialization.schedule` OR freshness (never
                both).
              - `package`: materializations may be reused across the package's
                own versions when fresh; cadence is freshness only (no
                `schedule` allowed).
            Null/absent = unknown this request; the control plane treats it as
            the platform default (`package`) and never as a scope change. See
            docs/persistence.md §3.1.
        materialization:
          oneOf:
            - $ref: '#/components/schemas/PackageMaterializationConfig'
            - type: 'null'
          description: |
            Package-level Malloy Persistence policy declared in
            malloy-publisher.json. The control plane reads it to drive scheduled
            re-materialization. The object is present whenever the package is
            loaded (with `schedule: null` when none is declared), so its
            presence is the authoritative manifest policy; null/absent means
            only that metadata was unavailable this request, which the control
            plane treats as "unknown" (never a schedule removal). A published
            version's schedule is persisted write-once and thereafter only
            verified, so it cannot self-wipe on a later build.
        manifestBindingStatus:
          type: string
          readOnly: true
          enum:
            - unbound
            - bound
            - live_fallback
          description: >-
            Server-computed, read-only: whether the configured build manifest is
            currently bound to this package's served models. `unbound` = no
            manifest configured, so the package serves live. `bound` = a
            manifest was fetched and applied, so persist sources route to their
            materialized physical tables. `live_fallback` = a `manifestLocation`
            is configured but the fetch/bind failed or timed out, so the package
            is serving live despite intending to be materialized-routed. Lets
            the caller confirm the publisher actually bound the configured
            manifest rather than inferring it from logs.
        manifestEntryCount:
          type: integer
          readOnly: true
          description: >-
            Server-computed, read-only: number of sourceEntityId ->
            physical-table entries currently bound (0 when unbound or on live
            fallback).
        boundManifestUri:
          type:
            - string
            - 'null'
          readOnly: true
          description: >-
            Server-computed, read-only: the manifest URI actually bound to the
            served models. Usually equals `manifestLocation`, but can differ
            after an in-memory auto-load following a materialization build (no
            URI), in which case it is null. Null whenever the package is
            unbound.
        buildPlan:
          oneOf:
            - $ref: '#/components/schemas/BuildPlan'
            - type: 'null'
          readOnly: true
          description: >-
            Server-computed, read-only: the persist build plan for this package
            version (per-source sourceEntityId, output columns, build SQL,
            dependency graphs), exposed as a deterministic property of the
            compiled package. A caller reads it directly off the
            load/get-package response, assigns physical names/identity per
            source, and issues a single build call (see
            `CreateMaterializationRequest.buildInstructions`) — no separate plan
            round-trip. The plan is a pure function of the compiled model +
            connection config (no warehouse access), so it is stable for a given
            (package version, connection config). Returned by default whenever
            the package is compiled; null only when the package declares no
            persist source.
    Error:
      type: object
      description: Standard error response format
      properties:
        message:
          type: string
          description: Human-readable error message describing what went wrong
        details:
          type: string
          description: Additional error details or context
      required:
        - message
    ConnectionAttributes:
      type: object
      description: Connection capabilities and configuration attributes
      properties:
        dialectName:
          type: string
          description: SQL dialect name for the connection
        isPool:
          type: boolean
          description: Whether the connection uses connection pooling
        canPersist:
          type: boolean
          description: Whether the connection supports persistent storage operations
        canStream:
          type: boolean
          description: Whether the connection supports streaming query results
    ConnectionProxy:
      type: object
      description: >-
        Optional network proxy through which the connection is reached. Applies
        to any connection type whose database is not directly reachable (e.g.
        behind a bastion). The proxy is established below the driver, so the
        driver connects to a local endpoint transparently. Modeled as a
        discriminated union on `type` so additional proxy mechanisms can be
        added later.
      properties:
        type:
          type: string
          description: Proxy mechanism. Currently only SSH local port-forwarding.
          enum:
            - ssh
        ssh:
          $ref: '#/components/schemas/SshProxyConfig'
    PostgresConnection:
      type: object
      description: PostgreSQL database connection configuration
      properties:
        host:
          type: string
          description: PostgreSQL server hostname or IP address
        port:
          type: integer
          description: PostgreSQL server port number
        databaseName:
          type: string
          description: Name of the PostgreSQL database
        userName:
          type: string
          description: PostgreSQL username for authentication
        password:
          type: string
          description: PostgreSQL password for authentication
        connectionString:
          type: string
          description: >-
            Complete PostgreSQL connection string (alternative to individual
            parameters)
        sslmode:
          type: string
          enum:
            - disable
            - no-verify
            - verify-ca
          description: >-
            TLS mode for a connection reached through a `proxy` (SSH bastion).
            Because the driver connects to a local tunnel endpoint, the cert
            hostname can't be checked; `verify-ca` validates the server cert
            chain against the trusted CA bundle (e.g. the baked Amazon RDS
            roots) without the hostname, `no-verify` encrypts without verifying,
            and `disable` uses no TLS. The server defaults it to `no-verify`
            when a proxy is set (so a force-SSL target isn't rejected for
            plaintext) — a server-applied default, not a schema default. Only
            valid on a proxied connection — a direct connection uses the
            deployment PGSSLMODE and rejects this field.
    BigqueryConnection:
      type: object
      description: Google BigQuery database connection configuration
      properties:
        defaultProjectId:
          type: string
          description: Default BigQuery project ID for queries
        billingProjectId:
          type: string
          description: BigQuery project ID for billing purposes
        location:
          type: string
          description: BigQuery dataset location/region
        serviceAccountKeyJson:
          type: string
          description: JSON string containing Google Cloud service account credentials
        maximumBytesBilled:
          type: string
          description: Maximum bytes to bill for query execution (prevents runaway costs)
        queryTimeoutMilliseconds:
          type: string
          description: Query timeout in milliseconds
    SnowflakeConnection:
      type: object
      description: Snowflake database connection configuration
      properties:
        account:
          type: string
          description: Snowflake account identifier
        username:
          type: string
          description: Snowflake username for authentication
        password:
          type: string
          description: Snowflake password for authentication
        privateKey:
          type: string
          description: Snowflake private key for authentication
        privateKeyPass:
          type: string
          description: Passphrase for the Snowflake private key
        warehouse:
          type: string
          description: Snowflake warehouse name
        database:
          type: string
          description: Snowflake database name
        schema:
          type: string
          description: Snowflake schema name
        role:
          type: string
          description: Snowflake role name
        responseTimeoutMilliseconds:
          type: integer
          description: Query response timeout in milliseconds
    TrinoConnection:
      type: object
      description: Trino database connection configuration
      properties:
        server:
          type: string
          description: Trino server hostname or IP address
        port:
          type: number
          description: Trino server port number
        catalog:
          type: string
          description: Trino catalog name
        schema:
          type: string
          description: Trino schema name
        user:
          type: string
          description: Trino username for authentication
        password:
          type: string
          description: Trino password for authentication
        peakaKey:
          type: string
          description: Peaka API key for authentication with Peaka-hosted Trino clusters
    DatabricksConnection:
      type: object
      description: Databricks SQL warehouse connection configuration
      properties:
        host:
          type: string
          description: >-
            Databricks workspace host (e.g.
            dbc-xxxxxxxx-xxxx.cloud.databricks.com)
        path:
          type: string
          description: SQL warehouse HTTP path (e.g. /sql/1.0/warehouses/<warehouse-id>)
        token:
          type: string
          description: Personal access token for authentication
        oauthClientId:
          type: string
          description: OAuth M2M client ID (service principal)
        oauthClientSecret:
          type: string
          description: OAuth M2M client secret (service principal)
        defaultCatalog:
          type: string
          description: Default Unity Catalog to use for queries
        defaultSchema:
          type: string
          description: Default schema to use for queries
        setupSQL:
          type: string
          description: SQL statements to run when the connection is established
    MysqlConnection:
      type: object
      description: MySQL database connection configuration
      properties:
        host:
          type: string
          description: MySQL server hostname or IP address
        port:
          type: integer
          description: MySQL server port number
        database:
          type: string
          description: Name of the MySQL database
        user:
          type: string
          description: MySQL username for authentication
        password:
          type: string
          description: MySQL password for authentication
    DuckdbConnection:
      type: object
      description: >
        DuckDB database connection configuration. Publisher intentionally
        exposes only data-source intent here. Database files, working
        directories, filesystem/network policy, extension loading, setup SQL,
        temp directories, and resource knobs are owned by Publisher so
        environment configs cannot widen deployment policy through low-level
        DuckDB settings.
      properties:
        attachedDatabases:
          type: array
          items:
            $ref: '#/components/schemas/AttachedDatabase'
    MotherDuckConnection:
      type: object
      description: MotherDuck database connection configuration
      properties:
        accessToken:
          type: string
          description: MotherDuck access token
        database:
          type: string
          description: MotherDuck database name
    DucklakeConnection:
      type: object
      description: DuckLake lakehouse connection configuration
      properties:
        storage:
          type: object
          description: Data storage connection configuration (S3 or GCS)
          properties:
            bucketUrl:
              type: string
              description: >-
                URL of the storage bucket (e.g. s3://my-bucket/path or
                gs://my-bucket/path)
            s3Connection:
              $ref: '#/components/schemas/S3Connection'
              description: AWS S3 connection configuration for data storage
            gcsConnection:
              $ref: '#/components/schemas/GCSConnection'
              description: Google Cloud Storage connection configuration for data storage
          required:
            - bucketUrl
        catalog:
          type: object
          description: Catalog metadata connection configuration
          properties:
            postgresConnection:
              $ref: '#/components/schemas/PostgresConnection'
              description: PostgreSQL connection for DuckLake metadata catalog
          required:
            - postgresConnection
      required:
        - storage
        - catalog
    PublisherConnection:
      type: object
      description: >
        Malloy Publisher proxy connection. Proxies SQL to a remote Publisher
        dataplane instead of connecting to a warehouse directly. The remote
        dataplane owns authentication, access control, and read-only
        enforcement.
      properties:
        connectionUri:
          type: string
          description: >
            Full URI of the remote connection, e.g.
            https://org.data.example.com/api/v0/environments/<env>/connections/<name>
        accessToken:
          type: string
          description: Bearer token for the remote dataplane (user-scoped, short-lived)
      required:
        - connectionUri
    PackageMaterializationConfig:
      type: object
      description: >-
        Package-level Malloy Persistence policy from malloy-publisher.json's
        `materialization` block. Surfaced verbatim so the control plane can
        drive scheduled version-level re-materialization without re-reading the
        package files.
      properties:
        schedule:
          type:
            - string
            - 'null'
          description: >-
            5-field UNIX cron controlling how often the control plane
            re-materializes this package's published versions. Null/absent = no
            scheduled re-materialization (publish / on-demand only). A cron is
            valid only in `scope: version` mode and is mutually exclusive with
            any freshness declaration in the package (package/model-file/source/
            index). A cron on a `scope: package` package, or alongside any
            freshness, is rejected at publish (declare
            `materialization.freshness.window` instead). See docs/persistence.md
            §9.4.
        freshness:
          oneOf:
            - $ref: '#/components/schemas/Freshness'
            - type: 'null'
          description: >-
            The manifest's `materialization.freshness` block, verbatim. Null =
            no freshness policy declared. `window` is the control plane's
            refresh objective for the package's materialized sources; `fallback`
            is the declared query-time behavior when the objective is missed.
            The publisher only surfaces the values — the control plane owns the
            scheduling and gating logic.
    BuildPlan:
      type: object
      description: >
        The package's persist build plan. Mirrors Malloy's native build plan
        plus

        the minimal per-source detail a caller needs to assign

        identity/naming/realization. Lineage, policy, and connection capability

        are intentionally omitted until they carry real data.
      required:
        - graphs
        - sources
      properties:
        graphs:
          type: array
          description: Dependency-ordered build graphs, one per connection.
          items:
            $ref: '#/components/schemas/BuildGraph'
        sources:
          type: object
          description: Map of sourceID ("sourceName@modelURL") to per-source plan.
          additionalProperties:
            $ref: '#/components/schemas/PersistSourcePlan'
    SshProxyConfig:
      type: object
      description: >-
        SSH bastion / jump-host config for reaching a database inside a private
        network via an SSH local port-forward. Authentication is public-key
        only.
      properties:
        host:
          type: string
          description: Bastion hostname or IP address (the SSH jump host)
        port:
          type: integer
          default: 22
          description: Bastion SSH port (defaults to 22)
        username:
          type: string
          description: SSH username on the bastion
        privateKey:
          type: string
          description: >-
            PEM-encoded SSH private key used to authenticate to the bastion.
            Write-only secret (never returned by reads). When updating an
            existing proxy, leave this blank to keep the stored key. The
            customer authorizes the matching public key in the bastion's
            authorized_keys.
        privateKeyPass:
          type: string
          description: >-
            Passphrase for the encrypted private key, if any. Write-only secret
            (never returned by reads). When updating, leave blank to keep the
            stored passphrase (kept only when the private key is also kept, not
            on rotation).
        hostKey:
          type: string
          description: >
            Optional pinned bastion host public key(s), as one or more OpenSSH

            known_hosts lines (or bare base64 blobs), verified on every connect.

            List multiple lines to pin a load-balanced/HA bastion that presents
            a

            different key per backend — any listed key is accepted; a mismatch

            fails the connection closed. Plain and hashed (`|1|…`) lines both
            work

            — only the key blob is compared, never the hostname. When omitted,
            the

            tunnel connects without host-key verification (the self-service

            default); the SSH transport is still encrypted.
    AttachedDatabase:
      type: object
      description: Attached DuckDB database
      properties:
        name:
          type: string
          pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
          example: test_connection, _connection, test_connection_1
        type:
          type: string
          description: Type of database connection
          enum:
            - bigquery
            - snowflake
            - postgres
            - gcs
            - s3
            - azure
        attributes:
          $ref: '#/components/schemas/ConnectionAttributes'
        bigqueryConnection:
          $ref: '#/components/schemas/BigqueryConnection'
        snowflakeConnection:
          $ref: '#/components/schemas/SnowflakeConnection'
        postgresConnection:
          $ref: '#/components/schemas/PostgresConnection'
        gcsConnection:
          $ref: '#/components/schemas/GCSConnection'
        s3Connection:
          $ref: '#/components/schemas/S3Connection'
        azureConnection:
          $ref: '#/components/schemas/AzureConnection'
    S3Connection:
      type: object
      description: AWS S3 connection configuration for DuckDB
      properties:
        accessKeyId:
          type: string
          description: AWS access key ID
        secretAccessKey:
          type: string
          description: AWS secret access key
        region:
          type: string
          description: AWS region (e.g., us-east-1)
          default: us-east-1
        endpoint:
          type: string
          description: Custom S3-compatible endpoint URL (optional, for MinIO, etc.)
        sessionToken:
          type: string
          description: AWS session token for temporary credentials (optional)
      required:
        - accessKeyId
        - secretAccessKey
    GCSConnection:
      type: object
      description: Google Cloud Storage connection configuration for DuckDB
      properties:
        keyId:
          type: string
          description: GCS HMAC access key ID
        secret:
          type: string
          description: GCS HMAC secret key
      required:
        - keyId
        - secret
    Freshness:
      type: object
      description: >-
        Freshness policy declared in malloy-publisher.json's
        `materialization.freshness` block. Fields are surfaced verbatim; invalid
        values are dropped (reported as absent), never defaulted.
      properties:
        window:
          type: string
          description: >-
            Maximum acceptable staleness of the package's materialized sources,
            as a duration string (e.g. "24h"). The control plane schedules
            refreshes to meet it.
        fallback:
          type: string
          enum:
            - live
            - stale_ok
            - fail
          description: >-
            Declared query-time behavior when the freshness window is missed:
            serve live, serve the stale table, or fail the query.
    BuildGraph:
      type: object
      required:
        - connectionName
        - nodes
      properties:
        connectionName:
          type: string
        nodes:
          type: array
          description: >-
            Leveled build nodes; each inner array is one parallelizable level,
            levels run in order.
          items:
            type: array
            items:
              $ref: '#/components/schemas/BuildNode'
    PersistSourcePlan:
      type: object
      required:
        - name
        - sourceID
        - connectionName
        - sourceEntityId
        - sql
        - columns
      properties:
        name:
          type: string
        sourceID:
          type: string
        connectionName:
          type: string
        dialect:
          type: string
        sourceEntityId:
          type: string
          description: >-
            Stable, content-addressed identity of this persisted source. Today a
            deterministic SHA-256 hex digest (`mkBuildID`) over the source's
            connection `fingerprint` and its canonical compiled SQL —
            deliberately independent of package version, so it changes only when
            the source's data identity changes. (Folding source scope into the
            address and moving to a UUID5 form is planned but not yet shipped.)
            Consumers treat it as an opaque token and use the supplied value
            verbatim.
        sql:
          type: string
          description: >-
            The source's build SQL (with the build manifest applied for upstream
            rewrites).
        refresh:
          type:
            - string
            - 'null'
          description: >-
            The source's declared `#@ persist ... refresh=...` value ("full" |
            "incremental"), reported verbatim; null = unset. Metadata
            pass-through — inert to the publisher today.
        freshness:
          oneOf:
            - $ref: '#/components/schemas/Freshness'
            - type: 'null'
          description: >-
            The source's EFFECTIVE freshness objective after most-specific-wins
            resolution (source > model-file > package). Null = unset at every
            level; the control plane applies the platform default. Reported
            verbatim (invalid fields dropped, never defaulted).
        columns:
          type: array
          description: Output schema of the source.
          items:
            $ref: '#/components/schemas/Column'
        annotationFields:
          type: object
          additionalProperties:
            type: string
          description: >-
            All key=value fields of the source's `#@ persist` annotation (e.g.
            `name`, `realization`). The control plane uses `name` as the
            materialized table name — it may carry a dialect container path
            (`dataset.table` / `project.dataset.table`) — falling back to the
            Malloy source name when absent.
        modelPath:
          type: string
          description: >-
            Package-relative path of the `.malloy` model that declares this
            source (e.g. `order_rollup.malloy`). The source's sourceID embeds an
            absolute `file://` modelURL with no package boundary, so this is the
            only place the relative path is exposed; the control plane uses it
            to let the build-plan DAG deep-link a source back to its model.
    AzureConnection:
      type: object
      description: >
        Azure Data Lake Storage (ADLS Gen2) / Blob Storage connection
        configuration Supports https://, http://, abfss://, and az:// URL
        schemes.
      properties:
        authType:
          type: string
          enum:
            - service_principal
            - sas_token
          description: Authentication method for Azure Storage
        sasUrl:
          type: string
          description: >
            Full SAS URL including token; required for sas_token auth. Supports
            single file, directory glob (*.ext), or recursive (**) patterns.
            Example:
            https://account.blob.core.windows.net/container/path/*.parquet?sp=rl&st=...
        tenantId:
          type: string
          description: Azure AD tenant ID (required for service_principal)
        clientId:
          type: string
          description: Azure AD application (client) ID (required for service_principal)
        clientSecret:
          type: string
          description: Azure AD client secret (required for service_principal)
        accountName:
          type: string
          description: Azure Storage account name (required for service_principal)
        fileUrl:
          type: string
          description: >
            Azure file URL to query; required for service_principal auth.
            Supports single file, directory glob (*.ext), or recursive (**)
            patterns. Example:
            https://account.blob.core.windows.net/container/path/**
      required:
        - authType
    BuildNode:
      type: object
      required:
        - sourceID
      properties:
        sourceID:
          type: string
          description: sourceName@modelURL
        dependsOn:
          type: array
          description: Upstream sourceIDs in this graph.
          items:
            type: string
    Column:
      type: object
      description: Database column definition
      properties:
        name:
          type: string
          description: Name of the column
        type:
          type: string
          description: Data type of the column
  responses:
    Unauthorized:
      description: Unauthorized - authentication required
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: The server encountered an internal error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServiceUnavailable:
      description: >
        The service is temporarily unable to accept the request. Possible

        causes:
          * Initialization or draining state (rolling updates, graceful
            shutdown).
          * Memory back-pressure — the publisher's RSS crossed the
            high-water mark derived from PUBLISHER_MAX_MEMORY_BYTES and
            PUBLISHER_MEMORY_HIGH_WATER_FRACTION, so new queries are
            rejected until RSS drops below the low-water mark
            (PUBLISHER_MEMORY_LOW_WATER_FRACTION).
          * Per-pod query concurrency cap reached — PUBLISHER_MAX_CONCURRENT_QUERIES
            in-flight queries are already running on this pod.
        Clients should retry with backoff; under sustained pressure, scale

        out, raise PUBLISHER_MAX_MEMORY_BYTES /
        PUBLISHER_MAX_CONCURRENT_QUERIES,

        or refine the offending queries.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````