{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/omniyond-com/json-schema/omniyond-com-job-detail-schema.json",
  "title": "JobDetail",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/omniyond-com-openapi.yml#/components/schemas/JobDetail",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "scheduled",
        "queued",
        "running",
        "paused",
        "completed",
        "cancelled",
        "failed"
      ]
    },
    "kind": {
      "type": "string",
      "enum": [
        "http",
        "x402"
      ]
    },
    "targetUrl": {
      "type": "string"
    },
    "method": {
      "type": "string"
    },
    "schedule": {
      "type": [
        "string",
        "null"
      ]
    },
    "nextRunAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "deliveryMode": {
      "type": "string",
      "enum": [
        "store",
        "callback",
        "both"
      ]
    },
    "callbackUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "balanceMicrousd": {
      "type": "integer"
    },
    "feeMicrousd": {
      "type": "integer"
    },
    "maxDownstreamMicrousd": {
      "type": "integer",
      "description": "Per-run downstream payment cap in microUSD (0 for http jobs)."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "recentRuns": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/JobRun"
      }
    }
  },
  "$defs": {
    "JobRun": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "attempt": {
          "type": "integer"
        },
        "status": {
          "type": "string",
          "enum": [
            "running",
            "success",
            "error"
          ]
        },
        "responseCode": {
          "type": [
            "integer",
            "null"
          ]
        },
        "paidMicrousd": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Amount paid to the downstream API on this run, in microUSD (x402 jobs only)."
        },
        "txHash": {
          "type": [
            "string",
            "null"
          ],
          "description": "Settlement transaction hash for the downstream payment (x402 jobs only)."
        },
        "startedAt": {
          "type": "string",
          "format": "date-time"
        },
        "finishedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "error": {
          "type": [
            "string",
            "null"
          ]
        },
        "resultR2Key": {
          "type": [
            "string",
            "null"
          ],
          "description": "Storage key of the run's response body (results endpoint only)."
        },
        "body": {
          "type": "string",
          "description": "The run's stored response body (only when ?body=1)."
        }
      }
    }
  }
}