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
- A SearchUPCData account (sign up free)
- An API key (generated from your API Keys dashboard)
- Basic knowledge of HTTP requests and JSON
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
/api/products/:upc
Look up a single product by its UPC, EAN, or GTIN code.
GET /api/products/012345678905 Authorization: Bearer YOUR_API_KEY
/api/products/search
Search for products by name, brand, or category.
Query Parameters:
q(required) - Search query stringlimit(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 |
|---|---|---|
200 | Success | Parse the response data |
401 | Unauthorized | Check your API key |
404 | Not Found | Product doesn't exist |
429 | Rate Limited | Implement backoff |
Rate Limits & Quotas
| Plan | Monthly Quota | Rate Limit |
|---|---|---|
| Free | 100 requests | 10/minute |
| Startup | 3,000 requests | 30/minute |
| Professional | 50,000 requests | 100/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.