{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/kaitoi-io/json-schema/kaitoi-io-public-template-endpoint-docs-schema.json",
  "title": "PublicTemplateEndpointDocs",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kaitoi-io-openapi.json#/components/schemas/PublicTemplateEndpointDocs",
  "properties": {
    "templateId": {
      "type": "string",
      "title": "Templateid",
      "description": "Template identifier."
    },
    "endpointId": {
      "type": "string",
      "title": "Endpointid",
      "description": "Endpoint identifier."
    },
    "name": {
      "type": "string",
      "title": "Name",
      "description": "Endpoint display name."
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Description",
      "description": "Endpoint description."
    },
    "auth": {
      "$ref": "#/$defs/PublicTemplateEndpointAuthDocs",
      "description": "Authentication requirements for the external endpoint."
    },
    "externalRun": {
      "$ref": "#/$defs/PublicTemplateEndpointRunDocs",
      "description": "Current external endpoint run contract."
    },
    "ownerRun": {
      "$ref": "#/$defs/PublicTemplateEndpointOwnerRunDocs",
      "description": "Owner-authenticated public API execution availability."
    },
    "inputs": {
      "items": {
        "$ref": "#/$defs/PublicTemplateEndpointPin"
      },
      "type": "array",
      "title": "Inputs",
      "description": "Exposed endpoint inputs."
    },
    "outputs": {
      "items": {
        "$ref": "#/$defs/PublicTemplateEndpointPin"
      },
      "type": "array",
      "title": "Outputs",
      "description": "Exposed endpoint outputs."
    },
    "requestExample": {
      "additionalProperties": true,
      "type": "object",
      "title": "Requestexample",
      "description": "Minimal JSON submit body example."
    }
  },
  "type": "object",
  "required": [
    "templateId",
    "endpointId",
    "name",
    "externalRun",
    "inputs",
    "outputs",
    "requestExample"
  ],
  "$defs": {
    "PublicTemplateEndpointAuthDocs": {
      "properties": {
        "scheme": {
          "type": "string",
          "const": "bearer",
          "title": "Scheme",
          "description": "Authentication scheme.",
          "default": "bearer"
        },
        "header": {
          "type": "string",
          "const": "Authorization",
          "title": "Header",
          "description": "HTTP header name.",
          "default": "Authorization"
        },
        "valueFormat": {
          "type": "string",
          "title": "Valueformat",
          "description": "Header value format for the external endpoint API key.",
          "default": "Bearer <endpoint_api_key>"
        },
        "apiKeyReturnedOnce": {
          "type": "boolean",
          "title": "Apikeyreturnedonce",
          "description": "Endpoint API keys are shown only when created or regenerated.",
          "default": true
        }
      },
      "type": "object",
      "title": "PublicTemplateEndpointAuthDocs"
    },
    "PublicTemplateEndpointOwnerRunDocs": {
      "properties": {
        "available": {
          "type": "boolean",
          "title": "Available",
          "description": "Whether owner-authenticated public API execution is currently available for this template endpoint.",
          "default": true
        },
        "submit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Submit",
          "description": "Owner-authenticated public API path for submitting an async template endpoint run."
        },
        "status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Status",
          "description": "Owner-authenticated public API path for polling a template endpoint run."
        },
        "stream": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Stream",
          "description": "Owner-authenticated public API path for streaming template endpoint run progress with Server-Sent Events."
        },
        "method": {
          "type": "string",
          "const": "POST",
          "title": "Method",
          "description": "Submit method.",
          "default": "POST"
        },
        "statusMethod": {
          "type": "string",
          "const": "GET",
          "title": "Statusmethod",
          "description": "Status polling method.",
          "default": "GET"
        },
        "streamMethod": {
          "type": "string",
          "const": "GET",
          "title": "Streammethod",
          "description": "Progress stream method.",
          "default": "GET"
        },
        "auth": {
          "type": "string",
          "const": "publicApiBearerToken",
          "title": "Auth",
          "description": "Use a public API bearer token with templates:run scope.",
          "default": "publicApiBearerToken"
        },
        "contentTypes": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Contenttypes",
          "description": "Accepted owner-authenticated submit request content types."
        },
        "note": {
          "type": "string",
          "title": "Note",
          "description": "Current owner-authenticated execution status.",
          "default": "Owner-authenticated execution uses the public API key owner and may spend credits."
        }
      },
      "type": "object",
      "title": "PublicTemplateEndpointOwnerRunDocs"
    },
    "PublicTemplateEndpointPin": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name",
          "description": "Human-readable exposed input/output label."
        },
        "fieldName": {
          "type": "string",
          "title": "Fieldname",
          "description": "Stable request/response field name."
        },
        "dataType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Datatype",
          "description": "Workflow data type for this exposed pin."
        },
        "kind": {
          "type": "string",
          "enum": [
            "primitive",
            "text",
            "file",
            "unknown"
          ],
          "title": "Kind",
          "description": "Broad integration hint for whether this field expects scalar primitive, text-wrapper, or file-like data.",
          "default": "unknown"
        },
        "nodeId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Nodeid",
          "description": "Template node id that owns the exposed pin."
        },
        "pinName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Pinname",
          "description": "Node pin name inside the template graph."
        }
      },
      "type": "object",
      "required": [
        "name",
        "fieldName"
      ],
      "title": "PublicTemplateEndpointPin"
    },
    "PublicTemplateEndpointRunDocs": {
      "properties": {
        "submit": {
          "type": "string",
          "title": "Submit",
          "description": "Path for submitting an async external template endpoint run."
        },
        "status": {
          "type": "string",
          "title": "Status",
          "description": "Path for polling a submitted external template endpoint run."
        },
        "info": {
          "type": "string",
          "title": "Info",
          "description": "Path for reading external endpoint metadata."
        },
        "method": {
          "type": "string",
          "const": "POST",
          "title": "Method",
          "description": "Submit method.",
          "default": "POST"
        },
        "statusMethod": {
          "type": "string",
          "const": "GET",
          "title": "Statusmethod",
          "description": "Status polling method.",
          "default": "GET"
        },
        "contentTypes": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Contenttypes",
          "description": "Accepted submit request content types."
        }
      },
      "type": "object",
      "required": [
        "submit",
        "status",
        "info"
      ],
      "title": "PublicTemplateEndpointRunDocs"
    }
  }
}