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

# Review tap script (AI)

> Uses AI to review a script after a successful test run — correctness, robustness, and adherence to tap conventions. May return the script rewritten. When it rewrites and the tap already exists, the tap's `scriptPath` is updated to the new object.



## OpenAPI

````yaml /openapi.yaml post /api/v1/tap/review
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.11.3
  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/tap/review:
    post:
      tags:
        - Taps
      summary: Review tap script (AI)
      description: >-
        Uses AI to review a script after a successful test run — correctness,
        robustness, and adherence to tap conventions. May return the script
        rewritten. When it rewrites and the tap already exists, the tap's
        `scriptPath` is updated to the new object.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - script
              properties:
                tapName:
                  type: string
                script:
                  type: string
                recordCount:
                  type: integer
                  description: Record count from the latest test run
                durationMs:
                  type: integer
                  format: int64
                  description: Duration of the latest test run in milliseconds
                logs:
                  type: string
                  description: Logs from the latest test run
                oldScriptPath:
                  type: string
                  description: Path of the current script, deleted if a rewrite is stored
                priorIterations:
                  type: string
                  description: >-
                    JSON-encoded array of prior review/optimize iterations, so
                    the AI doesn't repeat suggestions
      responses:
        '200':
          description: Review result
          content:
            application/json:
              schema:
                type: object
                properties:
                  script:
                    type: string
                  packages:
                    type: array
                    items:
                      type: string
                  scriptPath:
                    type: string
                  changes:
                    type: array
                    items:
                      type: string
                    description: Human-readable list of what changed
                  rewritten:
                    type: boolean
                    description: True when the AI produced a modified script
        '500':
          description: Error (including missing script)
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Optional API key for authentication (enabled via application.yaml)

````