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

# Finalize labeling job

> Turn the rows you accepted into a dataset.



## OpenAPI

````yaml /openapi.json post /v1/labeling/jobs/{job_id}/finalize
openapi: 3.1.0
info:
  title: OneHot API
  description: >-
    Decisions your application can act on: send a context and the questions you
    want answered, and get a probability for every answer you allow.
    Authenticate with `Authorization: Bearer onehot_sk_...`. A short guide for
    coding agents is at /llms.txt. An API key reads its account but never
    changes it: keys, billing and settings change in the console. Money fields
    ending in _usd are exact decimal strings, never integer cents. Over a rate
    limit a request gets 429 with Retry-After, and one with more input tokens
    than your minute allows gets 422 too_many_tokens.
  version: 0.1.0
servers:
  - url: https://api.sqwish.ai
security: []
tags:
  - name: Decisions
    description: Probabilities for questions with fixed outcomes.
  - name: Models
    description: Base models, and fine-tuned models by their numbers.
  - name: Families
    description: >-
      Lines of models trained on one dataset, and the switches that let them
      answer calls.
  - name: Datasets
    description: >-
      Validated training examples. A dataset grows in versions, and a version
      never changes.
  - name: Evaluations
    description: Reusable model results on a dataset's fixed evaluation rows.
  - name: Fine-tuning
    description: Training jobs, their events and held-out results.
  - name: Prompt tuning
    description: >-
      Deprecated. Better wording for a decision, tested on your rows. A server
      with prompt tuning switched off refuses a new job with 503
      prompt_tuning_unavailable, and past jobs stay readable.
  - name: Labelling
    description: Teacher labels for real queries, reviewed by you.
  - name: Accounts
    description: Email OTP sign-in, revocable sessions, security and API keys.
  - name: Billing
    description: Exact USD balances, purchases, automatic top-ups and referrals.
  - name: Organizations
    description: The organisation a request works in, and the role it has there.
  - name: Projects
    description: The projects that keep an organisation's work apart.
  - name: Integrations
    description: Endpoints other tools call, such as Claude Code.
  - name: System
    description: Health and discovery.
