# Start a durable bad-data analysis over immutable dataset versions

`POST /v1/datasets/curation/analyses`

Enqueue/recover a durable idempotent analysis; source data is immutable.

- Base URL: `https://junction-api.qualiastudios.dev`
- Authentication: an API key in the `X-API-Key` header, or `Authorization: Bearer …`

## Parameters

- `account_id` (query, string | null (uuid)): Act on this account (active)

## Request body

Required: `application/json` `StartDatasetCurationAnalysisBody`

## Responses

- `202` Successful Response: `application/json` `DatasetCurationAnalysisModel`
- `401` Invalid or missing API key: `application/json` `ErrorResponse`
- `422` Validation Error: `application/json` `HTTPValidationError`

## Schemas

```yaml
StartDatasetCurationAnalysisBody:
  properties:
    idempotency_key:
      type: string
      format: uuid
    base_version_ids:
      items:
        type: string
        format: uuid
      type: array
      maxItems: 32
      minItems: 1
  additionalProperties: false
  type: object
  required:
    - idempotency_key
    - base_version_ids
  title: StartDatasetCurationAnalysisBody
DatasetCurationAnalysisModel:
  properties:
    analysis_id:
      type: string
      format: uuid
    base_version_ids:
      items:
        type: string
        format: uuid
      type: array
      maxItems: 32
      minItems: 1
    engine_revision:
      type: string
      maxLength: 128
      minLength: 1
    status:
      type: string
      enum:
        - queued
        - running
        - ready
        - failed
    phase:
      type: string
      enum:
        - pass1
        - pass2
        - ready
        - failed
    base_member_count:
      type: integer
      maximum: 18446744073709552000
      exclusiveMinimum: 0
    processed_member_count:
      type: integer
      maximum: 18446744073709552000
      minimum: 0
    recommended_exclusion_count:
      type: integer
      maximum: 18446744073709552000
      minimum: 0
    threshold_digest:
      pattern: ^[0-9a-f]{64}$
      type:
        - string
        - "null"
    evidence_digest:
      pattern: ^[0-9a-f]{64}$
      type:
        - string
        - "null"
    recommendation_digest:
      pattern: ^[0-9a-f]{64}$
      type:
        - string
        - "null"
    selection_digest:
      pattern: ^[0-9a-f]{64}$
      type:
        - string
        - "null"
    audit_repo_id:
      format: uuid
      type:
        - string
        - "null"
    expected:
      nullable: true
      allOf:
        - $ref: "#/components/schemas/PublicationExpectedHeadModel"
    failure_code:
      maxLength: 128
      minLength: 1
      type:
        - string
        - "null"
    failure_detail:
      maxLength: 65536
      minLength: 1
      type:
        - string
        - "null"
  additionalProperties: false
  type: object
  required:
    - analysis_id
    - base_version_ids
    - engine_revision
    - status
    - phase
    - base_member_count
    - processed_member_count
    - recommended_exclusion_count
  title: DatasetCurationAnalysisModel
PublicationExpectedHeadModel:
  properties:
    generation:
      type: integer
      exclusiveMinimum: 0
    git_hash_algorithm:
      type: string
      enum:
        - sha1
        - sha256
    git_oid:
      type: string
      pattern: ^[0-9a-f]+$
    commit_id:
      type: string
      format: uuid
    pack_digest:
      type: string
      pattern: ^[0-9a-f]{64}$
  additionalProperties: false
  type: object
  required:
    - generation
    - git_hash_algorithm
    - git_oid
    - commit_id
    - pack_digest
  title: PublicationExpectedHeadModel
  description: Exact paired Git/lakehouse head used as a mutation fence.
ErrorResponse:
  properties:
    detail:
      type: string
      description: Error message describing what went wrong
  type: object
  required:
    - detail
  title: ErrorResponse
  description: Standard error response.
HTTPValidationError:
  properties:
    detail:
      items:
        $ref: "#/components/schemas/ValidationError"
      type: array
  type: object
  title: HTTPValidationError
ValidationError:
  properties:
    loc:
      items:
        type:
          - string
          - integer
      type: array
      title: Location
    msg:
      type: string
      title: Message
    type:
      type: string
      title: Error Type
    input: {}
    ctx:
      type: object
      title: Context
  type: object
  required:
    - loc
    - msg
    - type
  title: ValidationError
```
