API Documentation

The Barcode Lookup API documentation describes how to use our RESTful API service. All API responses are returned in JSON format. If you have additional questions, please email support.


Authentication

Every user account is assigned one unique API key upon account creation. Authenticate your account by including your API Key in all requests.

https://api.barcodelookup.com/v2/products?key=your_api_key

Endpoints

Parameter Data Type Example Value Description
barcode integer 865694301167 barcode value must be 7, 8, 10, 11, 12, 13 or 14 digits
mpn string LXCF9426B07 the MPN parameter is the manufacturer part number
asin string B000VKSULA the ASIN parameter is the Amazon Standard Identification Number
product-name string Red Running Shoes search by product name for any item
category string Home & Garden > Decor search by category - based on Google's product taxonomy
search string Air Jordan Red Shoes Size 40 query all the search fields including product-name, category, brand and MPN
page integer 1056 pagination for API results that return more than 10 products
geo string us, gb, ca, eu (only possible values) filter online store results by geographical location
formatted string y (only possible value) beautify JSON output - only to be used in a browser
key string isDzhm4Kav42OD93NEO your unique API key provided (required)
Note: Use multiple API parameters (mpn, product-name, category and/or geo) to filter your search results. The 'search' parameter is used for a more general search-everything response.
Curl Example
curl --include --header 'Accept: application/json' 'https://api.barcodelookup.com/v2/products?barcode=3614272049529&key=your_api_key'
Request URL Example
https://api.barcodelookup.com/v2/products?barcode=3614272049529&formatted=y&key=your_api_key
Response Code
200
Response Body
{ "products": [ { "barcode_number": "886736874135", "barcode_type": "UPC", "barcode_formats": "UPC 886736874135, EAN 0886736874135", "asin": "B01KUHG2G8", "model": "CE-XL3200" "product_name": "Nike Red Running Shoes - Size 10", "category": "Apparel & Accessories > Shoes", "brand": "Nike", "color": "Red", "description": "One of a kind, Nike Red Running Shoes that are great for walking, running and sports.", ....., ....., "features": [ "Gender: Female", "Size: US 7½", "Width: Medium", ], "images": [ "https://images.barcodelookup.com/5219/52194594-1.jpg", "https://images.barcodelookup.com/5219/52194594-2.jpg", "https://images.barcodelookup.com/5219/52194594-3.jpg" ], "stores": [ { "store_name": "Newegg.com", "store_price": "41.38", "product_url": "https://www.newegg.com/product-url", "currency_code": "USD", "currency_symbol": "$" }, { "store_name": "Jet.com", "store_price": "45.24", "product_url": "https://www.jet.com/product-url", "currency_code": "USD", "currency_symbol": "$" }, ....., ..... ], "reviews": [ { "name": "Josh Keller", "rating": "5", "title": "Love these shoes!", "review": "A stylish and great fitting shoe for walking and running.", "datetime": "2015-03-19 21:48:03" }, ....., ..... ] } ] }
Returned AttributeData TypeExample Value
barcode_numberinteger865694301167
barcode_typestringUPC
barcode_formatsstringUPC 865694301167, EAN 4054106219206
mpnstringCE-XL3200
modelstring4910
asinstringB00Q6IU52S
product_namestringRed Running Shoes
titlestringLord Of The Rings
categorystringHome & Garden > Decor
manufacturerstringLEGO Systems, Inc.
brandstringRalph Lauren
labelstringSony Music
authorstringJ. K. Rowling
publisherstringRandom House
artiststringMichael Jackson
actorstringAl Pacino
directorstringSteven Spielberg
studiostringUniversal Pictures
genrestringClassical
audience_ratingstringPG-13
ingredientsstringTomatoes, Onions, Celery
nutrition_factsstringCalories 85, Protein 7g
colorstringPurple
package_quantitystring6
sizestringLarge
lengthstring3.7 inches
widthstring4.8 inches
heightstring2.5 inches
weightstring0.64 lbs
release_datestring2012
descriptionstringDetailed product description...
featuresarray•Blue •Fast •Batteries Included
imagesarrayhttps://images.barcodelookup.com/product-id
storesarrayhttps://www.storedomain.com/product-url
reviewsarrayName, Rating, Title, Review, Datetime
Parameter Data Type Description
formatted string beautify JSON output - only to be used in a browser
key string your unique API key provided (required)
Curl Example
curl --include --header 'Accept: application/json' 'https://api.barcodelookup.com/v2/rate-limits?key=your_api_key'
Request URL Example
https://api.barcodelookup.com/v2/rate-limits?formatted=y&key=your_api_key
Response Code
200
Response Body
{ "allowed_calls_per_month": "500000", "remaining_calls_per_month": "408498", "allowed_calls_per_minute": "100", "remaining_calls_per_minute": "97" }

