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

# Force a new CodeGen script

> Generates a new script for `kind` now, from the source schema, with the current CodeGen model, and replaces the stored one. If generation fails the error is returned (502) and the current script stays in place. For a JSON or XML pipeline the script is marked pending and the next run generates it from its data. The script stays in its current store unless `storage` asks for another; the old copy is left in place. A repository-backed script whose file was edited in the repository since the recorded commit is not overwritten (409) unless `overwrite=true`. Requires `pipeline:create`. Audited.



## OpenAPI

````yaml /openapi.yaml post /api/v1/pipelines/{name}/codegen-scripts/{kind}/regenerate
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/{kind}/regenerate:
    post:
      tags:
        - Pipelines
      summary: Force a new CodeGen script
      description: >-
        Generates a new script for `kind` now, from the source schema, with the
        current CodeGen model, and replaces the stored one. If generation fails
        the error is returned (502) and the current script stays in place. For a
        JSON or XML pipeline the script is marked pending and the next run
        generates it from its data. The script stays in its current store unless
        `storage` asks for another; the old copy is left in place. A
        repository-backed script whose file was edited in the repository since
        the recorded commit is not overwritten (409) unless `overwrite=true`.
        Requires `pipeline:create`. Audited.
      parameters:
        - in: path
          name: name
          required: true
          schema:
            type: string
        - in: path
          name: kind
          required: true
          schema:
            type: string
            enum:
              - dataQuality
              - transformation
        - in: query
          name: storage
          required: false
          description: >-
            Move the script: `github` (the configured code repository) or
            `builtin` (the built-in object store). Default: its current store.
          schema:
            type: string
            enum:
              - github
              - builtin
        - in: query
          name: overwrite
          required: false
          description: >-
            Replace a repository file that was edited since the recorded commit.
            The edit stays in the repository history.
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: The new script entry
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodegenScript'
        '400':
          description: >-
            Unknown kind or storage, or the pipeline has no AI instruction of
            that kind
        '404':
          description: Unknown pipeline
        '409':
          description: >-
            The script's file was edited in the code repository since the
            recorded commit; nothing was committed and the current script is
            unchanged. Pull the edit, or repeat with `overwrite=true`.
        '502':
          description: >-
            Generation or the repository commit failed; the current script is
            unchanged
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.