Link Search Menu Expand Document

Barcode Reader

Explore Samples

Read barcodes from images and PDF. Can read all popular barcode types from QR Code and Code 128, EAN to Datamatrix, PDF417, GS1 and many other barcodes.

Available Methods

[POST] /barcode/read/from/url

Need to split PDF by barcode? Check PDF Split by Barcode (pdf/split2 endpoint).

Attributes
url required
URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage.

For uploading files via API please check Files Upload section.

If you are randomly getting a Too Many Requests or Access Denied error for your input URL, Please try to add cache: to enable built-in URL caching.

You can also encrypt data for output files and decrypt data input files with user-controlled data encryption to learn more.
httpusername optional
HTTP auth user name if required to access source url.
httppassword optional
HTTP auth password if required to access source url.
async optional
Runs processing asynchronously and returns JobId that you may use with /job/check to check the state of the processing (possible states: working, failed, aborted and success). Must be one of: true, or false.
type optional
Set the barcode type, Must be in a “string” format. QRCode By default.
supported barcode types:
AustralianPostCode, Aztec, BorderedTable, Checkbox, Circle, CircularI2of5, Codabar, CodablockF, Code128, Code16K, Code39, Code39Extended, Code39Mod43, Code39Mod43Extended, Code93, DataMatrix, DPMDataMatrix, EAN13, EAN2, EAN5, EAN8, GS1, GS1DataBarExpanded, GS1DataBarExpandedStacked, GS1DataBarLimited, GS1DataBarOmnidirectional, GS1DataBarStacked, GTIN12, GTIN13, GTIN14, GTIN8, HorizontalLine, IntelligentMail, Interleaved2of5, ITF14, MaxiCode, MICR, MicroPDF, MSI, Oval, PatchCode, PDF417, Pharmacode, PostNet, PZN, QRCode, Rectangle, RoyalMail, RoyalMailKIX, Segment, Trioptic, UnderlinedField, UPCA, UPCE, UPU, VerticalLine.
pages optional
Comma-Separated list of page indices (or ranges) to process. IMPORTANT: the very first page starts at 0 (zero). To set a range use the dash -, for example: 0,2-5,7-. To set a range from the index to the last page use range like this: 2- (from page #3 as the index starts at zero and till the end of the document). For ALL pages just leave this param empty. Example: 0,2-5,7- means the first page, then the 3rd page to the 6th page, and then the range from the 8th (index = 7) page till the end of the document. Must be in a “string” format.
profiles optional
Use this parameter to set additional configurations for fine-tuning and extra options. Must be in a “string” format. Explore PDF.co knowledgebase for profile examples.
  • Method: POST
  • URL: /v1/barcode/read/from/url

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
    "types": "QRCode,Code128,Code39,Interleaved2of5,EAN13",
    "pages": "0",
    "async": false
}

Example responses

/barcode/read/from/url
{
    "barcodes": [
        {
            "Value": "abcdef123456",
            "RawData": "",
            "Type": 14,
            "Rect": "{X=448,Y=23,Width=106,Height=112}",
            "Page": 0,
            "File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
            "Confidence": 1,
            "Metadata": "",
            "TypeName": "QRCode"
        },
        {
            "Value": "test123",
            "RawData": "",
            "Type": 2,
            "Rect": "{X=111,Y=60,Width=255,Height=37}",
            "Page": 0,
            "File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
            "Confidence": 0.90625155,
            "Metadata": "",
            "TypeName": "Code128"
        },
        {
            "Value": "123456",
            "RawData": "",
            "Type": 4,
            "Rect": "{X=111,Y=129,Width=306,Height=37}",
            "Page": 0,
            "File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
            "Confidence": 0.7710818,
            "Metadata": "",
            "TypeName": "Code39"
        },
        {
            "Value": "<FNC1>0112345678901231",
            "RawData": "",
            "Type": 2,
            "Rect": "{X=111,Y=198,Width=305,Height=37}",
            "Page": 0,
            "File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
            "Confidence": 0.9156459,
            "Metadata": "",
            "TypeName": "Code128"
        },
        {
            "Value": "12345670",
            "RawData": [
                1,
                2,
                3,
                4,
                5,
                6,
                7,
                0
            ],
            "Type": 5,
            "Rect": "{X=111,Y=267,Width=182,Height=0}",
            "Page": 0,
            "File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
            "Confidence": 1,
            "Metadata": "",
            "TypeName": "I2of5"
        },
        {
            "Value": "1234567890128",
            "RawData": "",
            "Type": 6,
            "Rect": "{X=102,Y=336,Width=71,Height=72}",
            "Page": 0,
            "File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
            "Confidence": 0.895925164,
            "Metadata": "",
            "TypeName": "EAN13"
        }
    ],
    "pageCount": 1,
    "error": false,
    "status": 200,
    "remainingCredits": 99826192,
    "credits": 35
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/barcode/read/from/url' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
    "types": "QRCode,Code128,Code39,Interleaved2of5,EAN13",
    "pages": "0",
    "async": false
}'

