{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hydrafetch-com/json-schema/hydrafetch-com-search-response-dto-schema.json",
  "title": "SearchResponseDto",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hydrafetch-com-search-api-openapi.yml#/components/schemas/SearchResponseDto",
  "type": "object",
  "properties": {
    "data": {
      "$ref": "#/$defs/SearchResultDto"
    }
  },
  "required": [
    "data"
  ],
  "$defs": {
    "SearchResultDto": {
      "type": "object",
      "properties": {
        "query": {
          "type": "string",
          "description": "The query you searched."
        },
        "status": {
          "type": "string",
          "enum": [
            "ok",
            "no_results"
          ],
          "description": "Whether the search found anything: `ok` when it returned results, `no_results` when the web had no match. An empty `results` with `no_results` is a real miss — if the search cannot be completed at all, the request fails with 503 rather than returning an empty list."
        },
        "results": {
          "description": "The ranked results.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/SearchResultItemDto"
          }
        }
      },
      "required": [
        "query",
        "status",
        "results"
      ]
    },
    "SearchResultItemDto": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "description": "The result title."
        },
        "url": {
          "type": "string",
          "description": "The result URL."
        },
        "snippet": {
          "type": "string",
          "description": "A short snippet describing the result."
        },
        "rank": {
          "type": "number",
          "description": "The result's position in the ranked list."
        },
        "data": {
          "description": "The scraped page for this result, or null when scraping is off or unavailable.",
          "type": [
            "object",
            "null"
          ],
          "allOf": [
            {
              "$ref": "#/$defs/WebScrapeDataDto"
            }
          ]
        }
      },
      "required": [
        "title",
        "url",
        "snippet",
        "rank",
        "data"
      ]
    },
    "WebLinksDto": {
      "type": "object",
      "properties": {
        "internal": {
          "description": "Links pointing to the same site.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "external": {
          "description": "Links pointing to other sites.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "internal",
        "external"
      ]
    },
    "WebQualityDto": {
      "type": "object",
      "properties": {
        "confidence": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "How trustworthy the extraction is, from 0 to 1. High when independent checks corroborate substantial content; near zero when the page yielded almost nothing."
        },
        "complete": {
          "type": "boolean",
          "description": "Whether the result captured the bulk of the content available on the page. False when the result looks thin or truncated."
        },
        "blocked": {
          "type": "boolean",
          "description": "Whether the page appeared to be behind a challenge or bot wall."
        }
      },
      "required": [
        "confidence",
        "complete",
        "blocked"
      ]
    },
    "WebScrapeDataDto": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "description": "The URL you requested."
        },
        "finalUrl": {
          "type": "string",
          "description": "The final URL after any redirects."
        },
        "redirected": {
          "type": "boolean",
          "description": "Whether the origin redirected: true when `finalUrl` differs from the URL you requested. Explicit so a page with no redirect is distinguishable from one whose redirect was not tracked."
        },
        "status": {
          "type": "number",
          "description": "HTTP status of the fetched page."
        },
        "cached": {
          "type": "boolean",
          "description": "Whether this result was served from cache."
        },
        "warning": {
          "type": "string",
          "description": "Set when the page was returned with a caveat (e.g. partial content)."
        },
        "metadata": {
          "$ref": "#/$defs/WebScrapeMetadataDto"
        },
        "usage": {
          "$ref": "#/$defs/WebUsageDto"
        },
        "quality": {
          "description": "Per-page extraction quality signals.",
          "allOf": [
            {
              "$ref": "#/$defs/WebQualityDto"
            }
          ]
        },
        "markdown": {
          "type": "string",
          "description": "Clean Markdown of the main content. Returned when `markdown` is requested."
        },
        "html": {
          "type": "string",
          "description": "Cleaned main-content HTML. Returned when `html` is requested."
        },
        "rawHtml": {
          "type": "string",
          "description": "The unmodified page HTML. Returned when `rawHtml` is requested."
        },
        "links": {
          "description": "Returned when `links` is requested.",
          "allOf": [
            {
              "$ref": "#/$defs/WebLinksDto"
            }
          ]
        },
        "structured": {
          "description": "Returned when `structured` is requested.",
          "allOf": [
            {
              "$ref": "#/$defs/WebStructuredDataDto"
            }
          ]
        },
        "summary": {
          "type": "string",
          "description": "A concise factual summary. Returned when `summary` is requested (LLM-backed)."
        },
        "json": {
          "type": "object",
          "additionalProperties": true,
          "description": "Schema-shaped JSON. Returned when `json` is requested (LLM-backed)."
        }
      },
      "required": [
        "url",
        "finalUrl",
        "redirected",
        "status",
        "cached",
        "metadata"
      ]
    },
    "WebScrapeMetadataDto": {
      "type": "object",
      "properties": {
        "title": {
          "type": [
            "object",
            "null"
          ],
          "description": "The page title."
        },
        "structure": {
          "type": "string",
          "enum": [
            "markdown",
            "plain"
          ],
          "description": "Whether the content carries markdown structure (headings, lists, emphasis) or is plain prose. `plain` is not an error — the default extractor optimises for capturing every word and wins on listing and forum pages. If you need the structure, re-request with `preferStructure: true`."
        },
        "pageType": {
          "type": "string",
          "description": "Coarse page classification (e.g. article, listing, forum, docs)."
        },
        "wordCount": {
          "type": "number",
          "description": "Word count of the extracted main content."
        },
        "description": {
          "type": [
            "object",
            "null"
          ],
          "description": "The page's own description (meta description / og:description)."
        },
        "language": {
          "type": [
            "object",
            "null"
          ],
          "description": "The language the page declares."
        },
        "author": {
          "type": [
            "object",
            "null"
          ],
          "description": "The declared author."
        },
        "siteName": {
          "type": [
            "object",
            "null"
          ],
          "description": "The declared site name."
        },
        "publishedTime": {
          "type": [
            "object",
            "null"
          ],
          "description": "When the page says it was published (ISO 8601)."
        },
        "modifiedTime": {
          "type": [
            "object",
            "null"
          ],
          "description": "When the page says it was last updated (ISO 8601)."
        },
        "image": {
          "type": [
            "object",
            "null"
          ],
          "description": "The page's lead image (og:image)."
        }
      },
      "required": [
        "title",
        "structure",
        "pageType",
        "wordCount",
        "description",
        "language",
        "author",
        "siteName",
        "publishedTime",
        "modifiedTime",
        "image"
      ]
    },
    "WebStructuredDataDto": {
      "type": "object",
      "properties": {
        "entities": {
          "description": "The page's own structured data, normalised into one deduplicated list of typed entities.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/WebStructuredEntityDto"
          }
        },
        "jsonLd": {
          "description": "Raw JSON-LD blocks, as found on the page.",
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "microdata": {
          "description": "Raw microdata items.",
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "opengraph": {
          "description": "Raw OpenGraph/Twitter-card tags.",
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "rdfa": {
          "description": "Raw RDFa items.",
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "appState": {
          "description": "Names of embedded framework app-state blocks detected on the page.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "entities",
        "jsonLd",
        "microdata",
        "opengraph",
        "rdfa",
        "appState"
      ]
    },
    "WebStructuredEntityDto": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "The schema.org type of the entity."
        },
        "source": {
          "type": "string",
          "enum": [
            "json-ld",
            "microdata",
            "rdfa",
            "opengraph"
          ],
          "description": "Which structured-data syntax the entity came from."
        },
        "properties": {
          "type": "object",
          "additionalProperties": true,
          "description": "The entity's properties, as published."
        }
      },
      "required": [
        "type",
        "source",
        "properties"
      ]
    },
    "WebUsageDto": {
      "type": "object",
      "properties": {
        "creditsUsed": {
          "type": "number",
          "description": "Credits this call consumed. Charged only on success."
        },
        "creditsRemaining": {
          "type": "number",
          "description": "Credits left in your workspace's balance after this call."
        },
        "freshness": {
          "type": "string",
          "enum": [
            "cache",
            "fresh"
          ],
          "description": "Whether the result was served from cache or freshly fetched."
        }
      },
      "required": [
        "creditsUsed",
        "creditsRemaining",
        "freshness"
      ]
    }
  }
}