Barcode API
The Barcode API generates custom barcodes for any text. It supports multiple barcode types, custom dimensions, and several image formats.
API Status
/v1/barcodegenerate GET
https://api.api-ninjas.com/v1/barcodegenerate
Returns a barcode image binary specified by input parameters.
Parameters
textrequiredText to encode in the barcode.
typeoptionalType of barcode to generate. Must be one of:
code39,code128,ean,ean13,ean8,gs1,gtin,isbn,isbn10,isbn13,issn,jan,pzn,upc,upca. Default isupc.formatoptionalImage format to return. Must be one of:
png,svg. Default ispng.include_textoptionalWhether to include the text below the barcode. Must be
trueorfalse. Default istrue.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Acceptmay be requiredDepending on the programming language and HTTP request library (e.g. Python's
requests), you may need to add a header indicating the content type(s) to accept in the result. Set the value according to yourformatparameter:png:image/pngsvg:image/svg+xml
Sample Request Live Demo!
https://api.api-ninjas.com/v1/barcodegenerate?format=png&type=upc&text=123456789012Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
3
4
curl -X GET "https://api.api-ninjas.com/v1/barcodegenerate?text=123456789012&type=upc" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Accept: image/png" \
--output barcode.pngIf your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.