[POST] /barcode/read/from/url (read qr code)

Need to split PDF by barcode? Check PDF Split by Barcode (pdf/split2 endpoint).

Attributes
url required
URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage.

For uploading files via API please check Files Upload section.

If you are randomly getting a Too Many Requests or Access Denied error for your input URL, Please try to add cache: to enable built-in URL caching.

You can also encrypt data for output files and decrypt data input files with user-controlled data encryption to learn more.
httpusername optional
HTTP auth user name if required to access source url.
httppassword optional
HTTP auth password if required to access source url.
types required
Comma-Separated list of barcode types to decode e.g Code128, Code39.
Supported Barcode Types:
AustralianPostCode, Aztec, BorderedTable, Checkbox, Circle, CircularI2of5, Codabar, CodablockF, Code128, Code16K, Code39, Code39Extended, Code39Mod43, Code39Mod43Extended, Code93, DataMatrix, DPMDataMatrix, EAN13, EAN2, EAN5, EAN8, GS1, GS1DataBarExpanded, GS1DataBarExpandedStacked, GS1DataBarLimited, GS1DataBarOmnidirectional, GS1DataBarStacked, GTIN12, GTIN13, GTIN14, GTIN8, HorizontalLine, IntelligentMail, Interleaved2of5, ITF14, MaxiCode, MICR, MicroPDF, MSI, Oval, PatchCode, PDF417, Pharmacode, PostNet, PZN, QRCode, Rectangle, RoyalMail, RoyalMailKIX, Segment, Trioptic, UnderlinedField, UPCA, UPCE, UPU, VerticalLine.
pages optional
Comma-Separated list of page indices (or ranges) to process. IMPORTANT: the very first page starts at 0 (zero). To set a range use the dash -, for example: 0,2-5,7-. To set a range from the index to the last page use range like this: 2- (from page #3 as the index starts at zero and till the end of the document). For ALL pages just leave this param empty. Example: 0,2-5,7- means the first page, then the 3rd page to the 6th page, and then the range from the 8th (index = 7) page till the end of the document. Must be in a “string” format.
async optional
Runs processing asynchronously and returns JobId that you may use with /job/check to check the state of the processing (possible states: working, failed, aborted and success). Must be one of: true, or false.
profiles optional
Use this parameter to set additional configurations for fine-tuning and extra options. Must be in a “string” format. Explore PDF.co knowledgebase for profile examples.
  • Method: POST
  • URL: /v1/barcode/read/from/url

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
    "types": "QRCode",
    "pages": "0",
    "async": false
}

Example responses

/barcode/read/from/url (read qr code)
{
    "barcodes": [
        {
            "Value": "abcdef123456",
            "RawData": "",
            "Type": 14,
            "Rect": "{X=448,Y=23,Width=106,Height=112}",
            "Page": 0,
            "File": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
            "Confidence": 1,
            "Metadata": "",
            "TypeName": "QRCode"
        }
    ],
    "pageCount": 1,
    "error": false,
    "status": 200,
    "duration": 781,
    "remainingCredits": 98725563,
    "credits": 35
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/barcode/read/from/url' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/barcode-reader/sample.pdf",
    "types": "QRCode",
    "pages": "0",
    "async": false
}'

Samples