Barcode
Generate a barcode image via GET. Output: SVG (default), PNG, WebP or JPEG. Supports 25+ formats: EAN-13, Code 128, ITF-14, GS1-128, postal codes and more.
Credit cost: 3 credits per call
Query Parameters
The data to encode in the barcode. Examples by type:
EAN-13 (retail): 4006381333931
EAN-8 (small pack): 73513535
UPC-A (North America): 012345678905
Code 128 (general): HELLO-WORLD-2026 or INV-2026-00456
Code 39 (uppercase): CODE39-DEMO or SHELF-A12
ITF-14 (carton): 00012345678905
GS1-128 (with AIs): (01)12345678901234(17)260101
Codabar (library): A1234567890B
POSTNET (postal): 902100123
Barcode format. Default: code128.
Retail: ean13, ean8, ean5, ean2, upca, upce
General: code128, code39, code39ext, code93, code93ext
Logistics: itf, itf14, gs1-128, gs1-databar, gs1-databar-limited, gs1-databar-expanded
Other: codabar, msi, pharmacode, code11, plessey
Postal: postnet, planet, identcode, leitcode
"code128""code128" | "ean13" | "ean8" | "upca" | "upce" | "code39" | "itf" | "itf14" | "codabar" | "gs1-128" | "postnet" | "planet" | "plessey"Bar height in pixels. Default: 80. Typical values: 50 (compact), 80 (standard), 100–120 (tall labels). Example: ?height=100
Bar color as a CSS color string. Default: #000. Examples: ?color=%231e293b (dark slate), ?color=%230f172a (near black), ?color=%237c3aed (purple), ?color=%23dc2626 (red). Use %23 to URL-encode the # character.
Show human-readable text below the bars. Example: ?show_text=true. Combine with font_size and text_align for print labels.
Position of the human-readable text label. Default: bottom. Example: ?text_position=top
"bottom""bottom" | "top"Horizontal alignment of the text label. Default: center. Example: ?text_align=left
"center""center" | "left" | "right"Font size of the text label in pixels. Default: 14. Example: ?font_size=12
Font family of the text label. Default: monospace. Examples: ?font_family=monospace, ?font_family=sans-serif, ?font_family=Arial
Width multiplier per module (bar). Default: 2. Increase for wider, more scannable barcodes. Example: ?bar_width=3
Extra horizontal spacing between bars in pixels. Default: 0. Example: ?bar_gap=1
Background fill color. Default: #fff. Use transparent for no background. Example: ?background=%23f8fafc
Uniform margin around the barcode in pixels. Default: 10. Overridden per side by margin_top/bottom/left/right. Example: ?margin=6
Top margin in pixels (overrides margin). Example: ?margin_top=4
Bottom margin in pixels (overrides margin). Example: ?margin_bottom=4
Left margin in pixels (overrides margin). Example: ?margin_left=8
Right margin in pixels (overrides margin). Example: ?margin_right=8
Rotate the barcode by 0, 90, 180 or 270 degrees. Default: 0. Use 90 or 270 for vertical label orientation. Example: ?rotation=90
0 | 90 | 180 | 270Add horizontal bearer bars above and below the barcode. Required for ITF-14. Default: false. Example: ?bearer_bars=true
Measurement unit for dimensions. Default: px. Use mm, in or cm for print-ready output. Example: ?unit=mm
"px""px" | "mm" | "in" | "cm"Accessible label added as aria-label on the SVG element. Improves screen reader support. Example: ?aria_label=EAN-13+barcode+for+product+4006381333931
SVG element for tooltip and accessibility. Example: ?title=Product+Barcode
SVG element for extended accessibility description. Example: ?desc=EAN-13+encoding+GTIN+for+Nivea+cream+75ml
Output format. Default: svg. Use png, webp or jpeg to get a raster image. SVG is lossless and scalable; PNG/WebP/JPEG are pixel-based and suitable for email, PDF or messaging. Example: ?format=png
"svg""svg" | "png" | "webp" | "jpeg"Set share=true to persist the config and receive JSON instead of an image: { id, render_url, view_url, embed_url, expires_in }. Free plan: 3-day expiry with watermark. Paid plan: 6-month expiry, no branding.
"false""false" | "true"Response Body
application/json
application/json
curl -X GET "https://api.chartquery.com/v1/barcode?data=string"{
"error": "Bad Request"
}{
"error": "Internal Error"
}