{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/huggingbay-xyz/json-schema/huggingbay-xyz-batch-job-request-schema.json",
  "title": "BatchJobRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/huggingbay-xyz-jobs-api-openapi.yml#/components/schemas/BatchJobRequest",
  "properties": {
    "items": {
      "items": {
        "$ref": "#/$defs/JobItemRequest"
      },
      "type": "array",
      "maxItems": 8,
      "minItems": 1,
      "title": "Items",
      "description": "Bounded operations executed sequentially in submission order."
    },
    "callback": {
      "anyOf": [
        {
          "$ref": "#/$defs/JobCallbackRequest"
        },
        {
          "type": "null"
        }
      ],
      "description": "Optional per-job HTTPS callback. When omitted, the active principal callback registration is used if one exists. Terminal content is completed.result or failed.error and is sent to the caller-provided callback URL; recipient processing and retention are controlled by the recipient, and Bay Run retention does not govern recipient-side handling."
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "items"
  ],
  "$defs": {
    "JobCallbackRequest": {
      "properties": {
        "url": {
          "type": "string",
          "maxLength": 2048,
          "minLength": 1,
          "title": "Url",
          "description": "HTTPS endpoint that receives signed terminal job events. Completed events carry completed.result and failed events carry failed.error at the caller-provided URL; recipient processing and retention are controlled by the recipient and are not governed by Bay Run retention."
        },
        "secret": {
          "type": "string",
          "maxLength": 256,
          "minLength": 16,
          "title": "Secret",
          "description": "Caller-held secret used to verify X-Bay-Run-Signature."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "url",
        "secret"
      ],
      "title": "JobCallbackRequest",
      "description": "HTTPS callback target and caller-held verification secret."
    },
    "JobItemRequest": {
      "properties": {
        "id": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 64,
              "minLength": 1,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Id",
          "description": "Caller correlation id; defaults to the zero-based item index."
        },
        "operation": {
          "type": "string",
          "enum": [
            "embeddings",
            "rerank",
            "classify",
            "summarize",
            "pdf_extract",
            "find_specialist",
            "calculate",
            "validate_json",
            "resolve_link"
          ],
          "title": "Operation"
        },
        "arguments": {
          "additionalProperties": true,
          "type": "object",
          "title": "Arguments"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "operation",
        "arguments"
      ],
      "title": "JobItemRequest",
      "description": "Shared typed item contract for both MCP discovery and REST/OpenAPI."
    }
  }
}