About this endpoint
What it does
Generates a Code 128 barcode from the provided text and returns it as a scalable SVG. By default the response is JSON that contains the SVG markup, a data URL and the image size. Set format to svg to get the raw SVG file instead.
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| text | String | Yes | Barcode content. 1 to 80 characters, printable ASCII only. |
| format | ENUM | No | Output format. Allowed values: json, svg. Default: json. |
| height | Number | No | Height of the bars in pixels. Minimum 10, maximum 400. Default: 80. |
Response
By default (format omitted or json) the endpoint returns a JSON object. With format set to svg it returns the raw SVG file (image/svg+xml) instead.
| Parameter | Type | Description |
|---|---|---|
| tool | String | Name of the tool that generated the barcode. |
| result.svg | String | The barcode as SVG markup. |
| result.dataUrl | String | The same barcode as a data URL (data:image/svg+xml), ready to use in an img tag. |
| result.width | Number | Image width in pixels. |
| result.height | Number | Image height in pixels. Slightly larger than the requested height, because of the margin around the bars. |