paths:
  /v1/labeling/jobs/{job_id}/finalize:
    post:
      tags:
        - Labelling
      summary: Finalize labeling job
      description: Turn the rows you accepted into a dataset.
      operationId: finalizeLabelingJob
      parameters:
        - name: job_id
          in: path
          required: true
          schema:
            type: string
            title: Job Id
        - name: idempotency-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Idempotency-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FinalizeLabels'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                properties:
                  id:
                    type: string
                    title: Id
                  name:
                    type: string
                    title: Name
                  created_at:
                    type: number
                    title: Created At
                  sha256:
                    type: string
                    title: Sha256
                    description: >-
                      Names every row of the latest version: its first version's
                      file digest, each later one's chained on.
                  version:
                    type: integer
                    title: Version
                    description: >-
                      The latest version. Counts and the split are this
                      version's.
                  rows:
                    type: integer
                    title: Rows
                  contexts:
                    type: integer
                    title: Contexts
                  duplicates_removed:
                    type: integer
                    title: Duplicates Removed
                  method:
                    type: string
                    enum:
                      - sft
                      - reward
                    title: Method
                  archived_at:
                    anyOf:
                      - type: number
                      - type: 'null'
                    title: Archived At
                    description: >-
                      When we archived it: when credit couldn't cover its
                      storage, or on a suspension. Restore it to start new work.
                      Null in the library.
                  used_at:
                    anyOf:
                      - type: number
                      - type: 'null'
                    title: Used At
                    description: >-
                      When work last started on it: a fine-tune, an evaluation
                      or prompt tuning, or the labelling job that made it.
                      Adding rows doesn't count. Null until then.
                  evaluation_only:
                    type: boolean
                    title: Evaluation Only
                  evaluation_fraction:
                    type: number
                    title: Evaluation Fraction
                    description: >-
                      Its first version's evaluation share: as asked, or for a
                      split of your own its evaluation contexts' share, which
                      may be below the 0.1 a request takes.
                  split:
                    additionalProperties:
                      type: integer
                    type: object
                    title: Split
                  prompt_tuning:
                    $ref: '#/components/schemas/PromptTuningReadiness'
                    description: >-
                      What prompt tuning can tune in the training partition,
                      counted when the dataset was made or grew, with the
                      reasons the counts give worked out under the limits in
                      force when it is read. Datasets of outcome scores have
                      none.
                  input:
                    $ref: '#/components/schemas/InputReceipt'
                  labeling:
                    $ref: '#/components/schemas/LabelingLineage'
                  storage_window:
                    anyOf:
                      - $ref: '#/components/schemas/StorageWindow'
                      - type: 'null'
                    description: >-
                      The day of storage held now, at the price it was accepted
                      at, or null. Archiving or deleting it charges the minutes
                      used of it; later days are priced as they start.
                  labels_to_check:
                    type: integer
                    title: Labels To Check
                    description: >-
                      How many labels prompt tuning doubted in this dataset that
                      nobody has dismissed, each row and decision once, as its
                      labels-to-check route lists them.
                type: object
                required:
                  - id
                  - name
                  - created_at
                  - sha256
                  - version
                  - rows
                  - contexts
                  - duplicates_removed
                  - method
                  - archived_at
                  - used_at
                  - evaluation_only
                  - evaluation_fraction
                  - split
                title: Dataset
        4XX:
          description: >-
            Client error. On a 422, `error.details` lists each field that
            failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: Server error. A 503 names what is not running on this server.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    FinalizeLabels:
      properties:
        row_indices:
          anyOf:
            - items:
                type: integer
              type: array
              maxItems: 2000
            - type: 'null'
          title: Row Indices
        evaluation_fraction:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0.1
            - type: 'null'
          title: Evaluation Fraction
        training_indices:
          anyOf:
            - items:
                type: integer
              type: array
              maxItems: 2000
            - type: 'null'
          title: Training Indices
        evaluation_indices:
          anyOf:
            - items:
                type: integer
              type: array
              maxItems: 2000
            - type: 'null'
          title: Evaluation Indices
        max_price_usd:
          anyOf:
            - type: string
              pattern: ^\d{1,9}(\.\d{1,9})?$
            - type: 'null'
          title: Max Price Usd
          description: >-
            The most you agree to pay for its first day of storage, which a
            dataset above the free size holds, in USD, such as the price you
            were shown. It is a decimal string, such as `"2.500000000"`, never a
            JSON number, so no precision is lost: a number is refused with
            invalid_request, naming this field. If it costs more when it is
            admitted, it is refused with price_changed and nothing is held.
      additionalProperties: false
      type: object
      title: FinalizeLabels
      description: >-
        The rows a job's dataset takes, in one of two modes, as a dataset
        upload: `row_indices`,

        whose sides the split picks at `evaluation_fraction`, or
        `training_indices` and

        `evaluation_indices`, whose rows take the side of their list.
    PromptTuningReadiness:
      properties:
        decisions:
          items:
            $ref: '#/components/schemas/DecisionReadiness'
          type: array
          title: Decisions
          description: >-
            Decisions the training rows ask, those it can tune first and then
            the most asked, as many as fit in 64 KiB.
        unlisted:
          type: integer
          title: Unlisted
          description: How many more decisions the training rows ask.
      type: object
      required:
        - decisions
        - unlisted
      title: PromptTuningReadiness
    InputReceipt:
      properties:
        format:
          type: string
          enum:
            - json
            - jsonl
            - multipart
          title: Format
          description: >-
            How its body came: JSON, a multipart form of JSONL files, or a body
            of JSONL alone.
        sha256:
          type: string
          title: Sha256
        bytes:
          type: integer
          title: Bytes
      type: object
      required:
        - format
        - sha256
        - bytes
      title: InputReceipt
    LabelingLineage:
      properties:
        job_id:
          type: string
          title: Job Id
        source_id:
          type: string
          title: Source Id
        source_sha256:
          type: string
          title: Source Sha256
        source_input_sha256:
          type: string
          title: Source Input Sha256
        spec_sha256:
          type: string
          title: Spec Sha256
        prompt_version:
          type: string
          title: Prompt Version
        teacher_models:
          items:
            type: string
          type: array
          title: Teacher Models
        row_indices:
          items:
            type: integer
          type: array
          title: Row Indices
        selection_sha256:
          type: string
          title: Selection Sha256
        target_method:
          type: string
          const: mean_one_hot_teacher_votes
          title: Target Method
      type: object
      required:
        - job_id
        - source_id
        - source_sha256
        - source_input_sha256
        - spec_sha256
        - prompt_version
        - teacher_models
        - row_indices
        - selection_sha256
        - target_method
      title: LabelingLineage
    StorageWindow:
      properties:
        started_at:
          type: number
          title: Started At
        ends_at:
          type: number
          title: Ends At
          description: When this day's hold ends and the next is reserved.
        reserved_usd:
          type: string
          title: Reserved Usd
          description: The day's fee held, as exact USD.
      type: object
      required:
        - started_at
        - ends_at
        - reserved_usd
      title: StorageWindow
    ErrorResponse:
      description: The body of every error.
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      required:
        - error
      title: ErrorResponse
      type: object
    DecisionReadiness:
      properties:
        decision:
          $ref: '#/components/schemas/Decision'
          description: The decision as the dataset's rows define it.
        outcomes:
          items:
            type: string
          type: array
          title: Outcomes
          description: >-
            Its outcome names in order, as the model reads them and targets name
            them.
        rows:
          type: integer
          title: Rows
          description: Training rows that ask it.
        labels:
          additionalProperties:
            type: integer
          type: object
          title: Labels
          description: How many of those rows expect each outcome, in the decision's order.
        reason:
          anyOf:
            - type: string
              enum:
                - conflicting_decision
                - structured_wording
                - too_few_rows
                - too_many_rows
                - too_few_per_outcome
                - unbalanced_split
            - type: 'null'
          title: Reason
          description: >-
            Why prompt tuning can't tune it, or null when it can. A job refused
            for it has this error code.
      type: object
      required:
        - decision
        - outcomes
        - rows
        - labels
        - reason
      title: DecisionReadiness
    ErrorBody:
      properties:
        code:
          description: A stable code to branch on, such as invalid_request.
          title: Code
          type: string
        message:
          description: What went wrong and what to change, in plain words.
          title: Message
          type: string
        retryable:
          description: >-
            True when another attempt may succeed; it does not prove that no
            work was done. Respect Retry-After when present. Only operations
            that support Idempotency-Key replay a prior result, including
            /v1/decide for 24 hours, but not a decision of an organisation with
            zero data retention, which keeps no answer.
          title: Retryable
          type: boolean
        request_id:
          description: Also sent as X-Request-ID. Quote it in bug reports.
          title: Request Id
          type: string
        details:
          anyOf:
            - items:
                $ref: '#/components/schemas/ErrorDetail'
              type: array
            - type: 'null'
          default: null
          description: On validation errors, one entry for each field that failed.
          title: Details
      required:
        - code
        - message
        - retryable
        - request_id
      title: ErrorBody
      type: object
    Decision:
      properties:
        id:
          type: string
          maxLength: 128
          minLength: 1
          title: Id
        question:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
            - items: {}
              type: array
          title: Question
        kind:
          type: string
          enum:
            - single
            - binary
            - ordinal
          title: Kind
          default: single
        outcomes:
          title: Outcomes
        rubric:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          title: Rubric
        policy:
          anyOf:
            - $ref: '#/components/schemas/Policy'
            - type: 'null'
      additionalProperties: false
      type: object
      required:
        - id
        - question
      title: Decision
    ErrorDetail:
      properties:
        path:
          description: Where the problem is, such as ["body", "decisions", 0, "outcomes"].
          items:
            anyOf:
              - type: string
              - type: integer
          title: Path
          type: array
        message:
          title: Message
          type: string
        type:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Type
      required:
        - path
        - message
      title: ErrorDetail
      type: object
    Policy:
      properties:
        action_costs:
          anyOf:
            - additionalProperties:
                additionalProperties:
                  type: number
                type: object
              type: object
            - type: 'null'
          title: Action Costs
        abstain_below:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0
            - type: 'null'
          title: Abstain Below
      additionalProperties: false
      type: object
      title: Policy
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: onehot_sk_...
      description: Create an API key in the console.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.