{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/periskop-ai/json-schema/periskop-ai-discovery-response-schema.json",
  "title": "DiscoveryResponse",
  "description": "A discovery result. Field presence depends on `response_format` and `answer_type`. `simple` responses populate `items` / `bundle_slots` / `next_actions`; `full` responses populate `products` / `bundle` / `refinements` / `stores_used` / `render_hints` / `handoff`. Both always include `schema_version`, `result_id`, `answer_type`, `summary`, `caveats`, `purchase_boundary` and `errors`.\n",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/periskop-ai-openapi.yaml#/components/schemas/DiscoveryResponse",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "schema_version": {
      "type": "string"
    },
    "result_id": {
      "type": "string",
      "description": "Stable id for this result; reusable for 24h via Get Discovery Result."
    },
    "request_id": {
      "type": "string",
      "description": "Per-call correlation id (also in the `X-Request-ID` header)."
    },
    "answer_type": {
      "type": "string",
      "enum": [
        "browse",
        "recommendation",
        "best_pick",
        "bundle",
        "closest_match",
        "no_match"
      ]
    },
    "mode_used": {
      "type": "string",
      "description": "The mode Periskop actually used (full format)."
    },
    "interpreted_prompt": {
      "type": "string",
      "description": "Periskop's normalized reading of the prompt (full format)."
    },
    "summary": {
      "type": "string",
      "description": "Human-readable summary of the result."
    },
    "suggested_agent_reply": {
      "type": [
        "string",
        "null"
      ],
      "description": "An optional ready-to-use reply your agent can show the user."
    },
    "confidence": {
      "type": [
        "number",
        "null"
      ]
    },
    "items": {
      "type": "array",
      "description": "Simple-format products.",
      "items": {
        "$ref": "#/$defs/SimpleItem"
      }
    },
    "products": {
      "type": "array",
      "description": "Full-format products.",
      "items": {
        "$ref": "#/$defs/Product"
      }
    },
    "bundle_slots": {
      "type": [
        "array",
        "null"
      ],
      "description": "Simple-format bundle slots.",
      "items": {
        "type": "object"
      }
    },
    "bundle": {
      "type": [
        "object",
        "null"
      ],
      "description": "Full-format bundle (slots + estimated_total)."
    },
    "next_actions": {
      "type": "array",
      "description": "Suggested follow-up prompts (simple format).",
      "items": {
        "type": "object"
      }
    },
    "refinements": {
      "type": "array",
      "description": "Suggested refinements (full format).",
      "items": {
        "type": "object"
      }
    },
    "stores_used": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "render_hints": {
      "type": [
        "object",
        "null"
      ]
    },
    "handoff": {
      "type": [
        "object",
        "null"
      ]
    },
    "caveats": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "purchase_boundary": {
      "$ref": "#/$defs/PurchaseBoundary"
    },
    "errors": {
      "type": "array",
      "description": "Machine-readable errors. Empty on success.",
      "items": {
        "$ref": "#/$defs/Error"
      }
    }
  },
  "$defs": {
    "Error": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string",
          "description": "Machine-readable error code."
        },
        "message": {
          "type": "string",
          "description": "Human-readable error message."
        },
        "recoverable": {
          "type": "boolean",
          "description": "Whether retrying the request may succeed."
        },
        "request_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "billing_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Present for billing (402) errors only."
        }
      }
    },
    "Price": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "amount": {
          "type": [
            "number",
            "null"
          ]
        },
        "currency": {
          "type": [
            "string",
            "null"
          ]
        },
        "display": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "Product": {
      "type": "object",
      "properties": {
        "product_id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "price": {
          "$ref": "#/$defs/Price"
        },
        "image": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": "string",
          "description": "Final, user-openable merchant product URL, decorated with Periskop attribution query params (`utm_source=periskop&utm_medium=referral&utm_campaign=periskop`). Existing merchant query params and fragment are preserved. Open it as-is — the user still completes the purchase on the merchant site."
        },
        "store_id": {
          "type": "string"
        },
        "store_name": {
          "type": "string"
        },
        "availability": {
          "type": "string",
          "enum": [
            "in_stock",
            "out_of_stock",
            "unknown"
          ]
        },
        "brand": {
          "type": [
            "string",
            "null"
          ]
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "match_quality": {
          "type": "string",
          "enum": [
            "exact",
            "close",
            "substitute",
            "weak",
            "unknown"
          ]
        },
        "match_reason": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "risk_flags": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "last_seen_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "item_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Stable per-item handle, when present."
        },
        "slot_label": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "PurchaseBoundary": {
      "type": "object",
      "description": "Always present. Periskop never completes a purchase. All flags are false except `user_must_complete_purchase_on_merchant_site`.\n",
      "properties": {
        "discovery_portal_completes_purchase": {
          "type": "boolean"
        },
        "merchant_cart_created": {
          "type": "boolean"
        },
        "checkout_created": {
          "type": "boolean"
        },
        "purchase_completed": {
          "type": "boolean"
        },
        "stock_reserved": {
          "type": "boolean"
        },
        "payment_processed": {
          "type": "boolean"
        },
        "user_must_complete_purchase_on_merchant_site": {
          "type": "boolean"
        },
        "price_guaranteed": {
          "type": "boolean"
        },
        "availability_guaranteed": {
          "type": "boolean"
        }
      }
    },
    "SimpleItem": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string"
        },
        "price": {
          "type": [
            "string",
            "null"
          ],
          "description": "Formatted price string (e.g. `EUR 59.90`), when available."
        },
        "image": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": "string",
          "description": "Final, user-openable merchant product URL where the user completes the purchase. Decorated with Periskop attribution query params (`utm_source=periskop&utm_medium=referral&utm_campaign=periskop`); any existing merchant query params and fragment are preserved. Open it as-is — do not strip or rewrite the attribution params."
        },
        "store": {
          "type": [
            "string",
            "null"
          ]
        },
        "match_quality": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "exact",
            "close",
            "substitute",
            "weak",
            "unknown",
            null
          ]
        }
      }
    }
  }
}