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

# Execute a specific notebook cell

> Executes a specific cell in a Malloy notebook by index. For code cells, this compiles
and runs the Malloy code, returning query results and any new sources defined.
For markdown cells, this simply returns the cell content.




## OpenAPI

````yaml /dataplane-public-api-doc.yaml get /environments/{environmentName}/packages/{packageName}/notebooks/{path}/cells/{cellIndex}
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}/notebooks/{path}/cells/{cellIndex}:
    get:
      tags:
        - notebooks
      summary: Execute a specific notebook cell
      description: >
        Executes a specific cell in a Malloy notebook by index. For code cells,
        this compiles

        and runs the Malloy code, returning query results and any new sources
        defined.

        For markdown cells, this simply returns the cell content.
      operationId: execute-notebook-cell
      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 notebook within the package
          required: true
          schema:
            type: string
        - name: cellIndex
          in: path
          description: Index of the cell to execute (0-based)
          required: true
          schema:
            type: integer
        - name: versionId
          in: query
          description: Version identifier for the package
          required: false
          schema:
            $ref: '#/components/schemas/VersionIdPattern'
        - name: filter_params
          in: query
          deprecated: true
          description: >
            **DEPRECATED**: Use `givens` (native Malloy runtime parameters)
            instead.

            Targets the deprecated `#(filter)` annotation path. See
            docs/givens.md

            for migration recipes.


            JSON-encoded filter parameter values keyed by filter name.
          required: false
          schema:
            type: string
        - name: bypass_filters
          in: query
          deprecated: true
          description: >
            **DEPRECATED**: Use `givens` (native Malloy runtime parameters)
            instead.

            See docs/givens.md for migration recipes.


            When true, skip filter injection entirely.
          required: false
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
        - name: givens
          in: query
          description: JSON-encoded given values keyed by given name
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Cell execution result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotebookCellResult'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '501':
          $ref: '#/components/responses/NotImplemented'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
        '504':
          $ref: '#/components/responses/GatewayTimeout'
components:
  schemas:
    IdentifierPattern:
      type: string
      pattern: ^[a-zA-Z0-9_-]+$
      description: Standard identifier pattern for resource names
    VersionIdPattern:
      type: string
      pattern: ^[a-zA-Z0-9_.-]+$
      description: Version identifier pattern supporting dots and dashes
    NotebookCellResult:
      type: object
      description: Result of executing a notebook cell
      properties:
        type:
          type: string
          enum:
            - markdown
            - code
          description: Type of notebook cell
        text:
          type: string
          description: Text contents of the notebook cell
        result:
          type: string
          description: JSON string containing the execution result for this cell
        newSources:
          type: array
          description: >-
            Array of JSON strings containing SourceInfo objects made available
            in this cell
          items:
            type: string
    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
  responses:
    BadRequest:
      description: >-
        The request was malformed or cannot be performed given the current state
        of the system
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    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'
    PayloadTooLarge:
      description: |
        The request was well-formed but the response exceeds a server-side
        size cap. Two caps can fire:
          * PUBLISHER_MAX_QUERY_ROWS (default 100000) — too many rows.
          * PUBLISHER_MAX_RESPONSE_BYTES (default 50 MB) — JSON-serialized
            response too large.
        The error message identifies which cap fired. Refine the query (add
        a LIMIT, more selective WHERE, project fewer columns) or raise the
        relevant cap; retrying without changes will not succeed. The
        per-cap rejection counter is exported as
        publisher_query_cap_exceeded_total{cap_type, source}.
      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'
    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'
    GatewayTimeout:
      description: |
        The query exceeded the per-request wall-clock budget
        (PUBLISHER_QUERY_TIMEOUT_MS) and was aborted server-side.
        Refine the query (add a more selective WHERE, lower LIMIT,
        simplify joins) or raise the timeout. Retrying without
        changes is unlikely to succeed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````