Chartquery

Barcode

GET
/v1/barcode

Generate a barcode image via GET. Output: SVG (default) or PNG. Supports 25+ formats: EAN-13, Code 128, ITF-14, GS1-128, postal codes and more.

Credit cost: 3 credits per call

Parâmetros de consulta

data*string

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

type?string

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

Default"code128"

Value in

  • "code128"
  • "ean13"
  • "ean8"
  • "upca"
  • "upce"
  • "code39"
  • "itf"
  • "itf14"
  • "codabar"
  • "gs1-128"
  • "postnet"
  • "planet"
  • "plessey"
height?number

Bar height in pixels. Default: 80. Typical values: 50 (compact), 80 (standard), 100–120 (tall labels). Example: ?height=100

color?string

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_text?boolean

Show human-readable text below the bars. Example: ?show_text=true. Combine with font_size and text_align for print labels.

text_position?string

Position of the human-readable text label. Default: bottom. Example: ?text_position=top

Default"bottom"

Value in

  • "bottom"
  • "top"
text_align?string

Horizontal alignment of the text label. Default: center. Example: ?text_align=left

Default"center"

Value in

  • "center"
  • "left"
  • "right"
font_size?number

Font size of the text label in pixels. Default: 14. Example: ?font_size=12

font_family?string

Font family of the text label. Default: monospace. Examples: ?font_family=monospace, ?font_family=sans-serif, ?font_family=Arial

bar_width?number

Width multiplier per module (bar). Default: 2. Increase for wider, more scannable barcodes. Example: ?bar_width=3

bar_gap?number

Extra horizontal spacing between bars in pixels. Default: 0. Example: ?bar_gap=1

background?string

Background fill color. Default: #fff. Use transparent for no background. Example: ?background=%23f8fafc

margin?number

Uniform margin around the barcode in pixels. Default: 10. Overridden per side by margin_top/bottom/left/right. Example: ?margin=6

margin_top?number

Top margin in pixels (overrides margin). Example: ?margin_top=4

margin_bottom?number

Bottom margin in pixels (overrides margin). Example: ?margin_bottom=4

margin_left?number

Left margin in pixels (overrides margin). Example: ?margin_left=8

margin_right?number

Right margin in pixels (overrides margin). Example: ?margin_right=8

rotation?number

Rotate the barcode by 0, 90, 180 or 270 degrees. Default: 0. Use 90 or 270 for vertical label orientation. Example: ?rotation=90

Value in

  • 0
  • 90
  • 180
  • 270
bearer_bars?boolean

Add horizontal bearer bars above and below the barcode. Required for ITF-14. Default: false. Example: ?bearer_bars=true

unit?string

Measurement unit for dimensions. Default: px. Use mm, in or cm for print-ready output. Example: ?unit=mm

Default"px"

Value in

  • "px"
  • "mm"
  • "in"
  • "cm"
aria_label?string

Accessible label added as aria-label on the SVG element. Improves screen reader support. Example: ?aria_label=EAN-13+barcode+for+product+4006381333931

title?string

SVG element for tooltip and accessibility. Example: ?title=Product+Barcode

desc?string

SVG element for extended accessibility description. Example: ?desc=EAN-13+encoding+GTIN+for+Nivea+cream+75ml

format?string

Output format. Default: svg. Use png to get a raster image. SVG is lossless and scalable; PNG is pixel-based and suitable for email, PDF or messaging. Example: ?format=png

Default"svg"

Value in

  • "svg"
  • "png"
share?boolean

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.

Default"false"

Value in

  • "false"
  • "true"

Corpo da resposta

application/json

application/json

curl -X GET "https://example.com/v1/barcode?data=string"
Empty
{  "error": "Bad Request"}
{  "error": "Internal Error"}