{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/periskop-ai/json-schema/periskop-ai-discovery-request-schema.json",
  "title": "DiscoveryRequest",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/periskop-ai-openapi.yaml#/components/schemas/DiscoveryRequest",
  "type": "object",
  "required": [
    "prompt"
  ],
  "additionalProperties": false,
  "properties": {
    "prompt": {
      "type": "string",
      "maxLength": 4096,
      "description": "Natural-language shopping intent. The only required field."
    },
    "response_format": {
      "type": "string",
      "enum": [
        "full",
        "simple"
      ],
      "default": "full",
      "description": "`simple` returns a compact, easy-to-render shape (recommended for workflow platforms). `full` returns the complete contract.\n"
    },
    "mode": {
      "type": "string",
      "enum": [
        "auto",
        "browse",
        "recommend",
        "best",
        "bundle"
      ],
      "description": "Optional discovery mode. Leave unset for `auto` (Periskop infers the best mode from the prompt).\n"
    },
    "store": {
      "type": "string",
      "description": "Optional store id or natural store hint to scope the search."
    },
    "country": {
      "type": "string",
      "description": "ISO country code (e.g. `PT`). Defaults to the account default."
    },
    "currency": {
      "type": "string",
      "description": "ISO currency code (e.g. `EUR`). Defaults to the account default."
    },
    "language": {
      "type": "string",
      "description": "BCP 47 language tag (e.g. `en`, `pt`)."
    },
    "max_results": {
      "type": "integer",
      "minimum": 1,
      "maximum": 50,
      "description": "Maximum number of products to return (1-50)."
    },
    "fields": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "title",
          "price",
          "image",
          "url",
          "store",
          "availability",
          "description",
          "brand",
          "match_reason",
          "match_quality",
          "last_seen_at",
          "risk_flags"
        ]
      },
      "description": "Optional subset of product fields to include (full format)."
    },
    "external_user_id": {
      "type": "string",
      "description": "Your end-user identifier, for your own analytics."
    },
    "constraints": {
      "$ref": "#/$defs/Constraints"
    }
  },
  "$defs": {
    "Constraints": {
      "type": "object",
      "additionalProperties": false,
      "description": "Optional shopping constraints.",
      "properties": {
        "budget": {
          "type": "string",
          "description": "Free-form budget hint."
        },
        "max_price": {
          "type": "number"
        },
        "min_price": {
          "type": "number"
        },
        "condition": {
          "type": "string",
          "enum": [
            "new",
            "used",
            "any"
          ]
        },
        "optimization": {
          "type": "string",
          "enum": [
            "cheapest",
            "best_quality",
            "balanced",
            "fastest",
            "exact_match",
            "one_store"
          ]
        },
        "include_used": {
          "type": "boolean"
        },
        "include_new": {
          "type": "boolean"
        }
      }
    }
  }
}