# Episodes_RelabelSubtasks

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

Queues the subtask labelling of an upload again on the selected episodes: each is annotated in its linked Task's names and its model
proposals are replaced. It runs later, as preparation does, and only on
the episodes still as preparation left them; the rest are counted as
skipped, never refused. A person's edit made before the run finishes
wins. At most 200 episodes per call. FAILED_PRECONDITION through a merged
dataset or a mixture and where preparation is off; also when it would
queue while a preparation of the upload is queued or running (with none
eligible it answers the counts).

- Base URL: `https://api.qualia.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.RelabelSubtasksRequest`

## Responses

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

## Schemas

```yaml
qualia.v1.RelabelSubtasksRequest:
  required:
    - parent
    - selection
  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, at most 200.
  description: Request for Episodes.RelabelSubtasks.
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.RelabelSubtasksResponse:
  type: object
  properties:
    episodeCount:
      type: integer
      description: Episodes queued for the relabel; zero queues nothing.
      format: int32
    untaskedCount:
      type: integer
      description: "Skipped: no linked Task, or a Task that names no actions."
      format: int32
    editedCount:
      type: integer
      description: |-
        Skipped: anyone but a model changed their subtasks, has an unapplied
        draft of them, or holds their edit lease; and cut pieces, which are
        frozen. A take drawn or leased after the request is left as well, when
        the run publishes.
      format: int32
  description: |-
    Response for Episodes.RelabelSubtasks. The three counts add up to the
    selected episodes.
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.
```
