{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fastcrw-com/json-schema/fastcrw-com-scrape-response-schema.json",
  "title": "ScrapeResponse",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fastcrw-com-openapi.json#/components/schemas/ScrapeResponse",
  "type": "object",
  "required": [
    "success",
    "data"
  ],
  "properties": {
    "success": {
      "type": "boolean"
    },
    "warning": {
      "type": "string",
      "description": "Top-level advisory (e.g. fallback render notice)"
    },
    "data": {
      "type": "object",
      "properties": {
        "markdown": {
          "type": "string"
        },
        "html": {
          "type": "string"
        },
        "rawHtml": {
          "type": "string"
        },
        "links": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "json": {
          "type": "object",
          "additionalProperties": true
        },
        "metadata": {
          "$ref": "#/$defs/PageMetadata"
        },
        "warning": {
          "type": "string"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "renderDecision": {
          "type": "object",
          "description": "How the renderer was chosen. A tagged object: `kind` is one of `userPinned`, `autoDefault`, `autoPromoted`, `breakerSkipped`, `failover`, and the remaining fields depend on it.",
          "properties": {
            "kind": {
              "type": "string"
            }
          }
        },
        "creditCost": {
          "type": "number"
        },
        "basis": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Basis"
          },
          "description": "Per-field evidence for the 'json' format; present only when the request set basis:true."
        },
        "basisWarnings": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BasisWarning"
          }
        },
        "llmInputHash": {
          "type": "string",
          "description": "'sha256:'-prefixed hash of the canonical text sent to the extraction LLM. The independent record a consumer checks a citation's sourceHash against, so the check is not circular."
        },
        "sourceHash": {
          "type": "string",
          "description": "Fingerprint of the canonical markdown, for dedup and caching."
        },
        "plainText": {
          "type": "string",
          "description": "Plain-text view; present when `formats` includes `plainText`."
        },
        "images": {
          "$ref": "#/$defs/ScrapedImages"
        },
        "summary": {
          "type": "string",
          "description": "LLM summary; present when `formats` includes `summary`."
        },
        "llmUsage": {
          "type": "object",
          "description": "Token usage for the LLM call, when one ran."
        },
        "chunks": {
          "type": "array",
          "items": {
            "type": "object"
          },
          "description": "Chunked content, when a `chunkStrategy` was requested."
        },
        "contentType": {
          "type": "string",
          "description": "MIME type of the fetched resource."
        },
        "changeTracking": {
          "type": "object",
          "description": "Diff result; present when `formats` includes `changeTracking`."
        },
        "screenshot": {
          "type": "string",
          "description": "PNG capture as a `data:image/png;base64,...` URL; present when `formats` includes `screenshot`."
        },
        "block": {
          "type": "object",
          "description": "Anti-bot verdict. Present only when the page was a block or challenge shell, in which case `success` is false."
        },
        "debugExtraction": {
          "type": "object",
          "description": "Extraction trace; present only when `debug: true`."
        }
      }
    }
  },
  "$defs": {
    "Basis": {
      "type": "object",
      "required": [
        "basisVersion",
        "field",
        "value",
        "status",
        "citations"
      ],
      "description": "Per-field extraction evidence. Emitted only for top-level scalar schema properties, and only when the request set basis:true. citations is empty exactly when status is 'unsupported' or 'notFound'; value is null exactly when status is 'notFound'.",
      "properties": {
        "basisVersion": {
          "type": "integer"
        },
        "field": {
          "type": "string"
        },
        "value": {
          "description": "The schema-validated value; null when status is 'notFound'. Never rewritten to the model's claim."
        },
        "status": {
          "$ref": "#/$defs/FieldStatus"
        },
        "confidence": {
          "type": "string",
          "enum": [
            "low",
            "medium",
            "high"
          ]
        },
        "citations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/EvidenceCitation"
          }
        }
      }
    },
    "BasisWarning": {
      "type": "object",
      "required": [
        "field",
        "code"
      ],
      "description": "A coded reason a field's attribution was downgraded. Closed, crw-owned code set; never upstream text.",
      "properties": {
        "field": {
          "type": "string"
        },
        "code": {
          "type": "string"
        }
      }
    },
    "EvidenceCitation": {
      "type": "object",
      "required": [
        "url",
        "sourceHash",
        "sourceTextKind"
      ],
      "description": "A citation backing an extracted value. Every field is server-produced; never a model-supplied url, hash or excerpt.",
      "properties": {
        "url": {
          "type": "string",
          "description": "The document the engine fetched."
        },
        "title": {
          "type": "string"
        },
        "excerpt": {
          "type": "string",
          "description": "Verbatim span from the canonical source text. Absent when the span could not be established (status 'unverified')."
        },
        "sourceHash": {
          "type": "string",
          "description": "'sha256:<hex>' of the exact text sent to the model."
        },
        "sourceTextKind": {
          "type": "string",
          "description": "Which text sourceHash covers. 'llmInput' for extraction basis (the truncated markdown sent to the model)."
        }
      }
    },
    "FieldStatus": {
      "type": "string",
      "enum": [
        "supported",
        "unverified",
        "unsupported",
        "notFound"
      ],
      "description": "How well an extracted field is attributed to its source. Honest: a field whose attribution could not be verified is 'unverified'/'unsupported' rather than given a fabricated citation."
    },
    "PageMetadata": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "sourceURL": {
          "type": "string",
          "format": "uri"
        },
        "statusCode": {
          "type": "integer"
        }
      }
    },
    "ScrapedImages": {
      "type": "array",
      "description": "Present when `formats` includes `images`.",
      "items": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "alt": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ]
      }
    }
  }
}