{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/kaitoi-io/json-schema/kaitoi-io-public-run-detail-schema.json",
  "title": "PublicRunDetail",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kaitoi-io-openapi.json#/components/schemas/PublicRunDetail",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "sourceType": {
      "type": "string",
      "enum": [
        "project",
        "inline_graph"
      ],
      "title": "Sourcetype",
      "default": "project"
    },
    "projectId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Projectid"
    },
    "projectVersion": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Projectversion"
    },
    "status": {
      "type": "string",
      "enum": [
        "accepted",
        "queued",
        "running",
        "succeeded",
        "failed",
        "canceled"
      ],
      "title": "Status"
    },
    "cancelRequested": {
      "type": "boolean",
      "title": "Cancelrequested",
      "default": false
    },
    "targetNodeIds": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Targetnodeids"
    },
    "externalId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Externalid"
    },
    "externalUserId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Externaluserid"
    },
    "externalWorkspaceId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Externalworkspaceid"
    },
    "inputFiles": {
      "items": {
        "$ref": "#/$defs/PublicRunFileInputReference"
      },
      "type": "array",
      "title": "Inputfiles"
    },
    "outputs": {
      "additionalProperties": {
        "oneOf": [
          {
            "$ref": "#/$defs/PublicFileOutput"
          },
          {
            "$ref": "#/$defs/PublicPrimitiveOutput"
          }
        ]
      },
      "type": "object",
      "title": "Outputs"
    },
    "error": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Error"
    },
    "creditsUsed": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Creditsused",
      "description": "Credits charged by this run. Null while the run is active, or when a terminal run could not produce a reliable accounting summary."
    },
    "creditsUsedMicrocredits": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Creditsusedmicrocredits",
      "description": "Exact run charge in millionths of one credit."
    },
    "spend": {
      "anyOf": [
        {
          "$ref": "#/$defs/PublicRunSpendSummary"
        },
        {
          "type": "null"
        }
      ],
      "description": "Compact spend summary for this run, populated from node execution cost snapshots when the run reaches a terminal state."
    },
    "executionTimeMs": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Executiontimems"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "title": "Createdat"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "title": "Updatedat"
    }
  },
  "type": "object",
  "required": [
    "id",
    "status",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "PublicFileOutput": {
      "properties": {
        "type": {
          "type": "string",
          "const": "file",
          "title": "Type",
          "default": "file"
        },
        "fileId": {
          "type": "string",
          "title": "Fileid"
        },
        "filename": {
          "type": "string",
          "title": "Filename"
        },
        "contentType": {
          "type": "string",
          "title": "Contenttype"
        },
        "sizeBytes": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Sizebytes"
        },
        "downloadUrl": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Downloadurl"
        },
        "expiresAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Expiresat"
        },
        "previewUrl": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Previewurl"
        },
        "previewExpiresAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Previewexpiresat"
        }
      },
      "type": "object",
      "required": [
        "fileId",
        "filename",
        "contentType",
        "sizeBytes"
      ],
      "title": "PublicFileOutput"
    },
    "PublicPrimitiveOutput": {
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "string",
            "number",
            "boolean",
            "json",
            "null"
          ],
          "title": "Type"
        },
        "value": {
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "type",
        "value"
      ],
      "title": "PublicPrimitiveOutput"
    },
    "PublicRunFileInputReference": {
      "properties": {
        "nodeId": {
          "type": "string",
          "title": "Nodeid"
        },
        "inputName": {
          "type": "string",
          "title": "Inputname"
        },
        "fileId": {
          "type": "string",
          "title": "Fileid"
        },
        "filename": {
          "type": "string",
          "title": "Filename"
        },
        "contentType": {
          "type": "string",
          "title": "Contenttype"
        },
        "sizeBytes": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Sizebytes"
        },
        "externalId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Externalid"
        },
        "externalUserId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Externaluserid"
        },
        "externalWorkspaceId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Externalworkspaceid"
        }
      },
      "type": "object",
      "required": [
        "nodeId",
        "inputName",
        "fileId",
        "filename",
        "contentType",
        "sizeBytes"
      ],
      "title": "PublicRunFileInputReference"
    },
    "PublicRunSpendNode": {
      "properties": {
        "nodeId": {
          "type": "string",
          "title": "Nodeid"
        },
        "nodeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Nodetype"
        },
        "nodeTitle": {
          "type": "string",
          "title": "Nodetitle"
        },
        "credits": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Credits"
        },
        "microcredits": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Microcredits",
          "description": "Exact billed amount in millionths of one credit."
        },
        "billedRuns": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Billedruns",
          "description": "Number of cost-bearing node execution snapshots counted for this node."
        }
      },
      "type": "object",
      "required": [
        "nodeId",
        "nodeTitle",
        "credits",
        "billedRuns"
      ],
      "title": "PublicRunSpendNode"
    },
    "PublicRunSpendSummary": {
      "properties": {
        "totalCredits": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Totalcredits"
        },
        "totalMicrocredits": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Totalmicrocredits"
        },
        "byNode": {
          "items": {
            "$ref": "#/$defs/PublicRunSpendNode"
          },
          "type": "array",
          "title": "Bynode"
        },
        "byProvider": {
          "additionalProperties": {
            "type": "integer"
          },
          "type": "object",
          "title": "Byprovider"
        },
        "byProviderMicrocredits": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "title": "Byprovidermicrocredits"
        },
        "byChargeType": {
          "additionalProperties": {
            "type": "integer"
          },
          "type": "object",
          "title": "Bychargetype"
        },
        "byChargeTypeMicrocredits": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "title": "Bychargetypemicrocredits"
        }
      },
      "type": "object",
      "required": [
        "totalCredits"
      ],
      "title": "PublicRunSpendSummary"
    }
  }
}