{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/last-price-ai/json-schema/last-price-ai-capture-pricing-decision-schema.json",
  "title": "CapturePricingDecision",
  "description": "The answer of `POST /api/price-router/pipelines`, a price for one captured item with what was read off it.",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/last-price-ai-openapi.json#/components/schemas/CapturePricingDecision",
  "type": "object",
  "required": [
    "bundle_id",
    "kind",
    "price_statement",
    "computed_price",
    "currency",
    "confidence",
    "explanation",
    "alternatives",
    "routing_reason",
    "stage_metering",
    "total_metering",
    "executed_path",
    "degraded",
    "simulated",
    "share_url",
    "valuation"
  ],
  "properties": {
    "bundle_id": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "enum": [
        "computed"
      ],
      "x-lastprice-term": "lp:price-kind.computed",
      "description": "What sort of claim the price is: `computed`, an estimate from what was read and found, never a commitment (vocabulary `lp:price-kind`)."
    },
    "price_statement": {
      "allOf": [
        {
          "$ref": "#/$defs/PriceStatementAxes"
        }
      ],
      "x-lastprice-term": "lp:price-statement",
      "description": "The three axes of this answer: a third party's estimate for the caller (speaker third_party, standing estimate, audience one_counterparty)."
    },
    "computed_price": {
      "type": [
        "number",
        "null"
      ]
    },
    "currency": {
      "type": "string"
    },
    "confidence": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "explanation": {
      "type": [
        "string",
        "null"
      ]
    },
    "alternatives": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "price": {
            "type": "number"
          },
          "confidence": {
            "type": "number"
          },
          "label": {
            "type": "string",
            "enum": [
              "quick sale",
              "top of range",
              "opening offer",
              "most to pay"
            ],
            "description": "quick sale and top of range when selling; opening offer and most to pay when buying."
          }
        }
      }
    },
    "routing_reason": {
      "type": "string",
      "enum": [
        "priced",
        "no_estimate",
        "not_recognized"
      ]
    },
    "stage_metering": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "total_metering": {
      "type": "object"
    },
    "executed_path": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "degraded": {
      "type": "boolean"
    },
    "degradation_reason": {
      "type": "string"
    },
    "pipeline_used": {
      "type": "string"
    },
    "simulated": {
      "type": "boolean",
      "enum": [
        false
      ]
    },
    "share_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "description": "A link to a page showing this price as a card, signed so it cannot be altered. Opening it needs no sign-in. Null when there is no price."
    },
    "check_id": {
      "type": "string",
      "format": "uuid",
      "description": "Where price history is kept on the account (`capture-history`), the id of this check; read it back with GET /api/price-router/checks/{id}. Absent otherwise."
    },
    "valuation": {
      "type": "object",
      "properties": {
        "item": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "brand": {
              "type": [
                "string",
                "null"
              ]
            },
            "model": {
              "type": [
                "string",
                "null"
              ]
            },
            "category": {
              "type": "string"
            },
            "condition": {
              "type": "string",
              "enum": [
                "new",
                "like_new",
                "good",
                "fair",
                "poor",
                "unknown"
              ]
            }
          }
        },
        "observed_prices": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "number"
              },
              "currency": {
                "type": "string"
              },
              "source": {
                "type": "string",
                "enum": [
                  "price_tag",
                  "listing",
                  "document",
                  "text"
                ]
              }
            }
          }
        },
        "range": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "low": {
              "type": "number"
            },
            "high": {
              "type": "number"
            }
          }
        },
        "would_help": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "target_price": {
          "type": [
            "number",
            "null"
          ]
        },
        "target_gap": {
          "type": [
            "number",
            "null"
          ],
          "description": "computed_price minus target_price."
        },
        "pages_read": {
          "type": "integer"
        },
        "pages_unread": {
          "type": "integer"
        },
        "side": {
          "type": "string",
          "enum": [
            "selling",
            "buying"
          ]
        },
        "write_up": {
          "type": [
            "object",
            "null"
          ],
          "description": "Selling: a listing (title and description) to post at computed_price. Buying: a message to the seller with the opening offer filled in. Null without a price.",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "listing",
                "offer"
              ]
            },
            "title": {
              "type": "string"
            },
            "body": {
              "type": "string"
            },
            "price": {
              "type": "number",
              "description": "The price the write-up goes with."
            }
          }
        },
        "signals": {
          "$ref": "#/$defs/CaptureSignalsResult"
        },
        "photo_groups": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0
            }
          },
          "description": "Present when `commercial.photos` was `group` and the attachments show more than one item: 0-based attachment indexes, one list per item. The price is for the first list's item."
        },
        "market_evidence": {
          "type": [
            "object",
            "null"
          ],
          "description": "Where market evidence is on for the workspace (`capture-market-evidence`): what the recognized item sold for and is listed at online. With at least 3 priced pages, computed_price starts from the median of the sold prices (else of the listings) and range is their low and high; signals, when on, move the price only inside that range. Null when the item was not recognized; absent when market evidence is off.",
          "properties": {
            "query": {
              "type": "string"
            },
            "currency": {
              "type": "string"
            },
            "sold": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "count": {
                  "type": "integer",
                  "description": "Pages with a price, after pages far from the rest were dropped."
                },
                "pages_searched": {
                  "type": "integer"
                },
                "low": {
                  "type": "number"
                },
                "median": {
                  "type": "number"
                },
                "high": {
                  "type": "number"
                },
                "sources": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string",
                        "format": "uri"
                      },
                      "title": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "price": {
                        "type": "number"
                      },
                      "published": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                },
                "cost_usd": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              }
            },
            "listing": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "count": {
                  "type": "integer",
                  "description": "Pages with a price, after pages far from the rest were dropped."
                },
                "pages_searched": {
                  "type": "integer"
                },
                "low": {
                  "type": "number"
                },
                "median": {
                  "type": "number"
                },
                "high": {
                  "type": "number"
                },
                "sources": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string",
                        "format": "uri"
                      },
                      "title": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "price": {
                        "type": "number"
                      },
                      "published": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                },
                "cost_usd": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              }
            },
            "basis": {
              "type": "string",
              "enum": [
                "sold",
                "listing",
                "model"
              ],
              "description": "What computed_price came from."
            },
            "grounded": {
              "type": "boolean"
            },
            "model_estimate": {
              "type": [
                "object",
                "null"
              ],
              "description": "The estimate from what was sent, kept beside a grounded price.",
              "properties": {
                "low": {
                  "type": "number"
                },
                "typical": {
                  "type": "number"
                },
                "high": {
                  "type": "number"
                }
              }
            },
            "unavailable": {
              "type": "object",
              "description": "Per kind, the code of a lookup that failed (market_prices_not_configured, market_prices_unavailable, market_timeout), or null.",
              "properties": {
                "sold": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "listing": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            },
            "looked_up_at": {
              "type": "string",
              "format": "date-time"
            },
            "caveat": {
              "type": "string"
            }
          }
        }
      }
    }
  },
  "$defs": {
    "CaptureSignalsResult": {
      "description": "Present when the check was priced with signals (`capture-signals`). Kept with the check in price history.",
      "type": "object",
      "properties": {
        "facets": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "tokens": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Every signal as a band, such as power.battery=low or location.city=lagos."
        },
        "combinations": {
          "type": "integer",
          "description": "How many combinations of up to max_order tokens the model could weigh."
        },
        "max_order": {
          "type": "integer"
        },
        "effects": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "signals": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "One token or up to three acting together."
              },
              "direction": {
                "type": "string",
                "enum": [
                  "up",
                  "down",
                  "none"
                ]
              },
              "weight": {
                "type": "number"
              },
              "reason": {
                "type": "string"
              }
            }
          }
        },
        "noticed": {
          "type": "array",
          "description": "Things the model noticed that no signal covered (a shelf tag, a sale sticker, a queue). Each is a candidate label, kept as noticed.<label>=<value>; labels seen on enough checks are asked about by name on later checks.",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{1,39}$"
              },
              "value": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              },
              "asked": {
                "type": "boolean",
                "description": "Set when the model was asked about this label by name; only unprompted sightings promote a label."
              }
            }
          }
        },
        "posture": {
          "type": "number",
          "minimum": -1,
          "maximum": 1,
          "description": "The posture used: the model's, mixed with the learned one."
        },
        "model_posture": {
          "type": "number",
          "minimum": -1,
          "maximum": 1
        },
        "learned": {
          "type": [
            "object",
            "null"
          ],
          "description": "What earlier real sales across workspaces taught about these signals and their combinations, one vote per workspace; null until a combination present here is backed by at least five outcomes from five workspaces.",
          "properties": {
            "posture": {
              "type": "number"
            },
            "trust": {
              "type": "number",
              "description": "How much the learned posture counted against the model's, 0 to 0.7, growing with the number of workspaces behind the combinations this check matched."
            },
            "outcomes": {
              "type": "integer"
            },
            "workspaces": {
              "type": "integer"
            },
            "combinations": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "combination": {
                    "type": "string"
                  },
                  "n": {
                    "type": "integer"
                  },
                  "workspaces": {
                    "type": "integer"
                  },
                  "weight": {
                    "type": "number"
                  }
                }
              }
            }
          }
        },
        "base_price": {
          "type": [
            "number",
            "null"
          ],
          "description": "The typical value before the signals moved it."
        },
        "adjustment": {
          "type": [
            "number",
            "null"
          ],
          "description": "computed_price minus base_price."
        },
        "history": {
          "type": [
            "object",
            "null"
          ],
          "description": "The account history read for this check: counts, sides, usual price, top categories, earlier checks of the same item, prices reported as wrong."
        },
        "location": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "country": {
              "type": [
                "string",
                "null"
              ]
            },
            "region": {
              "type": [
                "string",
                "null"
              ]
            },
            "city": {
              "type": [
                "string",
                "null"
              ]
            },
            "district": {
              "type": [
                "string",
                "null"
              ]
            },
            "street": {
              "type": [
                "string",
                "null"
              ]
            },
            "place": {
              "type": [
                "string",
                "null"
              ],
              "description": "The place or store the phone named. The exact point, house number and postcode are read for the signals but never kept or returned."
            },
            "accuracy_m": {
              "type": [
                "number",
                "null"
              ]
            }
          }
        },
        "world": {
          "type": [
            "object",
            "null"
          ],
          "description": "What was going on around the check.",
          "properties": {
            "store": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "kind": {
                  "type": "string"
                },
                "brand": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "distance_m": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              }
            },
            "holidays": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "days_away": {
                    "type": "integer"
                  }
                }
              }
            },
            "moments": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Shopping moments such as black_friday, christmas_run_up, january_sales, back_to_school."
            },
            "news": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "summary": {
                  "type": "string"
                },
                "lean": {
                  "type": "string",
                  "enum": [
                    "up",
                    "down",
                    "none"
                  ]
                },
                "headlines": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string"
                      },
                      "age": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                }
              }
            },
            "school_holidays": {
              "type": [
                "string",
                "null"
              ],
              "enum": [
                "nationwide",
                "some_regions",
                "none",
                null
              ]
            },
            "weather": {
              "type": [
                "object",
                "null"
              ],
              "description": "The weather at the place now (Open-Meteo, point rounded to 0.1 degree).",
              "properties": {
                "temp_c": {
                  "type": "number"
                },
                "code": {
                  "type": "integer",
                  "description": "WMO weather code."
                },
                "precipitation_mm": {
                  "type": "number"
                },
                "snowfall_cm": {
                  "type": "number"
                },
                "wind_kmh": {
                  "type": "number"
                },
                "is_day": {
                  "type": "boolean"
                },
                "surface_pressure_hpa": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "day_max_c": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "day_min_c": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              }
            },
            "area": {
              "type": [
                "object",
                "null"
              ],
              "description": "What is around the point within 300 m (OpenStreetMap).",
              "properties": {
                "shops": {
                  "type": "integer"
                },
                "same_kind": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Other shops of the same kind as the one the person is in."
                },
                "tourism": {
                  "type": "integer"
                },
                "station": {
                  "type": "boolean"
                },
                "airport": {
                  "type": "boolean"
                },
                "market": {
                  "type": "boolean"
                },
                "mall": {
                  "type": "boolean"
                },
                "top_kinds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            },
            "photo_store": {
              "type": [
                "object",
                "null"
              ],
              "description": "The store where a photo was taken when that was more than 200 m away.",
              "properties": {
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "kind": {
                  "type": "string"
                },
                "brand": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "km_away": {
                  "type": "number"
                }
              }
            },
            "economy": {
              "type": [
                "object",
                "null"
              ],
              "description": "How the check's currency moved (ECB reference rates).",
              "properties": {
                "currency": {
                  "type": "string"
                },
                "against": {
                  "type": "string"
                },
                "change_30d_pct": {
                  "type": "number"
                },
                "change_7d_pct": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "PriceStatementAxes": {
      "type": "object",
      "description": "What kind of price statement an answer is (`lp:price-statement`), on the three axes every price carries. A kind of price (`kind`, `lp:price-kind`: list, floor, ceiling, offer, agreed, settled, observed, computed, quoted) is a named combination of the three, defined in the ontology at /ns/price. Always present on a priced answer; the open world rule for what is missing is in /.well-known/lastprice-vocabulary.json.",
      "required": [
        "speaker",
        "standing",
        "audience"
      ],
      "properties": {
        "speaker": {
          "type": "string",
          "enum": [
            "seller",
            "buyer",
            "both",
            "third_party",
            "market"
          ],
          "description": "Who stands behind the amount. Last Price speaks as third_party; a signed quote is the workspace speaking as seller."
        },
        "standing": {
          "type": "string",
          "enum": [
            "proposal",
            "commitment",
            "executed",
            "estimate",
            "constraint"
          ],
          "description": "What the amount commits anyone to. An estimate binds nobody; a commitment binds until valid_until; a constraint (floor, ceiling) bounds a party's own proposals and is never offered."
        },
        "audience": {
          "type": "string",
          "enum": [
            "public",
            "one_counterparty",
            "private"
          ],
          "description": "Whom the amount was addressed to. An answer to one caller is one_counterparty."
        },
        "interval_meaning": {
          "type": "string",
          "enum": [
            "credible_interval",
            "evidence_spread",
            "acceptance_range",
            "negotiation_room"
          ],
          "description": "Only on an answer that carries a band or a low and high; what its edges are."
        }
      }
    }
  }
}