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

# Explain Inference Rows

> Create an asynchronous explanation job for selected row ids from a completed inference job. Poll the returned explanation job; inline explanations are included on the job detail once it succeeds.



## OpenAPI

````yaml /openapi.json post /jobs/{job_id}/explain
openapi: 3.1.0
info:
  title: Woodwide API
  description: API service for the Woodwide platform
  version: 0.1.0
servers:
  - url: https://api.woodwide.ai
    description: Production
security: []
paths:
  /jobs/{job_id}/explain:
    post:
      tags:
        - Jobs
      summary: Explain Inference Rows
      description: >-
        Create an asynchronous explanation job for selected row ids from a
        completed inference job. Poll the returned explanation job; inline
        explanations are included on the job detail once it succeeds.
      operationId: explain_job_rows_jobs__job_id__explain_post
      parameters:
        - name: job_id
          in: path
          required: true
          schema:
            type: string
            title: Job Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JobExplainRequest'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobDetail'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    JobExplainRequest:
      properties:
        ids:
          items:
            anyOf:
              - type: integer
              - type: string
          type: array
          maxItems: 500
          minItems: 1
          title: Ids
          description: Inference row ids to explain.
      type: object
      required:
        - ids
      title: JobExplainRequest
      description: Request a per-row explanation job for a completed inference job.
    JobDetail:
      properties:
        id:
          type: string
          title: Id
          description: Public ID of the job (e.g. job_A8K2P9QX).
        type:
          type: string
          title: Type
          description: 'Job type: dataset_ingest, train, infer_sync, or infer_batch.'
        status:
          $ref: '#/components/schemas/JobStatus'
          description: >-
            Job status: initializing, pending, queued, running, succeeded,
            failed, canceled, or rejected. For dataset_ingest jobs, may also be
            'waiting_for_upload'.
        created_at:
          type: string
          format: date-time
          title: Created At
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
        finished_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Finished At
        created_by:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Created By
          description: 'Who created this job: {principal_type, user_id, api_key_id}.'
        actor_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Actor Name
          description: >-
            Display name of who created the job: the user's display name (email
            fallback), or the API key's name for API-key principals. Populated
            on dashboard-activity rows; null when the creator is unknown.
        model_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Type
          description: >-
            Model task type when applicable (e.g. prediction, clustering,
            anomaly). Derived from job input or the linked model; null for jobs
            without a model context.
        model_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Id
          description: >-
            Public ID of the parent model when the job is tied to a model
            (training, inference); null otherwise.
        dataset_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Id
          description: >-
            Public ID of the dataset when the job references a dataset version
            (e.g. batch inference on curated data); null for file-only inference
            and other jobs.
        dataset_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Name
          description: >-
            Display name of the linked dataset when resolved via
            dataset_version; null when there is no dataset or the name is
            unavailable.
        input_filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Input Filename
          description: >-
            Original name of the uploaded file for file-backed jobs (sync/async
            file inference); null when the job referenced a dataset or carries
            no uploaded file.
        parent_job_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Job Id
          description: >-
            Public ID of the parent job when this job consumes outputs from it
            as part of a compound inference/training chain.
        input:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Input
        output:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Output
        resources:
          anyOf:
            - $ref: '#/components/schemas/IngestResources'
            - $ref: '#/components/schemas/TrainResources'
            - $ref: '#/components/schemas/InferSyncResources'
            - $ref: '#/components/schemas/InferBatchResources'
            - $ref: '#/components/schemas/ModelExplainResources'
            - type: 'null'
          title: Resources
          description: Typed resource references for this job.
        explanations:
          anyOf:
            - items:
                $ref: '#/components/schemas/JobExplanationRow'
              type: array
            - type: 'null'
          title: Explanations
          description: Inline row explanations for succeeded infer_explain jobs.
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: Human-readable error message if the job failed.
        woodwide_runtime_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Woodwide Runtime Version
          description: ML runtime version used for this job.
        credits_consumed:
          anyOf:
            - type: number
            - type: 'null'
          title: Credits Consumed
          description: Credits consumed by this job (null if not yet finalized).
        progress:
          anyOf:
            - type: number
            - type: 'null'
          title: Progress
          description: >-
            Progress percentage (0-100). For training jobs, tracks training
            progress.
        current_step:
          anyOf:
            - type: integer
            - type: 'null'
          title: Current Step
          description: >-
            Current training step (training jobs only). Counts SSL + finetune
            steps.
        total_steps:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Steps
          description: Total training steps planned for this job (training jobs only).
        current_phase:
          anyOf:
            - type: string
              enum:
                - ssl
                - finetune
            - type: 'null'
          title: Current Phase
          description: >-
            Current training phase: ``ssl`` (self-supervised pre-training) or
            ``finetune`` (supervised head finetune). Training jobs only; null
            for unsupervised model types that have no training loop.
        metrics_history:
          anyOf:
            - items:
                $ref: '#/components/schemas/MetricPoint'
              type: array
            - type: 'null'
          title: Metrics History
          description: >-
            Bounded series of per-interval training metrics (capped at 200
            points, downsampled in place). Training jobs only; null for
            unsupervised paths and for jobs before the first validation gate.
      type: object
      required:
        - id
        - type
        - status
        - created_at
      title: JobDetail
      description: |-
        Detailed job information.

        Extends ``Job`` with input/output payloads, typed resource
        references, error details, and billing information.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    JobStatus:
      type: string
      enum:
        - initializing
        - pending
        - queued
        - running
        - succeeded
        - failed
        - canceled
        - rejected
        - waiting_for_upload
      title: JobStatus
    IngestResources:
      properties:
        type:
          type: string
          const: dataset_ingest
          title: Type
          default: dataset_ingest
        dataset:
          $ref: '#/components/schemas/DatasetVersionRef'
      type: object
      required:
        - dataset
      title: IngestResources
      description: Resources for a dataset_ingest job.
    TrainResources:
      properties:
        type:
          type: string
          const: train
          title: Type
          default: train
        model:
          $ref: '#/components/schemas/ModelVersionRef'
        dataset:
          $ref: '#/components/schemas/DatasetVersionRef'
      type: object
      required:
        - model
        - dataset
      title: TrainResources
      description: Resources for a train job.
    InferSyncResources:
      properties:
        type:
          type: string
          const: infer_sync
          title: Type
          default: infer_sync
        model:
          $ref: '#/components/schemas/ModelVersionRef'
      type: object
      required:
        - model
      title: InferSyncResources
      description: Resources for a synchronous inference job.
    InferBatchResources:
      properties:
        type:
          type: string
          const: infer_batch
          title: Type
          default: infer_batch
        model:
          $ref: '#/components/schemas/ModelVersionRef'
        dataset:
          anyOf:
            - $ref: '#/components/schemas/DatasetVersionRef'
            - type: 'null'
      type: object
      required:
        - model
      title: InferBatchResources
      description: |-
        Resources for a batch inference job.

        ``dataset`` is null when the job ran on an uploaded file rather than a
        curated dataset version (async file inference).
    ModelExplainResources:
      properties:
        type:
          type: string
          const: model_explain
          title: Type
          default: model_explain
        model:
          $ref: '#/components/schemas/ModelVersionRef'
        dataset:
          $ref: '#/components/schemas/DatasetVersionRef'
      type: object
      required:
        - model
        - dataset
      title: ModelExplainResources
      description: Resources for a model-scoped explanation job.
    JobExplanationRow:
      properties:
        id:
          type: string
          title: Id
        explanation_text:
          anyOf:
            - type: string
            - type: 'null'
          title: Explanation Text
        explanation_label:
          anyOf:
            - type: string
            - type: 'null'
          title: Explanation Label
        explanation_gloss:
          anyOf:
            - type: string
            - type: 'null'
          title: Explanation Gloss
        feature_contributions:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Feature Contributions
        prediction_flip:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Prediction Flip
      type: object
      required:
        - id
      title: JobExplanationRow
      description: One row explanation returned by an explanation job.
    MetricPoint:
      properties:
        step:
          type: integer
          title: Step
          description: Training step at which this point was sampled.
        train_loss:
          anyOf:
            - type: number
            - type: 'null'
          title: Train Loss
          description: Average training loss over the interval ending at ``step``.
        val_loss:
          anyOf:
            - type: number
            - type: 'null'
          title: Val Loss
          description: Validation loss at ``step``. Null when no val gate fired.
      type: object
      required:
        - step
      title: MetricPoint
      description: |-
        One per-interval training metrics sample.

        Emitted by the trainer at each validation gate; the worker handler
        appends these to ``job.output_json['metrics_history']`` (capped at
        200 points with in-place every-other downsampling).
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    DatasetVersionRef:
      properties:
        id:
          type: string
          title: Id
          description: Public ID of the parent entity (model or dataset).
        version_id:
          type: string
          title: Version Id
          description: Public ID of the referenced version.
        version_number:
          type: integer
          title: Version Number
        archived:
          type: boolean
          title: Archived
          description: True if this dataset version has been archived (soft-deleted).
          default: false
      type: object
      required:
        - id
        - version_id
        - version_number
      title: DatasetVersionRef
      description: Dataset version reference.
    ModelVersionRef:
      properties:
        id:
          type: string
          title: Id
          description: Public ID of the parent entity (model or dataset).
        version_id:
          type: string
          title: Version Id
          description: Public ID of the referenced version.
        version_number:
          type: integer
          title: Version Number
      type: object
      required:
        - id
        - version_id
        - version_number
      title: ModelVersionRef
      description: Model version reference.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````