Commerce
Unit-price comparison API
Normalizes package options to price-per-unit (per oz/ml/count), ranks them, and reports the best value and its savings vs the worst. Answers 'Which size is cheaper per ounce?', 'What is the best unit-price option?'.
Price$0.01per request
MethodPOST
Route/v1/commerce/unit-price-compare
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
commercepricingunit-pricecomparisonprice-per-unitvalueshoppinggrocery
API URL
Integration docshttps://x402.hexl.dev/v1/commerce/unit-price-compareExample request
{
"options": [
{
"label": "S",
"price": 3,
"size": 8,
"unit": "oz"
},
{
"label": "L",
"price": 5,
"size": 16,
"unit": "oz"
}
]
}Example response
{
"options": [
{
"label": "L",
"price": 5,
"size": 16,
"unit": "oz",
"unitPrice": 0.3125,
"rank": 1,
"isBest": true
},
{
"label": "S",
"price": 3,
"size": 8,
"unit": "oz",
"unitPrice": 0.375,
"rank": 2,
"isBest": false
}
],
"bestValue": {
"label": "L",
"price": 5,
"size": 16,
"unit": "oz",
"unitPrice": 0.3125
},
"worstValue": {
"label": "S",
"price": 3,
"size": 8,
"unit": "oz",
"unitPrice": 0.375
},
"bestVsWorstSavingsPct": 16.6667,
"interpretation": "Best value: L at $0.3125/oz — 16.6667% cheaper per unit than S."
}Input schema
{
"type": "object",
"required": [
"options"
],
"properties": {
"options": {
"type": "array",
"examples": [
[
{
"label": "S",
"price": 3,
"size": 8,
"unit": "oz"
},
{
"label": "L",
"price": 5,
"size": 16,
"unit": "oz"
}
]
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}