API Documentation
Welcome to the Barcode Spider API
The quickest and easiest way to get started with Barcode Spider API is with the documentation below. The Barcode Spider 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 token upon account creation. Your API token is used to authenticate you with our API, and can be provided either as an request header or alternatively as a token URL parameter. Authenticate your account by including your API token in all requests.
# With request header $ curl -X GET -H "token: YOUR_TOKEN" https://api.barcodespider.com/v1/lookup $ curl -X GET -H "token: YOUR_TOKEN" https://api.barcodespider.com/v1/search # With token query parameter $ curl -X GET https://api.barcodespider.com/v1/lookup?token=YOUR_TOKEN $ curl -X GET https://api.barcodespider.com/v1/search?token=YOUR_TOKEN
Code Examples
Below are a few basic sample for the Lookup request to help you get started. The code examples demonstrate how to make an API call and print output in several popular programming languages.
$ curl -X GET -H 'token: YOUR_TOKEN' 'https://api.barcodespider.com/v1/lookup?upc=UPC_NUMBER'
$user_token = "ENTER YOUR API TOKEN HERE"; $endpoint = "https://api.barcodespider.com/v1/lookup"; $upc = "UPC_NUMBER"; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $endpoint ."?upc=".$upc, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_POSTFIELDS => "", CURLOPT_HTTPHEADER => "token: YOUR_TOKEN", )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
import requests url = "https://api.barcodespider.com/v1/lookup" querystring = {"upc":"UPC_NUMBER"} headers = { 'token': "ENTER YOUR API TOKEN HERE", 'Host': "api.barcodespider.com", 'Accept-Encoding': "gzip, deflate", 'Connection': "keep-alive", 'cache-control': "no-cache" } response = requests.request("GET", url, headers=headers, params=querystring) print(response.text)
JSON Response
Here's the API responses for an example UPC lookup.
$ curl -H "token: YOUR_TOKEN" https://api.barcodespider.com/v1/lookup?upc=039800108036
{ "item_response": { code": 200 status": "OK" message": "Data returned" } item_attributes": { title": "Eveready Battery Co Inc Energizer Alkaline Battery, AA, 16/PK, BKSR" upc": "039800108036" ean": "0039800108036" parent_category": "Batteries" category": "Wireless Phone Accessory" brand": "Eveready" model": "4330207043" mpn": "4330207043" manufacturer": "Eveready Battery Co Inc" publisher": "Eveready Battery Co Inc" asin": "B071HVKWFV" color": "Black" size": "All" weight": "0.1 Pounds" image": "https://images-na.ssl-images-amazon.com/images/I/517H6HFWLZL.jpg" description": "Battery,Aa,Enrgzer Max,16Pk" } Stores": [ { store_name": "Amazon US" title": "Eveready Battery Co Inc Energizer Alkaline Battery, AA, 16/PK, BKSR" image": "https://images-na.ssl-images-amazon.com/images/I/517H6HFWLZL.jpg" price": "16.99" currency": "USD" link": "https://www.amazon.com/Eveready-Battery-Energizer-Alkaline/dp/B071HVKWFV/" updated": "2019-04-10 22:45" }, { store_name": "Newegg.com" title": "Eveready Battery Co Inc Energizer Alkaline Battery, AA, 16/PK, BKSR" image": "https://images10.newegg.com/ProductImageCompressAll200/17-173-207-02.jpg" price": "23.25" currency": "USD" link": "https://www.newegg.com/Product/Product.aspx?Item=9SIA1K647Y5900" updated": "2019-04-27 04:25" } ] }
Error Response
Description of HTTP status codes returned from API
HTTP Code | Status | Message |
---|---|---|
200 | OK | Data returned |
400 | INVALID_REQUEST | Required parameters: API token is missing in the request. |
400 | INVALID_REQUEST | Required parameters: UPC number is missing in the request. |
401 | AUTH_ERR | Authentication is required |
404 | NOT_FOUND | The requested object does not exist |
405 | METHOD_NOT_ALLOWED | Invalid request method |
429 | EXCEEDED_LIMIT | Exceed daily request limits |
429 | TOO_FAST | Request exceeds rate limit |
50x | SERVER_ERR | If the problem persists, please shoot us an email with your sample request and the time it happened. |
HTTP Response Headers
Description of HTTP Response Headers returned from API. This information can be used to gauge your total number of allotted requests, the number of requests remaining for the day, and the time at which the daily limit will be reset. Any request that exceed the daily threshold will be throttled with an HTTP 429 response.
HTTP Header | Type | Description |
---|---|---|
X-RateLimit-Limit | integer | An integer specifying the number of requests available per day. This number is definied by your subscription plan. |
X-RateLimit-Remaining | integer | An integer specifying the number of remaining requests per day. |
X-RateLimit-Reset | timestamp | A timestamp specifying the time in which the daily rate limit is reset. |
Example:
HTTP/1.1 200 OK Cache-Control: max-age=0, private, must-revalidate Content-Type: application/json; charset=utf-8 Date: Sun, 18 Apr 2019 03:09:09 GMT Access-Control-Allow-Origin: * Vary: Accept-Encoding X-RateLimit-Limit: 500000 X-RateLimit-Remaining: 49768 X-RateLimit-Reset: 1556348400 Connection: keep-alive
Rate Limits
Free usage of our API is limited to 100 API requests per day ( 1 request / 5 seconds ).
Paid plans come with different daily limits per request types.
Daily Limits | |||
---|---|---|---|
Lite API Plan | Basic API Plan | Dev API Plan | |
1,000 lookup requests 100 search requests | 9,000 lookup requests 900 search requests | 20,000 lookup requests 2,000 search requests | |
1 lookup request / 2 seconds 1 search request / 5 seconds | 1 lookup request / 2 seconds 1 search request / 5 seconds | 1 lookup request / 1 second 1 search request / 4 seconds |
If exceed daily limit requests in a 24 hour period we'll return a 429 HTTP status code.
Hotlinking
Returned image URLs may be used for temporarily results. However, permanent hotlinking of images (using BarcodeSpider URLs in your app) is not allowed. If you intend to use the images, please download them to your server first.