{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/proofprice-com/json-schema/proofprice-com-price-answer-schema.json",
  "title": "PriceAnswer",
  "description": "A price answer: a range or an official statistic with sample size, period, confidence, source and licence.",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/proofprice-com-openapi.json#/components/schemas/PriceAnswer",
  "type": "object",
  "properties": {
    "query": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": true,
      "description": "The request as understood, echoed back."
    },
    "status": {
      "type": "string",
      "enum": [
        "ok",
        "insufficient_data",
        "no_matches"
      ],
      "description": "ok = a figure is returned; insufficient_data = fewer than 5 matching records; no_matches = nothing matched."
    },
    "price": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "currency": {
              "type": "string",
              "description": "ISO 4217 currency code, e.g. EUR."
            },
            "unit": {
              "type": "string",
              "description": "What the price is per, e.g. 'per litre', 'per home', 'per kWh'."
            },
            "value": {
              "type": "number",
              "description": "The headline figure. For ranges built from records it equals median."
            },
            "measure": {
              "description": "What value is: median for ranges built from records; average or median for official statistics.",
              "type": "string",
              "enum": [
                "median",
                "average"
              ]
            },
            "median": {
              "type": [
                "number",
                "null"
              ]
            },
            "typical_low": {
              "description": "10th percentile; null for official statistics that give no range.",
              "type": [
                "number",
                "null"
              ]
            },
            "typical_high": {
              "description": "90th percentile; null for official statistics that give no range.",
              "type": [
                "number",
                "null"
              ]
            },
            "min": {
              "type": [
                "number",
                "null"
              ]
            },
            "max": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "currency",
            "unit",
            "value"
          ],
          "additionalProperties": true,
          "description": "The price. Null when there is not enough data to publish a figure (fewer than 5 records) or nothing matched."
        },
        {
          "type": "null"
        }
      ]
    },
    "sample_size": {
      "description": "Number of records behind the figure; null when the publisher does not say.",
      "type": [
        "number",
        "null"
      ]
    },
    "period": {
      "description": "The period the records cover (ISO dates), or the date of the snapshot when the answer comes from our copy.",
      "type": "object",
      "properties": {
        "from": {
          "type": [
            "string",
            "null"
          ]
        },
        "to": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "from",
        "to"
      ],
      "additionalProperties": true
    },
    "confidence": {
      "description": "high = 50+ records, medium = 15–49, low = 5–14.",
      "type": "string",
      "enum": [
        "high",
        "medium",
        "low",
        "insufficient"
      ]
    },
    "price_type": {
      "description": "transaction, posted_pump_price, posted_price, contract_price, reimbursement_price or official_statistic.",
      "type": "string"
    },
    "statistic": {
      "description": "Official statistics only: what kind of figure it is and the period the publisher states it for.",
      "type": "object",
      "properties": {
        "measure": {
          "type": "string",
          "enum": [
            "median",
            "average"
          ]
        },
        "reference_period": {
          "type": "string"
        },
        "note": {
          "type": "string"
        }
      },
      "required": [
        "measure",
        "reference_period"
      ],
      "additionalProperties": true
    },
    "as_of": {
      "description": "When the answer was produced (ISO 8601); the snapshot date when the official source was down and the answer comes from our copy.",
      "type": "string"
    },
    "source": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Source id, e.g. es-fuel."
        },
        "name": {
          "type": "string"
        },
        "publisher": {
          "type": "string",
          "description": "Who publishes the data."
        },
        "licence": {
          "type": "string"
        },
        "licence_url": {
          "type": "string"
        },
        "attribution": {
          "type": "string",
          "description": "The attribution line to show with the figure."
        },
        "url": {
          "type": "string",
          "description": "The publisher's page for this data."
        }
      },
      "required": [
        "id",
        "name",
        "publisher",
        "licence",
        "licence_url",
        "attribution",
        "url"
      ],
      "additionalProperties": true,
      "description": "Where the figure comes from, under which licence, and the attribution line to show."
    },
    "method": {
      "type": "string"
    },
    "method_url": {
      "type": "string"
    },
    "summary": {
      "type": "string",
      "description": "One plain sentence an AI can quote."
    },
    "notice": {
      "type": "string",
      "description": "Information, not a valuation or offer. Also says when the answer is our copy because the official source did not respond."
    },
    "extra": {
      "description": "Source-specific details (for example cheapest stations). extra.stale is true when the answer comes from our copy of the source.",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": true
    },
    "answer_id": {
      "description": "Audit trail: a stable id (hash of source id, normalised query, data period and method_version). The same question on the same data gives the same id; keep it with the reasoning that used the figure.",
      "type": "string"
    },
    "method_version": {
      "description": "Audit trail: version of the way this source turns raw data into an answer (per source, default '1').",
      "type": "string"
    },
    "retrieved_at": {
      "description": "Audit trail: when ProofPrice produced this answer (ISO 8601). For an answer from our own copy this is now, while as_of is the snapshot date.",
      "type": "string"
    },
    "evidence": {
      "description": "Audit trail: what kind of evidence the figure is.",
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "Same as price_type."
        },
        "label": {
          "type": "string",
          "description": "Short name of the kind of evidence, e.g. 'Recorded sale prices', 'Official published average', 'Official published index', 'Posted shelf or pump price', 'Posted or listed price', 'Contract award value', 'Regulated reimbursement price'."
        },
        "meaning": {
          "type": "string",
          "description": "One sentence on what this kind of evidence does and does not establish."
        }
      },
      "required": [
        "type",
        "label",
        "meaning"
      ],
      "additionalProperties": true
    },
    "reliability": {
      "description": "How far to trust the figure as a distribution of real prices. official_with_count = a published official figure with a record count; official_median_no_count = a published average or median with no record count (confidence 'high' there means the publisher is official, not that a count was checked); record_level = 15+ records we hold; thin = 5–14 records; stale = our copy because the official source did not respond; insufficient_data = no figure published.",
      "type": "string",
      "enum": [
        "official_with_count",
        "official_median_no_count",
        "record_level",
        "thin",
        "stale",
        "insufficient_data"
      ]
    },
    "data_as_of": {
      "description": "ISO date (YYYY-MM-DD) of the newest data point behind the figure; null when unknown.",
      "type": [
        "string",
        "null"
      ]
    },
    "data_age_days": {
      "description": "Whole days between data_as_of and retrieved_at; null when data_as_of is null.",
      "type": [
        "number",
        "null"
      ]
    },
    "suggestions": {
      "description": "Short plain things to try next: widen the period or area, ask for an itemised quote. May be empty.",
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "query",
    "status",
    "source",
    "summary",
    "notice"
  ],
  "additionalProperties": true
}