{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nessflow-com/json-schema/nessflow-com-crawl-schema.json",
  "title": "Crawl",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nessflow-com-openapi.json#/components/schemas/Crawl",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "project_id",
    "campaign_id",
    "status",
    "stage",
    "active",
    "stage_plan",
    "pages",
    "issue_counts",
    "truncated",
    "blocked",
    "blocked_reason",
    "comparable",
    "error",
    "trigger",
    "started_at",
    "finished_at",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "project_id": {
      "type": "string",
      "format": "uuid"
    },
    "campaign_id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "paused",
        "completed",
        "failed",
        "stopped"
      ]
    },
    "stage": {
      "type": "string"
    },
    "active": {
      "type": "boolean",
      "description": "Whether the crawl is still running, as judged by the server. Poll while `true`."
    },
    "stage_plan": {
      "type": [
        "object",
        "null"
      ],
      "description": "Post-processing plan; `null` when the crawl has no plan yet (not measured, never zero steps).",
      "additionalProperties": false,
      "required": [
        "current_step",
        "step_count",
        "settled",
        "steps"
      ],
      "properties": {
        "current_step": {
          "type": [
            "integer",
            "null"
          ]
        },
        "step_count": {
          "type": "integer"
        },
        "settled": {
          "type": "boolean"
        },
        "steps": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "stage",
              "state",
              "skip_reason"
            ],
            "properties": {
              "stage": {
                "type": "string"
              },
              "state": {
                "type": "string",
                "enum": [
                  "pending",
                  "running",
                  "done",
                  "skipped",
                  "failed",
                  "interrupted"
                ]
              },
              "skip_reason": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      }
    },
    "pages": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "crawled",
        "discovered",
        "budget"
      ],
      "description": "Page counts and the URL budget granted to the crawl. The budget is never a percentage of completion.",
      "properties": {
        "crawled": {
          "type": "integer"
        },
        "discovered": {
          "type": "integer"
        },
        "budget": {
          "type": [
            "integer",
            "null"
          ]
        }
      }
    },
    "issue_counts": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "error",
        "warning",
        "info"
      ],
      "properties": {
        "error": {
          "type": "integer"
        },
        "warning": {
          "type": "integer"
        },
        "info": {
          "type": "integer"
        }
      }
    },
    "truncated": {
      "type": "boolean"
    },
    "blocked": {
      "type": "boolean"
    },
    "blocked_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "comparable": {
      "type": "boolean",
      "description": "Neither truncated nor blocked, so comparable with another run."
    },
    "error": {
      "type": [
        "string",
        "null"
      ],
      "description": "Stable failure reason code, never a raw message."
    },
    "trigger": {
      "type": "string",
      "enum": [
        "manual",
        "scheduled",
        "api",
        "mcp"
      ]
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "finished_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "created_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  }
}