API Services v2

We have three API services available for use in your own applications. You can use our XML or JSON API to query the database for information on an item.

Thanks to your suggestions, you can also use our new cURL API to insert an item into the database.

An API key is required to use the service. You can get an API key for free by signing up.

While this service is free to those who wish to use it, please remember that we have to pay to keep this service alive. If you are using the API for commercial purposes, we ask that you may provide us with a donation to keep this service running.

Disclaimer: This API service provides no guarantee on uptime, or the validity of the information returned.




March 24, 2014 changes:

XML and JSON changes:



February 17th, 2014 changes:

XML and JSON changes:




Using the XML API

Our XML API service is located at the following URL:

Output if the code exists:

<?xml version="1.0" encoding="ISO-8859-1"?>
<output xmlns="http://upcdatabase.org/">
    <itemname>UPC Database Testing Code</itemname>
    <alias>Testing Code</alias>

If the no price is found, or a feild does not contain data, it will be empty.

Output if the code does not exists:

<?xml version="1.0" encoding="ISO-8859-1"?>
<output xmlns="http://upcdatabase.org/">
<reason>Code does not exist!</reason>

Similar errors occur if the API length is incorrect or does not exist, or if the code is non-numeric.

Error codes:

101 - API Key length is incorrect
105 - API Key incorrect
199 - No more API requests remaining
201 - You did not enter a code
205 - The code you entered was non-numeric
301 - Code does not exist




Using the JSON API

Our JSON API service is located at the following URL:

Output if the code exists:

{"valid":"true","number":"0111222333446","itemname":"UPC Database Testing Code","alias":"Testing Code","description":"http:\/\/upcdatabase.org\/code\/0111222333446","avg_price":"123.45","rate_up":0,"rate_down":0}

Output if the code does not exists:

{"valid":"false","reason":"Code not found in database."}




Using the cURL API to insert codes

Our cURL API allows users to submit codes by POSTing them to the following URL:

Sample code (PHP):

$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_URL => 'http://api.upcdatabase.org/submit/curl.php',
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => http_build_query(array(
        'upc' => '0000000000000',
        'mrsp' => '0.00',
        'apikey' => 'YOURAPIKEYGOESHERE',
        'title' => 'Title of product',
        'alias' => 'Title alias',
        'description' => 'Optional lengthy description of product.',
        'unit' => 'Per case'
$server_output = curl_exec($ch);

if( $server_output == 'OK' ) {
    echo "Everything went alright!";
} else {
    echo "An error occured: ", $server_output;

Possible outputs:

There are various human-readable errors that our script can produce if there is an error.

Code length incorrect -The UPC code is the wrong length.
Invalid API key -The API you entered contains spaces, or is not 32 chars long.
Title must be 3 or more characters
Ailias must be under 20 characters
Item already exists -The UPC you entered already exists.
OK -The system accepted your code and added it to the database.
API key not found -The API key you entered does not belong to anyone.
An unknown problem has occured. -Should never happen.