> ## 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.

# Get compiled Malloy model

> Retrieves a compiled Malloy model with its source information, queries, and metadata.
The model is compiled using the specified version of the Malloy compiler. This endpoint
provides access to the model's structure, sources, and named queries for use in applications.




## OpenAPI

````yaml /dataplane-public-api-doc.yaml get /environments/{environmentName}/packages/{packageName}/models/{path}
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/{environmentName}/packages/{packageName}/models/{path}:
    get:
      tags:
        - models
      summary: Get compiled Malloy model
      description: >
        Retrieves a compiled Malloy model with its source information, queries,
        and metadata.

        The model is compiled using the specified version of the Malloy
        compiler. This endpoint

        provides access to the model's structure, sources, and named queries for
        use in applications.
      operationId: get-model
      parameters:
        - name: environmentName
          in: path
          description: Name of the environment
          required: true
          schema:
            $ref: '#/components/schemas/IdentifierPattern'
        - name: packageName
          in: path
          required: true
          description: Name of the package
          schema:
            type: string
        - name: path
          in: path
          description: Path to the model within the package
          required: true
          schema:
            $ref: '#/components/schemas/PathPattern'
        - name: versionId
          in: query
          description: Version identifier for the package
          required: false
          schema:
            $ref: '#/components/schemas/VersionIdPattern'
      responses:
        '200':
          description: Compiled Malloy model
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompiledModel'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '424':
          $ref: '#/components/responses/ModelCompilationError'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '501':
          $ref: '#/components/responses/NotImplemented'
components:
  schemas:
    IdentifierPattern:
      type: string
      pattern: ^[a-zA-Z0-9_-]+$
      description: Standard identifier pattern for resource names
    PathPattern:
      type: string
      pattern: ^[a-zA-Z0-9_/.-]+$
      description: Path pattern supporting slashes, dots, and dashes
    VersionIdPattern:
      type: string
      pattern: ^[a-zA-Z0-9_.-]+$
      description: Version identifier pattern supporting dots and dashes
    CompiledModel:
      type: object
      description: Compiled Malloy model with sources, queries, and metadata
      properties:
        resource:
          type: string
          description: Resource path to the model
        packageName:
          type: string
          description: Name of the package containing this model
        path:
          type: string
          description: Relative path to the model file within its package directory
        malloyVersion:
          type: string
          description: Version of the Malloy compiler used to generate the model data
        modelInfo:
          type: string
          description: JSON string containing model metadata and structure information
        sourceInfos:
          type: array
          description: >-
            Array of JSON strings containing source information for each data
            source
          items:
            type: string
        queries:
          type: array
          description: Array of named queries defined in the model
          items:
            $ref: '#/components/schemas/Query'
        sources:
          type: array
          description: Sources defined in this model
          items:
            $ref: '#/components/schemas/Source'
        givens:
          type: array
          description: >-
            Givens (runtime parameters) declared on this model via the `given:`
            keyword
          items:
            $ref: '#/components/schemas/Given'
    Query:
      type: object
      description: Named model query definition
      properties:
        name:
          type: string
          description: Name of the query
        sourceName:
          type: string
          description: Name of the source this query operates on
        annotations:
          type: array
          description: Annotations attached to the query
          items:
            type: string
    Source:
      type: object
      description: A Malloy source defined in a model
      properties:
        name:
          type: string
          description: Name of the source
        annotations:
          type: array
          description: Annotations attached to the source
          items:
            type: string
        views:
          type: array
          description: Views defined in this source
          items:
            $ref: '#/components/schemas/View'
        filters:
          type: array
          description: Filters declared on this source via
          items:
            $ref: '#/components/schemas/Filter'
        givens:
          type: array
          description: >-
            Model-level givens (runtime parameters) available to queries on this
            source. Identical to `CompiledModel.givens`; repeated here for SDK
            ergonomics so consumers iterating sources can render inputs without
            a second lookup.
          items:
            $ref: '#/components/schemas/Given'
        authorize:
          type: array
          description: >-
            Effective authorize expressions declared on this source via
            `#(authorize)` / `##(authorize)` annotations — file-level
            expressions first, then the source's own. Each is a Malloy boolean
            expression over declared givens, evaluated as a disjunction (OR) and
            enforced at query time. A request that reads this source is denied
            with HTTP 403 unless at least one expression evaluates true for the
            supplied givens; an empty or absent list means unrestricted. Givens
            are caller-asserted, so this is a boundary only behind a trusted
            tier — see docs/authorize.md.
          items:
            type: string
    Given:
      type: object
      description: >-
        A given (runtime parameter) declared on a Malloy model via the `given:`
        keyword. Surfaced on `CompiledModel.givens` and `Source.givens` so
        callers can introspect what runtime values a model accepts.
      properties:
        name:
          type: string
          description: Name as declared in the model
        type:
          type: string
          description: >-
            Rendered Malloy type for the given (e.g. string, number, boolean,
            date, timestamp, filter<string>)
        annotations:
          type: array
          description: Annotations attached to the given declaration
          items:
            type: string
        default:
          type: string
          description: >-
            The given's default value as a Malloy source literal (e.g. `'WN'`,
            `2003`, `@2024-01-01`, `f'WN'`), exactly as written in the model.
            Omitted when the given declares no default. Consumers render or
            prefill it per the given's `type` (e.g. unquote a string literal for
            a text input).
    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
    View:
      type: object
      description: Named model view definition
      properties:
        name:
          type: string
          description: Name of the view
        annotations:
          type: array
          description: Annotations attached to the view
          items:
            type: string
    Filter:
      type: object
      deprecated: true
      description: >
        **DEPRECATED**: Use the `Given` schema (native Malloy runtime
        parameters)

        instead. See docs/givens.md for migration recipes.


        A filter declared via #(filter) annotation on a Malloy source.
      properties:
        name:
          type: string
          description: Display name of the filter
        dimension:
          type: string
          description: Dimension this filter targets
        type:
          type: string
          description: Comparator type
          enum:
            - equal
            - in
            - like
            - greater_than
            - less_than
        implicit:
          type: boolean
          description: Whether this filter is hidden from users
        required:
          type: boolean
          description: Whether a value must be provided
        dimensionType:
          type: string
          description: >-
            Malloy data type of the dimension (e.g. string, number, boolean,
            date, timestamp)
  responses:
    Unauthorized:
      description: Unauthorized - authentication required
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The specified resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ModelCompilationError:
      description: Model compilation failed due to syntax or semantic errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: The server encountered an internal error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotImplemented:
      description: The requested operation is not implemented
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````