/v1/compare
Compare options, find best value
Essayez-le en direct
10 appels gratuits par jour — sans inscription, sans clé API. Passe par la passerelle oanor.
Ça marche. Récupérez une clé API et utilisez-la dans votre projet.
Obtenez une clé APIExtraits de code
curl "https://api.oanor.com/unitprice-api/v1/compare" \ -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/unitprice-api/v1/compare", {
headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/unitprice-api/v1/compare");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["x-oanor-key: oanor_test_..."]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($ch);
import requests
requests.get(
"https://api.oanor.com/unitprice-api/v1/compare",
headers={"x-oanor-key": "oanor_test_..."}
)
Exemple de réponse
Une réponse réelle de ce endpoint, capturée lors du dernier contrôle de santé.
{
"data": {
"note": "Options ranked cheapest-per-unit first. savings_vs_worst_percent compares the best option to the most expensive per unit.",
"measure": "weight",
"options": [
{
"rank": 1,
"size": 1,
"unit": "kg",
"count": 1,
"label": "5@1kg",
"price": 5,
"is_best": true,
"unit_price": {
"per_g": 0.005,
"per_kg": 5,
"per_lb": 2.268,
"per_100g": 0.5
}
},
{
"rank": 2,
"size": 500,
"unit": "g",
"count": 1,
"label": "3@500g",
"price": 3,
"is_best": false,
"unit_price": {
"per_g": 0.006,
"per_kg": 6,
"per_lb": 2.7216,
"per_100g": 0.6
}
},
{
"rank": 3,
"size": 750,
"unit": "g",
"count": 1,
"label": "4.5@750g",
"price": 4.5,
"is_best": false,
"unit_price": {
"per_g": 0.006,
"per_kg": 6,
"per_lb": 2.7216,
"per_100g": 0.6
}
}
],
"best_value": {
"label": "5@1kg",
"unit_price": {
"per_g": 0.005,
"per_kg": 5,
"per_lb": 2.268,
"per_100g": 0.5
}
},
"savings_vs_worst_percent": 16.67
},
"meta": {
"timestamp": "2026-06-04T01:59:20.112Z",
"request_id": "17271199-0e7b-45c3-985c-1bce656ab98f"
},
"status": "ok",
"message": "Compare options",
"success": true
}