Link Search Menu Expand Document

Read Barcode From Encrypted URL - JavaScript

Barcode Reader sample in JavaScript demonstrating ‘Read Barcode From Encrypted URL’

var https = require("https");

// The authentication key (API Key).
// Get your own by registering at
const API_KEY = "***********************************";

// Direct URL of source file to search barcodes in.
// You can also upload your own file into and use it as url. Check "Upload File" samples for code snippets:    
const SourceFileUrl = "";

// Comma-separated list of barcode types to search. 
// See valid barcode types in the documentation
const BarcodeTypes = "QRCode";

// Refer to documentations for more info.
const Profiles = "{ 'DataDecryptionAlgorithm': 'AES128', 'DataDecryptionKey': 'Qweasd1234567890', 'DataDecryptionIV': '0mDI&qLv*ivTCd$*' }";

// Prepare request to `Barcode Reader` API endpoint
var queryPath = `/v1/barcode/read/from/url`;

// JSON payload for api request
var jsonPayload = JSON.stringify({
    types: BarcodeTypes,
    profiles: Profiles,
    url: SourceFileUrl

var reqOptions = {
    host: "",
    method: "POST",
    path: queryPath,
    headers: {
        "x-api-key": API_KEY,
        "Content-Type": "application/json",
        "Content-Length": Buffer.byteLength(jsonPayload, 'utf8')

// Send request
var postRequest = https.request(reqOptions, (response) => {
    response.on("data", (d) => {
        // Parse JSON response
        var data = JSON.parse(d);

        if (data.error == false) {
            // Display found barcodes in console
            data.barcodes.forEach((element) => {
                console.log("Found barcode:");
                console.log("  Type: " + element.TypeName);
                console.log("  Value: " + element.Value);
                console.log("  Document Page Index: " + element.Page);
                console.log("  Rectangle: " + element.Rect);
                console.log("  Confidence: " + element.Confidence);
            }, this);
        else {
            // Service reported error
}).on("error", (e) => {
    // Request error

// Write request data
postRequest.end(); Web API: the Web API with a set of tools for documents manipulation, data conversion, data extraction, splitting and merging of documents. Includes image recognition, built-in OCR, barcode generation and barcode decoders to decode bar codes from scans, pictures and pdf.

Get your API key here!

Download Source Code (.zip)

return to the previous page explore Barcode Reader endpoint