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

# Stored CodeGen scripts for a pipeline

> The Python scripts the pipeline's AI data-quality rule and AI transformation run. A script is generated when the pipeline is saved (from the source schema, no row values) or, when none can be used, by the first run that needs it, and every later run executes the stored script without a model call. A changed instruction or source schema regenerates it; a changed CodeGen model does not (`modelIsCurrent` is false then; use the regenerate endpoint to adopt the new model). With a code repository configured, new scripts are committed to it and runs execute the recorded commit; `drift` reports an edit made in the repository since then. Requires `pipeline:read`.



## OpenAPI

````yaml /openapi.yaml get /api/v1/pipelines/{name}/codegen-scripts
openapi: 3.0.3
info:
  title: Datris API
  description: >
    REST API for the Datris AI Data Platform. Ingest, validate, transform,
    store, and retrieve data.


    For AI agent integration, use the [MCP
    Server](https://docs.datris.ai/mcp-server) instead.
  version: 1.28.0
  contact:
    name: Datris
    url: https://datris.ai
  license:
    name: Apache 2.0
servers:
  - url: http://localhost:8080
    description: Local development
security:
  - ApiKeyAuth: []
paths:
  /api/v1/pipelines/{name}/codegen-scripts:
    get:
      tags:
        - Pipelines
      summary: Stored CodeGen scripts for a pipeline
      description: >-
        The Python scripts the pipeline's AI data-quality rule and AI
        transformation run. A script is generated when the pipeline is saved
        (from the source schema, no row values) or, when none can be used, by
        the first run that needs it, and every later run executes the stored
        script without a model call. A changed instruction or source schema
        regenerates it; a changed CodeGen model does not (`modelIsCurrent` is
        false then; use the regenerate endpoint to adopt the new model). With a
        code repository configured, new scripts are committed to it and runs
        execute the recorded commit; `drift` reports an edit made in the
        repository since then. Requires `pipeline:read`.
      parameters:
        - in: path
          name: name
          required: true
          schema:
            type: string
      responses:
        '200':
          description: One entry per AI kind the pipeline has
          content:
            application/json:
              schema:
                type: object
                properties:
                  pipeline:
                    type: string
                  scripts:
                    type: array
                    items:
                      $ref: '#/components/schemas/CodegenScript'
        '404':
          description: Unknown pipeline
components:
  schemas:
    CodegenScript:
      type: object
      description: A stored CodeGen script (AI data-quality rule or AI transformation).
      properties:
        kind:
          type: string
          enum:
            - dataQuality
            - transformation
        instruction:
          type: string
        script:
          type: string
          nullable: true
        generatedAt:
          type: string
          format: date-time
          nullable: true
        model:
          type: string
          nullable: true
          description: The CodeGen model that wrote the script.
        modelIsCurrent:
          type: boolean
          description: False when the CodeGen model setting has changed since.
        status:
          type: string
          enum:
            - ready
            - pending
        pendingReason:
          type: string
          nullable: true
        origin:
          type: string
          enum:
            - save
            - run
            - regenerate
            - repository
          nullable: true
          description: >-
            How the current script was recorded. `repository` means an edit made
            in the code repository was adopted with the pull endpoint.
        storage:
          type: string
          description: >-
            Script store: `minio` for the built-in object store, `github` for
            the configured code repository.
          nullable: true
        repoPath:
          type: string
          nullable: true
          description: >-
            Code repository only. Path of the script file on the configured
            branch: `<pathPrefix>pipelines/<pipeline>/data-quality.py` or
            `.../transformation.py`.
        commitSha:
          type: string
          nullable: true
          description: Code repository only. The commit every run executes.
        drift:
          type: boolean
          description: >-
            True when the file at the head of the configured branch differs from
            the recorded commit (it was edited in the repository). Runs keep
            using the recorded commit until the edit is pulled. Always false for
            built-in storage.
        headSha:
          type: string
          description: >-
            Present when `drift` is true. The branch-head commit the pull
            endpoint would record.
        conflict:
          type: boolean
          description: >-
            True while a new script was not committed because the file was
            edited in the code repository since the recorded commit. Runs keep
            executing the recorded commit, without the new instruction or schema
            and with no model call, until the edit is pulled or the script is
            regenerated with `overwrite=true`. Present when the script has a
            record.
        conflictReason:
          type: string
          description: >-
            Present when `conflict` is true. The warning the save or regenerate
            returned.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Optional API key for authentication (enabled via application.yaml)

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.