{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rendry-io/json-schema/rendry-io-batch-task-status-schema.json",
  "title": "BatchTaskStatus",
  "description": "Progress of a batch task: counts, every row with its own outcome, and the archive once the run is over.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rendry-io-batch-tasks-api-openapi.yml#/components/schemas/BatchTaskStatus",
  "type": "object",
  "required": [
    "task_id",
    "status",
    "rows_total",
    "rows_done",
    "rows_failed",
    "rows"
  ],
  "properties": {
    "task_id": {
      "type": "string"
    },
    "preset_id": {
      "type": "string"
    },
    "created_at": {
      "type": "string"
    },
    "mapping": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "column -> variable used for this run"
    },
    "status": {
      "type": "string",
      "enum": [
        "running",
        "done",
        "partial",
        "failed"
      ],
      "description": "partial: the run is over with both finished and failed rows"
    },
    "rows_total": {
      "type": "integer"
    },
    "rows_done": {
      "type": "integer"
    },
    "rows_failed": {
      "type": "integer"
    },
    "rows": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/BatchTaskRow"
      }
    },
    "needs_attention": {
      "type": "array",
      "items": {
        "type": "integer"
      },
      "description": "Row indexes (idx) that failed or carry warnings; sent when there are any"
    },
    "verdict": {
      "type": "string",
      "description": "One sentence for a person: clean, with warnings, failed — sent with needs_attention"
    },
    "archive_url": {
      "type": "string",
      "description": "Path of GET /batch-tasks/{id}/archive, relative to the API origin; sent once every row is done or failed"
    },
    "delivery": {
      "$ref": "#/$defs/DeliveryReceipt"
    }
  },
  "$defs": {
    "BatchTaskRow": {
      "type": "object",
      "description": "One data row of a batch task and what became of it.",
      "properties": {
        "idx": {
          "type": "integer",
          "description": "0-based row number in the table"
        },
        "data": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "The variables this row fed"
        },
        "render_job_id": {
          "type": "string",
          "description": "The render job; poll-able through GET /render/status/{id}. A row refused before rendering carries a marker instead of an id"
        },
        "status": {
          "type": "string",
          "enum": [
            "queued",
            "processing",
            "done",
            "error"
          ]
        },
        "result_url": {
          "type": "string",
          "description": "Path under /api/v1/files/… relative to the API origin — prefix https://rendry.io to download. Historical image results are public. New document attempt files and their page previews require the authenticated owner; a user asset (user_assets/…) is served only to its owner."
        },
        "error": {
          "type": "string"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Layout findings of the finished picture (shrunk or clipped text, a sample photo printed)"
        },
        "ai_content": {
          "type": "string",
          "enum": [
            "composite"
          ],
          "description": "Present only when the rendered output contains an owned AI image; the artifact carries composite AI-content metadata."
        }
      }
    },
    "DeliveryReceipt": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status"
      ],
      "description": "Present only when deliver_to was given. A delivery failure does not refund or change the render.",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "delivered",
            "failed"
          ]
        },
        "reason": {
          "type": "string",
          "enum": [
            "address",
            "transport",
            "http",
            "source",
            "render",
            "archive",
            "expired"
          ]
        },
        "http_status": {
          "type": "integer",
          "minimum": 100,
          "maximum": 599,
          "description": "Remote status code, only with reason http."
        },
        "notice": {
          "type": "string",
          "const": "The file remains available at Rendry; a delivery failure does not refund the render."
        }
      }
    }
  }
}