← Back to API Ninjas
Generate a barcode
Generates a barcode image encoding `text`. Optional `type`, `format` and `include_text` control the symbology and output. Requires `text`.
API Ninjas·$0.001 per call
Example code
// Using @orth/sdk - The simplest way to call APIs
// Install: npm install @orth/sdk
import Orthogonal from "@orth/sdk";
const orthogonal = new Orthogonal({
apiKey: process.env.ORTHOGONAL_API_KEY,
});
const output = await orthogonal.run({
api: "api-ninjas",
path: "/v1/barcodegenerate",
query: {
"text": "example"
}
});
console.log(output);Query parameters
textrequired
string
Text to encode in the barcode.
type
string
Type of barcode to generate. (Allowed: code39, code128, ean, ean13, ean8, gs1, gtin, isbn, isbn10, isbn13, issn, jan, pzn, upc, upca) (Default: upc)
format
string
Image format to return. (Allowed: png, svg) (Default: png)
include_text
boolean
Whether to include the text below the barcode. (Default: True)