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

# Adopt a CodeGen script edited in the code repository

> For a script stored in the code repository: records the commit at the head of the configured branch (origin `repository`), so later runs execute the file as it is in the repository now. No commit is made. Later saves keep the adopted script while the instruction and source schema are unchanged. Requires `pipeline:create`. Audited.



## OpenAPI

````yaml /openapi.yaml post /api/v1/pipelines/{name}/codegen-scripts/{kind}/pull
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}/pull:
    post:
      tags:
        - Pipelines
      summary: Adopt a CodeGen script edited in the code repository
      description: >-
        For a script stored in the code repository: records the commit at the
        head of the configured branch (origin `repository`), so later runs
        execute the file as it is in the repository now. No commit is made.
        Later saves keep the adopted script while the instruction and source
        schema are unchanged. 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
      responses:
        '200':
          description: The script entry, now pinned to the head commit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodegenScript'
        '400':
          description: Unknown kind, no stored script, or the script is in built-in storage
        '404':
          description: Unknown pipeline
        '502':
          description: >-
            The code repository could not be read; the recorded commit 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.