New: Markdown to PDF built for AI agents, PDF to E-Invoice for Factur-X/ZUGFeRD, and PDF to PDF/A for archive-ready PDF/A-3b.

Generate a Barcode Using PDF.co’s Web API

4 MIN READ

Create a barcode image from a text value using PDF.co. This example generates a Code128 barcode containing an invoice number.

Open the API Tester

Sign in to your PDF.co account, then open the Barcode Generator API Tester.

Select Try it and provide your PDF.co API key in the x-api-key authorization field when prompted.

The endpoint is:

POST https://api.pdf.co/v1/barcode/generate

Configure the Request

Use these request parameters:

{
  "type": "Code128",
  "value": "INV-123456",
  "name": "barcode.png",
  "inline": false,
  "async": false
}
  • type: The barcode format. This example uses Code128.
  • value: The text to encode. Replace it with your invoice number or other value.
  • name: The generated image’s filename.
  • inline: Set to false to receive a downloadable image URL.
  • async: Set to false for this synchronous example.

PDF.co also supports QRCode, DataMatrix, Code39, and other formats. Check the Barcode Generator documentation for supported types and additional options.

Generate and Download the Barcode

Submit the request and review the response.

On success, open the returned url to view the barcode image. Download it before the temporary link expires, then scan it with a compatible barcode reader to confirm that it contains your expected value.

To integrate the request into your application, use the API Tester’s language selector to view a code example in your preferred language.

Was this page helpful?

Related Tutorials

See Related Tutorials

Try it with your document.

Create an account, get an API key and test a request.

Get Started Free

© Copyright 2016-2026 Artifex Software, Inc d/b/a PDF.co — All Rights Reserved