Skip to content
GET /v1/compare

Compare options, find best value

Try it live

10 free calls per day — no sign-up, no API key. Goes through the oanor gateway.

Custom headers (optional)
api.oanor.com/unitprice-api

It works. Grab an API key and use it in your project.

Get an API key

Code snippets

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_..."}
)

Example response

A real response from this endpoint, captured by the latest health check.

{
    "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
}