Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Online Barcode API
The bwip-js online API is hosted on an Amazon AWS EC2 instance using a node.js application. You can use this API to dynamically generate barcode images from anywhere on the web. The returned image is in PNG format.
The online API is implemented by the
node-bwipjs module provided in the main repository, so if you are running a node server, you can implement the same functionality on your local systems.
The API is available over HTTP and HTTPS via the URLs:
27 June 2018: There are some issues with the automated certificate renewal. If you are having trouble connecting to the https: URL, try the alternate names:
Only HTTP GET requests with parameters specified in the URL query string are valid.
The two required parameters are the barcode type and the value to encode, using the
bcid= must follow immediately after the
? question mark.
The list of supported barcode types (encoders) is available at BWIPP Barcode Types.
The remaining parameters can be broken into two groups, bwip-js parameters and BWIPP parameters.
scaleX: The x-axis scaling factor. Must be an integer > 0. Default is 2.
scaleY: The y-axis scaling factor. Must be an integer > 0. Default is
scale: Sets both the x-axis and y-axis scaling factors. Must be an integer > 0.
rotate: Allows rotating the image to one of the four orthogonal orientations:
N: Normal (not rotated). This is the default.
R: Clockwise 90 degree rotation.
L: Counter-clockwise 90 degree rotation.
I: Inverted 180 degree rotation.
monochrome: Sets the image text to render in monochrome. The default is 256-level gray-scale anti-aliased.
For example, to render a
code128 barcode at 3x scale with inverted orientation and displaying the text (a BWIPP-specific option):
BWIPP has two types of options, boolean and valued. Boolean parameters take no value; their presence in the URL specifies enabled/true. Valued parameters must be followed by an equals-sign (no spaces) and the value. The value string must be URL-encoded.
The following is an example of rendering a
code128 barcode using the BWIPP
parsefnc boolean option and specifying alternate text to appear below the barcode:
%5E at the start of the
text= parameter is the
^ ASCII caret, URL-encoded. BWIPP uses
^ to indicate control words and other values unique to each type of barcode.
alttext, in human-readable form is
encodeURIComponent() global method to encode the value string of any parameter.
You will need to consult the BWIPP documentation to understand what parameters are available for each barcode type.
How to use
From within an HTML document, you can use the API anywhere you can specify an image URL. For example, as a CSS
background-image URL or as the
src in an <img> tag. For example:
<img alt="Barcoded value 1234567890" src="http://bwipjs-api.metafloor.com/?bcid=code128&text=1234567890&includetext">
When used from a server, you must initiate an HTTP GET request. The HTTP response will be either status 200 with
Content-Type: image/png or status 4XX with
Content-Type: text/plain when an error occurs. The returned text will give an indication of what went wrong. Your client should also be prepared to handle HTTP 302 and 307 redirects.