Agent Native Price Comparison

Compare prices for a product across all platforms with AI-generated highlights and insights.

Base URL: https://api.buywhere.ai/v2/agents/price-comparison

Overview

The Agent Native Price Comparison endpoint finds all listings of the same product across multiple platforms and returns a comprehensive comparison with highlights for the cheapest, best-rated, and fastest shipping options. This is ideal for AI agents helping users find the best deals.

HTTP Method

GET /v2/agents/price-comparison

Authentication

Requires API key in the Authorization header:

Authorization: Bearer bw_live_xxxxxxxxxxxxxxxx

Query Parameters

ParameterTypeRequiredDefaultDescription
product_namestringYes-Product name to search for
categorystringNo-Optional category filter
limitintegerNo20Maximum results (1-100)
currencystringNoSGDResponse currency

Request Example

cURL

curl -X GET "https://api.buywhere.ai/v2/agents/price-comparison?product_name=iphone+15+pro+256gb&limit=20" \
  -H "Authorization: Bearer bw_live_xxxxxxxxxxxxxxxx"

Python

import httpx

API_KEY = "bw_live_xxxxxxxxxxxxxxxx"
BASE_URL = "https://api.buywhere.ai"

headers = {"Authorization": f"Bearer {API_KEY}"}

response = httpx.get(
    f"{BASE_URL}/v2/agents/price-comparison",
    params={
        "product_name": "iphone 15 pro 256gb",
        "limit": 20
    },
    headers=headers
)
data = response.json()
print(f"Found {data['total']} listings across platforms")

for result in data['results']:
    print(f"\n{result['source']}: {result['title']}")
    print(f"  Price: {result['currency']} {result['price']}")
    print(f"  Rating: {result['rating']} ({result['review_count']} reviews)")
    print(f"  Confidence: {result['confidence_score']}")

if data.get('highlights'):
    h = data['highlights']
    print(f"\n--- Highlights ---")
    if h.get('cheapest'):
        print(f"Cheapest: {h['cheapest']['source']} at {h['cheapest']['price']}")
    if h.get('best_rated'):
        print(f"Best Rated: {h['best_rated']['source']} with {h['best_rated']['rating']} rating")

JavaScript (Node.js)

const API_KEY = "bw_live_xxxxxxxxxxxxxxxx";
const BASE_URL = "https://api.buywhere.ai";

const response = await fetch(
  `${BASE_URL}/v2/agents/price-comparison?product_name=${encodeURIComponent("iphone 15 pro 256gb")}&limit=20`,
  {
    headers: { "Authorization": `Bearer ${API_KEY}` }
  }
);

const data = await response.json();
console.log(`Found ${data.total} listings across platforms`);

data.results.forEach(result => {
  console.log(`\n${result.source}: ${result.title}`);
  console.log(`  Price: ${result.currency} ${result.price}`);
  console.log(`  Rating: ${result.rating} (${result.review_count} reviews)`);
  console.log(`  Confidence: ${result.confidence_score}`);
});

if (data.highlights) {
  const h = data.highlights;
  console.log("\n--- Highlights ---");
  if (h.cheapest) {
    console.log(`Cheapest: ${h.cheapest.source} at ${h.cheapest.price}`);
  }
  if (h.best_rated) {
    console.log(`Best Rated: ${h.best_rated.source} with ${h.best_rated.rating} rating`);
  }
}

Go

package main

import (
    "encoding/json"
    "fmt"
    "net/http"
    "net/url"
)

func priceComparison(apiKey, productName string) error {
    baseURL, _ := url.Parse("https://api.buywhere.ai/v2/agents/price-comparison")
    params := url.Values{}
    params.Set("product_name", productName)
    params.Set("limit", "20")
    baseURL.RawQuery = params.Encode()

    req, _ := http.NewRequest("GET", baseURL.String(), nil)
    req.Header.Set("Authorization", "Bearer "+apiKey)

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        return err
    }
    defer resp.Body.Close()

    var result map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&result)

    total := int(result["total"].(float64))
    fmt.Printf("Found %d listings across platforms\n", total)

    results := result["results"].([]interface{})
    for _, r := range results {
        m := r.(map[string]interface{})
        fmt.Printf("\n%s: %s\n", m["source"], m["title"])
        fmt.Printf("  Price: %s %s\n", m["currency"], m["price"])
        fmt.Printf("  Rating: %.1f (%.0f reviews)\n", m["rating"].(float64), m["review_count"].(float64))
    }

    if highlights, ok := result["highlights"].(map[string]interface{}); ok {
        fmt.Println("\n--- Highlights ---")
        if cheapest, ok := highlights["cheapest"].(map[string]interface{}); ok {
            fmt.Printf("Cheapest: %s at %s\n", cheapest["source"], cheapest["price"])
        }
    }
    return nil
}

