{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/finedata-ai/json-schema/finedata-ai-public-scrape-response-schema.json",
  "title": "PublicScrapeResponse",
  "description": "Scrape result.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/finedata-openapi.json#/components/schemas/PublicScrapeResponse",
  "properties": {
    "success": {
      "type": "boolean",
      "title": "Success",
      "description": "Whether the request completed successfully"
    },
    "status_code": {
      "type": "integer",
      "title": "Status Code",
      "description": "HTTP status code of the target page"
    },
    "headers": {
      "type": "object",
      "title": "Headers",
      "description": "Response headers from the target page"
    },
    "body": {
      "type": "string",
      "title": "Body",
      "description": "Raw HTML or text content of the page (kept for backward compatibility)"
    },
    "data": {
      "anyOf": [
        {
          "$ref": "#/$defs/ScrapeData"
        },
        {
          "type": "null"
        }
      ],
      "description": "Structured output based on requested 'formats'. Contains markdown, text, links, etc."
    },
    "meta": {
      "type": "object",
      "title": "Meta",
      "description": "Request metadata: url, resolved_url, elapsed_ms, proxy_country"
    },
    "tokens_used": {
      "type": "integer",
      "title": "Tokens Used",
      "description": "Total tokens consumed for this request",
      "default": 1
    },
    "captcha_detected": {
      "type": "boolean",
      "title": "Captcha Detected",
      "description": "Whether a captcha was detected on the page",
      "default": false
    },
    "captcha_type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Captcha Type",
      "description": "Captcha type if detected: recaptcha_v2, recaptcha_v3, hcaptcha, turnstile"
    },
    "captcha_solved": {
      "type": "boolean",
      "title": "Captcha Solved",
      "description": "Whether the captcha was solved successfully",
      "default": false
    }
  },
  "type": "object",
  "required": [
    "success",
    "status_code",
    "headers",
    "body"
  ],
  "$defs": {
    "ScrapeData": {
      "properties": {
        "markdown": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Markdown",
          "description": "Page content converted to Markdown format. Clean, LLM-friendly output"
        },
        "raw_html": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Raw Html",
          "description": "Original HTML content of the page"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Text",
          "description": "Plain text content extracted from the page"
        },
        "links": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Links",
          "description": "All links (URLs) found on the page"
        },
        "screenshot": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Screenshot",
          "description": "Base64-encoded PNG screenshot of the page (requires JS rendering)"
        },
        "extract": {
          "anyOf": [
            {
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Extract",
          "description": "Structured data extracted via extract_rules, extract_schema, or extract_prompt"
        },
        "metadata": {
          "anyOf": [
            {
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Metadata",
          "description": "Page metadata: title, description, language, og:image, favicon, etc."
        },
        "content_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Content Type",
          "description": "Original Content-Type of the response (useful for binary data detection)"
        },
        "csv": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Csv",
          "description": "AI extraction results as CSV string (when 'csv' format requested)"
        },
        "xlsx": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Xlsx",
          "description": "AI extraction results as base64-encoded XLSX (when 'xlsx' format requested)"
        }
      },
      "type": "object",
      "title": "ScrapeData",
      "description": "Structured scrape output. Fields are populated based on the requested 'formats'."
    }
  }
}