{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/palo-alto-networks/main/json-schema/palo-alto-networks-stream-detail-response-schema-schema.json",
  "title": "StreamDetailResponseSchema",
  "x-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/palo-alto-networks-report-api-openapi.yml#/components/schemas/StreamDetailResponseSchema",
  "properties": {
    "uuid": {
      "type": "string",
      "format": "uuid",
      "title": "Uuid"
    },
    "tsg_id": {
      "type": "string",
      "title": "Tsg Id"
    },
    "job_id": {
      "type": "string",
      "format": "uuid",
      "title": "Job Id",
      "description": "Job identifier"
    },
    "target_id": {
      "type": "string",
      "format": "uuid",
      "title": "Target Id",
      "description": "Target identifier"
    },
    "stream_idx": {
      "type": "integer",
      "title": "Stream Idx",
      "description": "Stream index",
      "default": 0
    },
    "iteration": {
      "type": "integer",
      "title": "Iteration",
      "description": "Iteration",
      "default": 0
    },
    "goal_id": {
      "type": "string",
      "format": "uuid",
      "title": "Goal Id",
      "description": "Goal identifier"
    },
    "goal": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Goal",
      "description": "Goal to use in the backend"
    },
    "marked_safe": {
      "type": "boolean",
      "title": "Marked Safe",
      "description": "Marked safe",
      "default": false
    },
    "stream_type": {
      "anyOf": [
        {
          "$ref": "#/$defs/StreamType"
        },
        {
          "type": "null"
        }
      ],
      "default": "NORMAL"
    },
    "threat": {
      "type": "boolean",
      "title": "Threat",
      "description": "Indicates if it is a threat",
      "default": false
    },
    "first_threat_iteration": {
      "anyOf": [
        {
          "$ref": "#/$defs/StreamIterationDataSchema"
        },
        {
          "type": "null"
        }
      ],
      "description": "First threat iteration data (denormalized JSONB for performance)"
    },
    "created_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Created At"
    },
    "updated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Updated At"
    },
    "extra_info": {
      "additionalProperties": true,
      "type": "object",
      "title": "Extra Info",
      "description": "Extra information"
    },
    "version": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Version",
      "description": "Stream schema version"
    },
    "error": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Error",
      "description": "Whether this stream encountered errors"
    },
    "error_message": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Error Message",
      "description": "Error message details"
    },
    "iterations": {
      "items": {
        "$ref": "#/$defs/StreamIterationDataResponseSchema"
      },
      "type": "array",
      "title": "Iterations",
      "description": "List of iterations"
    },
    "goal_category": {
      "anyOf": [
        {
          "$ref": "#/$defs/GoalCategory"
        },
        {
          "type": "null"
        }
      ],
      "description": "Goal category for filtering and allocation"
    },
    "goal_metadata": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Goal Metadata",
      "description": "Per-goal metadata (e.g. TOOL_CHAINING tool_sequence, trigger_text, data_flow_narrative, success_markers)"
    }
  },
  "type": "object",
  "required": [
    "uuid",
    "tsg_id",
    "job_id",
    "target_id",
    "goal_id"
  ],
  "$defs": {
    "GoalCategory": {
      "type": "string",
      "enum": [
        "GOAL_MANIPULATION",
        "PRIVILEGE_MISUSE",
        "TOOL_MISUSE",
        "TOOL_CHAINING",
        "TOXIC_CONTENT_GENERATION",
        "CUSTOM"
      ],
      "title": "GoalCategory"
    },
    "StreamIterationDataResponseSchema": {
      "properties": {
        "uuid": {
          "type": "string",
          "format": "uuid",
          "title": "Uuid"
        },
        "tsg_id": {
          "type": "string",
          "title": "Tsg Id"
        },
        "job_id": {
          "type": "string",
          "format": "uuid",
          "title": "Job Id",
          "description": "Job identifier"
        },
        "stream_id": {
          "type": "string",
          "format": "uuid",
          "title": "Stream Id",
          "description": "Stream identifier"
        },
        "goal_id": {
          "type": "string",
          "format": "uuid",
          "title": "Goal Id",
          "description": "Goal identifier"
        },
        "iteration": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Iteration",
          "description": "Iteration number"
        },
        "prompt": {
          "type": "string",
          "minLength": 1,
          "title": "Prompt",
          "description": "The attack prompt"
        },
        "techniques": {
          "type": "string",
          "title": "Techniques",
          "description": "Techniques used in the attack"
        },
        "improvement": {
          "type": "string",
          "title": "Improvement",
          "description": "Improvement strategy for next iteration"
        },
        "prompts_objective": {
          "type": "string",
          "title": "Prompts Objective",
          "description": "Objective of the prompt"
        },
        "summary": {
          "type": "string",
          "title": "Summary",
          "description": "Summary of the attack"
        },
        "output": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Output",
          "description": "Best target output (highest score)"
        },
        "score": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 10.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Score",
          "description": "Best judge score",
          "default": 0
        },
        "judge_reasoning": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Judge Reasoning",
          "description": "Judge reasoning for best output"
        },
        "threat": {
          "type": "boolean",
          "title": "Threat",
          "description": "Whether this is a threat (score == 3)",
          "default": false
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Created At"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Updated At"
        },
        "extra_info": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Extra Info",
          "description": "Extra information"
        },
        "version": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Version",
          "description": "Stream Iter data schema version"
        },
        "error": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error",
          "description": "Whether this iteration had an error"
        },
        "error_message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error Message",
          "description": "Error message for this iteration"
        }
      },
      "type": "object",
      "required": [
        "uuid",
        "tsg_id",
        "job_id",
        "stream_id",
        "goal_id",
        "iteration",
        "prompt",
        "techniques",
        "improvement",
        "prompts_objective",
        "summary"
      ],
      "title": "StreamIterationDataResponseSchema",
      "description": "API response schema for Stream Iteration Data."
    },
    "StreamIterationDataSchema": {
      "properties": {
        "uuid": {
          "type": "string",
          "format": "uuid",
          "title": "Uuid"
        },
        "tsg_id": {
          "type": "string",
          "title": "Tsg Id"
        },
        "job_id": {
          "type": "string",
          "format": "uuid",
          "title": "Job Id",
          "description": "Job identifier"
        },
        "stream_id": {
          "type": "string",
          "format": "uuid",
          "title": "Stream Id",
          "description": "Stream identifier"
        },
        "goal_id": {
          "type": "string",
          "format": "uuid",
          "title": "Goal Id",
          "description": "Goal identifier"
        },
        "iteration": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Iteration",
          "description": "Iteration number"
        },
        "prompt": {
          "type": "string",
          "minLength": 1,
          "title": "Prompt",
          "description": "The attack prompt"
        },
        "prompt_english": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Prompt English",
          "description": "English version of prompt for judge"
        },
        "techniques": {
          "type": "string",
          "title": "Techniques",
          "description": "Techniques used in the attack"
        },
        "improvement": {
          "type": "string",
          "title": "Improvement",
          "description": "Improvement strategy for next iteration"
        },
        "prompts_objective": {
          "type": "string",
          "title": "Prompts Objective",
          "description": "Objective of the prompt"
        },
        "summary": {
          "type": "string",
          "title": "Summary",
          "description": "Summary of the attack"
        },
        "output": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Output",
          "description": "Best target output (highest score)"
        },
        "output_english": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Output English",
          "description": "English version of output for judge"
        },
        "score": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 10.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Score",
          "description": "Best judge score",
          "default": 0
        },
        "judge_reasoning": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Judge Reasoning",
          "description": "Judge reasoning for best output"
        },
        "threat": {
          "type": "boolean",
          "title": "Threat",
          "description": "Whether this is a threat (score == 3)",
          "default": false
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Created At"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Updated At"
        },
        "extra_info": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Extra Info",
          "description": "Extra information"
        },
        "version": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Version",
          "description": "Stream Iter data schema version"
        },
        "error": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error",
          "description": "Whether this iteration had an error"
        },
        "error_message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error Message",
          "description": "Error message for this iteration"
        }
      },
      "type": "object",
      "required": [
        "uuid",
        "tsg_id",
        "job_id",
        "stream_id",
        "goal_id",
        "iteration",
        "prompt",
        "techniques",
        "improvement",
        "prompts_objective",
        "summary"
      ],
      "title": "StreamIterationDataSchema",
      "description": "Main stream iteration data - one row per iteration."
    },
    "StreamType": {
      "type": "string",
      "enum": [
        "NORMAL",
        "ADVERSARIAL"
      ],
      "title": "StreamType"
    }
  }
}