Skip Navigation Digit-Eyes UPC Laser Scanning Create Your Own Labels
  click for shopping cart Shopping Cart   ·        ·   Search
Digit-Eyes: Identify and Organize Your World

Creating a Signed Request

Your requests to the Digit-Eyes API must be signed.  The signature is different for every UPC/EAN request and needs to be recomputed for each UPC/EAN. This is because the signature is an encrypted version of the UPC or EAN code that is dependent on a shared secret -- your authorization key (in your case, this is the value "")

The signature is created by combining the authorization key with each UPC in an SHA-1 hash, converting the signature to base 64 and sending it to the API. The exact process for creating a signature depends on your programming language, but here is a general flow:

  1. If your language does not have a native SHA-1 encryption function, instantiate the SHA-1 utility for your language;
  2. Add the authorization key to the SHA-1 object;
  3. Add the UPC/EAN code to the SHA-1 object;
  4. Obtain the signature (a binary hash of the authorization key + the UPC/EAN code) from the SHA-1 object. Then, using the binary signature:
    1. Convert the binary signature to base 64;
    2. Pad the signature (now in base 64) to 28 bytes using the equals sign ("=").
  5. Submit the signed request to the API. Please note that the authorization key is NOT included in the list -- it is the shared secret and stays secret. You will be submitting at least the following fields.
    1. Your application key in the format "app_key="
    2. The UPC/EAN code for which you want information in the format "upcCode=xxxxxxxxxxxxx"where xxxxxxxxxxxxx is the code for which you want information
    3. The computed signature for the UPC/EAN in the format "signature=yyyyyyyyyyyyyyyyyyyyyyyyyyy"
    4. The preferred language of retrieval in the format "language=xx" where "xx" is the two-character ISO language code. The default language will be "en"
    5. The names of the data fields that you want the API to return or "all". Note that there are special charges for some fields like images or structured categories, so do not request these if you do not need them.

Examples are shown below and you can use the demo at  to validate your signature creation results.


Objective C Example

To create a signature, we provide a category in objective C that takes a string and a key and returns the encoded value where UPCCode is the UPC or EAN code and AuthKey is your authorization key:

#import "NSString+SHA1.h"
NSString *hashedValue = [UPCCode hashedValue:AuthKey];



C# Example

/// Product code that is to be used in the query is UpcCode
/// Hash that is to be used to create the siguature is AuthKey
private string GetDigitEyesVerificationCode(string UpcCode)
var hmac = new HMACSHA1(Encoding.UTF8.GetBytes(AuthKey));
var m = hmac.ComputeHash(Encoding.UTF8.GetBytes(UpcCode));
return Convert.ToBase64String(m);



PHP Example

Where $upc_code is the UPC or EAN code and $auth_key is your authorization key:

$signature = print base64_encode(hash_hmac('sha1', $upc_code, $auth_key, $raw_output = true));



perl Example

Where $upc_code is the UPC or EAN code and $auth_key is your authorization key:

sub makeSignature {
    my ($auth_key, $upc_code) = @_;
    use Digest::HMAC_SHA1 qw(hmac_sha1 hmac_sha1_hex);
    my $hmac = Digest::HMAC_SHA1->new($auth_key);
    my $signature = $hmac->b64digest;
    my $paddingRequired = 4-(length($signature) % 4);
    $signature .= substr("====", 0, $paddingRequired) if ($paddingRequired);
    return $signature;



Python Example

Where upc_code is the UPC or EAN code and_key is your authorization key:

import base64
import hashlib
import hmac

def make_auth_token(upc_code, auth_key):
sha_hash =, upc_code, hashlib.sha1)
return base64.b64encode(sha_hash.digest())



VBScript Example

Private Function GetDigitEyesVerificationCode(UpcCode As String) As String
Dim hmac = New HMACSHA1(Encoding.UTF8.GetBytes(AuthKey))
Dim m = hmac.ComputeHash(Encoding.UTF8.GetBytes(UpcCode))
Return Convert.ToBase64String(m)
End Function



Implementation Guide

Got questions? We've got answers (and we're friendly, too!) Contact us by email or phone 817.571.3083.

Home | Security | Privacy | Terms of Service | About Us | Our Translators | Contact Us | API | Site Map