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

# Approve a dataset proposal and finalize it

> Apply edits, mark approved, and finalize the training JSONL.



## OpenAPI

````yaml post /api/finetune/datasets/{job_id}/approve
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/finetune/datasets/{job_id}/approve:
    post:
      tags:
        - AutoLLM
      summary: Approve a dataset proposal and finalize it
      description: Apply edits, mark approved, and finalize the training JSONL.
      operationId: approve_dataset_api_finetune_datasets__job_id__approve_post
      parameters:
        - name: job_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: Dataset job ID.
            title: Job Id
          description: Dataset job ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatasetApprovalRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatasetApprovalResponse'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '409':
          description: Job isn't in a ``pending_approval`` state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    DatasetApprovalRequest:
      properties:
        edits:
          anyOf:
            - $ref: '#/components/schemas/DatasetEdits'
            - type: 'null'
        auto_train:
          type: boolean
          title: Auto Train
          description: >-
            If true, kick off a fine-tune training job once the dataset is
            finalized. Chaining lands with the training vertical.
          default: false
      type: object
      title: DatasetApprovalRequest
      description: Approve a proposed dataset and queue finalization.
    DatasetApprovalResponse:
      properties:
        job_id:
          type: string
          format: uuid
          title: Job Id
        status:
          $ref: '#/components/schemas/FineTuneDatasetStatusEnum'
        example_count:
          type: integer
          title: Example Count
        approved_dataset_s3:
          anyOf:
            - type: string
            - type: 'null'
          title: Approved Dataset S3
        training_job_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Training Job Id
          description: >-
            Fine-tune training job chained from this dataset, when auto_train is
            true.
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
      type: object
      required:
        - job_id
        - status
        - example_count
      title: DatasetApprovalResponse
      description: Response returned by the approval endpoint.
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: A brief description of the error that occurred.
        code:
          type: integer
          title: Code
          description: The HTTP status code associated with the error.
          default: 500
      type: object
      required:
        - error
      title: ErrorResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DatasetEdits:
      properties:
        remove_indices:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Remove Indices
          description: Zero-based indices (into the proposed dataset) to drop.
        add_examples:
          anyOf:
            - items:
                $ref: '#/components/schemas/QAExample'
              type: array
              maxItems: 500
            - type: 'null'
          title: Add Examples
          description: Extra examples to append (user-authored).
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
          description: Reviewer notes captured in the audit trail.
      type: object
      title: DatasetEdits
      description: Edits the user wants applied before the dataset is finalized.
    FineTuneDatasetStatusEnum:
      type: string
      enum:
        - running
        - pending_approval
        - failed
        - approved
        - materializing
        - complete
      title: FineTuneDatasetStatusEnum
      description: Lifecycle of a fine-tuning dataset job.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    QAExample:
      properties:
        messages:
          items:
            $ref: '#/components/schemas/ChatMessage'
          type: array
          maxItems: 50
          minItems: 1
          title: Messages
          description: Chat turns; typically a user question and an assistant answer.
        provenance:
          anyOf:
            - type: string
            - type: 'null'
          title: Provenance
          description: Source of the example — a DataHub URN, document name, or note.
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
          description: >-
            Knowledge category: glossary | document | lineage | tag |
            data_product | user.
      type: object
      required:
        - messages
      title: QAExample
      description: A single instruction-tuning example in chat format.
    ChatMessage:
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
          title: Role
        content:
          type: string
          maxLength: 100000
          title: Content
      type: object
      required:
        - role
        - content
      title: ChatMessage
      description: One turn in a chat-format training example.
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````