{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/answerline-dev/json-schema/answerline-dev-perplexity-monitor-response-schema.json",
  "title": "PerplexityMonitorResponse",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/answerline-dev-openapi.json#/components/schemas/PerplexityMonitorResponse",
  "required": [
    "success",
    "result"
  ],
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "result": {
      "description": "Data returned by Perplexity",
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "description": "Text of Perplexity's answer"
        },
        "html": {
          "type": "string",
          "format": "uri",
          "description": "Present when include.html is true: the link to the answer's public page on perplexity.ai."
        },
        "sources": {
          "type": "array",
          "description": "Sources the response cites",
          "items": {
            "type": "object",
            "properties": {
              "position": {
                "type": "number",
                "description": "Where the source sits in the response, as an index"
              },
              "url": {
                "type": "string",
                "description": "Link to the source"
              },
              "label": {
                "type": "string",
                "description": "Label shown for this source"
              },
              "description": {
                "type": "string",
                "description": "Text describing what the source contains"
              }
            }
          }
        },
        "citationPills": {
          "type": "array",
          "description": "Citation pills that appear inline in the Perplexity answer. Every element pairs one pill with one source: a pill backed by N sources (bracketed groups like Perplexity's `[1][2][3]`) yields N elements with the same `citationPillId`, each holding that source's own `label`, `url` and `domain`. Grouping by `citationPillId` rebuilds the pills. Not present in `result` if the answer has no pills.",
          "items": {
            "type": "object",
            "required": [
              "label",
              "citationPillId",
              "url",
              "domain",
              "position"
            ],
            "properties": {
              "label": {
                "type": "string",
                "description": "Title of this individual source as shown in the sources rail (for instance `\"Best Programming Laptops 2026 — TechCrunch\"`). Never missing, but can be an empty string if the rail gives no title for it — in that case identify the source by `domain` / `url`. Entries that share a `citationPillId` each have their own per-source label."
              },
              "citationPillId": {
                "type": "integer",
                "description": "One-based number common to every entry that comes from one chip. Grouping on `citationPillId` rebuilds the chip as displayed; each entry's `label` is specific to its source, so it varies inside a chip."
              },
              "url": {
                "type": "string",
                "description": "Link straight to the cited source."
              },
              "domain": {
                "type": "string",
                "description": "Hostname taken from `url`, useful for grouping and display."
              },
              "description": {
                "type": "string",
                "description": "Source snippet shown in the sources rail, if Perplexity supplies one; otherwise omitted."
              },
              "position": {
                "type": "integer",
                "description": "Index of this source within the sibling `result.sources` array, starting at 1."
              }
            }
          }
        },
        "markdown": {
          "type": "string",
          "description": "Perplexity's answer rendered as Markdown (present when include.markdown is true)"
        },
        "related_queries": {
          "type": "array",
          "description": "Suggested searches to follow up with",
          "items": {
            "type": "string"
          }
        },
        "videos": {
          "type": "array",
          "description": "Videos that appear in the response",
          "items": {
            "$ref": "#/$defs/MediaItem"
          }
        },
        "images": {
          "type": "array",
          "description": "Image found in the response",
          "items": {
            "$ref": "#/$defs/MediaItem"
          }
        },
        "hotels": {
          "type": "array",
          "description": "Hotels listed when the query shows travel intent",
          "items": {
            "$ref": "#/$defs/HotelItem"
          }
        },
        "places": {
          "type": "array",
          "description": "The places Perplexity lists on its map for a local or lodging question (restaurants, shops, hotels), in its order. Absent when it shows no map.",
          "items": {
            "type": "object",
            "description": "A place on Perplexity's map: the contract's PlaceItem plus its card's review count, phone and description",
            "properties": {
              "name": {
                "type": "string",
                "description": "Place name"
              },
              "url": {
                "type": "string",
                "description": "URL of the place's page"
              },
              "rating": {
                "type": "number",
                "description": "Rating of the place (0-5)"
              },
              "num_reviews": {
                "type": "integer",
                "description": "Review count"
              },
              "phone": {
                "type": "string",
                "description": "Phone number"
              },
              "description": {
                "type": "string",
                "description": "The place's description on its card"
              },
              "address": {
                "type": "array",
                "description": "Address lines",
                "items": {
                  "type": "string"
                }
              },
              "lat": {
                "type": "number",
                "description": "Latitude"
              },
              "lng": {
                "type": "number",
                "description": "Longitude"
              },
              "categories": {
                "type": "array",
                "description": "Place categories",
                "items": {
                  "type": "string"
                }
              },
              "map_url": {
                "type": "string",
                "description": "Map URL"
              },
              "images": {
                "type": "array",
                "description": "Image URLs for the place",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        },
        "shopping_cards": {
          "type": "array",
          "description": "Product cards for shopping with full product details (present when the query shows shopping intent)",
          "items": {
            "type": "object",
            "properties": {
              "tags": {
                "type": "array",
                "description": "Category tags on the shopping card, if any",
                "items": {
                  "type": "string"
                }
              },
              "products": {
                "type": "array",
                "description": "List of products",
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "description": "Product name"
                    },
                    "id": {
                      "type": "string",
                      "description": "Product identifier"
                    },
                    "url": {
                      "type": "string",
                      "description": "URL of the product page"
                    },
                    "price": {
                      "type": "string",
                      "description": "Current price"
                    },
                    "merchant": {
                      "type": "string",
                      "description": "Merchant name"
                    },
                    "available": {
                      "type": "boolean",
                      "description": "True if the product is available right now"
                    },
                    "imageUrls": {
                      "type": "array",
                      "description": "URLs of the product images",
                      "items": {
                        "type": "string"
                      }
                    },
                    "numReviews": {
                      "type": "number",
                      "description": "Review count (0 if there are none)"
                    },
                    "offers": {
                      "type": "array",
                      "description": "Per-merchant shopping offers",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "description": "Offer link including Perplexity referral parameters"
                          },
                          "price": {
                            "type": "string",
                            "description": "Offer price"
                          },
                          "merchant_name": {
                            "type": "string",
                            "description": "Merchant name"
                          },
                          "product_name": {
                            "type": "string",
                            "description": "Product title as given by the merchant"
                          },
                          "available": {
                            "type": "boolean",
                            "description": "True if this offer currently has stock"
                          },
                          "price_details": {
                            "type": "object",
                            "description": "Itemized breakdown of the price",
                            "properties": {
                              "display_price": {
                                "type": "string",
                                "description": "Price formatted for display"
                              }
                            }
                          },
                          "original_price": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Pre-discount price; null if the item isn't on sale"
                          }
                        }
                      }
                    },
                    "position": {
                      "type": "integer",
                      "description": "Rank starting at 1, counted over every product in every shopping card of the response (one continuous sequence that does not restart for each card)"
                    },
                    "rating": {
                      "type": "number",
                      "description": "Rating of the product, on a 0-5 scale"
                    },
                    "original_price": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pre-discount price; null if the item isn't on sale"
                    },
                    "description": {
                      "type": "string",
                      "description": "Product description"
                    },
                    "variants": {
                      "type": "array",
                      "description": "Variants of the product (e.g. size or color)",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "search_model_queries": {
          "type": "array",
          "description": "Search queries the engine ran internally to build the response",
          "items": {
            "type": "string"
          }
        },
        "rawResponse": {
          "type": "array",
          "description": "The answer as normalized stream events (present when include.rawResponse is true). For the engine's answer as received, use include.rawWire.",
          "items": {}
        },
        "screenshot": {
          "type": "string",
          "format": "uri",
          "description": "Present when include.screenshot is true: the link to the PNG screenshot of the answer's public page on perplexity.ai."
        }
      }
    }
  },
  "$defs": {
    "HotelItem": {
      "type": "object",
      "description": "Hotel entry with full details",
      "properties": {
        "name": {
          "type": "string",
          "description": "Hotel name"
        },
        "url": {
          "type": "string",
          "description": "URL of the hotel's page"
        },
        "rating": {
          "type": "number",
          "description": "Rating of the hotel, from 0 to 5"
        },
        "num_reviews": {
          "type": "number",
          "description": "Review count"
        },
        "address": {
          "type": "array",
          "description": "Address lines",
          "items": {
            "type": "string"
          }
        },
        "phone": {
          "type": "string",
          "description": "Phone number"
        },
        "description": {
          "type": "string",
          "description": "Hotel description"
        },
        "image_url": {
          "type": "string",
          "description": "URL of the hotel's primary image"
        },
        "images": {
          "type": "array",
          "description": "URLs of further hotel photos",
          "items": {
            "type": "string"
          }
        },
        "lat": {
          "type": "number",
          "description": "Latitude"
        },
        "lng": {
          "type": "number",
          "description": "Longitude"
        },
        "price_level": {
          "type": "string",
          "description": "Indicator of the price tier"
        },
        "categories": {
          "type": "array",
          "description": "Hotel categories",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "MediaItem": {
      "type": "object",
      "description": "A video or image that appears in the response",
      "properties": {
        "title": {
          "type": "string",
          "description": "Media title"
        },
        "url": {
          "type": "string",
          "description": "Media URL"
        },
        "thumbnail": {
          "type": "string",
          "description": "Thumbnail URL"
        },
        "medium": {
          "type": "string",
          "description": "Media type",
          "enum": [
            "video",
            "image",
            "map"
          ]
        },
        "source": {
          "type": "string",
          "description": "Source platform"
        },
        "image_width": {
          "type": "number",
          "description": "Width of the original image"
        },
        "image_height": {
          "type": "number",
          "description": "Height of the original image"
        },
        "thumbnail_width": {
          "type": "number",
          "description": "Thumbnail width"
        },
        "thumbnail_height": {
          "type": "number",
          "description": "Thumbnail height"
        }
      }
    }
  }
}