---
title: "Barcode Image API — Code 128, EAN & UPC via API | Imejis"
description: "Render Code 128, EAN-13, UPC-A and other bwip-js barcodes into images, encoding a new SKU or ticket value on every API call. Start generating free."
url: "https://www.imejis.io/components/barcode"
---

# Barcode Image API — Code 128, EAN & UPC via API | Imejis

Renders 1D/linear barcodes (Code 128, EAN-13, UPC-A and other bwip-js symbologies) with optional human-readable text — ideal for tickets, SKUs and shipping labels.

## Use cases

- Shipping labels with the tracking number encoded per parcel
- Event and cinema tickets with unique entry codes
- Retail shelf labels and price tags with product SKUs
- Warehouse bin and asset labels generated in bulk

## Authoring notes

- Any bwip-js symbology id works as format: code128 (default), code39, code93, ean13, ean8, upca, upce, itf14, interleaved2of5, codabar, msi, pharmacode, gs1-128.
- The value must be valid for the chosen format (e.g. ean13 needs 12-13 digits) — invalid values render a placeholder.
- For 2D codes use the qr component.

## Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string` | — | The raw value encoded into the barcode. |
| `format` | `string` | `"code128"` | Barcode symbology (bwip-js bcid), e.g. 'code128', 'ean13', 'upca'. |
| `barColor` | `color` | `"#000000"` | Color of the bars (dark modules). |
| `backgroundColor` | `color` | `"#ffffff"` | Background color behind the barcode. |
| `displayValue` | `boolean` | `true` | Show the human-readable text below the bars. |
| `textColor` | `color` | — | Human-readable text color (defaults to barColor). |
| `opacity` | `number` | `1` | Overall component opacity from 0 (transparent) to 1 (opaque). |
| `borderWidth` | `number` | `0` | Border thickness in pixels around the component. |
| `borderColor` | `color` | `"transparent"` | Border color (any CSS color). |
| `borderStyle` | `'solid' \| 'dashed' \| 'dotted' \| 'double' \| 'none'` | `"solid"` | Border line style. |
| `borderRadius` | `number` | `0` | Corner radius in pixels. |
| `boxShadow` | `string` | — | CSS box-shadow applied to the component, e.g. "0 4px 6px rgba(0,0,0,0.1)". |

## Sample design JSON

```json
{
  "title": "Barcode sample",
  "description": "A dynamic Code 128 barcode",
  "dimensions": {
    "width": 800,
    "height": 420
  },
  "background": {
    "color": "#ffffff"
  },
  "components": [
    {
      "id": "sample-barcode",
      "key": "sku",
      "type": "barcode",
      "position": {
        "x": 240,
        "y": 140
      },
      "rotation": 0,
      "size": {
        "width": 320,
        "height": 140
      },
      "dynamic": true,
      "properties": {
        "value": "012345678905",
        "format": "code128",
        "barColor": "#000000",
        "backgroundColor": "#ffffff",
        "displayValue": true,
        "opacity": 1
      }
    }
  ]
}
```

## Examples

### Parcel tracking label

A shipping label strip with the carrier tracking number in Code 128.

API overrides that reproduce this example:

```json
{
  "sku.value": "1Z999AA10123456784"
}
```

### Warehouse bin label

A bin location code printed for rack labelling, text kept below the bars.

API overrides that reproduce this example:

```json
{
  "sku.value": "BIN-A12-045",
  "sku.barColor": "#1E3A8A"
}
```

## API overrides

Encode a different SKU/ticket per render via '<key>.value' (or just '<key>'); format and colors can also be overridden.

Flat override payload (`key.property` addressing) with the sample design's current values — send only the keys you want to change:

```json
{
  "sku.value": "012345678905",
  "sku.format": "code128",
  "sku.barColor": "#000000",
  "sku.backgroundColor": "#ffffff",
  "sku.displayValue": true,
  "sku.opacity": 1
}
```

```bash
curl --location 'https://render.imejis.io/v1/{{YOUR_DESIGN_ID}}' \
--header 'dma-api-key: {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
    "sku.value": "012345678905",
    "sku.format": "code128",
    "sku.barColor": "#000000",
    "sku.backgroundColor": "#ffffff",
    "sku.displayValue": true,
    "sku.opacity": 1
}'
```

`{{YOUR_DESIGN_ID}}` and `{{YOUR_API_KEY}}` are placeholders: first create
the design in your account (paste the sample design JSON above into the
editor at https://app.imejis.io, or create it programmatically via the
imejis MCP server's `create_design` + `update_design` tools), then render
it with the design's id and one of your API keys.

Agents: the MCP server at https://api.imejis.io/api/mcp exposes this same
catalog as structured data via the `list_component_types` tool (property
kinds, allowed values, bounds, ready-to-use sample designs).

## Frequently Asked Questions

### Which barcode formats are supported?

The format property accepts any bwip-js symbology id (bcid) — 'code128' by default, plus 'ean13', 'upca' and the rest of the bwip-js catalog.

### Can I encode a different value on each API call?

Yes — pass '<key>.value' (or just the key) in the modifications JSON; the format and colors can be overridden per render too.

### Can I hide the human-readable text under the bars?

Set displayValue to false to render bars only; when shown, textColor styles the text and defaults to barColor.

## Variants

- [EAN-13](https://www.imejis.io/components/barcode/ean-13.md) — Retail product barcode used outside North America (13-digit GTIN).
- [UPC-A](https://www.imejis.io/components/barcode/upc-a.md) — North-American retail barcode (12-digit UPC).
- [Bars only](https://www.imejis.io/components/barcode/bars-only.md) — No human-readable text — for tight layouts where the value is printed elsewhere.

All components: https://www.imejis.io/components.md
