{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/contrie-com/json-schema/contrie-com-scrape-request-schema.json",
  "title": "ScrapeRequest",
  "description": "Unknown fields, here or in options, are refused with 400 INVALID_REQUEST naming them.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/contrie-com-openapi.yml#/components/schemas/ScrapeRequest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "url"
  ],
  "properties": {
    "url": {
      "type": "string",
      "format": "uri",
      "description": "Target page. Must be http or https."
    },
    "extract": {
      "type": "string",
      "description": "Natural-language description of the data to extract.",
      "maxLength": 4000
    },
    "schema": {
      "$ref": "#/$defs/JsonSchemaSubset"
    },
    "format": {
      "type": "string",
      "description": "json: structured data; markdown: the page as markdown; both: both in one response (REST only, not an MCP tool argument).",
      "enum": [
        "json",
        "markdown",
        "both"
      ],
      "default": "json"
    },
    "options": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "timeout": {
          "type": "integer",
          "minimum": 1000,
          "maximum": 30000,
          "description": "REST only. Fetch timeout in milliseconds."
        },
        "maxAge": {
          "type": "integer",
          "minimum": 0,
          "maximum": 86400,
          "description": "Maximum age in seconds of page bytes reused within your account. Default 0 bypasses cache reads and writes. A shorter origin expiry takes precedence. Query/fragment/user-info URLs and restrictive origin responses bypass caching. Cache hits preserve metadata.fetchedAt; this is not a zero-retention setting for extraction logs."
        },
        "waitFor": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "REST only. CSS selector to wait for after browser navigation. Applies only when rendering occurs; the request still fails at the overall timeout if the selector never appears."
        }
      }
    },
    "render": {
      "type": "string",
      "enum": [
        "auto",
        "always",
        "never"
      ],
      "default": "auto",
      "description": "auto renders the page in a browser only when the plain fetch returns a JavaScript shell (RENDER_REQUIRED); always renders first; never keeps the plain fetch. An accepted rendered answer costs 2 extra credits. A rendered request must fit the plan's per-request cap (Free 3, Builder 5, Pro 17 credits including the surcharge)."
    }
  },
  "$defs": {
    "JsonSchemaSubset": {
      "type": "object",
      "description": "JSON Schema subset. type accepts one supported type or an array of supported types for nullable unions. Supported keywords: properties, required, items, enum, description. Other keywords, such as value constraints (minLength, pattern), and combinators the subset cannot express are carried unchecked. A local $ref is inlined and a nullable anyOf or oneOf becomes a type list. Only unusable schemas are refused: required that is neither a list nor a name, enum that is not a list, or a null property schema, is a 400 INVALID_REQUEST naming the keyword. Maximum 10,000 bytes when serialized as UTF-8 JSON.",
      "properties": {
        "type": {
          "oneOf": [
            {
              "type": "string",
              "enum": [
                "object",
                "array",
                "string",
                "number",
                "integer",
                "boolean",
                "null"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "object",
                  "array",
                  "string",
                  "number",
                  "integer",
                  "boolean",
                  "null"
                ]
              },
              "minItems": 1,
              "uniqueItems": true
            }
          ]
        },
        "properties": {
          "type": "object"
        },
        "required": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "items": {
          "type": "object"
        },
        "enum": {
          "type": "array"
        },
        "description": {
          "type": "string"
        }
      }
    }
  }
}