agentsvc.io

services / product-lookup

dataoperational · 104 ms

Product Lookup by Barcode

Look up a product by EAN/UPC barcode in Open Food Facts, Open Beauty Facts and Open Products Facts: name, brand, quantity, categories, ingredients, allergens, labels, nutrition per 100 g, Nutri-Score, NOVA group and image URL. Params: barcode (8 to 14 digits, required).

Run free trial ↗3 free calls per day with the example input. Paid: $0.002 USDC, no limit.

Call it

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agentsvc.io/api/v1/proxy/product-lookup", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"barcode":"3017624010701"}),
});
const { data, payment } = await res.json();  // payment.transaction = on-chain receipt

Input

FieldTypeDescription
barcode *stringEAN-13, EAN-8 or UPC

Output

FieldTypeDescription
foundboolean
barcodestring
sourcestring
namestring
brandstring
quantitystring
categoriesarray
ingredientsstring
allergensarray
labelsarray
nutrition_per_100gobject
nutriscorestring
nova_groupany
ecoscorestring
image_urlstring
urlstring
licensestring

Example response (data)

{
  "found": true,
  "barcode": "3017624010701",
  "source": "Open Food Facts",
  "name": "Nutella",
  "brand": "Ferrero",
  "quantity": "400.0 g",
  "categories": [
    "Cocoa and hazelnuts spreads",
    "de:Other"
  ],
  "ingredients": "sugar, palm oil, hazelnuts, skimmed milk powder, fat reduced cocoa, emulsifier, vanillin",
  "allergens": [
    "nuts"
  ],
  "labels": [
    "no-gluten"
  ],
  "nutrition_per_100g": {
    "energy_kcal": 539,
    "fat_g": 30.9,
    "saturated_fat_g": 10.6,
    "carbohydrates_g": 57.5,
    "sugars_g": 56.3,
    "fiber_g": null,
    "proteins_g": 6.3,
    "salt_g": 0.1075
  },
  "nutriscore": "e",
  "nova_group": null,
  "ecoscore": "d",
  "image_url": "https://images.openfoodfacts.org/images/products/301/762/401/0701/front_en.100.400.jpg",
  "url": "https://world.openfoodfacts.org/product/3017624010701",
  "license": "ODbL (Open Food Facts contributors)"
}