{"inputSchema":{"type":"object","required":["observations"],"additionalProperties":false,"properties":{"observations":{"type":"array","minItems":4,"maxItems":2000,"description":"Your own price and sales history for one SKU. Every amount is in the currency named at document level.","items":{"type":"object","required":["price","units_sold"],"additionalProperties":false,"properties":{"price":{"type":"number","exclusiveMinimum":0,"maximum":100000000,"description":"Selling price in that period. Must be positive: the estimation is on logarithms."},"units_sold":{"type":"number","minimum":0,"maximum":1000000000,"description":"Units sold at that price. A zero cannot enter a log-log fit and is excluded, reported and never silently dropped."},"period_start":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Optional period label as YYYY-MM-DD, passed through unchanged."},"promotion":{"type":"boolean","default":false,"description":"Whether the period was a promotion. Enters the fit as a separate indicator when include_promotion is true, so that a campaign is not attributed to the price."},"competitor_price":{"type":"number","exclusiveMinimum":0,"maximum":100000000,"description":"Competitor price in that period. Only used when include_competitor_price is true; you bring the figure, nothing is looked up."}}}},"unit_cost":{"type":"number","minimum":0,"maximum":100000000,"description":"Variable cost per unit. Required for the contribution-optimal price; without it only the elasticity is returned."},"include_competitor_price":{"type":"boolean","default":false,"description":"Whether to add the log competitor price as a second regressor and report the cross-price elasticity. Every observation must then carry competitor_price."},"include_promotion":{"type":"boolean","default":false,"description":"Whether to add the promotion indicator as a regressor."},"price_grid":{"type":"array","maxItems":200,"items":{"type":"number","exclusiveMinimum":0,"maximum":100000000},"description":"Candidate prices to evaluate with predicted units and contribution. Evaluated at the fitted model, in the order you give them."},"confidence_level":{"type":"number","enum":[0.8,0.9,0.95],"default":0.95,"description":"Confidence level for the elasticity interval. Student t, not normal."},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"EUR","description":"ISO 4217 code for every amount in this request. Not converted, only carried through."}}},"outputSchema":{"type":"object","properties":{"elasticity":{"type":"object"},"cross_price_elasticity":{"type":["object","null"]},"promotion_effect":{"type":["object","null"]},"fit":{"type":"object"},"optimal_price":{"type":"object"},"price_grid":{"type":"array"},"excluded_observations":{"type":"array"},"warnings":{"type":"array"},"method":{"type":"object"},"unavailable_fields":{"type":"array"}}},"priceModel":null,"requestExample":{"currency":"EUR","unit_cost":11.5,"observations":[{"period_start":"2026-01-05","price":24.9,"units_sold":412},{"period_start":"2026-01-12","price":22.9,"units_sold":503},{"period_start":"2026-01-19","price":26.9,"units_sold":341},{"period_start":"2026-01-26","price":19.9,"units_sold":688},{"period_start":"2026-02-02","price":24.9,"units_sold":431},{"period_start":"2026-02-09","price":29.9,"units_sold":262},{"period_start":"2026-02-16","price":21.9,"units_sold":559},{"period_start":"2026-02-23","price":27.9,"units_sold":301},{"period_start":"2026-03-02","price":23.9,"units_sold":470},{"period_start":"2026-03-09","price":18.9,"units_sold":742}],"price_grid":[19.9,21.9,23.9,25.9,27.9],"confidence_level":0.95},"price_usdc":"0.005","example_request":{"currency":"EUR","unit_cost":11.5,"observations":[{"period_start":"2026-01-05","price":24.9,"units_sold":412},{"period_start":"2026-01-12","price":22.9,"units_sold":503},{"period_start":"2026-01-19","price":26.9,"units_sold":341},{"period_start":"2026-01-26","price":19.9,"units_sold":688},{"period_start":"2026-02-02","price":24.9,"units_sold":431},{"period_start":"2026-02-09","price":29.9,"units_sold":262},{"period_start":"2026-02-16","price":21.9,"units_sold":559},{"period_start":"2026-02-23","price":27.9,"units_sold":301},{"period_start":"2026-03-02","price":23.9,"units_sold":470},{"period_start":"2026-03-09","price":18.9,"units_sold":742}],"price_grid":[19.9,21.9,23.9,25.9,27.9],"confidence_level":0.95},"serviceName":"price_elasticity","tags":["pricing","elasticity","regression","commerce","revenue"],"outputExample":{"elasticity":{"value":-2.323644,"std_error":0.078133,"t":-29.7397,"p_value":0,"confidence_level":0.95,"confidence_interval":[-2.503818,-2.143469],"t_critical":2.306004,"degrees_of_freedom":8,"interpretation":"elastic: a one percent price increase costs more than one percent of volume","estimable":true},"cross_price_elasticity":null,"promotion_effect":null,"fit":{"model":"ln(units_sold) = intercept + ln_price","observations_used":10,"observations_excluded":0,"regressors":["intercept","ln_price"],"coefficients":{"intercept":{"value":13.485861,"std_error":0.248459,"t":54.2781,"p_value":0},"ln_price":{"value":-2.323644,"std_error":0.078133,"t":-29.7397,"p_value":0}},"r_squared":0.991036,"r_squared_adjusted":0.989915,"residual_std_error_log":0.034009,"degrees_of_freedom":8,"price_variation_pct":58.201,"observed_price_range":[18.9,29.9]},"optimal_price":{"currency":"EUR","unit_cost":11.5,"formula":"p* = unit_cost * b / (1 + b), the stationary point of (p - c) * A * p^b","price":20.1881,"reason":null,"predicted_units":667.2036,"revenue":13469.5725,"contribution":5796.7314,"range_from_confidence_interval":[19.1472,21.5571],"range_note":"Both ends of the elasticity confidence interval carried through the same formula. A null end means that end of the interval is inelastic and has no interior optimum."},"price_grid":[{"price":19.9,"predicted_units":689.8639,"revenue":13728.2914,"contribution":5794.8567},{"price":21.9,"predicted_units":552.2308,"revenue":12093.8554,"contribution":5743.2007},{"price":23.9,"predicted_units":450.7436,"revenue":10772.7723,"contribution":5589.2208},{"price":25.9,"predicted_units":373.9642,"revenue":9685.674,"contribution":5385.0852},{"price":27.9,"predicted_units":314.6053,"revenue":8777.4888,"contribution":5159.5274}],"excluded_observations":[],"warnings":[],"method":{"estimator":"ordinary least squares on logarithms, normal equations with Gauss-Jordan inversion","interval":"Student t with the residual degrees of freedom, not a normal approximation","optimum":"closed form from the constant-elasticity demand curve, no search","deterministic":true,"external_sources":"none: competitor prices and costs come from the caller","causality":"this measures an association in observational data. It does not establish that a price change causes the volume change.","out_of_scope":["stock-outs","cannibalisation between SKUs","reference-price and fairness effects","competitor reaction","demand curves other than constant elasticity"],"limits":{"max_observations":2000,"min_usable_observations":4,"max_price_grid":200,"min_price_variation_pct":5}},"unavailable_fields":["cross_price_elasticity","promotion_effect"]}}