How Search Works

When you combine the manufacturer, mpn, brand, name or category parameters, these specific fields are joined using the & (AND) operator. So the more parameters you use, the more filtered your output is since you can target multiple fields at once with different values. For example:

https://api.barcodelookup.com/v2/products?category=Apparel%20%26%20Accessories%20%3E%20Shoes&brand=Nike&mpn=885691-001&formatted=y&key=your_api_key
The category parameter must be encoded. Apparel & Accessories > Shoes is represented as Apparel%20%26%20Accessories%20%3E%20Shoes in the above URL.

You can also use the search parameter to query all the parameters mentioned above with a single search string. For example:

https://api.barcodelookup.com/v2/products?search=olive%20oil%20from%20italy&formatted=y&key=your_api_key

Most of the time, you'll get more than 1 result when you use the search parameter or when you combine parameters. It’s similar to how a search engine works: the first result is the most relevant, with the rest of the results becoming less relevant as you move down the list.


Code Examples

Below are a few sample scripts to help you get started. The code examples demonstrate how to make an API call and print output in several popular programming languages.

<?php $api_key = 'ENTER YOUR API KEY HERE'; $url = 'https://api.barcodelookup.com/v2/products?barcode=077341125112&formatted=y&key=' . $api_key; $ch = curl_init(); // Use only one cURL connection for multiple queries $data = get_data($url, $ch); $response = array(); $response = json_decode($data); echo '<strong>Barcode Number:</strong> ' . $response->products[0]->barcode_number . '<br><br>'; echo '<strong>Product Name:</strong> ' . $response->products[0]->product_name . '<br><br>'; echo '<strong>Entire Response:</strong><pre>'; print_r($response); echo '</pre>'; function get_data($url, $ch) { curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $data = curl_exec($ch); curl_close($ch); return $data; }
<html> <script> function getAPIdata() { const proxyurl = "https://cors-anywhere.herokuapp.com/"; // Use a proxy to avoid CORS error const api_key = "ENTER_YOUR_API_KEY_HERE"; const url = proxyurl + "https://api.barcodelookup.com/v2/products?barcode=077341125112&formatted=y&key=" + api_key; fetch(url) .then(response => response.json()) .then((data) => { document.getElementById("BarcodeNumber").innerHTML = (data.products[0].barcode_number); document.getElementById("ProductName").innerHTML = (data.products[0].product_name); document.getElementById("EntireResponse").innerHTML = JSON.stringify(data, null,"<br/>"); }) .catch(err => { throw err }); } </script> <body onload="getAPIdata()"> <strong>Barcode Number: </strong> <div id="BarcodeNumber"></div><br/> <strong>Product Name: </strong> <div id="ProductName"></div><br/> <strong>Entire Response: </strong> <div id="EntireResponse"></div> </body> </html>
# PYTHON 3 import urllib.request import json import pprint api_key = "ENTER_YOUR_API_KEY_HERE" url = "https://api.barcodelookup.com/v2/products?barcode=077341125112&formatted=y&key=" + api_key with urllib.request.urlopen(url) as url: data = json.loads(url.read().decode()) barcode = data["products"][0]["barcode_number"] print ("Barcode Number: ", barcode, "\n") name = data["products"][0]["product_name"] print ("Product Name: ", name, "\n") print ("Entire Response:") pprint.pprint(data) # PYTHON 2 import urllib import json import pprint api_key = "ENTER_YOUR_API_KEY_HERE" url = "https://api.barcodelookup.com/v2/products?barcode=077341125112&formatted=y&key=" + api_key response = urllib.urlopen(url) data = json.loads(response.read()) barcode = data["products"][0]["barcode_number"] print "Barcode Number: ", barcode, "\n" name = data["products"][0]["product_name"] print "Product Name: ", name, "\n" print "Entire Response:" pprint.pprint(data)
require "net/http" require "json" api_key = "ENTER_YOUR_API_KEY_HERE" url = "https://api.barcodelookup.com/v2/products?barcode=077341125112&formatted=y&key=" + api_key uri = URI(url) response = Net::HTTP.get(uri) data = JSON.parse(response) barcode = data["products"][0]["barcode_number"] puts "Barcode Number: #{barcode} \n\n" name = data["products"][0]["product_name"] puts "Product Name: #{name}" puts "Entire Response:" puts JSON.pretty_generate(data)
import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import com.google.gson.Gson; import com.google.gson.GsonBuilder; public class Sample { public class Store { public String store_name; public String store_price; public String product_url; public String currency_code; public String currency_symbol; } public class Review { public String name; public String rating; public String title; public String review; public String datetime; } public class Product { public String barcode_number; public String barcode_type; public String barcode_formats; public String mpn; public String model; public String asin; public String product_name; public String title; public String category; public String manufacturer; public String brand; public String label; public String author; public String publisher; public String artist; public String actor; public String director; public String studio; public String genre; public String audience_rating; public String ingredients; public String nutrition_facts; public String color; public String format; public String package_quantity; public String size; public String length; public String width; public String height; public String weight; public String release_date; public String description; public Object[] features; public String[] images; public Store[] stores; public Review[] reviews; } public class RootObject { public Product[] products; } public static void main(String[] args) { try { URL url = new URL("https://api.barcodelookup.com/v2/products?barcode=077341125112&formatted=y&key=ENTER_YOUR_API_KEY_HERE"); BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); String str = ""; String data = ""; while (null != (str= br.readLine())) { data+=str; } Gson g = new Gson(); RootObject value = g.fromJson(data, RootObject.class); String barcode = value.products[0].barcode_number; System.out.print("Barcode Number: "); System.out.println(barcode); String name = value.products[0].product_name; System.out.print("Product Name: "); System.out.println(name); System.out.println("Entire Response:"); System.out.println(data); } catch (Exception ex) { ex.printStackTrace(); } } }
use LWP::Simple; use JSON; use Data::Dumper; my $api_key = "ENTER_YOUR_API_KEY_HERE"; my $url = "https://api.barcodelookup.com/v2/products?barcode=077341125112&formatted=y&key=".$api_key; my $json = get( $url ); die "Could not get $url!" unless defined $json; my $data = decode_json( $json ); my $barcode = $data->{products}->[0]->{barcode_number}; print "Barcode Number: ".$barcode."\n"; my $name = $data->{products}->[0]->{product_name}; print "Product Name: ".$name."\n"; print "Entire Response: \n"; print Dumper $data;
using System; using System.Net; using Newtonsoft.Json; using System.Collections.Generic; public class Store { public String store_name { get; set; } public String store_price { get; set; } public String product_url { get; set; } public String currency_code { get; set; } public String currency_symbol { get; set; } { public class Review { public String name { get; set; } public String rating { get; set; } public String title { get; set; } public String review { get; set; } public String datetime { get; set; } { public class Product { public String barcode_number { get; set; } public String barcode_type { get; set; } public String barcode_formats { get; set; } public String mpn { get; set; } public String model { get; set; } public String asin { get; set; } public String product_name { get; set; } public String title { get; set; } public String category { get; set; } public String manufacturer { get; set; public String brand { get; set; } public String label { get; set; } public String author { get; set; } public String publisher { get; set; } public String artist { get; set; } public String actor { get; set; } public String director { get; set; } public String studio { get; set; } public String genre { get; set; } public String audience_rating { get; set; } public String ingredients { get; set; } public String nutrition_facts { get; set; } public String color { get; set; } public String format { get; set; } public String package_quantity { get; set; } public String size { get; set; } public String length { get; set; } public String width { get; set; } public String height { get; set; } public String weight { get; set; } public String release_date { get; set; } public String description { get; set; } public IList<object> features { get; set; } public IList<string> images { get; set; } public IList<Store> stores { get; set; } public IList<Review> reviews { get; set; } } public class RootObject { public IList<Product> products { get; set; } } class Program { static void Main(string[] args) { using (WebClient webClient = new System.Net.WebClient()) { WebClient n = new WebClient(); string api_key = "ENTER_YOUR_API_KEY_HERE"; string url = "https://api.barcodelookup.com/v2/products?barcode=077341125112&formatted=y&key=" + api_key; var data = n.DownloadString(url); var name = JsonConvert.DeserializeObject<RootObject>(data).products[0].product_name; System.Console.Write("Product Name: "); System.Console.WriteLine(name); var barcode = JsonConvert.DeserializeObject<RootObject>(data).products[0].barcode_number; System.Console.Write("Barcode Number: "); System.Console.WriteLine(barcode); System.Console.WriteLine("Entire Response: "); System.Console.WriteLine(data); } } }

API Call Limits

You can make a maximum of 100 requests per minute.

Each request is considered 1 API call if data is returned.

Your monthly API call limit is determined by your API plan subscription.


Error Codes

HTTP status codes returned from API:

200 OK
Data returned
403 Forbidden
Invalid API key
404 Not Found
No data returned
429 Too Many Requests
Exceeded API call limits

Update Account & Billing Information

You can update your API customer profile and billing information by logging into your API account.