# Datasets_ReingestDataset

`POST /v1/accounts/{account}/datasets/{dataset}:reingest`

Upload only (MCAP): commits a new meta/ingest.toml and ingests the
unchanged recordings again under it, publishing the upload's next
generation. Returns once the work is admitted; the ingest
takes minutes and is read with GetReingest. A config identical to the
published one runs nothing and returns that publication, SUCCEEDED,
with unchanged set.

A config that declares `[episodes] spans` re-cuts the recordings at those
windows. Episode ids follow position, so a re-cut renumbers every episode
of the upload: it is FAILED_PRECONDITION, naming the counts, while any
episode holds a person ruling, a person issue or note, a reach result, an
edit or a split child.

FAILED_PRECONDITION on a mixture, a non-MCAP upload, a merged dataset
(re-ingest its uploads before they merge) and an upload merged
into one (naming it; its GetReingest and GetIngestReport still answer);
INVALID_ARGUMENT when the config does not parse.

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

## Parameters

- `account` (path, string, required): The account id.
- `dataset` (path, string, required): The dataset id.

## Request body

Required: `application/json` `qualia.v1.ReingestDatasetRequest`

## Responses

- `200` OK: `application/json` `qualia.v1.ReingestDatasetResponse`
- `default` Default error response: `application/json` `google.rpc.Status`

## Schemas

```yaml
qualia.v1.ReingestDatasetRequest:
  required:
    - name
  type: object
  properties:
    name:
      type: string
      description: accounts/{account}/datasets/{dataset}
    ingestConfig:
      type: string
      description: |-
        Required unless resume_reingest is set. The complete meta/ingest.toml
        (schema = 1). It replaces the published
        file: a table the published file declared and this one leaves out is
        dropped. Declaring [episodes] spans re-cuts the upload (see
        ReingestDataset). With merged_settings_context this is instead a strict
        clock/alignment patch: only schema, clock and channels.<topic>.align are
        accepted. Omitted clock keeps it; empty [clock] resets clock/grid/source
        overrides to automatic. In a nonempty clock table, a supplied fixed_hz or
        row_clock_topic replaces the grid, and source changes only if supplied.
        Explicit align = "nearest" resets alignment; omitted topics keep theirs.
        Unknown/unrouted topics and every other key are refused. The server
        composes onto the exact captured head, retaining episode boundaries,
        rig, camera settings and per-channel timestamp offsets.
    mergedSettingsContext:
      allOf:
        - $ref: "#/components/schemas/qualia.v1.MergedSettingsContext"
      description: |-
        Explicitly confirmed MCAP clock/alignment edit of one merged member.
        Other config tables and episode boundaries must remain unchanged. Older
        callers without this context retain the existing member re-cut rules.
    requestId:
      type: string
      description: |-
        UUID retry key, required with merged_settings_context. A replay retains
        its original operation and membership scope, never today's membership.
    resumeReingest:
      type: string
      description: |-
        Resume this exact completed corrective publication. No ingest_config,
        request_id or merged_settings_context may accompany this operation.
  description: Request for Datasets.ReingestDataset.
qualia.v1.MergedSettingsContext:
  required:
    - mergedDataset
    - members
    - membershipRevision
    - etag
  type: object
  properties:
    mergedDataset:
      type: string
      description: The merged dataset whose membership was confirmed.
    members:
      type: array
      items:
        type: string
      description: Every upload it held, in merge order, including the selected upload.
    membershipRevision:
      type: string
      description: Opaque merge/undo epoch from GetDataset; never recapture it on retry.
    etag:
      type: string
      description: The dataset's editable etag; a member edit sends the selected upload's.
    sourceCommit:
      type: string
      description: |-
        The selected upload's exact paired head. Empty on the merged dataset's
        context, which is used only to fence global label edits.
  description: |-
    No longer answered: a merge is final and a merged dataset is not
    corrected through its uploads. One an older client still sends is checked:
    every resource in the caller's account/workspace, the exact ordered
    membership, the selected upload's etag and its published head. A stale
    context is ABORTED.
qualia.v1.ReingestDatasetResponse:
  type: object
  properties:
    reingest:
      allOf:
        - $ref: "#/components/schemas/qualia.v1.Reingest"
      description: |-
        The re-ingest it admitted (QUEUED), or with unchanged set, the
        publication that already carries the config (SUCCEEDED).
  description: Response for Datasets.ReingestDataset.
qualia.v1.Reingest:
  type: object
  properties:
    name:
      type: string
      description: accounts/{account}/datasets/{dataset}/reingests/{reingest}
    state:
      readOnly: true
      enum:
        - STATE_UNSPECIFIED
        - QUEUED
        - PREPARING
        - PUBLISHING
        - SUCCEEDED
        - FAILED
      type: string
      description: Where the work stands.
      format: enum
    unchanged:
      readOnly: true
      type: boolean
      description: |-
        The posted config was the published one: nothing ran, and this names
        the publication that already carries it.
    failureReason:
      readOnly: true
      type: string
      description: Why it failed; empty unless FAILED.
    progress:
      readOnly: true
      type: object
      description: |-
        While PREPARING: the live step, the same open set of fields the upload
        feed reports (step, detail, counters).
    episodeCount:
      readOnly: true
      type: string
      description: "Once SUCCEEDED: episodes in the published generation."
    frameCount:
      readOnly: true
      type: string
      description: "Once SUCCEEDED: frames in the published generation."
    poseAttempt:
      readOnly: true
      type: integer
      description: Attempt currently preparing a pose move, or zero when cancellation is unavailable.
      format: int32
    publicationFailure:
      readOnly: true
      type: string
      description: Most recent safe publication failure while publishing, if any.
    recutResult:
      readOnly: true
      allOf:
        - $ref: "#/components/schemas/qualia.v1.ReingestRecutResult"
      description: |-
        Present only when a verified re-cut result committed atomically with
        this successful publication. Absence is not an empty/clean result.
  description: |-
    One re-ingest of an upload under a new meta/ingest.toml
    (Datasets.ReingestDataset).
qualia.v1.ReingestRecutResult:
  type: object
  properties:
    notCarriedCount:
      readOnly: true
      type: string
      description: |-
        Exact number of old original takes with state not carried. Zero means
        the verified publication lost no state; no such take is listed.
    publicationCommit:
      readOnly: true
      type: string
      description: Immutable publication commit, used to bind every page of the result.
  description: Summary of state not carried by one verified, finalized re-cut publication.
google.rpc.Status:
  oneOf:
    - $ref: "#/components/schemas/ApiError"
    - $ref: "#/components/schemas/GatewayError"
  description: "The body of a failed call: one of the two shapes below."
ApiError:
  title: API error
  type: object
  required:
    - code
    - message
    - retryable
    - details
  properties:
    code:
      type: string
      description: The gRPC code name in upper case, e.g. `NOT_FOUND`.
    message:
      type: string
    retryable:
      type: boolean
      description: Whether the same call may succeed if retried.
    details:
      type: array
      items:
        type: object
      description: "Empty, except when a dataset copy or move is refused: then one `google.rpc.ErrorInfo` with the refusal's `reason` code, its `domain` and, in `metadata`, the datasets it names."
  description: A refusal from the API itself.
GatewayError:
  title: Gateway error
  type: object
  required:
    - detail
  properties:
    detail:
      type: string
      description: What went wrong.
  description: A refusal from the gateway before the call reaches the API, for example `401` bad or missing API key, `403` key lacks the scope or environment closed, `413` body too large.
```
