Skip to main content

Create Barcode - QR Code Generator API

PDF4me Create Barcode enables you to create standalone barcode and QR code images with support for 150+ barcode types including QR codes, Code128, DataMatrix, Aztec, Hanxin, PDF417, and specialized formats. This API service generates compliant barcode images optimized for printing, mobile scanning, and digital applications. The API receives text data and barcode parameters through REST API calls, utilizing Base64 encoding for secure transmission. This solution is ideal for inventory management systems, product labeling automation, and enterprise barcode generation workflows.

Authenticating Your API Request

To access the PDF4me REST API, every request must include proper authentication credentials. Authentication ensures secure communication and validates your identity as an authorized user of the REST API.

Key Features

  • Comprehensive Barcode Library: 150+ barcode types including QR codes, Code128, DataMatrix, Aztec, Hanxin, PDF417, postal codes, and specialized industry symbologies using Barcode Type parameter
  • Standalone Image Generation: Create high-quality barcode images independently without requiring existing documents or templates through File Name specification
  • Advanced Text Management: Configure barcode text display, positioning, and visibility with professional formatting options for clean presentation using Text parameter
  • Enterprise Integration: Simple API with minimal parameters designed for seamless integration into existing business systems and workflows with proper parameter mapping

REST API Endpoint

The PDF4me REST API uses standard HTTP methods to interact with resources. All barcode generation operations are performed through a single endpoint:

  • Method: POST
  • Endpoint: /api/v2/CreateBarcode

Supported Barcode Types

Supports 150+ barcode types for comprehensive barcode generation based on the JSON specification.

  • Code128 - Universal barcode (255 chars max) using Barcode Type parameter
  • Code39 - Alphanumeric barcode (43 chars max) through Text parameter
  • EAN13/EAN8 - Retail product codes (13/8 chars) with File Name specification
  • UPC-A/UPC-E - North American retail (12/8 chars) using API integration
  • QR Code - Mobile scanning (4,296 chars max) using Barcode Type parameter
  • DataMatrix - High-density 2D (2,335 chars max) through Text parameter
  • PDF417 - Large data capacity (2,710 chars max) with File Name specification
  • Aztec - Excellent error correction (3,832 chars max) using API integration

Specialized Formats

  • Postal Codes: USPS, Royal Mail, Australia Post, Deutsche Post using Barcode Type parameter
  • Healthcare: HIBC, GS1 DataBar, Pharmacode through Text parameter
  • Logistics: MaxiCode, SSCC-18, ITF-14, GS1-128 with File Name specification
  • QR Variants: Micro QR, iQR, rMQR using API integration

REST API Parameters

Complete list of parameters for the Create Barcode REST API. Parameters are organized by category for better understanding and implementation.

Important: Parameters marked with an asterisk (*) are required and must be provided for the API to function correctly.

Required Parameters

ParameterTypeDescriptionExample
text*StringText to be encoded in the barcode. Text length depends on barcode typePDF4me Create Barcode Sample
barcodeType*StringBarcode format type. Options: qrCode, code128, dataMatrix, aztec, hanXin, pdf417, code39, ean13, ean8, upcA, upcEqrCode
hideText*BooleanHide barcode text label (true=hide, false=show text alongside barcode)false
async*BooleanEnable asynchronous processing. When true, the API returns a 202 status and provides a polling URL in the Location headertrue

Output

The PDF4me Create Barcode REST API returns different responses based on the processing mode. The API returns the barcode as a binary image file (PNG format), not as JSON.

Synchronous Processing (Default)

When async is not set or set to false, the API processes the request immediately:

Status Code: 200 OK

Content-Type: image/png (or appropriate image format)

Response Body: The response body contains the barcode image as binary data (PNG format by default).

How to Use:

  1. Read the response body as binary data
  2. Save the binary data as an image file (e.g., .png, .jpg)
  3. Use the image file as needed

Example (JavaScript):

const response = await fetch(url, options);
const blob = await response.blob();
const url = URL.createObjectURL(blob);
// Use the URL to display or download the image

Example (Python):

response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200:
with open('barcode.png', 'wb') as f:
f.write(response.content)

Request Example

Content-Type: application/json
Authorization: Basic YOUR_BASE64_ENCODED_API_KEY

Note:

  • Get your API key from the PDF4me Dashboard
  • The API key must be Base64 encoded and prefixed with "Basic " in the Authorization header
  • Example: If your API key is abc123, encode it to Base64 and use Authorization: Basic YWJjMTIz

Payload

Example:

{
"text": "PDF4me Create Barcode Sample",
"barcodeType": "qrCode",
"hideText": false,
"async": true
}

Code Samples

The PDF4me Create Barcode REST API provides code samples in multiple programming languages. Choose the language that best fits your development environment:

C# (CSharp) Sample

Complete C# implementation for creating barcodes:

Industry Use Cases & Applications

E-commerce & Retail Use Cases

  • Product Labels: Generate standalone barcode images for product packaging and labels using Barcode Type parameter
  • Price Tags: Create barcode images for dynamic pricing and automated checkout systems through Text parameter
  • Inventory Management: Generate barcode images for warehouse management and stock control with File Name specification
  • Product Catalogs: Create barcode images for product identification and catalog systems using API integration

Get Help