{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usewrit-app/json-schema/usewrit-app-crawl-job-schema.json",
  "title": "CrawlJob",
  "description": "A Dragnet crawl job (`crawl_jobs` row), in the `to_view` projection: the JSON-TEXT scope columns are parsed into arrays, and the `Dragnet` brand, the `data_workflow_id` alias (of `workflow_id`) and the derived `is_terminal` are added. SQLite booleans arrive as `0`/`1` integers — kept typed as ints, not coerced.",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/writ-agent.yaml#/components/schemas/CrawlJob",
  "type": "object",
  "required": [
    "id",
    "name",
    "seed_url",
    "include_paths",
    "exclude_paths",
    "max_depth",
    "same_domain",
    "allow_subdomains",
    "extract_mode",
    "respect_robots",
    "delay_ms",
    "max_concurrent",
    "page_budget",
    "status",
    "pages_discovered",
    "pages_done",
    "pages_failed",
    "pages_skipped",
    "workers_active",
    "current_depth",
    "cancel_requested",
    "brand",
    "is_terminal",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "integer",
      "format": "int64"
    },
    "name": {
      "type": "string"
    },
    "seed_url": {
      "type": "string"
    },
    "include_paths": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Parsed path-regex allowlist."
    },
    "exclude_paths": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Parsed path-regex denylist."
    },
    "max_depth": {
      "type": "integer",
      "format": "int64"
    },
    "same_domain": {
      "type": "integer",
      "description": "0/1 integer flag."
    },
    "allow_subdomains": {
      "type": "integer",
      "description": "0/1 integer flag."
    },
    "extract_mode": {
      "type": "string",
      "description": "`markdown` | `schema`."
    },
    "extract_schema": {
      "type": [
        "object",
        "null"
      ],
      "description": "The extraction schema (present when `extract_mode` is `schema`)."
    },
    "persona_id": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "respect_robots": {
      "type": "integer",
      "description": "0/1 integer flag."
    },
    "delay_ms": {
      "type": "integer",
      "format": "int64"
    },
    "max_concurrent": {
      "type": "integer",
      "format": "int64"
    },
    "page_budget": {
      "type": "integer",
      "format": "int64"
    },
    "workflow_id": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "The synthetic per-crawl workflow the extracted pages aggregate under."
    },
    "data_workflow_id": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "Alias of `workflow_id` — read the crawl's data via this workflow id."
    },
    "concierge_session_id": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "status": {
      "type": "string",
      "description": "Open string enum: `queued` | `mapping` | `crawling` | `stopping` | `completed` | `failed` | `cancelled` (the last three are terminal).",
      "enum": [
        "queued",
        "mapping",
        "crawling",
        "stopping",
        "completed",
        "failed",
        "cancelled"
      ]
    },
    "pages_discovered": {
      "type": "integer",
      "format": "int64"
    },
    "pages_done": {
      "type": "integer",
      "format": "int64"
    },
    "pages_failed": {
      "type": "integer",
      "format": "int64"
    },
    "pages_skipped": {
      "type": "integer",
      "format": "int64"
    },
    "workers_active": {
      "type": "integer",
      "format": "int64"
    },
    "current_depth": {
      "type": "integer",
      "format": "int64"
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    },
    "cancel_requested": {
      "type": "integer",
      "description": "0/1 integer flag."
    },
    "brand": {
      "type": "string",
      "description": "Always `Dragnet`."
    },
    "is_terminal": {
      "type": "boolean",
      "description": "Whether `status` is one of the terminal states."
    },
    "created_at": {
      "type": "string"
    },
    "updated_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ]
    }
  }
}