Response

Success Response (200 OK)

{
  "query": "iphone 15 pro 256gb",
  "total": 8,
  "limit": 20,
  "results": [
    {
      "id": 18472931,
      "sku": "IPHONE15PRO256-SG",
      "source": "shopee_sg",
      "title": "iPhone 15 Pro 256GB Natural Titanium",
      "price": "1349.00",
      "currency": "SGD",
      "buy_url": "https://shopee.sg/product/18472931",
      "brand": "Apple",
      "category": "Mobile Phones",
      "rating": 4.8,
      "review_count": 2341,
      "is_available": true,
      "confidence_score": 0.95,
      "availability_prediction": "in_stock",
      "competitor_count": 8,
      "buybox_price": "1349.00",
      "affiliate_url": "https://buywhere.ai/track/abc123"
    },
    {
      "id": 18472932,
      "sku": "IPHONE15PRO256-LAZ",
      "source": "lazada_sg",
      "title": "iPhone 15 Pro 256GB - Natural Titanium",
      "price": "1399.00",
      "currency": "SGD",
      "buy_url": "https://www.lazada.sg/products/18472932",
      "brand": "Apple",
      "category": "Mobile Phones",
      "rating": 4.7,
      "review_count": 1245,
      "is_available": true,
      "confidence_score": 0.93,
      "availability_prediction": "in_stock",
      "competitor_count": 8,
      "buybox_price": "1349.00",
      "affiliate_url": "https://buywhere.ai/track/def456"
    },
    {
      "id": 18472933,
      "sku": "IPHONE15PRO256-AMZ",
      "source": "amazon_sg",
      "title": "Apple iPhone 15 Pro (256GB) - Titanium",
      "price": "1449.00",
      "currency": "SGD",
      "buy_url": "https://amazon.sg/product/18472933",
      "brand": "Apple",
      "category": "Mobile Phones",
      "rating": 4.9,
      "review_count": 892,
      "is_available": true,
      "confidence_score": 0.97,
      "availability_prediction": "in_stock",
      "competitor_count": 8,
      "buybox_price": "1349.00",
      "affiliate_url": "https://buywhere.ai/track/ghi789"
    }
  ],
  "highlights": {
    "cheapest": {
      "source": "shopee_sg",
      "price": "1349.00"
    },
    "best_rated": {
      "source": "amazon_sg",
      "rating": 4.9
    },
    "fastest_shipping": {
      "source": "lazada_sg",
      "shipping_days": 1
    }
  }
}

Response Fields

FieldTypeDescription
querystringThe product search query
totalintegerNumber of matching listings
limitintegerMaximum results requested
resultsarrayArray of product listings
highlightsobjectAI-generated highlights

Highlights Object

FieldTypeDescription
cheapestobjectCheapest listing with source and price
best_ratedobjectHighest rated listing with source and rating
fastest_shippingobjectFastest shipping with source and shipping_days

Product Listing Fields

FieldTypeDescription
idintegerUnique product ID
skustringProduct SKU
sourcestringPlatform source
titlestringProduct title
pricestringCurrent price
currencystringCurrency code
buy_urlstringDirect purchase URL
brandstringBrand name
categorystringCategory
ratingfloatAverage rating
review_countintegerNumber of reviews
is_availablebooleanStock availability
confidence_scorefloatData quality (0-1)
availability_predictionstringStock prediction
competitor_countintegerSame product listings count
buybox_pricestringLowest price across all platforms
affiliate_urlstringTracked affiliate link

Error Responses

401 Unauthorized

{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API key"
  }
}

404 Not Found

{
  "error": {
    "code": "NOT_FOUND",
    "message": "No products found for the query"
  }
}

Related Endpoints