SearchUPCData.com
Developer Tutorial Last updated: December 2024

UPC Lookup API Integration Guide

A comprehensive step-by-step tutorial for developers integrating barcode lookup into applications—with code examples in JavaScript, Python, PHP, and more.

Quick Start (30 seconds)

Try our API right now with this cURL command:

curl -X GET "https://searchupcdata.com/api/products/012345678905" \
  -H "Authorization: Bearer YOUR_API_KEY"

Getting Started

The SearchUPCData API provides programmatic access to our database of millions of products. You can look up products by UPC, EAN, or GTIN codes, search by product name, and retrieve detailed product information including images, descriptions, brands, categories, and pricing data.

Prerequisites

Base URL

https://searchupcdata.com/api

Authentication

The API uses API key authentication. Include your key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Security Best Practices: Never expose your API key in client-side code. Store keys in environment variables and rotate them periodically.

API Endpoints

GET /api/products/:upc

Look up a single product by its UPC, EAN, or GTIN code.

GET /api/products/012345678905
Authorization: Bearer YOUR_API_KEY
GET /api/products/search

Search for products by name, brand, or category.

Query Parameters:

  • q (required) - Search query string
  • limit (optional) - Results per page (default: 20, max: 100)
  • offset (optional) - Pagination offset (default: 0)

Code Examples

JavaScript (Node.js)

const axios = require('axios');

const API_KEY = process.env.SEARCHUPCDATA_API_KEY;

async function lookupProduct(upc) {
  const response = await axios.get(
    `https://searchupcdata.com/api/products/${upc}`,
    { headers: { 'Authorization': `Bearer ${API_KEY}` } }
  );
  return response.data;
}

lookupProduct('012345678905').then(console.log);

Python

import requests
import os

API_KEY = os.environ.get('SEARCHUPCDATA_API_KEY')

def lookup_product(upc):
    response = requests.get(
        f'https://searchupcdata.com/api/products/{upc}',
        headers={'Authorization': f'Bearer {API_KEY}'}
    )
    return response.json()

print(lookup_product('012345678905'))

Error Handling

Status Code Meaning How to Handle
200SuccessParse the response data
401UnauthorizedCheck your API key
404Not FoundProduct doesn't exist
429Rate LimitedImplement backoff

Rate Limits & Quotas

Plan Monthly Quota Rate Limit
Free100 requests10/minute
Startup3,000 requests30/minute
Professional50,000 requests100/minute

Best Practices

  • Cache Responses: Product data changes infrequently. Cache for 24-72 hours.
  • Implement Retry Logic: Use exponential backoff for 429 and 5xx errors.
  • Handle Missing Products: Not every UPC exists. Design for 404 responses.
  • Monitor Usage: Check rate limit headers to stay within quotas.

Common Use Cases

E-commerce Product Import

Auto-populate product listings from barcode scans.

Inventory Management

Identify products during receiving and audits.

Price Comparison Apps

Let users scan and compare prices.

Nutrition Apps

Retrieve nutrition data for diet tracking.

Ready to Start Building?

Create a free account and get your API key in seconds.

Get Your API Key Full Documentation