# GTIN / UPC Barcode Product & Arbitrage Intelligence (MCP) (`scrapesmart/gtin-barcode-product-radar`) Actor

Deterministic GTIN / UPC / EAN / ISBN barcode product resolver & multi-marketplace arbitrage engine. ISO Modulo-10 checksum verification, GS1 prefix decoding, multi-registry lookup, and Amazon/eBay/Walmart fee spread calculators.

- **URL**: https://apify.com/scrapesmart/gtin-barcode-product-radar.md
- **Developed by:** [Dysen K](https://apify.com/scrapesmart) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 gtin/upc/ean/isbn barcode validated, resolved across open registries & analyzed for resale arbitrages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## 🏷️ Universal GTIN / Barcode Product & Arbitrage Intelligence (MCP)

> **Deterministic ISO/GS1 Barcode Verification, Open Multi-Registry Catalog Resolver, Multi-Marketplace Fee Calculator, and Token-Optimized AI Agent Briefs.**

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-orange.svg)](https://apify.com)
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](LICENSE)
[![GS1 Standard](https://img.shields.io/badge/GS1-ISO%2FIEC%2015420-green.svg)](https://www.gs1.org)
[![MCP Ready](https://img.shields.io/badge/MCP-Optimized-purple.svg)](https://modelcontextprotocol.io)

***

### 🚀 Why This Actor Wins

E-commerce resellers, Amazon FBA sourcing bots, retail arbitrageurs, and CPG procurement agents frequently suffer from **fuzzy keyword search hallucinations** and **fragile web scrapers** when matching products across marketplaces.

**Universal GTIN / Barcode Product & Arbitrage Intelligence** replaces brittle scraping with **100% deterministic, ISO-standard barcode decoding and open catalog resolution**:

1. **Deterministic ISO/GS1 Checksum Verification:**
   - Evaluates **GTIN-8, UPC-A (12 digits), EAN-13 (13 digits), and GTIN-14** using the official **GS1 Modulo-10 Check Digit Algorithm**.
   - Decodes the **GS1 Company Prefix Country / Region** (e.g. `000-139` US & Canada, `300-379` France, `400-440` Germany, `450-459`/`490-499` Japan, `500-509` UK, `690-699` China, `978-979` Bookland ISBN).
   - Converts legacy **ISBN-10** to **ISBN-13 / EAN-13** automatically with recalculated Modulo-10 check digits.

2. **Open Multi-Registry Catalog Resolver:**
   - Queries official, unauthenticated open barcode data networks in parallel:
     - **OpenFoodFacts / OpenBeautyFacts / OpenProductsFacts v2 API:** Extracts official product title, brand, category hierarchy, packaging, net weight/volume, Nutri-Score, Eco-Score, NOVA food processing group, and full ingredients lists.
     - **OpenLibrary Media & Books API:** Enriches `978`/`979` Bookland ISBNs with book title, author list, publishers, publication date, page count, and high-res cover art.
     - **UPCitemdb Registry:** Gathers brand, model, lowest/highest recorded historical prices, and live merchant retail offers.

3. **Multi-Marketplace Arbitrage & Fee Calculator:**
   - Computes fee schedules across **Amazon (FBA/FBM)**, **eBay**, and **Walmart Marketplace**:
     - Amazon Referral Fees (8% to 15%) + Variable Media Closing Fees ($1.80 for books).
     - eBay Final Value Fees (13.25% + $0.30, or 14.95% for media).
     - Walmart Referral Fees (8% to 15%).
   - Calculates **Break-Even Resale Selling Price** (0% ROI) and **Target ROI Resale Selling Price** (default 25% ROI) factoring in your estimated shipping/fulfillment costs.
   - Realizes actual net payout, net profit spread, and profit margin % when market prices or merchant offers are observed.

4. **Token-Optimized MCP Briefs (<400 tokens):**
   - Emits structured, high-density Markdown briefs ready for LLMs (Claude, GPT-4o, Gemini) without context window bloat.
   - Generates an actionable summary in Key-Value store `MCP_PROMPT` for autonomous retail sourcing workflows.

***

### 📥 Input Parameters

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `barcodes` | `array` | *(prefilled)* | List of GTIN-8, UPC-A, EAN-13, GTIN-14, or ISBN barcodes to resolve. |
| `targetRoiPercent` | `integer` | `25` | Target return on investment percentage (5% to 200%) used for resale price modeling. |
| `estimatedShippingCost` | `number` | `4.5` | Estimated packaging & shipping fulfillment cost in USD per unit. |
| `buyPrices` | `object` | `{}` | Optional key-value map of barcode to wholesale acquisition price (e.g. `{"3017620422003": 2.50}`). |
| `concurrency` | `integer` | `5` | Concurrent registry lookup workers (1 to 15). |

#### Example Input (`INPUT.json`)

```json
{
  "barcodes": [
    "3017620422003",
    "5449000000996",
    "9780132350884",
    "0049000028904"
  ],
  "targetRoiPercent": 25,
  "estimatedShippingCost": 4.5,
  "buyPrices": {
    "3017620422003": 3.00,
    "9780132350884": 8.00
  },
  "concurrency": 5
}
```

***

### 📤 Output Dataset Format

Each record written to the default Apify Dataset contains rich, verified product metadata and deterministic arbitrage calculations:

```json
{
  "barcode": "3017620422003",
  "rawInput": "3017620422003",
  "standardFormat": "EAN-13",
  "isValid": true,
  "expectedCheckDigit": 3,
  "actualCheckDigit": 3,
  "validationError": null,
  "ean13": "3017620422003",
  "upcA": null,
  "gtin14": "03017620422003",
  "countryOrAuthority": "France",
  "gs1Authority": "GS1 France",
  "prefix": "301",
  "isBooklandIsbn": false,
  "isCoupon": false,
  "isRestrictedDistribution": false,
  "foundInRegistries": true,
  "sourceRegistries": ["OpenFoodFacts"],
  "productName": "Nutella Ferrero Hazelnut Spread",
  "brand": "Ferrero, Nutella",
  "category": "Spreads",
  "categories": ["Spreads", "Sweet spreads", "Hazelnut spreads"],
  "quantity": "400 g",
  "packaging": "Glass jar",
  "countries": ["France", "United States", "Germany"],
  "imageUrl": "https://images.openfoodfacts.org/images/products/301/762/042/2003/front_en.jpg",
  "nutriscoreGrade": "E",
  "ecoscoreGrade": "D",
  "novaGroup": 4,
  "ingredientsText": "Sugar, palm oil, hazelnuts (13%), skimmed milk powder (8.7%), fat-reduced cocoa (7.4%)",
  "pricing": {
    "lowestRecordedPrice": 4.99,
    "highestRecordedPrice": 18.99,
    "averageRecordedPrice": 12.50,
    "currency": "USD",
    "offersCount": 3,
    "offers": [
      {
        "merchant": "Amazon.com",
        "currency": "USD",
        "price": 18.99,
        "condition": "New",
        "availability": "InStock",
        "link": "https://amazon.com/..."
      }
    ]
  },
  "arbitrage": {
    "hasUserBuyPrice": true,
    "buyPrice": 3.00,
    "effectiveBuyPrice": 3.00,
    "estimatedShippingCost": 4.50,
    "targetRoiPercent": 25,
    "marketPrice": 18.99,
    "bestMarketplace": "eBay",
    "arbitrageOpportunityScore": 95,
    "marketplaces": {
      "amazon": {
        "platform": "Amazon",
        "feeSchedule": "Amazon Grocery (15%)",
        "referralRatePercent": 15,
        "fixedFee": 0.30,
        "breakevenSalePrice": 9.18,
        "targetRoiSalePrice": 11.38,
        "realized": {
          "marketPrice": 18.99,
          "feeAmount": 3.15,
          "netPayout": 11.34,
          "netProfit": 8.34,
          "netMarginPercent": 43.92,
          "actualRoiPercent": 111.20,
          "isProfitable": true,
          "meetsTargetRoi": true
        }
      },
      "ebay": {
        "platform": "eBay",
        "feeSchedule": "eBay Standard (13.25% + $0.30)",
        "referralRatePercent": 13.25,
        "fixedFee": 0.30,
        "breakevenSalePrice": 8.99,
        "targetRoiSalePrice": 11.15,
        "realized": {
          "marketPrice": 18.99,
          "feeAmount": 2.82,
          "netPayout": 11.67,
          "netProfit": 8.67,
          "netMarginPercent": 45.66,
          "actualRoiPercent": 115.60,
          "isProfitable": true,
          "meetsTargetRoi": true
        }
      },
      "walmart": {
        "platform": "Walmart",
        "feeSchedule": "Walmart Standard Marketplace (15%)",
        "referralRatePercent": 15,
        "fixedFee": 0.0,
        "breakevenSalePrice": 8.82,
        "targetRoiSalePrice": 11.03,
        "realized": {
          "marketPrice": 18.99,
          "feeAmount": 2.85,
          "netPayout": 11.64,
          "netProfit": 8.64,
          "netMarginPercent": 45.50,
          "actualRoiPercent": 115.20,
          "isProfitable": true,
          "meetsTargetRoi": true
        }
      }
    }
  },
  "mcpMarkdownBrief": "### 🏷️ [EAN-13: `3017620422003`] Nutella Ferrero Hazelnut Spread (Ferrero, Nutella)\n- **GS1 Verification:** ✅ Valid | **Origin:** France | **Standard:** EAN-13\n- **Category:** Spreads | **Nutri-Score:** E | **Eco-Score:** D | **NOVA:** Group 4\n- **Resale Economics:** Cost: $3.00 buy + $4.50 ship = $7.50 basis | **Observed Market:** $18.99 (3 offers)\n  - **Amazon:** Break-even: $9.18 | Target 25% ROI: $11.38 -> Net Profit: $8.34 (111.2% ROI)\n  - **eBay:** Break-even: $8.99 | Target 25% ROI: $11.15 -> Net Profit: $8.67 (115.6% ROI)\n  - **Walmart:** Break-even: $8.82 | Target 25% ROI: $11.03 -> Net Profit: $8.64 (115.2% ROI)\n- **Recommendation:** **eBay** | **Arbitrage Score:** 95/100 🔥 High Yield"
}
```

***

### 🤖 Model Context Protocol (MCP) Integration

This actor is purpose-built for AI agents operating via Anthropic Claude, LangChain, LlamaIndex, or AutoGen.

#### Stored Key-Value Store Artifacts:

- **`OUTPUT`**: JSON summary of scan results, checksum passes, registry resolutions, and marketplace distributions.
- **`MCP_PROMPT`**: Self-contained Markdown brief designed to be fed straight into an autonomous procurement agent:

```markdown
## 🏷️ Universal GTIN / Barcode Product & Arbitrage Intelligence Report
### 📊 Scan Execution Summary
- **Total Barcodes Processed:** 4
- **GS1 Checksum Validated:** 4 ✅ | **Failed Checksums:** 0 ❌
- **Resolved in Open Registries:** 4 / 4
- **High-Yield Arbitrage Opportunities (Score >= 80):** 3 🔥
- **Preferred Resale Venues:** eBay (2), Amazon (1), Walmart (1)

---
#### 🏷️ [EAN-13: `3017620422003`] Nutella Ferrero Hazelnut Spread (Ferrero)
- **GS1 Verification:** ✅ Valid | **Origin:** France | **Standard:** EAN-13
...
```

***

### 💻 Programmatic Usage

#### Apify Python Client

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run_input = {
    "barcodes": ["3017620422003", "9780132350884"],
    "targetRoiPercent": 30,
    "estimatedShippingCost": 4.50,
    "buyPrices": {
        "3017620422003": 2.50
    }
}

run = client.actor("gtin-barcode-product-radar").call(run_input=run_input)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"Barcode: {item['barcode']} | Best Marketplace: {item['arbitrage']['bestMarketplace']}")
```

#### Apify JavaScript / Node.js Client

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_API_TOKEN>' });
const run = await client.actor('gtin-barcode-product-radar').call({
    barcodes: ['3017620422003', '9780132350884'],
    targetRoiPercent: 25,
    estimatedShippingCost: 4.50
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.table(items.map(i => ({
    barcode: i.barcode,
    product: i.productName,
    valid: i.isValid,
    topVenue: i.arbitrage?.bestMarketplace,
    score: i.arbitrage?.arbitrageOpportunityScore
})));
```

***

### ⚖️ License

Apache-2.0 License. Open source and production-ready for automated retail intelligence.

# Actor input Schema

## `barcodes` (type: `array`):

List of UPC, EAN-13, GTIN, or ISBN-13 barcodes to validate, resolve, and analyze for marketplace arbitrage.

## `targetRoiPercent` (type: `integer`):

Target ROI % used to calculate break-even and target resale prices across Amazon, eBay, and Walmart fee schedules (5% to 200%).

## `estimatedShippingCost` (type: `number`):

Estimated fulfillment/shipping cost in USD per unit for break-even and net profit calculation (e.g. 4.5 for $4.50 USPS/UPS/FBA delivery).

## `buyPrices` (type: `object`):

Optional JSON object mapping barcode to your specific wholesale or liquidation buy price in USD (e.g. {"3017620422003": 2.50}). If omitted, uses lowest recorded market price.

## `concurrency` (type: `integer`):

Maximum concurrent registry lookup workers (1 to 15).

## Actor input object example

```json
{
  "barcodes": [
    "3017620422003",
    "5449000000996",
    "9780132350884",
    "0049000028904"
  ],
  "targetRoiPercent": 25,
  "estimatedShippingCost": 4.5,
  "buyPrices": {},
  "concurrency": 5
}
```

# Actor output Schema

## `results` (type: `string`):

JSON/table dataset containing all enriched records and per-record mcpMarkdownBrief fields.

## `mcpPrompt` (type: `string`):

Token-optimized Markdown brief stored in the default Key-Value Store for direct LLM/MCP consumption.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "barcodes": [
        "3017620422003",
        "5449000000996",
        "9780132350884",
        "0049000028904"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapesmart/gtin-barcode-product-radar").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "barcodes": [
        "3017620422003",
        "5449000000996",
        "9780132350884",
        "0049000028904",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("scrapesmart/gtin-barcode-product-radar").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "barcodes": [
    "3017620422003",
    "5449000000996",
    "9780132350884",
    "0049000028904"
  ]
}' |
apify call scrapesmart/gtin-barcode-product-radar --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapesmart/gtin-barcode-product-radar"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/myQh2ckddk9hSBthM/builds/Fbo2bhN2BbjGge5Fe/openapi.json
