{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/scifig-ai/json-schema/scifig-ai-job-schema.json",
  "title": "Job",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/scifig-ai-openapi.json#/components/schemas/Job",
  "type": "object",
  "required": [
    "id",
    "kind",
    "status",
    "created_at",
    "credits",
    "outputs",
    "error"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "kind": {
      "type": "string",
      "enum": [
        "image_generation",
        "image_edit",
        "image_upscale",
        "image_conversion",
        "chart",
        "flowchart"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "processing",
        "succeeded",
        "failed",
        "canceled"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "credits": {
      "type": "object",
      "properties": {
        "reserved": {
          "type": "integer"
        },
        "charged": {
          "type": "integer"
        },
        "refunded": {
          "type": "integer"
        }
      }
    },
    "outputs": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "format": "uuid"
          },
          "format": {
            "type": "string"
          },
          "download_url": {
            "type": "string",
            "format": "uri"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "width": {
            "type": "integer",
            "minimum": 1,
            "description": "Pixel width, when the output is a raster image."
          },
          "height": {
            "type": "integer",
            "minimum": 1,
            "description": "Pixel height, when the output is a raster image."
          },
          "editor_url": {
            "type": "string",
            "format": "uri",
            "description": "Charts and flowcharts: opens the conversation in the SciFig web editor (the signed-in owner only)."
          }
        }
      }
    },
    "error": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "object",
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "details": {
              "type": "object"
            }
          }
        }
      ]
    },
    "late_delivery_until": {
      "type": "string",
      "format": "date-time"
    }
  }
}