Skip to content

Free Barcode Generator API

Create barcodes from a single URL — no API key, no sign-up. CODE128, EAN-13, EAN-8, UPC-A and CODE39 as SVG or PNG, with CORS enabled so it works from any website or app.

GET https://www.payate.com/barcode-api/generate.php?type=code128&data=PAYATE-2026

Try it

Barcode preview

Parameters

ParameterDefaultDescription
datarequiredThe value to encode. URL-encode it (e.g. spaces as %20).
typecode128code128, ean13, ean8, upca or code39.
formatsvgsvg or png.
scale2Width of the thinnest bar in pixels, 1–6.
height80Bar height in pixels, 20–300.
text11 shows the human-readable text under the bars, 0 hides it.
color000000Bar colour, 6-digit hex without #.
bgffffffBackground colour, 6-digit hex without #.

Errors return HTTP 400 with JSON, e.g. {"ok":false,"error":"EAN-13 needs 12 or 13 digits."}. Over the limit returns 429 with a Retry-After header.

Code examples

HTML

<img src="https://www.payate.com/barcode-api/generate.php?type=ean13&data=590123412345"
     alt="EAN-13 barcode" width="230" height="120">

cURL (save a PNG)

curl -o barcode.png "https://www.payate.com/barcode-api/generate.php?type=code128&data=ORDER-1042&format=png&scale=3"

JavaScript

const url = new URL('https://www.payate.com/barcode-api/generate.php');
url.search = new URLSearchParams({ type: 'code128', data: 'SKU-7781', format: 'svg' });
document.querySelector('#label').src = url;

PHP

$url = 'https://www.payate.com/barcode-api/generate.php?' . http_build_query([
    'type' => 'upca', 'data' => '03600029145', 'format' => 'png',
]);
file_put_contents('barcode.png', file_get_contents($url));

Python

import requests
r = requests.get('https://www.payate.com/barcode-api/generate.php',
                 params={'type': 'code39', 'data': 'PART-55', 'format': 'png'})
open('barcode.png', 'wb').write(r.content)

Prefer a point-and-click tool with more formats? Use the Barcode Generator. Need QR codes? Try the QR Code Generator.

More PAYATE tools

Frequently asked questions

Is the barcode API free? Do I need an API key?

Yes, it is free and needs no key and no sign-up. Call the URL and you get an image back. A fair-use limit of 300 requests per minute per IP keeps it fast for everyone.

Which barcode types are supported?

CODE128 (any printable ASCII text, automatically compacted for digits), EAN-13, EAN-8, UPC-A and CODE39. EAN and UPC check digits are calculated for you, or verified if you send the full number.

Can I use it directly in an <img> tag?

Yes — that is the easiest way. Put the API URL in the src of an image. Responses are cached, sent with CORS enabled, and identical requests return the same image.

SVG or PNG — which should I use?

SVG is vector, tiny and stays sharp at any print size, so it is the default and the best choice for web pages and labels. Use PNG when a system only accepts bitmap images.

Are the barcodes scannable?

Yes. The bars follow the official symbol specifications and include the required quiet zones. For printing, keep dark bars on a light background and do not shrink below scale 1.

Do you store the data I send?

No. The image is generated on the fly and the data is not saved. Avoid putting secrets in URLs, since URLs can appear in browser history and server logs.