---
title: Generate Code 128 Barcode as SVG API
slug: generate-code-128-barcode-as-svg-api
url: https://apyhub.com/freedailypro/service/generate-code-128-barcode-as-svg-api
provider: FreeDailyPro
tags: [barcode, code 128, barcode generator, generate barcode, svg barcode, label printing, inventory, shipping labels]
auth: api_key
version: 1.0.0
service_type: sync
endpoints: 1
atoms: 10
mcp: true
---

# Generate Code 128 Barcode as SVG API

Generate a Code 128 barcode from text as a scalable SVG. Set the height from 10 to 400 and choose JSON or SVG output. Max 80 printable ASCII characters.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/freedailypro/generate-code-128-barcode-as-svg-api` | What it does Generates a Code 128 barcode from the provided text and returns it as a scalable SVG.… | 10 |

## Endpoint reference

### Generate a Code 128 barcode as valid SVG

`POST https://api.eu.apyhub.com/freedailypro/generate-code-128-barcode-as-svg-api` · 10 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `text` | body | string | yes |  |
| `format` | body | string | no | One of: json, svg. |
| `height` | body | number | no |  |

#### Quickstart

Generate a Code 128 barcode from plain text using the required `text` field. Add `format` and `height` if you need them.

```bash
curl -X POST "https://api.eu.apyhub.com/freedailypro/generate-code-128-barcode-as-svg-api" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello123"}'
```

#### What you'll get back

By default, a JSON object with the barcode as SVG markup and as a data URL:

```json
{
  "tool": "...",
  "result": {
    "svg": "<svg ...>...</svg>",
    "dataUrl": "data:image/svg+xml;...",
    "width": 266,
    "height": 108
  }
}
```

## About

## What it does
Code 128 Barcode Generator turns a text string into a valid Code 128 barcode. Send plain ASCII text in the `text` field, and you can also set `format` to `json` or `svg` and adjust `height` between 10 and 400.

Use it when you need a barcode for product labels, inventory flows, shipping workflows, or any system that has to encode short alphanumeric identifiers. The input is constrained to printable ASCII and a maximum length of 80 characters, which makes the output predictable for downstream printing and scanning.

The default response is JSON containing the SVG markup, a data URL for use in an `img` tag, and the image size. Set `format` to `svg` to get the raw SVG file instead. That makes it a good fit for backend jobs, document generation pipelines, and internal tools that need a standards-based barcode from a simple string.

If you are rendering labels, receipts, or packaging assets, this gives you a clean way to create Code 128 output without building barcode logic yourself.

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/freedailypro/service/generate-code-128-barcode-as-svg-api
