# Episodes_RestoreEpisodes

`POST /v1/accounts/{account}/datasets/{dataset}/episodes:restore`

Puts back episodes ingest validation rejected, with a required reason. They become UNREVIEWED with their validation issues open.
Upload scope only.

- 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.RestoreEpisodesRequest`

## Responses

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

## Schemas

```yaml
qualia.v1.RestoreEpisodesRequest:
  required:
    - parent
    - selection
    - reason
  type: object
  properties:
    parent:
      type: string
      description: "accounts/{account}/datasets/{dataset}: must be the upload."
    selection:
      allOf:
        - $ref: "#/components/schemas/qualia.v1.EpisodeSelection"
      description: Which episodes; only validation rejects are restored, the rest skipped.
    reason:
      type: string
      description: Why the check was wrong. Required and non-empty.
  description: Request for Episodes.RestoreEpisodes.
qualia.v1.EpisodeSelection:
  type: object
  properties:
    names:
      allOf:
        - $ref: "#/components/schemas/qualia.v1.EpisodeNames"
      description: Episode names under the request's parent.
    filter:
      type: string
      description: A ListEpisodes filter over the parent (e.g. what the filter bar leaves).
  description: |-
    Which episodes a bulk ruling acts on: an explicit list, or a filter. Names
    must be under the request's parent (INVALID_ARGUMENT otherwise); a filter
    only ever matches the parent's own episodes (a mixture: its pool).
qualia.v1.EpisodeNames:
  type: object
  properties:
    names:
      type: array
      items:
        type: string
      description: accounts/{account}/datasets/{dataset}/episodes/{episode}, at most 10000.
  description: A list of episode names.
qualia.v1.RestoreEpisodesResponse:
  type: object
  properties:
    result:
      allOf:
        - $ref: "#/components/schemas/qualia.v1.RulingResult"
      description: What happened.
  description: Response for Episodes.RestoreEpisodes.
qualia.v1.RulingResult:
  type: object
  properties:
    changedCount:
      type: integer
      description: Episodes whose standing changed.
      format: int32
    unchangedCount:
      type: integer
      description: Episodes already standing that way.
      format: int32
    skippedCount:
      type: integer
      description: |-
        Episodes skipped: through a mixture, those not KEPT upstream (rejected
        or unreviewed in their upload or a mixture in between); anywhere, a
        Restore on an episode that is not a validation reject, and a Keep on a
        validation reject (RestoreEpisodes puts those back, with a reason).
      format: int32
    dismissedIssueCount:
      type: integer
      description: Open issues dismissed with a keep.
      format: int32
    lockedCount:
      type: integer
      description: |-
        Episodes the call would have changed but left as they were, because
        another person holds their edit lease. Not counted in skipped_count.
      format: int32
    locked:
      type: array
      items:
        $ref: "#/components/schemas/qualia.v1.LockedEpisode"
      description: The first 100 of them, with their holders.
    reopenedIssueCount:
      type: integer
      description: "Blocking issues a reset reopened: the ones the withdrawn keep had closed."
      format: int32
  description: The result every bulk ruling returns.
qualia.v1.LockedEpisode:
  type: object
  properties:
    episode:
      type: string
      description: |-
        accounts/{account}/datasets/{dataset}/episodes/{episode}, in the scope
        the write was made in.
    holderName:
      type: string
      description: The holder's display name; empty when they have none.
  description: |-
    An episode a write left alone, or refused, because another person holds
    its edit lease (Episodes.AcquireEpisodeLease). Bulk responses list at most
    100 of these beside a count of all of them.
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.
```
